52 lines
1.4 KiB
GDScript
52 lines
1.4 KiB
GDScript
extends StateAnimatedActor
|
|
|
|
export (NodePath) var idle_node
|
|
export (NodePath) var landing_node
|
|
|
|
onready var idle_state: StateAnimatedActor = get_node(idle_node)
|
|
#onready var landing_mod: StateModifier = get_node(landing_node)
|
|
|
|
var landing_modifier: StateModifier
|
|
|
|
func _ready():
|
|
landing_modifier= StateModifier.new()
|
|
#add_child(modifier)
|
|
#modifier.init_ref()
|
|
landing_modifier.ready( "landing", "jump" , landing_modifier.TYPE.EXIT_ANIMATION)
|
|
landing_modifier.starting_frame = 6
|
|
#print("ready! MOD")
|
|
|
|
|
|
func enter() -> void:
|
|
# var landing_mod_index = modifier_stack_ref.rfind(landing_mod)
|
|
# if landing_mod_index != -1:
|
|
# #print("You're Supposed to be dead!?: ", landing_mod_index)
|
|
# modifier_stack_ref.remove(landing_mod_index)
|
|
.enter()
|
|
# Jump to fall frame
|
|
animations.frame = 5
|
|
animations.stop()
|
|
|
|
func process_physics(delta: float) -> State:
|
|
|
|
# First allow horizontal movement.
|
|
move_actor_as_desired(delta)
|
|
|
|
#Flip the character before tha actual move maybe.
|
|
if move_component.get_movement_direction() != 0.0:
|
|
parent.transform.x.x = move_component.get_movement_direction()
|
|
|
|
if parent.is_on_floor():
|
|
print("DO you even!?: ", landing_modifier.animation_name)
|
|
#modifier.reference()
|
|
idle_state.modifier = landing_modifier
|
|
return idle_state
|
|
return null
|
|
|
|
#func exit() -> void:
|
|
# .exit()
|
|
## push_animation_state_modifier(landing_mod)
|
|
## $"../landing".enter()
|
|
## modifier_stack_ref.push_front($"../landing")
|
|
# return
|