37 lines
897 B
GDScript
37 lines
897 B
GDScript
extends "res://src/templates/Actor/states/move.gd"
|
|
|
|
export var jump_force: float = 200.0
|
|
|
|
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)
|
|
#print("ready! MOD")
|
|
|
|
|
|
func enter() -> void:
|
|
.enter()
|
|
# Apply initial jump velocity on state enter
|
|
move_component.velocity.y = -jump_force
|
|
|
|
func process_physics(delta: float) -> State:
|
|
|
|
# if move_component.velocity.y > 0:
|
|
# return fall_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():
|
|
idle_state.modifier = landing_modifier
|
|
return idle_state
|
|
|
|
return null
|