Author: James Clarke
Posted on 5/12/2023
Early this week I was putting the finishing touches on the inventory for the "Player" and I had many issues scaling from items being stuck in the player's hands when trying to swap items from inventory to scroll selection jumping between two items on a list of three or greater improperly. The main goal for the early days of the week was to implement a selection process via scrolling through inventory and allowing the item currently selected to show in the Player's hand. One thing in particular that caused me lots of trouble was getting the scrolling process to allow the Player to scroll up and down the entire list of currently stored items within the inventory. The issue that occurred had to do with how the selection was jumping to the next item in the list. At first, The way I implemented selection, had the scrolling jump between the first and second item, but would never select the last item of the list.
My solution to this problem involved a series of fixes. To start off, I had to re-configure how I implemented the inventory swapping ability so that it would work with selection. I had to go back and forth through my code to understand how to piece everything together accordingly. This involved separate functionality for selection swapping and swapping items in hand with items in inventory. This was the majority of what I had to work on. The final touch to get everything working was re-evaluating how I was scrolling through items in inventory which was a thinking task and a half. In the end the solution I found was just recycling the first node of the list and adding items being swapped from hand to the end of the list which allowed for the correct ordering. I had to do the reverse depending on whether the Player scrolls up or down.
Did you like this post? Tell us
Leave a comment
Log in with your itch.io account to leave a comment.