game.gd 371 B

1234567891011121314
  1. extends Node2D
  2. @onready var health_bar = $HealthBar
  3. var direction = -1
  4. func _process(_delta: float) -> void:
  5. if Input.is_action_pressed("ui_cancel"):
  6. get_tree().change_scene_to_file("res://screens/main_menu.tscn")
  7. func _on_timer_timeout():
  8. health_bar.health += direction
  9. if health_bar.health == 0 || health_bar.health == health_bar.MAX_HEALTH:
  10. direction *= -1