added Graphics and sound Effects and more overhauls
This commit is contained in:
parent
c887a2168c
commit
b9d4288900
214 changed files with 3378 additions and 198 deletions
45
scenes/upgradeChooser/upgradeChooser.gd
Normal file
45
scenes/upgradeChooser/upgradeChooser.gd
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
extends Control
|
||||
|
||||
@onready var choice = preload("res://scenes/upgradeChooser/choice/choice.tscn")
|
||||
|
||||
@onready var choiceContainer = $CenterContainer/VBoxContainer/ChoiceContainer
|
||||
|
||||
@onready var select = $select
|
||||
|
||||
func _ready() -> void:
|
||||
randomize()
|
||||
|
||||
|
||||
func showUpgrades():
|
||||
show()
|
||||
|
||||
for i in choiceContainer.get_children():
|
||||
i.queue_free()
|
||||
var selectableUpgrades = getRandomUpgrades(3)
|
||||
for i in selectableUpgrades:
|
||||
addChoice(i)
|
||||
|
||||
|
||||
func getRandomUpgrades(amount: int) -> Array[int]:
|
||||
var selectableUpgrades: Array[int]
|
||||
var rng = RandomNumberGenerator.new()
|
||||
for i in range(0, amount):
|
||||
var choice: int = rng.randi_range(0, Globals.getUpgrades().size()-1)
|
||||
if choice in selectableUpgrades:
|
||||
choice = rng.randi_range(0, Globals.getUpgrades().size()-1)
|
||||
selectableUpgrades.append(choice)
|
||||
return selectableUpgrades
|
||||
|
||||
func addChoice(option: int):
|
||||
var _choice: Choice = choice.instantiate()
|
||||
choiceContainer.add_child(_choice)
|
||||
_choice.setValues(Globals.getUpgrade(option).upgradeName, Globals.getUpgrade(option).description, option)
|
||||
_choice.selected.connect(choose)
|
||||
|
||||
func choose(option: int):
|
||||
select.play()
|
||||
var test = StrafeUpgrade.new()
|
||||
Globals.getUpgrade(option).select()
|
||||
if Globals.getUpgrade(option) is DashUpgrade or Globals.getUpgrade(option) is StrafeUpgrade or Globals.getUpgrade(option) is SelfHealUpgrade:
|
||||
Globals.removeUpgrade(option)
|
||||
hide()
|
||||
Loading…
Add table
Add a link
Reference in a new issue