Personal Inventory
π Recent Implementations
π Moving Items Between Inventories
To make the inventory system truly useful, it's essential to move items between different inventories. When you drag and drop an item, a graphic raycast is triggered to detect where the mouse is. If the item intersects with an InventoryView
component (responsible for drawing the inventory), bingo! If not, the item is removed from the inventory (for now). In the future, you'll be able to place these items directly into the world.
πΌ Changing Inventories
If you move an item to a different inventory, first it gets removed from the original inventory and added to the new one, assigning new viewport coordinates to ensure it appears in its new location.
π Keeping Order with LineRenderer
Moving items between blocks can be confusing, so I added a LineRenderer
that visually connects the inventory to its corresponding block, helping you avoid losing reference.
ποΈββοΈ Weight System
One of the most requested features: weight. Each inventory has a maximum weight and an overflow weight. For example, if a backpack has a maximum weight of 20kg and an overflow of 2kg, your character will move slower if they exceed 20kg but won't be able to carry more than 22kg. This adds a layer of realism and strategy to the game.
βοΈ InventorySettings Class
To better manage these parameters, I created the InventorySettings
class, which contains the inventory IDs, maximum and overflow weights, and which prefab will be used. This allows even items to have their own inventories if needed.
𧩠Snap Functionality
As a player with certain OCD tendencies (myself included π ), I know that moving items βby eyeβ is frustrating. So I added a "snap" function that activates when you press the "alt" key. Items move to fixed positions and can be rotated with the mouse scroll, allowing for perfect order!
πββοΈ Quick Looting
For those adrenaline-filled moments when you need to loot quickly, items will be placed randomly in your inventory. Yes, it can be messy, but it reflects the chaos of those extreme situations. You can organize everything later when you have more time.
π Personal Inventory
Pressing the 'TAB' key will open your personal inventory, configurable for different types of inventories throughout the game. The subID of this inventory is a configurable string, allowing you to switch inventories easily.
πΊοΈ Inventory Design
The inventory consists of 5 spaces:
- Central: Your backpack.
- Upper: Clothing.
- Lower: Items for quick use.
- Sides: Right and left hands for weapons.
This design ensures you always have your tools and weapons within reach. πͺ
π οΈ Upcoming Features
For next week, I plan to work on the following features:
- SubInventories: Some items will be able to open and display their own inventory.
- Context Menu: Right-click on an item to display actions (open, inspect, eat, drop, etc).
- Tooltip: Experiment with tooltips when hovering over an item, though I'm concerned about screen clutter.
- Inventory Conditions: Restrictions for certain items in specific inventories.
- Adding Items to Blocks from the UI: Drag an item from your backpack and place it on a refrigerator, making it disappear and add to the fridge. Very intuitive!
Thanks for reading! I hope to hear your comments and suggestions to keep improving. See you next week! π
Files
Get Z-Engine
Z-Engine
Status | Prototype |
Authors | Argendel, [Random Adjective] |
Genre | Survival, Simulation |
Tags | building, Minecraft, Sandbox, Singleplayer, Top down shooter, Voxel, Zombies, zomboid |
More posts
- Graphic StyleJun 08, 2024
- Inventory SystemMay 17, 2024
- VerticalityMay 08, 2024
- XRayMay 06, 2024
- FOVMay 02, 2024
- Colliding WallsApr 30, 2024
- MiniaturizationApr 26, 2024
- First ProblemsApr 24, 2024
- World Edit ToolApr 11, 2024
Leave a comment
Log in with itch.io to leave a comment.