34 lines
1.1 KiB
Text
34 lines
1.1 KiB
Text
[gd_scene load_steps=4 format=3 uid="uid://cckeamgkt8bqo"]
|
|
|
|
[ext_resource type="FontFile" uid="uid://c3fsj6knyiuhl" path="res://fonts/Knewave/Knewave-Regular.ttf" id="1_xaun4"]
|
|
|
|
[sub_resource type="LabelSettings" id="LabelSettings_8g5s8"]
|
|
font = ExtResource("1_xaun4")
|
|
font_size = 32
|
|
font_color = Color(1, 0, 0, 1)
|
|
outline_size = 8
|
|
shadow_size = 8
|
|
shadow_color = Color(0, 0, 0, 1)
|
|
|
|
[sub_resource type="GDScript" id="GDScript_xaun4"]
|
|
script/source = "extends Label
|
|
|
|
var ball_velocity := 0.0:
|
|
get: return ball_velocity
|
|
set(value):
|
|
ball_velocity = value
|
|
var rounded := int(floor(value))
|
|
self.text = str(rounded) + \" km/h\"
|
|
|
|
const min_px = 32.0
|
|
const max_px = 56.0
|
|
self.label_settings.font_size = min(max(rounded / 3, min_px), max_px)
|
|
self.label_settings.outline_size = min(max(rounded / 12, min_px / 4), max_px / 4)
|
|
self.label_settings.shadow_size = min(max(rounded / 12, min_px / 4), max_px / 4)
|
|
"
|
|
|
|
[node name="Speed" type="Label"]
|
|
text = "0 km/h"
|
|
label_settings = SubResource("LabelSettings_8g5s8")
|
|
horizontal_alignment = 2
|
|
script = SubResource("GDScript_xaun4")
|