From 516d22c1737a9c94026b5ff0c9856bc5549aa416 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Fri, 3 May 2024 09:32:22 +0200 Subject: update --- Scenes/Entities/Player.gd | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Scenes/Entities/Player.gd') 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"): -- cgit v1.2.3