ammo working through weapon manager

This commit is contained in:
derek
2024-07-15 13:21:13 -05:00
parent 06b8229db1
commit f2ff68b7fa
5 changed files with 659 additions and 19 deletions

View File

@@ -2,20 +2,20 @@ extends Label
const ASPECT_RATIO_STD = .5625 #9/16 for standard ratio
@export var padding_amount = .05 #multiplied by screen size
@onready var level_control = $"../../../.."
@onready var player = $"../../.."
@onready var gun_anim = $"../gun/GunAnims"
var gun_index
# 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
gun_index = 0
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)
text = "Ammo: " + str(level_control.ammo_current[gun_index]) +" " + str(level_control.ammo_reserve[gun_index])