Level Transitions


The largest task I undertook this week was natural scene transitions within our game. What seemed to be a simple addition to be slightly more visually appealing to the user quickly became one of the most intense systems I have had to write across all my coding experiences. Between utilization of encapsulation, deep-dives into any and all edge cases, and mathematical equations for movement; my hands were full of work. A total of 10 base cases needed to be hand crafted for the new system with at least 4 known edge cases (new game, load game, nonlinear transitions, and boss rooms). Communicating between scenes how the player needed to move next required very specific communication between our singleton game manager, the levelLoader component, and the levelLoaderHelper component.

The most important part of the solution I came up with, was the utilization of the GameManager to hold key data between scenes. Having the luxury of a well written GM (thanks Chance!), there are multiple overloaded versions of the levelLoad() method. Using this, I was able to remove issues with most of the edge cases by having a sort of 'defaut' behavior if a certain version of the levelLoad() was called. Otherwise, I had adjusted a diffrent overload to be able to pass information from the LevelLoader to the GameManager to the LevelLoaderHelper. This is how the level transition in one scene is able to tell the player how to move even when the object is no longer in the active scene. As far as writing the movement for the player, it had to be pretty specific. Going left and right was simple enough as I just needed to adjust the horizontal velocity of the player. Going down was also simple as gravity can do the work for me. Going up, however, needed to use a combination of vertical movement followed by horizontal movement combined with gravity. This had to be fine-tuned until it got to a point that could be used with all "going up" transitions. The portal transitions were mostly just playing around with spinning, shrinking, and using the Vector3.MoveTowards() method to make a visually appealing transition.

For any graphics regarding this topic, please consult the Trello card. This page will not allow me to upload any videos other than Youtube videos which take me an absurd amount of time to upload.