弹出动画在cocos2d游戏 [英] Pop Up Animation in Cocos2D game

查看:215
本文介绍了弹出动画在cocos2d游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建一个游戏场景做出那样弹出randmoly一些对象。它显示了小的时候在任何时间,任何位置出现在屏幕上。它进入到大,走出来筛选..

I want to create one game scene to make some object like pop up randmoly.. It shows to small when appear in screen at any time and any position.. It goes to big and come out to screen..

GameScene与对象显示screnn randmoly ..

GameScene with objects shows pop up in screnn randmoly..

就像一场比赛有对象出现在跳跃的动画。

Like one game which has objects appear in jumping animation..

如何其可能的..?
任何帮助应该是AP preciated。请...

How its possible..? Any help should be appreciated.. Please...

推荐答案

易...

要做到这些动画ü必须记住,你的动画精灵的Z值应该更高了所有其他人总是前面(创建常量来表示)
你要使用CCAction确实创造了类似的行动,淡入,缩放,移动。

To do those animations u must be in mind that the z value of your animated sprite should be higher the all the others to be always up front (create constants to that) You are going to use CCAction do create the action like, fadeIn, Scale, Move.

这是一个海盗的样品中的屏幕和像

This is a sample of an viking poping up in the screen and like


CCSprite *viking =
[CCSprite spriteWithFile:@"VikingFloating.png"];
[viking setPosition:ccp(screenSize.width * 0.35f, screenSize.height * 0.45f)];
[self addChild:viking];
id rotateAction = [CCEaseElasticInOut actionWithAction:
[CCRotateBy actionWithDuration:5.5f angle:360]];
id scaleUp = [CCScaleTo actionWithDuration:2.0f scale:1.5f];
id scaleDown = [CCScaleTo actionWithDuration:2.0f scale:0.5f];
[viking runAction:[CCRepeatForever actionWithAction:
[CCSequence actions:scaleUp,scaleDown,nil]]];
[viking runAction:
[CCRepeatForever actionWithAction:rotateAction]];

还有一个伟大的书这件事,其实我已经有了这块code从它 - 的http:/ /cocos2dbook.com/

这篇关于弹出动画在cocos2d游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆