New features and plenty of code still in testing. This includes a level select, basic inventory, and a basic HUD.

This commit is contained in:
VoidTwo
2021-11-15 22:29:42 -06:00
parent bbb245f7b7
commit 2c98c112bd
47 changed files with 753 additions and 68 deletions

45
Player/Inventory.gd Normal file
View File

@@ -0,0 +1,45 @@
extends Node
signal update_currency(amount)
var __currency: int
var __weapons: Array
var __accessories: Array
var __categories: Dictionary
func _ready() -> void:
self.__currency = 100
self.__weapons = []
self.__accessories = []
self.__categories = {
'Weapon': self.__weapons,
'Accessory': self.__accessories}
return
func get_currency() -> int:
return self.__currency
func add_currency(amount: int) -> void:
self.__currency += amount
emit_signal('update_currency', self.__currency)
return
func add(item) -> void:
self.__categories[item.type].append(item)
return
func discard(item) -> void:
var index: int = 0
for itr in self.__categories[item.type]:
if itr.equals(item):
self.__categories[item.type].remove(index)
break
index += 1
return