godot:components

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
godot:components [2025/10/19 06:46] – [Links] silversurfergodot:components [2025/10/19 07:04] (aktuell) – [Contracts] silversurfer
Zeile 1: Zeile 1:
 ====== Godot Components ====== ====== Godot Components ======
 {{youtube>W8gYHTjDCic?}} {{youtube>W8gYHTjDCic?}}
-===== Links =====+===== 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/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]]   * [[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 ====
 +<codedoc code=python>func take_damage(damage: int) -> void:
 +   Globals.health -= damage
 +   if Globals.health > 0:
 +      get_tree().reload_current_scene()</codedoc>
 +==== _on_body_ented - Funktion ====
 +<codedoc code=python>func _on_body_entered(body: Node2D) -> void:
 +   if body.has_method("take_damage"):
 +      body.take_damage(damage)</codedoc>
 +
  • godot/components.1760849192.txt.gz
  • Zuletzt geändert: 2025/10/19 06:46
  • von silversurfer