Animation - SamToorchi/Godot-Zombi-Game GitHub Wiki
- KinematicBody
- AnimationPlayer
- Sprite
- CollisionShape2D
<Aktion><Richtung>
z.B.: walkdown
- Playback Options --> Speed
siehe Player-Skript
zuerst die Animation in einer extra-Szene einbauen
- Node2D
- AnimationPlayer
extends Node2D
func _ready():
$anim.play("default")
$anim.connect("animation_finished", self, "destroy")
func destroy(animation):
queue_free()
if TYPE == "ENEMY" and health <= 0:
#Animation laden und inizialisieren
var death_animation = preload("res://scene/enemy_death.tscn").instance()
#Animation in der Szene einbinden
get_parent().add_child(death_animation)
#Position der Animation festlegen
death_animation.global_transform = global_transform