Selling mechanism

This commit is contained in:
2025-04-29 14:29:25 +02:00
parent fc4285e99d
commit 0cc20ef435
10 changed files with 131 additions and 17 deletions

View File

@ -15,14 +15,32 @@ const ARCHER_TOWER = preload("res://Game/Towers/archer_tower.tscn")
@onready var wizardtowerspawn: Button = $HBoxContainer4/HBoxContainer2/Button3
const WIZARD_TOWER = preload("res://Game/Towers/wizard_tower.tscn")
@onready var delete_tower_button: Button = $HBoxContainer4/HBoxContainer5/Button4
const DELETER = preload("res://Game/Accesories/deleter.tscn")
var lives = 0
func _ready() -> void:
stickspawner.connect("button_up", Spawn_Stick)
minespawner.connect("button_up", Spawn_Mine)
archertowerspawn.connect("button_up", Spawn_Archer)
wizardtowerspawn.connect("button_up", Spawn_wizard)
delete_tower_button.connect("button_up", Spawn_Deleter)
func set_Lifes(amount) -> void:
lives = amount
func Update_Lives(lives) -> void:
livelabel.text = "Lives: " + str(lives)
func get_Lifes():
return lives
func Update_Lifes(amount) -> void:
lives += amount
livelabel.text = "Lives: " + str(lives)
func Update_Coins(coins) -> void:
livelabel.text = "Lives: " + str(coins)
func Spawn_Stick() -> void:
var stick = STICK_TRAP.instantiate()
@ -45,3 +63,8 @@ func Spawn_wizard() -> void:
tower.name = "WizardTower-" + str(randi())
get_parent().add_child(tower)
pass
func Spawn_Deleter() -> void:
var deleter = DELETER.instantiate()
get_parent().add_child(deleter)
pass