NSCoder Toronto – Mac/iOS developers Message Board › Cocos2D Chapter 3

Cocos2D Chapter 3

Swee
user 12871423
Toronto, ON
Post #: 4
On listing 3.1 (page 58)

How to convert this?

id robotAnimationAction =
[CCAnimate::actionWithDuration(0.5f, animation:robotAnim, YES]; // 6

They don't have actionWithDuration(with multiple parameters) in V2.0 anymore, and only have
actionWithAnimation and actionWithDuration.

How to do the same initialization with two different calls?

UPDATE: (Found answer on the web)
[robotAnim setDelayPerUnit:0.5f];
[robotAnim setRestoreOriginalFrame:YES];
CCAnimate *robotAnimationAction = [CCAnimate actionWithAnimation:robotAnim];

Greg H.
gregheo
Group Organizer
Toronto, ON
Post #: 11
I think `setDelayPerUnit:` will set the duration for a single animation frame, not the whole animation. So if you had three frames you wanted to take 0.5s all together, you would need to `setDelayPerUnit:0.5/3`.

Note that the animation `duration` is just the number of frames multiplied by the delay per unit:
http://www.cocos2d-ip...­

I'm not 100% sure of the differences yet, but there's also a `setDuration:` message on CCAnimate...
Swee
user 12871423
Toronto, ON
Post #: 8
I think `setDelayPerUnit:` will set the duration for a single animation frame, not the whole animation. So if you had three frames you wanted to take 0.5s all together, you would need to `setDelayPerUnit:0.5/3`.

Note that the animation `duration` is just the number of frames multiplied by the delay per unit:
http://www.cocos2d-ip...­

I'm not 100% sure of the differences yet, but there's also a `setDuration:` message on CCAnimate...

Thanks. :-)
Powered by mvnForum

Our Sponsors

  • Telerik

    UI controls for compelling app experiences across any screen.

  • Ferocious Apps

    A small but ferocious app development shop. They pay the Meetup dues.

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy