Does anyone know how to code a gun's rate of fire?
I don't know how to make a delay between each shot you click the mouse to fire, however have it still automatic. It would involve timers right?
I have a temporary fix, but it's more on how fast the Code is read.
if (C_ammo > 0)
{
if ( dbMouseClick() == 1 && dbMouseClick() != 3 && dbObjectPlaying (10) != 1)
{
N1 = N1 + 1;
dbShowObject (50);
dbPositionObject (50,4,-3,44);
dbRollObjectLeft ( 50 , (float)(rand() % 180) );
if ((N1%ROF) == 1) // the rate of fire.
{
C_ammo = C_ammo - 1;
if ( dbSoundPlaying ( 30 ) == 0 )
{
dbLoopSound ( 30 , 0 , 2070 , 0 );
}
}
}
else