hey, I am making a game where the enemy shoot projectiles but i can not figure out how  to get the enemy to shoot on its own without me pressing a key, thanks
   
   
            int time = 0;
int rate = 500;
if(time==rate){
time = 0;
//do something
}else{
time ++;
}