Some nice rounding in float representation

This commit is contained in:
2ndbeam 2024-05-14 08:07:29 +03:00
commit 997e3c0982
6 changed files with 33 additions and 9 deletions

View file

@ -19,7 +19,12 @@ script/source = "extends Label
@onready var ship: Ship = get_parent().get_parent().get_parent()
func _process(_delta):
text = unformatted_text.format([ship.hull.hp, ship.hull.max_hp, ship.shield.capacity, ship.shield.max_capacity])
text = unformatted_text.format([
round(ship.hull.hp * 100) / 100.0,
ship.hull.max_hp,
round(ship.shield.capacity * 100) / 100.0,
ship.shield.max_capacity
])
"
[node name="KamikazeShip" type="Node2D"]

View file

@ -20,7 +20,12 @@ script/source = "extends Label
@onready var ship: Ship = get_parent().get_parent().get_parent()
func _process(_delta):
text = unformatted_text.format([ship.hull.hp, ship.hull.max_hp, ship.shield.capacity, ship.shield.max_capacity])
text = unformatted_text.format([
round(ship.hull.hp * 100) / 100.0,
ship.hull.max_hp,
round(ship.shield.capacity * 100) / 100.0,
ship.shield.max_capacity
])
"
[node name="ShooterShip" type="Node2D"]