Attempt2/lib/templates/Actor/states/idle.gd

29 lines
865 B
GDScript

extends StateAnimatedActor
# Do states need to have references to the states they want to transition
# to? I suppose if on exit/entrance we needed to do something
func enter() -> void:
#.enter()
# parent.set_hurtbox(true)
move_component.velocity.x = 0
print ("this doesn't work does it? ")
# if debug_state:
# print(owner.name, " Move Component: ", move_component.desired_movement_vector.x)
func process_physics(delta: float) -> String:
return ''
# parent.velocity.y += gravity * delta
# #parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
# parent.velocity.x = move_component.desired_movement_vector.x * move_speed
# parent.velocity = parent.move_and_slide(parent.velocity, Vector2(0, -1))
move_actor_as_desired(delta)
if move_component.velocity.x != 0.0:
return 'move'
if !parent.is_on_floor():
return 'fall'
return ''