save management

This commit is contained in:
2025-10-14 20:19:29 +02:00
parent 21a25c07a8
commit ea63279633
9 changed files with 74 additions and 10 deletions

View File

@@ -31,19 +31,18 @@ func _ready() -> void:
func _physics_process(delta: float) -> void:
velocity = Input.get_vector("move_left","move_right","move_up","move_down").normalized() * delta * SPEED * 3
move_and_slide()
position.x = clamp(position.x, position_limit_rect.position.x, position_limit_rect.end.x)
position.y = clamp(position.y, position_limit_rect.position.y, position_limit_rect.end.y)
position = position.clamp(position_limit_rect.position, position_limit_rect.end)
animated_sprite.flip_h = velocity.x < 0
if velocity.length() != 0:
animated_sprite.play()
if velocity.x != 0:
animated_sprite.flip_h = false
if abs(velocity.x) > abs(velocity.y):
animated_sprite.animation = "side"
animated_sprite.flip_h = velocity.x < 0
elif velocity.y < 0:
animated_sprite.animation = "up"
else:
animated_sprite.animation = "down"
else:
animated_sprite.stop()