Devlog #3 - UI additions and rework


Hello everyone, welcome to a new devlog but this time its a bit special because for this devlog I've created a video version so people who are interested can see the changes in the editors more clearly.I will also be creating a written version below as well.

______________________________________________________________________________________________________________________________________

Last time I explained that I had implemented a fade in and fade out system every time the Player level transitions. Now that has been fully applied to all instances of level transitions including when the Player loads into the game.


______________________________________________________________________________________________________________________________________

1. Button SFX

One additional thing I realised was that every time I called an OnClicked() event in the widget I call the Play Sound 2d node every time. So I thought instead of calling it every time, I should make adjustments to the button widget itself so that it calls the Play Sound 2d node in its own code. After this I created an instance editable sound variable in the button so that if I want, I could have a button produce a different sound and I didn’t need to add a PlaySound 2d node every time I created a button it would do it by default.


In this way, the button sounds and consistent but also flexible since I can change it on a case by case basis.

______________________________________________________________________________________________________________________________________

2. Confirmation window popup for saving

Expanded the saving and loading menus to now include a confirmation window when the Player wants to save or load the game which should prevent any accidental clicks

 

I have also cleaned up the blueprint so that the creation of the confirmation window, deletion of the confirmation window, saving and deleting save slots are now their own functions. This means that I just have to call the same function for the different buttons and reduces blueprint bloat.
______________________________________________________________________________________________________________________________________

3.Event Dispatchers

Another UI optimization I did was to replace the per tick binding for player health in my health bar to an event dispatcher. So whenever the player health value gets changed(damage, heal, health-up). The health bar update function will only be called then instead of the health bar checking the player health every tick.

I changed the accessory equipped and enemy health display functions the same way. If you wish to see the code you can check out the YouTube video for more clarity.

______________________________________________________________________________________________________________________________________

4.Better Variable Storage

The way I was saving the Player's equipped accessories and item shortcuts was by saving the entire item structure in the FirstPersonPlayer blueprint.

Before

There is no reason for that as all the item structures are already in my inventories array variable so creating a copy to exist forever inside the player is wasteful so instead I just store the item name (INameIdentifier) whenever the Player equips something or sets a shortcuts and I use that name to search through the inventory when needed.

After

 

Function equip accessory



Use setItem

As you can see form the above images, I don't need to store the entire structure I can just store the name.

______________________________________________________________________________________________________________________________________

5.Inventory Menu Rework

As I was reworking the UI, When I got to the inventory menu I realized that I only had 3 buttons Use, Set and Cancel. For equippable items like gem of defense, it would be weird to have the Use button the way the Player equips it, same goes for the future lance tip items(attack boosts.

So I added 3 more buttons to the menu equip, unequipp and unset item as shortcut.

While testing the button and using the inventory, I realized that having one singular list for all the items would make searching and equipping and re-equipping weapon tips and accessories annoying. So, I redid the inventory window and created separate panels for the different item types and used a Panel Switcher to switch between item types when the Player clicks on the corresponding button.

Inventory Before


Inventory After


If you found this interesting please donate by downloading the demo and choosing your price or you can donate at

https://ko-fi.com/swordsage10


Thank you very much for reading

Get Sceptre of God

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.