News:

Do you enjoy all things anime and role playing?  Come on in and take a seat!  Create a character, and let's have some fun! (PS:  Bring your friends, please!!!!)

Main Menu
17 Guests, 0 Users
avatar_Senkusha

Nested Mess

Started by Senkusha, Thursday, June 06, 2024, 21:50

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Senkusha

I've been following a tutorial pretty straight forward.  And sometimes I run into blocks of code that are just monstrosities.  They bug me.  Specifically, nested IF statements (called Branches in Unreal Engine Blueprints).  For example:

2024-06-06 21_42_05-AnimeRTS - Unreal Editor.png

I replaced with this:
2024-06-02 19_41_00-AnimeRTS - Unreal Editor.png

And earlier today, I replaced this:
OldSpeedSettingSwitch.png

With this:
NewSetSpeedMultipler.png

And finally, replaced this:
OldTimeMultiplierLogic.png

With this:
NewGameTimeLogic.png

I must say that I'm quite impressed with myself for figuring these out.  The new code is much easier to follow and understand, and it's also much more compact.  Oh, I almost forgot the critical component to the final two upgrades, the Speed Multiplier Array:
TimeMultipliersArray.png

I made another change just before I posted this (and didn't feel like re-screen-shotting my modifications.  I tripped into figuring out how to implement my own Interface (which I still don't quite understand what I did, but I'll figure that out over the next week.  Now, I can modify this single array in one location!  (I'll be posting a tutorial on how to create and implement Blueprint Interfaces probably tomorrow.)