Alejandro Cotilla
Alejandro Cotilla

Reputation: 2621

CCJumpTo and CCJumpBy height parameter?

The classes CCJumpTo and CCJumpBy have the method: actionWithDuration:position:height:jumps:. I don´t understand what´s the true meaning of the height parameter. Thanks in advance.

Upvotes: 0

Views: 309

Answers (1)

andrew92b
andrew92b

Reputation: 73

That method gives you not only jump functionality, but also moving. Position what you set needed for moving object, but not for simple moving. You can set moving with small jumps (like a ball) or moving throw one jump.

So

Duration - duration of moving action.
Position - target position for moving (CCJumpTo) or shift (CCJumpBy).
Height - height of jump.
Jumps - number of jumps throw moving animation.

If you need only one jump without moving - you can simply call:

    [CCJumpBy actionWithDuration:jumpDuration position:ccp(0.0, 0.0) height:jumpHeight jumps:1.0]

Upvotes: 1

Related Questions