On Mon, Jun 21, 2010 at 2:24 PM, karanveer singh <[email protected]>wrote:
> I'm using jumpby in the following way: > > JumpBy( (200,0), 300, 1, duration = 1) > > However, whenever it jumps, it seems to go slightly above its earlier > position. As in, the y coordinate increases slightly. Its supposed to > stay at the same y coordinate. > I modified test_sprite.py to use exactly your JumpBy, attached, and it shows no problems. But the code in cocos\actions\interval_actions , JumpBy, seems susceptible to rounding errors, so maybe the initial position in your code is important to show the problem. I commited r978 with slightly better code for JumpBy, let me know how it goes with your app. > If I increase the duration to 5, the difference in initial and final y > coordinates seems to be less. > > Also, is there a way I can check if it collides with a tile WHILE it > is executing the Jumpby command? For example, in a mario type platform > game, the player jumps, and while it is executing the jump, I would > like to see if it is on top of a block so that it stays there instead > of going all the way to the ground. > > I think you can do: action = JumpBy(...) + CheckCollisionWithTile(...) where CheckCollisionWithTile is a custom action you must define. Look at the sample test\test_action_non_interval.py (in svn trunk) for an action doing some sort of collision test -- claudio -- You received this message because you are subscribed to the Google Groups "cocos2d discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cocos-discuss?hl=en.
test_JumpBy.py
Description: Binary data
