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

Z-Engine-Backpack.zip 38 MB
May 25, 2024

Get Z-Engine

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.