The problem is that you are setting the hp from inside the script with the setter defined. Setters and getters only works from ouside. If not, when you try to set the hp inside the setter, it will call again the setter and again and again (stack overflow). So, if you want to call the setter from inside the same script, you just have to call it as any other method, or use self
. In your Enn1.gd, simply change:
hp -= Global.damage
to:
set_health(hp-Global.damage)
or to this if you want something more similar to what you've done:
self.hp -= Global.damage
To make it clear: the setter will only be called if you set the variable from other script, like if in your player scene call enemy.hp -= damage
or something similar.