Inventory Quest

Learn Resources, clean data, and modular inventory systems.

Building the Item.gd Resource

Create a complete item definition script with all properties your inventory needs.

0

of 100 DMG

What you’ll build

An InventoryUI.gd coordinator that spawns slot UI, listens toinventory_changed, and refreshes the grid.

Grid settings

Columns4
Slots12

Data → UI refresh

Inventory.gdInventoryUI.gdSlots
Teach → Practice → Check

Live preview

Learning Objectives

By the end, you’ll have a real Item resource you can reuse across your entire game.

0/6 done
Understand common item fields (icon, name, rarity, stack size, value).
Know which fields should be exported so designers can edit them.
Use @export to expose variables in the Inspector.
Use typed exports (enums/ranges) to constrain values safely.
Build Item.gd as a Resource with clean exported fields.
Create a few .tres items (potion, sword) and confirm they share the same script.

Part 1: Explore Item Properties

Inspect items to see what data they need

Match Items to Properties

Click each item to see what Item.gd needs to store.

Item.gd Properties
Select an item to inspect
Inspected: 0/3 items

Part 2: Create Your Own Item

Learn @export by building a custom item

Watch: Export Tricks

5 min

Key concept: @export annotations transform the Inspector into a user-friendly editor.

@export_enum = dropdown menus
@export_group = collapsible sections

🛠️ Create Your Own Item

Fill in the Inspector fields to build a custom item Resource!

1
2
3
4
@exportBasic Info

Every item needs a name and description. These use basic @export.

Inspector Preview

GDScript Code

Item.gd
@export var name: String = "Item"
@export var icon: Texture2D  # 🗡️
@export_multiline var description: String = ""

Live Preview

🗡️

Unnamed Item

Equipment · 100g

Common

Part 3: Build the Code

Write your Item.gd resource step by step

Build Item.gd

Implement your item Resource step by step, from extends to helper functions.

0/10
1
Extend Resource
2
Add class_name
3
Basic fields
4
Stack rules
5
Rarity dropdown
6
Item value
7
Item type
8
Equipment group
9
use() function
10
get_rarity_color()
Item.gd
GDScript
1
2
3
4
Ln 1, Col 1Spaces: 4 • UTF-8 • GDScript

📚 Go Deeper (Optional)

← Lesson 1