大佬教程收集整理的这篇文章主要介绍了ios – 在两个或更多SKSpriteNode上同步SKActions?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
有没有办法在两个或多个具有持续时间的精灵上运行并行SKActions,以便它们在完全相同的时间结束或者至少以它们的启动顺序结束?
- (void)testMethod1{ SKSpriteNode *child_1=[arrayWithSprites objectATindex:1]; SKSpriteNode *child_2=[arrayWithSprites objectATindex:2]; //This doesn't work. [child_1 runAction:[SKAction moveToX:20.0 duration:0.5]]; [child_2 runAction:[SKAction moveToX:20.0 duration:0.5] completion:^{[self testMethod1];}]; //Actions might not be finished in the order they are started. }
这是我尚未尝试的一种方式,但想知道它是否可以解决我的问题:
- (void)testMethod2{ SKSpriteNode *child_1=[arrayWithSprites objectATindex:1]; SKSpriteNode *child_2=[arrayWithSprites objectATindex:2]; //Will this guarantee @R_984_10586@l syncronisation? [self runAction:[SKAction group:[NSArray arrayWithObjects: [SKAction runBlock:^{[child_1 runAction:[SKAction moveToX:20.0 duration:0.5]];}],[SKAction runBlock:^{[child_2 runAction:[SKAction moveToX:20.0 duration:0.5]];}],nil]] completion:^{[self testMethod2];}]; }
我希望我的英语和思想是可以理解的.
// Micke ….
以上是大佬教程为你收集整理的ios – 在两个或更多SKSpriteNode上同步SKActions?全部内容,希望文章能够帮你解决ios – 在两个或更多SKSpriteNode上同步SKActions?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。