Added a HUD for both distance driven and current speed (in pixels and pixels/second respectively)

This commit is contained in:
KingGurke 2023-10-01 12:13:42 +02:00
parent 098033bbbf
commit 837408aaa3
5 changed files with 79 additions and 1 deletions

View file

@ -1,8 +1,9 @@
[gd_scene load_steps=6 format=3 uid="uid://c77xk0mywwt5f"]
[gd_scene load_steps=7 format=3 uid="uid://c77xk0mywwt5f"]
[ext_resource type="Script" path="res://src/game/level.gd" id="1_hv75i"]
[ext_resource type="PackedScene" uid="uid://ckau5s2tsb3oc" path="res://src/game/player.tscn" id="2_5nf51"]
[ext_resource type="Texture2D" uid="uid://bd0jqkgq1gh7p" path="res://assets/track.png" id="2_knecs"]
[ext_resource type="PackedScene" uid="uid://cdlbh3smpgg42" path="res://src/game/hud.tscn" id="2_w64nx"]
[ext_resource type="Texture2D" uid="uid://cd7bqj3v0k8yi" path="res://assets/finish.png" id="4_r6pvu"]
[sub_resource type="Curve2D" id="Curve2D_ll8bj"]
@ -36,3 +37,11 @@ texture_mode = 1
[node name="player" parent="." instance=ExtResource("2_5nf51")]
position = Vector2(42.7545, -14.9219)
brake_strength = 800.0
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="hud" parent="CanvasLayer" instance=ExtResource("2_w64nx")]
size_flags_horizontal = 3
[connection signal="distance_changed" from="." to="CanvasLayer/hud" method="_on_level_distance_changed"]
[connection signal="speed_changed" from="player" to="CanvasLayer/hud" method="_on_player_speed_changed"]