22 lines
954 B
GDScript
22 lines
954 B
GDScript
extends Label
|
|
|
|
@onready var player = $"../../.."
|
|
@onready var level_control = $"../../../.."
|
|
|
|
const ASPECT_RATIO_STD = .5625 #9/16 for standard ratio
|
|
@export var padding_amount = .05 #multiplied by screen size
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
var viewportWidth = get_viewport().size.x
|
|
var viewportHeight = get_viewport().size.y
|
|
var viewportHeightAdjusted = viewportWidth * ASPECT_RATIO_STD
|
|
|
|
size = Vector2(viewportWidth + (padding_amount * viewportWidth), viewportHeight - (padding_amount * viewportHeightAdjusted))
|
|
position = Vector2(0 + (padding_amount * viewportWidth) ,- (padding_amount * viewportHeightAdjusted))
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
text = "health " + str(clamp(level_control.health,0,100))+ "\n$" + str(int(level_control.money)) + "\nStamina: " + str(int((player.remaining_stamina/player.MAX_STAMINA)*100)) + "%"
|