Good way to make animations with cocos2d?

Posted by Johnny Oin on Stack Overflow See other posts from Stack Overflow or by Johnny Oin
Published on 2010-03-21T17:43:56Z Indexed on 2010/03/21 17:51 UTC
Read the original article Hit count: 414

Filed under:
|
|
|

Hi there,

I'm making a little iphone game, and I would get some clues. Let's imagine:

Two background sprites moving pretty fast from right to left, and moving up and down with accelerometer.

I guess I can't use animations here, cause the movement of the background is recalculated at each frame. So I use a schedule with an interval of 0.025s and move my sprites at each clock with a :

sprite.position = ccp(x, y);

So here is my problem: the result is laggy, with only these two sprites.

I tried both declaring sprites in the header, and getting them with CCNodes and Tags. It's quite the same.

So if someone can give me a hint on what is the best way to do that, that would be so nice. I wonder if the problem can't be the fact that sprites are moving very fast, but i'm not sure.

Anyway, thanks for your time.

J.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocos2d