|
|
|
|
@ -105,12 +105,8 @@ func jump_state(_delta): |
|
|
|
|
$fsm.set_next_state("climb") |
|
|
|
|
|
|
|
|
|
func on_enter_climb_state(): |
|
|
|
|
sprite.modulate = Color(1, 0, 0) |
|
|
|
|
velocity = Vector2(0, 0) |
|
|
|
|
|
|
|
|
|
func on_exit_climb_state(): |
|
|
|
|
sprite.modulate = Color(1, 1, 1) |
|
|
|
|
|
|
|
|
|
func climb_state(_delta): |
|
|
|
|
if is_on_wall(): |
|
|
|
|
var direction = Input.get_axis("player_up", "player_down") |
|
|
|
|
@ -186,9 +182,10 @@ func handle_sprite_orientation(): |
|
|
|
|
var should_flip_with_wall_left = (wall_position > player_position) && (velocity.y > 0) |
|
|
|
|
var should_flip_with_wall_right = (wall_position < player_position) && (velocity.y < 0) |
|
|
|
|
sprite.flip_v = should_flip_with_wall_left || should_flip_with_wall_right |
|
|
|
|
sprite.flip_h = false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elif is_on_ceiling(): |
|
|
|
|
elif is_on_ceiling_only(): |
|
|
|
|
if velocity.x != 0: |
|
|
|
|
$oriented_container.rotation = PI if (velocity.x > 0) else -PI |
|
|
|
|
sprite.flip_h = velocity.x > 0 |
|
|
|
|
@ -199,6 +196,7 @@ func handle_sprite_orientation(): |
|
|
|
|
sprite.flip_h = false |
|
|
|
|
|
|
|
|
|
func on_enter_swim_state(): |
|
|
|
|
sprite.modulate = Color(0, 0, 1) |
|
|
|
|
gravity = WORLD_GRAVITY / 2 |
|
|
|
|
|
|
|
|
|
func swim_state(_delta): |
|
|
|
|
@ -213,6 +211,7 @@ func swim_state(_delta): |
|
|
|
|
die() |
|
|
|
|
|
|
|
|
|
func on_exit_swim_state(): |
|
|
|
|
sprite.modulate = Color(1, 1, 1) |
|
|
|
|
gravity = WORLD_GRAVITY |
|
|
|
|
sprite.modulate = Color(1,1,1) |
|
|
|
|
|
|
|
|
|
|