Will having many timers affect my game performance?

Posted by iQue on Game Development See other posts from Game Development or by iQue
Published on 2012-09-15T16:56:54Z Indexed on 2012/09/16 3:53 UTC
Read the original article Hit count: 405

Filed under:
|
|

I'm making a game for android, and earlier today I was trying to add some cool stuff to my game. The problem is this thing needs like 5 timers. I build my timers like this:

timer += deltaTime;
if(timer >= 2.0f){
    doStuff;
    timer -= 2.0f;
} // this timers gets stuff done every 2 secs

Will having to many timers like this, getting checked every frame, screw up my games performance? The effect I wanted to add was a crosshair every 2 sec, then remove it after 2 sec and do a timed animation. So an array of crosshairs dependent on a bunch of timers to be exact. This caused my game to shut down when used, so thats why Im wondering if using that many timers causes my game to flip out.

© Game Development or respective owner

Related posts about java

Related posts about Performance