I am creating a iphone game currently using cocos2d. The basics of the game is that I have a cannon, and on pressing a fire button, the cannon fires a certain number of balls into the screen area.
So far, i have the layers setup with the cannon, the fire button, and even the balls. When I click the fire button, the cannon fires all the balls at the same time.
I have setup a for loop to loop through the ball objects in an NSMutableArray. For each one, I create it, add it to the layer, and then give it some motion. In theory, this should give me one ball at a time, however in testing it goes through the code so quickly that all the balls appear at the same time.
What I need help with is the delay between firing consecutive balls i.e. fire a ball, wait 1 second, and fire next ball, so that it shows up on screen and thus the illusion of firing one ball at a time – if that makes sense.
I have tried using the scheduler i.e. (ccTime) dt, but I don’t need the delay to be repeating, if you know what I mean.
Any help is greatly appreciated.
Thanks in advance.
Pras.
fireball is function name