[godot] Register signal handlers before queuing animations.

This commit is contained in:
Mario Zechner 2023-03-03 12:06:37 +01:00
parent 425e5a5f2c
commit 5f9f684408
2 changed files with 12 additions and 10 deletions

View File

@ -24,15 +24,16 @@ func _animation_event(sprite: SpineSprite, animation_state: SpineAnimationState,
func _ready():
var spineboy = $Spineboy
var animation_state = spineboy.get_animation_state()
animation_state.set_animation("jump", false, 0)
animation_state.add_animation("walk", 0, true, 0)
animation_state.add_animation("run", 2, true, 0)
spineboy.animation_started.connect(_animation_started)
spineboy.animation_interrupted.connect(_animation_interrupted)
spineboy.animation_ended.connect(_animation_ended)
spineboy.animation_completed.connect(_animation_completed)
spineboy.animation_disposed.connect(_animation_disposed)
spineboy.animation_event.connect(_animation_event)
var animation_state = spineboy.get_animation_state()
animation_state.set_animation("jump", false, 0)
animation_state.add_animation("walk", 0, true, 0)
animation_state.add_animation("run", 2, true, 0)
pass

View File

@ -24,15 +24,16 @@ func _animation_event(sprite: SpineSprite, animation_state: SpineAnimationState,
func _ready():
var spineboy = $Spineboy
var animation_state = spineboy.get_animation_state()
animation_state.set_animation("jump", false, 0)
animation_state.add_animation("walk", 0, true, 0)
animation_state.add_animation("run", 2, true, 0)
spineboy.connect("animation_started", self, "_animation_started")
spineboy.connect("animation_interrupted", self, "_animation_interrupted")
spineboy.connect("animation_ended", self, "_animation_ended")
spineboy.connect("animation_completed", self, "_animation_completed")
spineboy.connect("animation_disposed", self, "_animation_disposed")
spineboy.connect("animation_event", self, "_animation_event")
var animation_state = spineboy.get_animation_state()
animation_state.set_animation("jump", false, 0)
animation_state.add_animation("walk", 0, true, 0)
animation_state.add_animation("run", 2, true, 0)
pass