Godot Components
Online-Doku
Contracts
Timestamp: Contacts
Take Damage Function
func take_damage(damage: int) → void:
Globals.health -= damage
if Globals.health > 0:
get_tree().reload_current_scene()
_on_body_ented - Funktion
func _on_body_entered(body: Node2D) → void:
if body.has_method(„take_damage“):
body.take_damage(damage)