cocos2d精灵弹跳效果

发布于 2024-11-15 04:59:38 字数 643 浏览 2 评论 0原文

我正在制作一个游戏来找出两张图像之间的差异。现在我想创建一个类“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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初熏 2024-11-22 04:59:38

使用 Cocos2d 内置的反弹或弹性缓动方法。 Google Cocos2d 简化操作。

Use the bounce or elastic easing methods built into Cocos2d. Google Cocos2d ease actions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文