oh my god let's try this again
This commit is contained in:
26
scripts/hud_text.gd
Normal file
26
scripts/hud_text.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
extends Label
|
||||
|
||||
var hud_scaling : float = 1.0
|
||||
|
||||
func update(player, walljump_timer, dash_timer):
|
||||
var hp = "Health: " + str(player.hp)
|
||||
var walljump_ready = "Walljump Ready"
|
||||
var dash_ready = "Dash Ready"
|
||||
|
||||
if get_viewport_rect().size.x > 1280 and hud_scaling == 1.0:
|
||||
hud_scaling = (get_viewport_rect().size.x / 1280)
|
||||
|
||||
get_parent().size = get_viewport_rect().size
|
||||
get_parent().add_theme_constant_override("margin_top", 600 * hud_scaling)
|
||||
get_parent().add_theme_constant_override("margin_right", 1000 * hud_scaling)
|
||||
get_parent().add_theme_constant_override("margin_bottom", 20 * hud_scaling)
|
||||
get_parent().add_theme_constant_override("margin_left", 20 * hud_scaling)
|
||||
label_settings.font_size = int(25 * hud_scaling)
|
||||
label_settings.outline_size = int(3 * hud_scaling)
|
||||
|
||||
if !player.walljump_ready:
|
||||
walljump_ready = "Walljump in " + str("%.1f" % walljump_timer.time_left)
|
||||
if player.dash_spent:
|
||||
dash_ready = "Dash in " + str("%.1f" % dash_timer.time_left)
|
||||
|
||||
text = hp + "\n" + walljump_ready + "\n" + dash_ready
|
||||
Reference in New Issue
Block a user