diff --git a/nodes/player/player.gd b/nodes/player/player.gd index 60c0be1..129fdba 100644 --- a/nodes/player/player.gd +++ b/nodes/player/player.gd @@ -93,16 +93,16 @@ func jump_state(_delta): if(direction): velocity.x = move_toward(velocity.x, direction * SPEED, SPEED) - if velocity.y > 0: - if is_on_floor(): - if direction: - $fsm.set_next_state("walk") - else: - velocity.x = 0 - $fsm.set_next_state("idle") - if is_on_wall() || (is_on_ceiling() and Input.is_action_pressed("player_up")): - $fsm.set_next_state("climb") + if is_on_floor(): + if direction: + $fsm.set_next_state("walk") + else: + velocity.x = 0 + $fsm.set_next_state("idle") + + if is_on_wall() || (is_on_ceiling() ): + $fsm.set_next_state("climb") func on_enter_climb_state(): sprite.modulate = Color(1, 0, 0) @@ -178,10 +178,6 @@ func drop_obstacle(): grabbed_obstacle = null func handle_sprite_orientation(): - # rotates oriented_container to face - # the direction of the velocity - # if is_on_wall, rotated regarding velocity.y, with up by default - # if is_on_ceiling, rotated regarding velocity.x, with right by default if is_on_wall_only(): if velocity.y != 0: $oriented_container.rotation = PI/2 if (velocity.y > 0) else - PI / 2 @@ -195,6 +191,7 @@ func handle_sprite_orientation(): elif is_on_ceiling(): if velocity.x != 0: $oriented_container.rotation = PI if (velocity.x > 0) else -PI + sprite.flip_h = velocity.x > 0 else: if velocity.x != 0: $oriented_container.rotation = 0 if (velocity.x > 0) else PI