added spedometer

This commit is contained in:
Wheelbarrow
2025-07-26 15:32:05 -04:00
parent c1426ddcc0
commit 9008acadcd
2 changed files with 7 additions and 0 deletions

1
car.gd
View File

@@ -31,6 +31,7 @@ func _ready() -> void:
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
steer(delta) steer(delta)
apply_air_resistance() apply_air_resistance()
get_tree().get_first_node_in_group("spedometer").text = str(linear_velocity.length())
func steer(delta: float) -> void: func steer(delta: float) -> void:
var steer_input = Input.get_axis("Steer Right", "Steer Left") var steer_input = Input.get_axis("Steer Right", "Steer Left")

View File

@@ -45,3 +45,9 @@ size = Vector3(178.75879, 1, 233.49219)
[node name="Car" parent="." instance=ExtResource("1_ig7tw")] [node name="Car" parent="." instance=ExtResource("1_ig7tw")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.1980705, 3.2689552, -35.90589) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.1980705, 3.2689552, -35.90589)
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Label" type="Label" parent="CanvasLayer" groups=["spedometer"]]
offset_right = 40.0
offset_bottom = 23.0