diff options
Diffstat (limited to 'Scenes/Entities/Player.gd')
-rw-r--r-- | Scenes/Entities/Player.gd | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Scenes/Entities/Player.gd b/Scenes/Entities/Player.gd index ba404fe..77dfac5 100644 --- a/Scenes/Entities/Player.gd +++ b/Scenes/Entities/Player.gd @@ -95,6 +95,10 @@ func _process(delta): self.DIRECTION = Vector2.DOWN self.DIRECTIONS.append(Vector2.DOWN) + var last_animation = $AnimatedSprite2D.animation + var frame = $AnimatedSprite2D.frame + var progress = $AnimatedSprite2D.frame_progress + if velocity.x < 0 && velocity.y == 0: $AnimatedSprite2D.play("left") elif velocity.x > 0 && velocity.y == 0: @@ -130,6 +134,9 @@ func _process(delta): elif self.LAST_DIRECTIONS == [Vector2.RIGHT, Vector2.DOWN]: $AnimatedSprite2D.play("idle_bottom_right") + if last_animation != $AnimatedSprite2D.animation: + $AnimatedSprite2D.set_frame_and_progress(frame, progress) + self.LAST_DIRECTIONS = self.DIRECTIONS if Input.is_action_just_pressed("ui_accept"): |