cocos2d精灵弹跳效果
我正在制作一个游戏来找出两张图像之间的差异。现在我想创建一个类“Circle:CCSprite”来指示正确的位置。 我想给圆圈添加一个“弹跳效果”(就像iphone的警告模态窗口一样) 我手动创建 CCActions,但结果并不自然(因为很难控制持续时间和规模量)。有没有更好的方法来做到这一点?
这是我的代码:
id up1 =[CCScaleBy actionWithDuration:0.2f scale:1.5f];
id down1 = [CCScaleBy actionWithDuration:0.2f scale:1 / 1.5f];
id up2 = [CCScaleBy actionWithDuration: 0.2f scale: 1.25f];
id down2 = [CCScaleBy actionWithDuration: 0.2f scale 1 / 1.25f];
id up3 = [CCScaleBy actionWithDuration: 0.2f scale 1.1f];
id down3 = [CCScaleBy actionWithDuration: 0.2f scale 1 / 1.1f];
[self runAction:[CCSequence actions:up1, down1, up2, down2, up3, down3, nil]];
I'm making a game to spot the differences between 2 images. now i want to create a class 'Circle : CCSprite' to indicate the correct spot.
I want to add a 'bouncing Effect' to the Circle(Just like iphone's warning modal window)
I manually create CCActions, but the result is not as natural (since it's hard to control the duration and scale amount). Is there any better way to do this?
here is my code:
id up1 =[CCScaleBy actionWithDuration:0.2f scale:1.5f];
id down1 = [CCScaleBy actionWithDuration:0.2f scale:1 / 1.5f];
id up2 = [CCScaleBy actionWithDuration: 0.2f scale: 1.25f];
id down2 = [CCScaleBy actionWithDuration: 0.2f scale 1 / 1.25f];
id up3 = [CCScaleBy actionWithDuration: 0.2f scale 1.1f];
id down3 = [CCScaleBy actionWithDuration: 0.2f scale 1 / 1.1f];
[self runAction:[CCSequence actions:up1, down1, up2, down2, up3, down3, nil]];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 Cocos2d 内置的反弹或弹性缓动方法。 Google Cocos2d 简化操作。
Use the bounce or elastic easing methods built into Cocos2d. Google Cocos2d ease actions.
您可以使用 CoreImage。
http://developer.apple.com/library/mac/#documentation/graphicsimaging/Conceptual/CoreImaging/ci_tasks/ci_tasks.html#//apple_ref/doc/uid/TP30001185-CH203-TPXREF101
You can use CoreImage.
http://developer.apple.com/library/mac/#documentation/graphicsimaging/Conceptual/CoreImaging/ci_tasks/ci_tasks.html#//apple_ref/doc/uid/TP30001185-CH203-TPXREF101