22 lines
842 B
GDScript
22 lines
842 B
GDScript
extends Label
|
|
|
|
const ASPECT_RATIO_STD = .5625 #9/16 for standard ratio
|
|
@export var padding_amount = .05 #multiplied by screen size
|
|
|
|
@onready var player = $"../../.."
|
|
@onready var gun_anim = $"../gun/GunAnims"
|
|
|
|
|
|
# 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) ,0 - (padding_amount * viewportHeightAdjusted))
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
text = "Ammo: " + str(player.ammo) +" " + str(player.ammo_reserve)
|