44 lines
1.1 KiB
GDScript
44 lines
1.1 KiB
GDScript
extends StateAnimatedActor
|
|
|
|
export (NodePath) var fall_node
|
|
export (NodePath) var idle_node
|
|
|
|
onready var fall_state: State = get_node(fall_node)
|
|
onready var idle_state: State = get_node(idle_node)
|
|
|
|
func enter() -> void:
|
|
.enter()
|
|
# parent.set_hurtbox(true)
|
|
if state_timeout:
|
|
state_timeout.start()
|
|
move_component.velocity.x = 0
|
|
if debug_state:
|
|
print(owner.name, " Move Component: ", move_component.desired_movement_vector.x)
|
|
|
|
func process_frame(_delta: float) -> State:
|
|
.process_frame(_delta)
|
|
if move_component.wants_shoot() == false and state_timeout.time_left == 0:
|
|
return idle_state
|
|
|
|
# if animations.frame > 1:
|
|
# parent.set_hitbox(true)
|
|
# else:
|
|
# parent.set_hitbox(false)
|
|
|
|
|
|
return null
|
|
|
|
|
|
func process_physics(delta: float) -> State:
|
|
|
|
# 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 !parent.is_on_floor():
|
|
return fall_state
|
|
return null
|