我最近遇到了一个问题:我想扩大一个节点的大小,但是物理体仍然保持原来的大小。我试图寻找解决方案,但没有成功。那么我该怎样才能使物理体与节点的大小同步扩大呢?
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"];