Some nice rounding in float representation
This commit is contained in:
parent
1982eb5e4e
commit
997e3c0982
6 changed files with 33 additions and 9 deletions
|
|
@ -86,7 +86,7 @@ select_target={
|
|||
}
|
||||
dock={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":80,"key_label":0,"unicode":112,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":73,"key_label":0,"unicode":105,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -45,7 +45,10 @@ script/source = "extends Label
|
|||
@onready var ship: PlayerShip = get_parent().get_parent()
|
||||
|
||||
func _process(_delta):
|
||||
text = unformatted_text.format([ship.hull.hp, ship.hull.max_hp])
|
||||
text = unformatted_text.format([
|
||||
round(ship.hull.hp * 100) / 100.0,
|
||||
ship.hull.max_hp
|
||||
])
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_q1sx2"]
|
||||
|
|
@ -58,7 +61,10 @@ script/source = "extends Label
|
|||
@onready var ship: PlayerShip = get_parent().get_parent()
|
||||
|
||||
func _process(_delta):
|
||||
text = unformatted_text.format([ship.shield.capacity, ship.shield.max_capacity])
|
||||
text = unformatted_text.format([
|
||||
round(ship.shield.capacity * 100) / 100.0,
|
||||
ship.shield.max_capacity
|
||||
])
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_rrgab"]
|
||||
|
|
@ -72,7 +78,7 @@ script/source = "extends Label
|
|||
|
||||
func _process(_delta):
|
||||
var format = [
|
||||
ship.hull.ammunition[\"Laser Energy\"],
|
||||
round(ship.hull.ammunition[\"Laser Energy\"] * 100) / 100.0,
|
||||
ship.hull.max_ammunition[\"Laser Energy\"],
|
||||
ship.hull.ammunition[\"Rockets\"],
|
||||
ship.hull.max_ammunition[\"Rockets\"]
|
||||
|
|
|
|||
|
|
@ -10,3 +10,12 @@ class_name PlayerShip
|
|||
var selected_node: Node2D = null
|
||||
## Currency variable
|
||||
var money: float = 1000.0
|
||||
## Base which was requested to dock last
|
||||
var docking_base: Base = null
|
||||
|
||||
func destroy():
|
||||
super.destroy()
|
||||
if docking_base != null:
|
||||
docking_base.dock_ready()
|
||||
docking_base = null
|
||||
selected_node = null
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class_name StarSystem
|
|||
## Pause controller packed scene
|
||||
@export var pause_controller_scene: PackedScene
|
||||
|
||||
## Node which is colliding with mouse
|
||||
var targeted_node: Node2D = null
|
||||
|
||||
## Player ship reference. May be null.
|
||||
|
|
@ -53,11 +54,9 @@ func unpause():
|
|||
pause_controller.visible = false
|
||||
|
||||
func _process(_delta):
|
||||
# pausing
|
||||
if Input.is_action_just_released("pause"):
|
||||
unpause() if get_tree().paused else pause()
|
||||
|
||||
if player_ship != null:
|
||||
pause_controller.position = player_ship.global_position
|
||||
|
||||
func set_targeted_node(node):
|
||||
targeted_node = node
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue