====== Godot Components ======
{{youtube>W8gYHTjDCic?}}
===== Online-Doku =====
* [[https://docs.godotengine.org/de/4.x/tutorials/physics/using_area_2d.html|Verwendung von Area2D]]
* [[https://docs.godotengine.org/de/4.x/tutorials/scripting/singletons_autoload.html|Autoload/Singeltons/Globals]]
* [[https://docs.godotengine.org/en/stable/tutorials/scripting/groups.html|Groups/Gruppen]]
* [[https://docs.godotengine.org/de/4.x/tutorials/physics/physics_introduction.html#physics-introduction|Einführung in die Physik]]
* [[https://docs.godotengine.org/de/4.x/getting_started/step_by_step/signals.html|Signale nutzen]]
===== Contracts =====
Timestamp: [[https://www.youtube.com/watch?v=W8gYHTjDCic&t=1171s|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)