Added locked barriers and a new ghost enemy

This commit is contained in:
VoidTwo
2021-12-04 18:23:05 -06:00
parent fcea3cee03
commit 9101bf2f65
21 changed files with 472 additions and 41 deletions

View File

@@ -3,43 +3,38 @@ extends Node
signal update_currency(amount)
var __currency: int
var __weapons: Array
var __accessories: Array
var __categories: Dictionary
var __items: Array
func _ready() -> void:
self.__currency = 100
self.__weapons = []
self.__accessories = []
self.__categories = {
'Weapon': self.__weapons,
'Accessory': self.__accessories}
__currency = 100
__items = []
return
func get_currency() -> int:
return self.__currency
return __currency
func add_currency(amount: int) -> void:
self.__currency += amount
emit_signal('update_currency', self.__currency)
__currency += amount
emit_signal('update_currency', __currency)
return
func add(item) -> void:
self.__categories[item.type].append(item)
func contains(item: String) -> bool:
if item in __items:
return true
return false
func add(item: String) -> void:
__items.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
func remove(item: String) -> void:
for k in range(len(__items)):
if __items[k] == item:
__items.remove(k)
return

View File

@@ -45,8 +45,17 @@ func add_currency(amount: int) -> void:
return
func has_item(item: String) -> bool:
return $Inventory.contains(item)
func add_item(item: String) -> void:
print('%s added to inventory' % [item])
$Inventory.add(item)
return
func remove_item(item: String) -> void:
$Inventory.remove(item)
return