#21 | 2023-08-16 | Major Code Overhaul


Hello!

This DevBlog has been written through computer issues, power outages and frustration.


Progress is slow but steady. Once I've finished the code overhaul and creating new levels, then I can release the second alpha version of the game to get feedback.


Starting with "SetPlayerVariables", there wasn't much to change. The only things I added were booleans in reference to if each player controller is enabled.

The purpose of this script is to set the player's variables when they spawn, allowing me to change all of that quickly and more efficiently than opening the player prefab every time something needed to be changed.

In the player controller, I created a new function to handle setting the player's variables and called it in Start.

All this function does is set the player prefab's variables to equal the same as the ones on the "SetPlayerVariables" script.


One thing I forgot to add into the "TriggerDetection" script was changing the player's active sprite when the player controllers change.

The player's sprite changing is a visual indicator to let the player know that the movement type has changed. If I get around to implementing audio then I'll try out an auditory indicator as well.

To make sure that the correct sprite is displayed when the active movement type is changed, I created another function, "SpriteCheck".

While this may seen redundant, it's to make sure that the correct sprite is displayed corresponding to the active moment type.


Next up, the "RespawnManager".

With variables and functions defined, next is the code.

In short, when the game starts the player is spawned and when  "playerDied" equals true, the player is respawned. The comments in the script are to help me remember what each line of code does and to help whomever is reading my blog to understand what is going on.

I should create a flow chart to show how all my scripts interact.


Lastly, "CinemachineCamera". This script makes the camera follow the player.

With variables and functions defined, the code is next.

To summarize, when the player is spawned or respawned, this script makes the Cinemachine Virtual Camera follow the player.


With the amount of times I've had to rebuild all my scripts, I've become very familiar with the code I'm using and how to write certain scripts.

I look forward to finally continuing development after this hurdle. I'm sure there are more to come.


Thanks for reading and stay tuned for the next log!

Get Factory of the Damned

Leave a comment

Log in with itch.io to leave a comment.