Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Scavex |
Hello Godot community, my variable that I created isn’t storing the updated value. I have made a variable death_count
with value 0 and it s supposed to increase everytime my player health reaches 0, but it’s always stuck on 1 and I don’t know why it is happening.
Take a look at my dead function :
func dead():
playerhp-=1
if playerhp==0:
death_count +=1 // It's not getting incremented
print("player with 0 health")
is_dead=true
if emit == false:
$Particles2D.emitting = true
#emit = true
$Sprite.play("PlayerDead")
Engine.time_scale = 0.2
motion=Vector2(0,0)
$CollisionShape2D.disabled = true
print("Dead Function")
$Timer.start()