我最近遇到了一个问题,我会增加节点的大小,但物理体的大小会保持不变。我试图寻找解决方案但没有成功。如何使身体与节点的大小成比例?
CGPoint location = CGPointMake(randX, -self.frame.size.height - expander.size.height);
SKAction *moveAction = [SKAction moveTo:location duration:randDuration];
SKAction *expandAction = [SKAction resizeToWidth:(expander.size.width * 1.4) height:(expander.size.width * 1.4) duration:1.0];
SKAction *collapseAction = [SKAction resizeToWidth:(expander.size.width) height: (expander.size.height) duration:1.0];
SKAction *doneAction = [SKAction runBlock:(dispatch_block_t)^() {
expander.hidden = YES;
}];
SKAction *expandCollapseAction = [SKAction repeatActionForever:[SKAction sequence:@[expandAction, collapseAction]]];
SKAction *moveExpandAction = [SKAction group:@[moveAction, expandCollapseAction]];
SKAction *moveExpanderActionWithDone = [SKAction sequence: @[moveExpandAction, doneAction ]];
[expander runAction:moveExpanderActionWithDone withKey: @"expanderMoving"];
Run Code Online (Sandbox Code Playgroud)