Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(3 edits)

Or you can do it in more elegant fashion by using setter function on health variable.

var health = 100 setget set_health

...

func set_health(value):
  health = value
  if value <= 0:
    die()
...

func on_area_entered(area):
  self.health -= 5. # It's very important to write self.health instead of health if you use setter function
...

func die():
  $death_timer.start()
  $AnimationPlayer.play("death") 
(+1)

thank you very much 

Because of you it's working 


You’re welcome! :)