Right, first off - don't scale frameTicks by 1000 if you're not scaling delay by 1000. If you scale it by 1000, you want to use floats as the delayCounter and frameTick.
In level_init() or whatever, you need to set up your variables.
float delaycounter = 0; float frameTick = 0; float Ticks = frameTick; int fire_arrows = 0;
In game_tick() you need to calculate the tick and update the delay
// calc tick count frameTick = (float)(SDL_GetTicks() / 1000) - Ticks; if( delaycounter > 0 ) { delaycounter -= frameTick; } Ticks = frameTick; // check keypresses // if attack key is pressed: if( delaycounter <= 0 ) { // delay counter is at 0, can fire delaycounter = player->getDelay_bow(); }
Do not set tick, frametick, etc to zero after the frame is updated. They need to persist through the game.
Why are you incrementing fire_arrows? What does that variable signify? As far as i can tell, you're either a) Setting the trametick, tick, etc to zero on each frame or the problem has something to do with how you're using fire_arrows.
I really can't tell any more from here. [shrug]