fixed that speed was relative to framerate

This commit is contained in:
KingGurke 2023-09-30 19:12:46 +02:00
commit 753cb4eb2a
2 changed files with 6 additions and 5 deletions

View file

@ -8,10 +8,11 @@ size = Vector2(36, 20)
[node name="player" type="StaticBody2D" node_paths=PackedStringArray("camera")] [node name="player" type="StaticBody2D" node_paths=PackedStringArray("camera")]
script = ExtResource("1_g4ij8") script = ExtResource("1_g4ij8")
dec = 15.0 acc = 500.0
max_speed = 50.0 dec = 400.0
max_speed = 1000.0
turn_speed = 2.0 turn_speed = 2.0
brake_strength = 12.0 brake_strength = 60.0
camera = NodePath("Camera2D") camera = NodePath("Camera2D")
[node name="Sprite2D" type="Sprite2D" parent="."] [node name="Sprite2D" type="Sprite2D" parent="."]

View file

@ -13,7 +13,7 @@ extends StaticBody2D
## regulates how much more you can turn while breaking, values below 1 mean you can turn worse while drifting ## regulates how much more you can turn while breaking, values below 1 mean you can turn worse while drifting
@export var drift_factor := 1.5 @export var drift_factor := 1.5
## regulates how far the camera looks ahead of the player (affected by speed) ## regulates how far the camera looks ahead of the player (affected by speed)
@export var camera_offset_factor = 20. @export var camera_offset_factor = .2
# references # references
@export var camera : Camera2D @export var camera : Camera2D
@ -59,4 +59,4 @@ func _process(delta):
if momentum.length() > max_speed: if momentum.length() > max_speed:
momentum = momentum.normalized() * max_speed momentum = momentum.normalized() * max_speed
move_and_collide(momentum) move_and_collide(momentum * delta)