views:

19

answers:

0

Ok I am a complete newbie at game design and have a question. Ive been working on a rhythm game for the iphone for the past few months now. The game runs well and is getting closer to being finished, however, being my first major project I feel like the underlying way I am doing it is very flawed. We are shooting for 60 fps and it runs mostly at that speed, with some occasional bumps to around 50. Let me explain. For reference I am using Cocos2d and actions with sprite frames to animate my sprites.

The game has ring like objects that appear about 500 milliseconds before a beat and shrink to the size of one of the static touch circles on the screen. (Very similar to Ouendan/Elite Beat Agents) For each song, I have a custom file that contains each note of my song by the millisecond value when it should be hit. In my main loop I check the AVAudioPlayer.currentTime variable and compare with the note value - (500 milliseconds). Then at that point I create the animation to run for 500 milliseconds and then check the AVAudioPlayer.currentTime variable for accuracy.

I have a feeling this is flawed. Can I be sure my animation will always take 500 milliseconds? Should I instead be checking the current frame for timing? Will fps fluctuations mess up this logic?

I dont know and would really appreciate some insight. Thank you!