Files
Defensaria/Game/sidepanel.gd
2025-03-13 19:50:05 +01:00

18 lines
513 B
GDScript

extends Panel
@onready var livelabel: Label = $HBoxContainer4/HBoxContainer3/Label
@onready var stickspawner: Button = $HBoxContainer4/HBoxContainer4/Button2
const STICK_TRAP = preload("res://Game/Traps/stick_trap.tscn")
func _ready() -> void:
stickspawner.connect("button_up", Spawn_Stick)
func Update_Lives(lives) -> void:
livelabel.text = "Lives: " + str(lives)
func Spawn_Stick() -> void:
var stick = STICK_TRAP.instantiate()
stick.name = "StickTrap-" + str(randi())
get_parent().add_child(stick)