I am making a game similar to bust-a-move for the iphone. I am using cocos2d. I am encountering lag sometimes during the game. I have 6 different types of balls. I am creating 30 instances of each type and I reuse them. The problem comes when I shoot the ball and the ball does not collide with either the wall on the sides or the balls on the screen. I believe it may be due to a lag. When the ball is shot I initialize a scheduler to run every 0.01s to check if it collides with any of the other balls. In each interval I create a rect for the ball that was shot and create a rect for all other balls and check for intersection.
I was wondering what the reason for the lag could be. I am also trying to figure out if there is any bottle neck by using the Instruments. Could having a lot of images loaded cause lag? or could a lot of numerical computation be the reason?
It would be helpful if you can share any similar experiences or if you can suggest some possible reasons for lag and how to avoid them.
Thanks Abhinav