From: Eduardo Date: Fri, 2 Aug 2024 13:36:30 +0000 (+0200) Subject: trying to setup the inventory system X-Git-Url: http://git.edufdez.es/?a=commitdiff_plain;h=df1638808e8e4668e646b5b02e9bc2509a8ec85f;p=rpg-template.git trying to setup the inventory system --- diff --git a/scenes/components/item_protoset.json b/scenes/components/item_protoset.json new file mode 100644 index 0000000..41b2bff --- /dev/null +++ b/scenes/components/item_protoset.json @@ -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 index 0000000..c3872c9 --- /dev/null +++ b/scenes/components/item_protoset.tres @@ -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, + } +] +" diff --git a/scenes/elements/player.tscn b/scenes/elements/player.tscn index c83d6c0..a50959f 100644 --- a/scenes/elements/player.tscn +++ b/scenes/elements/player.tscn @@ -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")