@@ -307,7 +307,7 @@ -(void)testBasicSequences9
307
307
308
308
TestBasicSequenceHelper (self, physicsNode, parent, node, body);
309
309
}
310
-
310
+
311
311
-(void )testBasicSequences10
312
312
{
313
313
CCPhysicsNode *physicsNode = [CCPhysicsNode node ];
@@ -333,6 +333,74 @@ -(void)testBasicSequences10
333
333
TestBasicSequenceHelper (self, physicsNode, parent, node, body);
334
334
}
335
335
336
+ -(void )testBasicSequences11
337
+ {
338
+ CCPhysicsNode *physicsNode = [CCPhysicsNode node ];
339
+
340
+ CCNode *parent = [CCNode node ];
341
+ parent.contentSize = CGSizeMake (25 , 35 );
342
+ parent.anchorPoint = ccp (0.3 , 0.7 );
343
+ parent.position = ccp (20 , 60 );
344
+ parent.rotation = -15 ;
345
+ parent.scaleX = 1.5 ;
346
+ parent.scaleY = 8.0 ;
347
+
348
+ CCNode *node = [CCNode node ];
349
+ node.contentSize = CGSizeMake (30 , 30 );
350
+ node.anchorPoint = ccp (0 ,0 );
351
+ node.position = ccp (100 , 100 );
352
+ node.rotation = 30 ;
353
+ node.scaleX = 2.0 ;
354
+ node.scaleY = 3.0 ;
355
+
356
+ CCPhysicsBody *body = [CCPhysicsBody bodyWithCircleOfRadius: 1.0 andCenter: CGPointZero];
357
+ body.type = CCPhysicsBodyTypeStatic;
358
+
359
+ TestBasicSequenceHelper (self, physicsNode, parent, node, body);
360
+ }
361
+
362
+ -(void )testDynamicAnchorPoint
363
+ {
364
+ CCPhysicsNode *physicsNode = [CCPhysicsNode node ];
365
+
366
+ CCNode *node = [CCNode node ];
367
+ node.contentSize = CGSizeMake (2 , 2 );
368
+ node.anchorPoint = ccp (0.5 , 0.5 );
369
+ XCTAssert (ccpDistance (node.position , CGPointZero) == 0.0 , @" " );
370
+
371
+ node.physicsBody = [CCPhysicsBody bodyWithCircleOfRadius: 1.0 andCenter: CGPointZero];
372
+ node.physicsBody .type = CCPhysicsBodyTypeDynamic;
373
+ XCTAssert (ccpDistance (node.position , CGPointZero) == 0.0 , @" " );
374
+
375
+ [physicsNode addChild: node];
376
+ [physicsNode onEnter ];
377
+ XCTAssert (ccpDistance (node.position , CGPointZero) == 0.0 , @" " );
378
+
379
+ node.rotation = 90 ;
380
+ XCTAssert (ccpDistance (node.position , CGPointZero) == 0.0 , @" " );
381
+ }
382
+
383
+ -(void )testStaticAnchorPoint
384
+ {
385
+ CCPhysicsNode *physicsNode = [CCPhysicsNode node ];
386
+
387
+ CCNode *node = [CCNode node ];
388
+ node.contentSize = CGSizeMake (2 , 2 );
389
+ node.anchorPoint = ccp (0.5 , 0.5 );
390
+ XCTAssert (ccpDistance (node.position , CGPointZero) == 0.0 , @" " );
391
+
392
+ node.physicsBody = [CCPhysicsBody bodyWithCircleOfRadius: 1.0 andCenter: CGPointZero];
393
+ node.physicsBody .type = CCPhysicsBodyTypeStatic;
394
+ XCTAssert (ccpDistance (node.position , CGPointZero) == 0.0 , @" " );
395
+
396
+ [physicsNode addChild: node];
397
+ [physicsNode onEnter ];
398
+ XCTAssert (ccpDistance (node.position , CGPointZero) == 0.0 , @" " );
399
+
400
+ node.rotation = 90 ;
401
+ XCTAssert (ccpDistance (node.position , CGPointZero) == 0.0 , @" " );
402
+ }
403
+
336
404
-(void )testCollisionGroups
337
405
{
338
406
CCPhysicsNode *physicsNode = [CCPhysicsNode node ];
0 commit comments