Inventory system for player characters (for keys, gravity boots, etc.) #16
Labels
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: SketchyMaze/doodle#16
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently, the colored keys and doors system uses a really basic key/value data store on the actor who picked up the key.
These are ideas to extend the inventory system for future growth.
Inventory Struct
Level actors should store their inventory in a key/value map where the keys are the actor filename (i.e. red-key.doodad) and the value is the quantity in the inventory. A value of zero indicates a permanent item that doesn't get consumed when used and doesn't show its quantity in the inventory HUD.
Example:
Usage
In these examples, the red key is a permanent item that unlocks all red doors and the small key is a consumable that only opens one locked door (a door specifically for small keys; small keys don't unlock colored doors).
.AddInventory(Self.Filename, 0)
to "add" the item with 0 quantity to the player's inventory..AddInventory(Self.Filename, 1)
to add 1 small key to the inventory..RemoveInventory("small-key.doodad", 1)
to remove 1 small key from the inventory.The .RemoveInventory function's logic would be like:
.RemoveInventory("red-key.doodad", 0)
would remove it.The .AddInventory would create the hashmap key and increment it by the "add amount" parameter.
HUD
In Play Mode, show a HUD on-screen in the upper right corner when the player character has at least one item in their inventory. The HUD will display doodad icons (no scripts attached) for each item in their inventory.
Use cases and examples