From 5c3fb326aaa238fa4308ea22fe1d6207b3a8f569 Mon Sep 17 00:00:00 2001 From: Kellan KOZUME Date: Mon, 13 Apr 2026 23:04:16 -0400 Subject: [PATCH] fix: resolve player jitter with position.round() and 120px/s speed --- entities/player/player.gd | 14 +++----------- entities/player/player.tscn | 6 +++++- project.godot | 3 ++- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/entities/player/player.gd b/entities/player/player.gd index 9ffb842..9aa374d 100644 --- a/entities/player/player.gd +++ b/entities/player/player.gd @@ -1,9 +1,8 @@ extends CharacterBody2D -const SPEED := 64.0 +const SPEED := 120 @onready var sprite := $AnimatedSprite2D -@onready var interaction_area := $InteractionArea var last_direction := Vector2.DOWN var interactable : Node = null @@ -15,6 +14,8 @@ func _physics_process(_delta: float) -> void: velocity = direction * SPEED move_and_slide() + + position.round() _update_animation(direction) func _unhandled_input(event: InputEvent) -> void: @@ -34,12 +35,3 @@ func _dir_name(dir: Vector2) -> String: return "right" if dir.x > 0 else "left" else: return "down" if dir.y > 0 else "up" - -# --- Interaction --- -func _on_interaction_area_body_entered(body: Node) -> void: - if body.has_method("interact"): - interactable = body - -func _on_interaction_area_body_exited(body: Node) -> void: - if body == interactable: - interactable = null diff --git a/entities/player/player.tscn b/entities/player/player.tscn index cbd4732..98b13dd 100644 --- a/entities/player/player.tscn +++ b/entities/player/player.tscn @@ -852,10 +852,14 @@ script = ExtResource("1_fkugw") [node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D" unique_id=865652003] shape = SubResource("CapsuleShape2D_26q78") +[node name="Camera2D" type="Camera2D" parent="CharacterBody2D" unique_id=1653637445] +zoom = Vector2(0.5, 0.5) +position_smoothing_enabled = true + [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="CharacterBody2D" unique_id=1859344504] position = Vector2(1, 7) sprite_frames = SubResource("SpriteFrames_ix1gt") -animation = &"walk_right" +animation = &"walk_down" autoplay = "idle_down" [node name="InteractionArea" type="Area2D" parent="CharacterBody2D/AnimatedSprite2D" unique_id=22124935] diff --git a/project.godot b/project.godot index 7397ce1..d62ee21 100644 --- a/project.godot +++ b/project.godot @@ -13,6 +13,7 @@ config_version=5 config/name="Scrap Signal" run/main_scene="uid://c5lskgqkorw6v" config/features=PackedStringArray("4.6", "GL Compatibility") +run/max_fps=60 config/icon="res://icon.svg" [display] @@ -22,7 +23,6 @@ window/size/viewport_height=180 window/size/window_width_override=1280 window/size/window_height_override=720 window/stretch/mode="canvas_items" -window/stretch/scale_mode="integer" [input] @@ -67,6 +67,7 @@ interact={ [physics] 3d/physics_engine="Jolt Physics" +common/physics_interpolation=true [rendering]