Player Upgrade Bar Implementation

 Author: Yashwant Patel

Problem:

We have a nice save system that saves the player's progress between rounds. This is a nice to have since the player can come back to a saved game. Although this brings up a problem for the player which is remembering what they left off with specifically their upgrades. While things like the round, player health, core health, etc. are saved and displayed on the UI the player doesn't have to remember these values when they load up a saved game, but for the upgrades they bought for the player they'd have to remember or keep track of them manually. Sometimes during the playthrough the player might forget which player upgrades they have bought, so this problem needed to be addressed.

Solution:

One solution probably comes to mind which is just displaying the upgrades on the UI in some form, but the question was how should they be displayed? We could have the player hold down a button and then list out all the player upgrades they have bought or figure out a way to display it on the screen somewhere. The latter method is what seemed the best for us, so that is what was implemented. The reason it's a better method in our eyes is because the player has one less keybind to keep track of and they can glance at their upgrades whenever they'd like. The upgrades could be displayed with text as a list on the UI, but that'd take up too much space, especially since it isn't a toggled UI via a keypress. The solution for this problem was to just display the icon of each upgrade, but this poses another problem. The player would have to remember which icon correlates to which upgrade, so incase the player forgets they can hover their mouse over the icon to see the upgrade name and info for a refresher. With these issues out of the way it was time to implement the UI. The implementation is pretty simple. There is a wrapbox container that starts out empty and whenever a player upgrade is bought it listens for the event and then creates an upgrade button which gets added to the wrapbox. The image for the button is set and it stores the upgrade info that is received from the event. 

The button has events for when the mouse hovers and unhovers over them. When this happens it displays the tooltip which shows the upgrade name and info or hides the tooltip. 
This works pretty well (will have to rework UI placement since it overlaps with the notification system), but there was one problem. The info such as the texture, upgrade name, upgrade info, etc. wasn't being saved, so when loading a saved game it wouldn't display the upgrades (which was the whole point of this system). Fortunately this was yet another easy fix since the upgrade info structs just had to be added to the save struct for the upgrade system.


Comments

Popular posts from this blog

UI Polish

AI Navigation Problems - Yashwant Patel

Round End Cutscene Implementation