|
|
|
|
@ -16,7 +16,7 @@ const STATES= [ |
|
|
|
|
|
|
|
|
|
var use_gravity = { |
|
|
|
|
"climb": false, |
|
|
|
|
"die": false, |
|
|
|
|
"die": true, |
|
|
|
|
"idle": true, |
|
|
|
|
"jump": true, |
|
|
|
|
"spawn": true, |
|
|
|
|
@ -30,7 +30,7 @@ func _ready(): |
|
|
|
|
$fsm.set_states(STATES) |
|
|
|
|
add_to_group("player") |
|
|
|
|
|
|
|
|
|
func _enter_spawn(): |
|
|
|
|
func on_enter_spawn_state(): |
|
|
|
|
$fsm.set_next_state("idle") |
|
|
|
|
|
|
|
|
|
func on_enter_idle_state(): |
|
|
|
|
@ -59,7 +59,6 @@ func walk_state(_delta): |
|
|
|
|
if Input.is_action_just_pressed("ui_accept") and is_on_floor(): |
|
|
|
|
$fsm.set_next_state("jump") |
|
|
|
|
|
|
|
|
|
# detect collision with wall or ceiling to enter climb state |
|
|
|
|
if is_on_wall() or (Input.is_action_pressed('ui_up') && is_on_ceiling()): |
|
|
|
|
velocity.y = 0 |
|
|
|
|
$fsm.set_next_state("climb") |
|
|
|
|
|