Devlog 3.1 Inventory System and Items
Devlog 3.1:Inventory System and Items
Devlog for the game 'Into the Mist', a game project/assignment for KIT109.
Inventory System
In 'Into the Mist,' we implement an inventory system where the playersPlayer can carry around a bunch of items that they found in the dungeon. For the inventory system, we add a Canvas object, which will be the Inventory UI (Figure. 1). When the Player picks up an item, it will show on the inventory UI (Figure. 2). Players can use an item in the Player's turn. The code for the inventory system is primarily based on a YouTube tutorial video [1] [2]. How does the inventory system work? When a player picks up an item (using onTriggerEnter2D in the script inside the item game object), a game object with a button component is Instantiate in the inventory UI, which can be used later ( in the Player's turn). When an item is used, we count it as a player turn;
Figure. 1 Player inventory UI
Items
At this point of the development, we only added 2 items, a healing potion and a normal sword. When healing potion is used, it will restore some of the player health (Figure. 3), then the health potion item will be destroyed as it has been used (Figure. 3). The code for this is largely inspired from YouTube tutorial video [1] [2]. The implementation of the sword mechanic is inspired by the movement script, with a bit of tweaking, we get our desired result.
Figure. 4 Sword item cannot be used when there is no enemy adjacent to the player (i.e., in the attack range of a sword)
Figure. 5 Player attack bat (an enemy) with sword item
Alternative and Improvement Implementation
I want to make some improvements to the code in the future. In this current state of development, the item code could be more scalable for more extensive item selection. I want to redo all of the item and inventory code to make it more scalable and easier to maintain in the long run.
As to alternative implementations, there are a couple of different implementations I saw on YouTube and online forums; one that might be better is to make an 'enum' for all the items and a build-in inventory script/code under the player-manager script, which is more efficient and scalable for larger item pool.
Feedback from Peer Review
Most of the feedback is positive. The main thing that people point out is to describe each item and enemy so that users can plan how to approach a fight/plan their next move. To implement this, we will try to make a UI that pops up when a used mouse hovers over an item/enemy. Right now, I am unsure if I have the time to implement this hovering mechanic, though making a person not know the description of an item/enemy can make it more challenging for a game, and that is what we aim for in the game design.
Reference
[1] HOW TO MAKE AN INVENTORY WITH UNITY & C# - BEGINNER TUTORIAL - 1/2. (n.d.). Www.youtube.com.
[2] HOW TO MAKE AN INVENTORY WITH UNITY & C# - BEGINNER TUTORIAL - 2/2. (n.d.). Www.youtube.com. Retrieved May 11, 2024, fromInto the Mist
A game project for a unity course
More posts
- Game Project ImplementationMay 25, 2024
- Devlog - UI/PolishMay 23, 2024
- Devlog - Presentation and GraphicsMay 17, 2024
- Devlog 3.2 - Player, Enemy, and InteractionsMay 11, 2024
- Devlog 2.1 - AnimationsMay 11, 2024
- Devlog - Basic Level Blocking with Procedural Level GenerationMay 03, 2024
- Devlog - Player MovementApr 26, 2024
- Into the Mist - Game ConceptApr 19, 2024
Leave a comment
Log in with itch.io to leave a comment.