The Runz

About The Project

This Game is a running game akin to that of the highly successful subway surfers. It has multiple levels with increasing difficulty, with two sections that have their own themes. It was developed within Unreal Engine, alongside four other students at Purdue University for the sake of being showcased at Fractal, which is a game design showcase event held at Purdue.


Constructing Momentum

Below is how I was able to

Momentum Effects

Before we get to applying momentum to movement, to the right we have two portions of the code that were dedicated to effects that were in the game.

The first effect was slowed, which gave the player a strict momentum maximum of .1. This was primarily used within the water that I implemented into the game, which punished the player with this slowed effect if they happened to walk into it.

The lava mechanic was something that was far more difficult. The player needed to sink into the lava, and then be reset. The code to the side here involved sinking the player into the ground, while incrementing the sink variable to act as a timer. Once the last point of sink is run, the player component’s position is reset back to to the “Last standing position” variable. While this is being run, the momentum is not being applied to the player.

Negative Momentum

Negative momentum is treated like a status effect of its own, used as a penalty for when the player runs into an obstacle. Because of this, momentum is applied in its own way through direct setting of the player location as well as small increments to momentum to eventually get the player back moving again

Increasing/Decreasing Momentum

The player is able to increase or decrease the momentum based on the W or S key, which are tracked through two boolean variables. When the player is found to be pressing one of these buttons, the players momentum will change.

After all of this, the momentum is applied to the player using the built in add movement input function, making it function with what the 3D animators on the project had created.

Implementing Features To Others Work

There were points in this project that I was asked to work with preexisting code and to alter it to implement new changes. Below is one of those instances.

The Change Lane Function Was Frustrating

What had existed was the mechanic where the player could slide over to the next lane by imputing A or D respective to standard controls. However, holding down the button meant nothing as it was only taking in the initial press of the button. The person who initially made this so was to avoid the issue of the player jumping multiple lanes at once by accident, as that could be frustrating. However, this left players frustrated as they discovered they had to remove their finger from the button to continue changing lanes.

I solved this problem by adding a delayed reset to the function, which meant that there was a window we could control for the player to release the button before sliding all the way over. Additionally, this delay could be skipped by the player removing their finger and pressing the button again, allowing for those that liked the old style of play to continue.

The final code for this is below.

X