I use ccTouches_xxx method to notify touch event. But, when player touch to scene (normal or fast), game seem to be lag: action and node pause. Sorry I use English not well. This is my code:
void HelloWorld::ccTouchesBegan(CCSet *touches, CCEvent *event)
{
CCTouch *touch = (CCTouch*) (touches->anyObject());
CCPoint point = touch->locationInView(touch->view());
point = CCDirector::sharedDirector()->convertToGL(point);
createAndAnimateFlower(point);
}
Did you touch many times?
If so, HelloWorld::ccTouchesBegan() will be called many times, and will cal createAndAnimateFlower() many times.
I don’t if it is the problem.
Yes. When player touch, it add a sprite (flower) and animate the flower. I test automatic call createAndAnimateFlower() (use schedule), so it is work well, not lag.
when player touch many times (fast) to scene, the game pause about some seconds, after when stop touch, game resume and new node (was added by touch) animate.
Post your code for createAndAnimateFlower(), it is probably the way you are creating your sprites or textures. At a guess you need to use a sprite sheet (CCSpriteBatchNode).
You could look at optimizing things a bit, might be part of the problem. You seem to be calling “firework1_animation = makeAnimation(”firework1.png“, 3, 5);” each time you create a flower, why not call this once in your init and just reuse “firework1_animation”.