CONTEXT: Hi! I am trying to make enemies which can track the player, and inflict damage to the player via contact. my enemy tracks successfully. my enemy does attack when the player is within ‘range’ ( of my enemy collisionbody2d),but it only attacks once.
MY PROBLEM: i want the enemy to attack the player every 0.8 seconds for as long as the player is within range. please help if you can, it means alot to me (:
To do this, I’ll use an Area2d with a boolean called player_is_detected. When the player enters the enemys Area2d, set player_is_detected to true, when the player exits the Area2d set it to false.
Now just use a timer to repeat the attack every 0.8s if player_is_detected is true.