diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-05-03 09:32:22 +0200 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-05-03 09:32:22 +0200 |
commit | 516d22c1737a9c94026b5ff0c9856bc5549aa416 (patch) | |
tree | cd9ef3089d1c8bdfc440b5673f7ad0d0dce787a9 /Scenes/Entities/Player.gd | |
parent | d192b1546ab39180cdc28d2621c117539e3d26d6 (diff) |
update
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"): |