helo, i try to make a 2 cube fighting with an attack and i think it will be no fun
if i can spam the attack, less startegy.
then i try to make a cooldown in my attack which it look like this:
if (attackTimer > 0)
attackTimer -= Time.deltaTime;
if (attackTimer < 0)
attackTimer = 0;
//pencet spasi
if (Input.GetKeyUp (KeyCode.Space)) {
//when attack timer reach 0
if(attackTimer == 0)
//call attack
Attack();
//attack timer back to cooldown
attackTimer = coolDown;
now the problem is, if i try to spam the spacebar the attacktimer will be reset to cooldown time.
so if the player spam a space, he will never get a chance to attack cause the
attacktimer reset each time he press space button.
anyone can gimme a suggestion what i should do to make
the attacktimer run till the time up even we spamming the space bar?
any answer will help! thanks!