mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-15 16:34:48 +00:00
✨ enforce static typing
This commit is contained in:
parent
675974150f
commit
20eb9824cd
36 changed files with 271 additions and 374 deletions
|
|
@ -6,23 +6,23 @@
|
|||
script/source = "extends CanvasLayer
|
||||
class_name HUD
|
||||
|
||||
@onready var _health_bar = $HealthBar
|
||||
@onready var _energy_bar = $EnergyBar
|
||||
@onready var _health_bar : ProgressBar = $HealthBar
|
||||
@onready var _energy_bar : ProgressBar = $EnergyBar
|
||||
|
||||
func _ready():
|
||||
_update_health_bar(100)
|
||||
_update_energy_bar(100)
|
||||
func _ready() -> void:
|
||||
_update_health_bar(100.)
|
||||
_update_energy_bar(100.)
|
||||
|
||||
func _update_energy_bar(energy) -> void:
|
||||
func _update_energy_bar(energy : float) -> void:
|
||||
_energy_bar.value = energy
|
||||
|
||||
func _on_energy_changed(new_energy) -> void:
|
||||
func _on_energy_changed(new_energy : float) -> void:
|
||||
_update_energy_bar(new_energy)
|
||||
|
||||
func _update_health_bar(health) -> void:
|
||||
func _update_health_bar(health : float) -> void:
|
||||
_health_bar.value = health
|
||||
|
||||
func _on_health_changed(new_health) -> void:
|
||||
func _on_health_changed(new_health : float) -> void:
|
||||
_update_health_bar(new_health)
|
||||
"
|
||||
|
||||
|
|
@ -34,14 +34,14 @@ bg_color = Color(0, 0.454902, 0.992157, 1)
|
|||
[sub_resource type="GDScript" id="GDScript_w8l21"]
|
||||
script/source = "extends Label
|
||||
|
||||
@onready var player = get_parent().owner
|
||||
@onready var player : Player = get_parent().owner
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
func _process(_delta : float) -> void:
|
||||
text = \"\"
|
||||
text += \"fps: %s\\n\" % str(Engine.get_frames_per_second())
|
||||
text += \"position: %d, %d, %d\\n\" % [player.position.x, player.position.y, player.position.z]
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@ extends Node2D
|
|||
@export var attach_point : Node3D
|
||||
@export var player : Player
|
||||
|
||||
@onready var _player_name_label = $Offset/VBoxContainer/PlayerNameLabel
|
||||
@onready var _health_bar = $Offset/VBoxContainer/HealthBar
|
||||
@onready var _v_box_container = $Offset/VBoxContainer
|
||||
@onready var _player_name_label : Label = $Offset/VBoxContainer/PlayerNameLabel
|
||||
@onready var _health_bar : ProgressBar = $Offset/VBoxContainer/HealthBar
|
||||
@onready var _v_box_container : VBoxContainer = $Offset/VBoxContainer
|
||||
|
||||
func _process(_delta):
|
||||
func _process(_delta : float) -> void:
|
||||
var camera : Camera3D = get_viewport().get_camera_3d()
|
||||
if camera.is_position_behind(attach_point.global_position):
|
||||
_v_box_container.hide()
|
||||
|
|
@ -34,8 +34,8 @@ func _process(_delta):
|
|||
position.x = clampf(position.x, 0, viewport_size.x - _v_box_container.size.x)
|
||||
position.y = clampf(position.y, _v_box_container.size.y, viewport_size.y)
|
||||
|
||||
func _update_health_bar(health) -> void:
|
||||
func _update_health_bar(health : float) -> void:
|
||||
_health_bar.value = health
|
||||
|
||||
func _on_health_changed(new_health) -> void:
|
||||
func _on_health_changed(new_health : float) -> void:
|
||||
_update_health_bar(new_health)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue