我不太知道从哪里开始。我有一个存储在SKSpriteNode
中的圆形图像和一个physicsBody
,当它被创建时,它会镜像大小。
然而,我正在使用一个SKAction
来缩小图像的大小,但是physicsBody
的大小保持不变。我该如何缩小physicsBody
的大小?
我的代码:
SKSpriteNode *sprite = [SKSpriteNode spriteNodeWithImageNamed:@"whiteball"];
sprite.size = CGSizeMake(20, 20);
sprite.position = CGPointMake(dx, CGRectGetHeight(self.frame)-dy);
sprite.name = @"ball";
sprite.physicsBody = [SKPhysicsBody bodyWithCircleOfRadius:sprite.size.width/2];
[self addChild:sprite];
SKNode *ballNode = [self childNodeWithName:@"ball"];
if (ballNode != Nil){
ballNode.name = nil;
SKAction *delay = [SKAction waitForDuration:3];
SKAction *scale = [SKAction scaleTo:0 duration:1]; // I want this to scale the physicsBody as well as the spriteNode...
SKAction *remove = [SKAction removeFromParent];
//put actions in sequence
SKAction *moveSequence = [SKAction sequence:@[delay, scale, remove]];
//run action from node (child of SKLabelNode)
[ballNode runAction:moveSequence];
}