Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Multiple scripts that control things added. Images to illustrate inventory added. The Inventory and equipment Sprites added. Testing Items: Small Health Potion, Large Health Potion, and Iron Sword. These get pulled from the item database for all their stat values. Update to the enum made. All these items are tres, resource files. Changed the item.gd, Item resource to have slots for Sprites and stack size for potion and a description of the item.
Related Issue(s)
Inventory bug/ missing feature. No save function, will not remember previous items and always go to the initialized values. Does not remember where the items were moved to when inventory is closed and reopened.
Added
Resource items added: Iron sword.tres, large health potion, small health potion
Sprites added: Accessory slot, hand slot, head slot , pants slot, shoes slot, Weapon slot these are GUI images. Sword, empty inventory slot icon, small health potion, large health potion. Inventory and equipment png are reference images used to align the profile png that has no reference.
Item.tscn this is an object that holds a Texture and a label that will allow us to display the sprite and amount of item the player owns with the label.
Items.gd this is the script attacked to Item.tscn. Has function to add and decrease the amount. Setitem will set the name and the amount that the item is initialized to. This will control whenever label should be visible if the item is stackable.
PlayerInventory.gd This script will hold the players inventory, into inventory and equips for the equipment. Inventory has 15 slots. Only initialization
Slot.gd This script is the one that is attached to every item slot and equipment slot. It holds an enum value for each slot to match with their respective equipment or Inventory. This one will call upon the item.setitem function to initialize the item so that the slot can add it as its child. Which will then oversee putting items and picking items from its slots.
UserInterface.gd: Script to control the Inventory showing up and hiding. The default inventory button is I and will also close when the red x on it is clicked.
Inventory.gd: ends up combining all the functions together, by initializing the inventory. Making each slot the type that it needs to be. Slotinput is the main function that does all the item swaps and checks. It is also the one that manages the tooltip of showing the items name and moving it to the item that the user is hovering over. Checks for mouse button input of left click to do its checks of putting the items, combining them if the item is similar or not and blocking wrong slot types from items.
Changed
Item.gd the resource file for items. Changed the enum EquipmentLocation to better accommodate the GUI icons, added the sprites properties to access them as textures to be able to display them in the GUI. Added max_stack_size to be able to have items that stack and the description.
Game_scene.tscn change to auto load the PlayerInventory.gd
Removed
None
Fixed
None
Screenshots
Instructions for Testing
Run project, select play, go to any of the levels, press I to open the inventory, move items around, equip the test sword by left click on it in the inventory and moving mouse to the weapon slot and left clicking to place it and can also combine 2 small health potions into 1 slot, making the 10 and 5 become 15 items in 1 slot .To close inventory press I or the red x at the top right of the interface.
Checklist before Merging