Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an inventory GUI #77

Merged
merged 1 commit into from
Apr 6, 2024
Merged

Conversation

Ruben14789
Copy link
Contributor

@Ruben14789 Ruben14789 commented Apr 5, 2024

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

image
image
image
image
image

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

  • I have performed a self-review of my own code.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate).
  • I have ensured the changes adhere to the project's coding standards and guidelines.

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.
@dusek2
Copy link
Contributor

dusek2 commented Apr 5, 2024

Pull Request Review:

  • Readability:

Code readable, easy to understand

  • Code Quality:

Pull request is large, hard to evaluate all code, but seems to be mostly game props

  • Testing:

Unaware of testing situation in the game

Copy link
Contributor

@MoldyPotat MoldyPotat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Review:

Readability:

Code readable, easy to understand

Code Quality:

Pull request is large, code seems to be easy to follow, lots of small changes and additions.

Testing:

Testing Needs to start to be implemented in the game.

@MoldyPotat MoldyPotat merged commit 699f65a into UNLV-CS472-672:main Apr 6, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants