我正在尝试在SpriteKit中翻转精灵。它可以在cocos2d中使用CCOribitCamera完成,如下所示:
id firstAction = [CCOrbitCamera actionWithDuration:d/2 radius:1 deltaRadius:0 angleZ:0 deltaAngleZ:90 angleX:0 deltaAngleX:0];
id secondAction = [CCOrbitCamera actionWithDuration:d/2 radius:1 deltaRadius:0 angleZ:270 deltaAngleZ:90 angleX:0 deltaAngleX:0];
[self runAction: [CCSequence actions:firstAction,
[ImageSwapAction actionWithCard: self],
secondAction, nil]];
有什么想法吗?
- Added--
感谢nickfalk的回答,我明白了。
[sprite runAction:[SKAction sequence:@[
[SKAction scaleXTo:0 duration:0.2],
[SKAction runBlock:^{
[sprite swapImage];
}],
[SKAction scaleXTo:1 duration:0.2]
]]];
答案 0 :(得分:3)
您可以使用节点的xScale属性:
spriteInstance.xScale = -1;