【发布时间】:2014-08-29 14:46:03
【问题描述】:
我正在尝试将一个节点缩小到一个小尺寸,向下移动,然后在所有这些发生后重复地对其进行动画处理(在相同的缩小尺寸下使用不同的纹理)。
这是我缩小节点并移动它的方法。那部分工作正常。但是,一旦完成,我需要更改精灵纹理并为其设置动画。
- (void)shrinkAndMoveToPosition:(CGPoint)position {
SKAction *move = [SKAction moveTo:position duration:.5];
SKAction *scale = [SKAction scaleTo:.3 duration:.5];
SKAction *moveAndScale = [SKAction group:@[move, scale]];
[self runAction:moveAndScale completion:^{
NSArray *textures = @[[SKTexture textureWithImageNamed:@"ship-small_01"],
[SKTexture textureWithImageNamed:@"ship-small_02"],
[SKTexture textureWithImageNamed:@"ship-small_03"],
[SKTexture textureWithImageNamed:@"ship-small_04"]];
SKAction *animate = [SKAction animateWithTextures:textures timePerFrame:0.5];
[self runAction:[SKAction repeatActionForever:animate]];
}];
}
问题是每当我的完成块运行时,精灵都会跳回到纹理的大小。如何保持缩小后的尺寸?
【问题讨论】:
-
尝试将最后一行切换到 SKAction *repeatAnimation = [SKAction repeatActionForever:animate];
-
另见 calculateAccumulatedFrame developer.apple.com/library/ios/documentation/SpriteKit/…
-
@RachelGallen 那么什么会执行该操作?如果我用你的建议替换它,动画动作将永远不会运行
-
我不认为这是精灵改变比例,只是你正在使用尚未缩放的纹理制作动画。 我认为。
标签: ios ios7 sprite-kit scale