I’m creating a shooting game where you touch the screen and the player shoots. The problem I have is that when you touch the screen and keep it down dragging it around it shoots rapid fire. What is the best way to deal with this?
I want the player to be able to hold the finger down and shoot at a steady pace, and on finger up stop shooting.
I was thinking of just using a Timer but I don’t think that’s very efficient… Any other ideas?
Thanks
I would really like to see more details on how you are implementing the shooting, but let me provide you with a way to accomplish this:
CCSchedulerto schedule a method call, instead of using timers. And this is very efficient. You don’t have to worry about performance.Here is some code to get you started:
NOTE: Am using cocos2d v1.0.1 .. in cocos2d v2.0, I think the
CCSchedulerwas moved to theCCDirector.