Issue with a timer

Hi, I made this little code to try the healing sistem of my sprite. I want that every 10 seconds, pressing the “E”, the sprite (Nave) heals by 250. The problem is that after 10 seconds, it heals, and then it stop so if i press the E after other 10 seconds, i happen nothing. Why?

Hi, you set the variable Heal at the beginning of the scene to 1. After pressing e the variable is set to 0 but there is no condition that would set it again to 1 because this happens only at the beginning of the scene which is only triggered one time.

holy cow… hahah i’m sorry. But where i have to insert the condition that set the variable to 1 again?

You could just replace those last 3 events in your screen shot with this one:

Conditions:
  If timer "Heal" is greater than 10 seconds
  'e' key is pressed

Actions:
  reset timer "Heal"
  Heal Nave, adding 250 to it's health

I think it should do what you’re trying to achieve.

can you do what you said in gdevelop please. because i don’t understand. (If I don’t ask too much :sweat_smile:)

Remove the Pause when reach 10 sec instead of pause se Reset again

Holy cow… Thank you. I didn’t understand but now it worked!