Hi there,
I am working on this 2d panel based game. What I want to do is to control the frequency of attacks of enemies. I was thinking of using wait(x) where x is the amount of seconds to wait until a new attack is possible. Like this:
...
if (enemy_active == 1) { }
if (enemy_active == 0)
{
enemy_active == 1;
attackPlayer(); //do needed stuff
wait(-5);
enemy_active == 0;
}
...
Is that ok? Will the wait(x) slow down my code? I am asking that because the player will have a faster attack rate, like 2 seconds between attacks, and each attack player does grants a chance of being attacked by nearby enemies. I´ve read somewhere that the wait() function allows the other functions to resume their execution while waiting, so I don´t know if that is a problem or not...
Thanks