trying to setup the inventory system
authorEduardo <[email protected]>
Fri, 2 Aug 2024 13:36:30 +0000 (15:36 +0200)
committerEduardo <[email protected]>
Fri, 2 Aug 2024 13:36:30 +0000 (15:36 +0200)
scenes/components/item_protoset.json [new file with mode: 0644]
scenes/components/item_protoset.tres [new file with mode: 0644]
scenes/elements/player.tscn

diff --git a/scenes/components/item_protoset.json b/scenes/components/item_protoset.json
new file mode 100644 (file)
index 0000000..41b2bff
--- /dev/null
@@ -0,0 +1,15 @@
+[
+       {
+               "id": "base_item",
+               "name": "Base Item",
+               "description": "An example item used as a base to create other items.",
+               
+               "_comment": "Stack Based Inventory",
+               "stack_size": 10,
+               "weight": 1.0,
+               
+               "_comment": "Grid Based Inventory",
+               "width": 2,
+               "height": 2,
+       }
+]
diff --git a/scenes/components/item_protoset.tres b/scenes/components/item_protoset.tres
new file mode 100644 (file)
index 0000000..c3872c9
--- /dev/null
@@ -0,0 +1,22 @@
+[gd_resource type="Resource" script_class="ItemProtoset" load_steps=2 format=3 uid="uid://djhhxwo6oave4"]
+
+[ext_resource type="Script" path="res://addons/gloot/core/item_protoset.gd" id="1_gt6d6"]
+
+[resource]
+script = ExtResource("1_gt6d6")
+json_data = "[
+       {
+               \"id\": \"base_item\",
+               \"name\": \"Base Item\",
+               \"description\": \"An example item used as a base to create other items.\",
+               
+               \"_comment\": \"Stack Based Inventory\",
+               \"stack_size\": 10,
+               \"weight\": 1.0,
+               
+               \"_comment\": \"Grid Based Inventory\",
+               \"width\": 2,
+               \"height\": 2,
+       }
+]
+"
index c83d6c062d9f622e4646f9d8dfdadcd2f2d547d3..a50959f1ec04852f938d4c8460fb48c9c2e6e590 100644 (file)
@@ -1,7 +1,9 @@
-[gd_scene load_steps=4 format=3 uid="uid://k76535tjepm3"]
+[gd_scene load_steps=6 format=3 uid="uid://k76535tjepm3"]
 
 [ext_resource type="Script" path="res://scripts/player.gd" id="1_1webx"]
 [ext_resource type="SpriteFrames" uid="uid://dum0mxk5oajvu" path="res://assets/animations/player_animation.tres" id="1_qf5ok"]
+[ext_resource type="Script" path="res://addons/gloot/core/inventory_stacked.gd" id="3_kcm8a"]
+[ext_resource type="Resource" uid="uid://djhhxwo6oave4" path="res://scenes/components/item_protoset.tres" id="4_oy0ny"]
 
 [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_geqid"]
 radius = 6.0
@@ -19,3 +21,7 @@ position = Vector2(0, -8)
 sprite_frames = ExtResource("1_qf5ok")
 animation = &"idle"
 frame_progress = 0.577081
+
+[node name="InventoryStacked" type="Node" parent="."]
+script = ExtResource("3_kcm8a")
+item_protoset = ExtResource("4_oy0ny")