Initial commit (1/2)
This commit is contained in:
commit
3411c5796d
66 changed files with 2261 additions and 0 deletions
29
scenes/menus/BuyMenuLaser.gd
Normal file
29
scenes/menus/BuyMenuLaser.gd
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
extends BuyMenuButton
|
||||
|
||||
class_name BuyWeaponMenuButton
|
||||
|
||||
@export var AddedWeapon : String
|
||||
@export var Slot : String = "primary"
|
||||
@export var Position : Vector2 = Vector2.ZERO
|
||||
|
||||
@onready var PrimarySlot = get_tree().current_scene.get_node("MainShip/PrimaryWeapon")
|
||||
@onready var SecondarySlot = get_tree().current_scene.get_node("MainShip/SecondaryWeapon")
|
||||
@onready var BoughtWeapon = get_tree().current_scene.BoughtWeapon
|
||||
@onready var WeaponDict = get_tree().current_scene.WeaponDict
|
||||
|
||||
func bought_action():
|
||||
var SlotInst = PrimarySlot if Slot == "primary" else SecondarySlot
|
||||
if !BoughtWeapon[AddedWeapon]:
|
||||
BoughtWeapon[AddedWeapon] = true
|
||||
else:
|
||||
PlayerShip.Money += Price
|
||||
if SlotInst.get_child_count() == 0:
|
||||
var AddingWeapon = load(WeaponDict[AddedWeapon]).instantiate()
|
||||
SlotInst.add_child(AddingWeapon)
|
||||
SlotInst.position = Position
|
||||
else:
|
||||
for node in SlotInst.get_children():
|
||||
node.queue_free()
|
||||
var AddingWeapon = load(WeaponDict[AddedWeapon]).instantiate()
|
||||
SlotInst.add_child(AddingWeapon)
|
||||
SlotInst.position = Position
|
||||
Loading…
Add table
Add a link
Reference in a new issue