Moved godot files into a directory to keep things clean
This commit is contained in:
24
project/items/inventory.gd
Normal file
24
project/items/inventory.gd
Normal file
@@ -0,0 +1,24 @@
|
||||
#Inventory Singleton
|
||||
extends Node
|
||||
|
||||
#game items
|
||||
@abstract
|
||||
class Item:
|
||||
var name: String
|
||||
func _init(_name: String):
|
||||
name = _name
|
||||
|
||||
class Wood extends Item:
|
||||
func _init():
|
||||
super("Wood")
|
||||
|
||||
class Stone extends Item:
|
||||
func _init():
|
||||
super("Stone")
|
||||
|
||||
#inventory controls
|
||||
var _inventory_contents: Array[Item] = []
|
||||
|
||||
func add_item(item: Item) -> void:
|
||||
_inventory_contents.push_back(item)
|
||||
print("Inventory: ", _inventory_contents.map(func (i: Item) -> String: return i.name))
|
||||
1
project/items/inventory.gd.uid
Normal file
1
project/items/inventory.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cf0cv8j7r1qjm
|
||||
Reference in New Issue
Block a user