Change CCAnimation speed of sprites?

Forums Programming cocos2d support (graphics engine) Change CCAnimation speed of sprites?

This topic contains 6 replies, has 3 voices, and was last updated by  TheBMan 1 year, 5 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
Author Posts
Author Posts
October 20, 2012 at 10:11 pm #244870

TheBMan
Participant
@thebman

Hey,

In my app I have a bunch of enemy characters that are moving by CCAnimations (CCActions). They are set to a certain animation speed, however at certain times I need to either increase or decrease the speed of the animation that are currently doing.

Now is this possible? I have looked around have seen nothing mentioned about it. Can anyone point me to somewhere that can explain how to do this or if you have any tips or advice on how to achieve this, that would be great!

Thanks!

October 20, 2012 at 10:16 pm #390469

shadaz
Participant
@shadaz

It may be best to handle the animations yourself so you will have more control:

look up: setDisplayFrame or setDisplayFrameWithAnimationName

you can then control the speed and many other things (ie:sync animations w/other animations or sound)

October 20, 2012 at 10:20 pm #390470

TheBMan
Participant
@thebman

Is that the only possible way? Do you have any links where I can see of an example in this?

October 20, 2012 at 10:25 pm #390471

hareball
Participant
@hareball

I think it’s possible to wrap multiple animations under the one action… create an animation for each speed that you need, and run them in a sequenceable action.

Haven’t tried this myself, but in theory it should work!

October 20, 2012 at 10:27 pm #390472

TheBMan
Participant
@thebman

@hareball Unfortunately I cannot do that. I know I said each is a certain speed but to elaborate, it is set to a random speed for each so each has their own ‘certain’ speed. Bottom line its a random float so it will most likely never be the same number twice.

Sorry for the confusion!

October 20, 2012 at 10:31 pm #390473

shadaz
Participant
@shadaz

Look at this post pay attention to the animationInterval variable – you can set that to what ever you want.

October 21, 2012 at 12:13 am #390474

TheBMan
Participant
@thebman

Ok I’ll look at it tomorrow. Ill post back if I have any questions!

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.