Jhon Sommer

Unreal developer | C++ | Blueprints

Another One Fights the Dust

General

Another One Fights the Dust is a project that was created with Unity during the summer semester 2023 at my university. My team were all second semester so it was for all five of us our first game to make.

Itch.io Link: https://slothmotion.itch.io/another-one-fights-the-dust

Role

I was the only programmer in this project. Since we couldn’t work with version control yet, it was also my job to insert all the assets into our Unity project. It also goes without saying that I was also responsible for any bug fixing (with the knowledge and time I had at the time, I did my best to fix as many as I could).

Work samples

CLean dirt

The main part of the code can be found in the OnTriggerEnter2D function. Here I ask the first “if” which tag the other object has. If it has the tag “Lappen” then it goes to the next if guard. This only covers the case of what should happen if the Lerp has already ended. If the Lerp has not yet ended, the variable “currentLerpTime” is added to “Time.deltaTime”. Additionally, a new float variable called “t” is instantiated. The float “alphavalue” is set equal to the Math.Lerp function. The parameters for this function are (“1f” for the initial value, “0f” for the final value and “t” for the duration).


The variable spriteColor gets the information from spriteRenderer.color. The sprite’s alpha value is set equal to the alphaValue and spriteRenderer.color is set to spriteColor.


In the last if guard the object is disabled, “currentLerpTime” should be greater than “lerpDuration”.

Loader

In the loader I saved all scenes in the enum “Scene”.

Phase manager

The first thing I created for the PhaseManager was the enum GamePhase. Phase1, Phase2 and Phase3 are stored there.

The update then checks which phase is currently active and the associated functions are then called (In the working sample I showed an example with Phase1)

The “SwitchToPhase” function is used to change phases of the game. The functions “Phase1”, “Phase2” or “Phase3” are called there.

In each phase there is code that deactivates the box colliders from the objects of the other phase. This means the player can only interact with the objects in the associated phase.