This commit is contained in:
Dustin 2025-03-17 21:11:09 -07:00
parent 1b7715746e
commit 702782def7
3 changed files with 17 additions and 11 deletions

View File

@ -9,7 +9,7 @@ export var callable_state_machine :NodePath
onready var current_state = StateAnimatedActor.new() onready var current_state = StateAnimatedActor.new()
var animation_finished: bool = false #var animation_finished: bool = false
var request_state_change: FuncRef var request_state_change: FuncRef
# this just wouldn't work well. Maybe I can try a resource # this just wouldn't work well. Maybe I can try a resource
@ -42,13 +42,16 @@ func _ready():
# Sprites should only have a process function # Sprites should only have a process function
# but if I have this will the sprite still animate? # but if I have this will the sprite still animate?
func _process(delta): func _process(delta):
if current_state.state_timeout != null: # Shouldn't need this anymore!
if current_state.state_timeout.time_left == 0: # if current_state.state_timeout != null:
print("You're out of time! I saw it!") # if current_state.state_timeout.time_left == 0:
request_state_change.call_func('idle') # print("You're out of time! I saw it!")
#play() # request_state_change.call_func('idle')
else: # #play()
print("what, no current_state?") # else:
# print("what, no current_state?")
# Not sure what should be called first here.
if has_method('_state_process_' + current_state.name): if has_method('_state_process_' + current_state.name):
call('_state_process_' + current_state.name) call('_state_process_' + current_state.name)
process_animations() process_animations()

View File

@ -28,6 +28,8 @@ var jerk: float
var physics_modifier :StateModifier var physics_modifier :StateModifier
var animation_finished: bool = false
# Not sure if this should be here. probably not # Not sure if this should be here. probably not
export(Array, String) var animation_sequence export(Array, String) var animation_sequence
@ -42,9 +44,10 @@ var modifier: StateModifier
func enter() -> void: func enter() -> void:
# Call parent class enter # Call parent class enter
.enter() .enter()
animation_finished = false
jerk = 0 jerk = 0
return return

View File

@ -5,8 +5,8 @@ func _ready():
var state_ref :State = get_node(callable_state_machine).get_state_reference('idle') var state_ref :State = get_node(callable_state_machine).get_state_reference('idle')
state_ref.connect("state_entered", self, "_on_state_entered_idle") state_ref.connect("state_entered", self, "_on_state_entered_idle")
state_ref = get_node(callable_state_machine).get_state_reference('fall') # state_ref = get_node(callable_state_machine).get_state_reference('fall')
state_ref.connect("state_entered", self, "_on_state_entered_fall") # state_ref.connect("state_entered", self, "_on_state_entered_fall")
# It works but node order really mattered. # It works but node order really mattered.
# State machine needed to be processed first probably for ready function. # State machine needed to be processed first probably for ready function.
# good to know! # good to know!