Week 3: Powered Up!


Power-ups

This week saw the addition of four new power-ups; speed boost, jump boost, damage boost and a health pack. The three boost all follow the same methodology of a script that takes in two customizable variables for the boost modifier and how long the boost will last for. When the player enters the collider on the power-up prefab it calls the corresponding function on the player and passes through the two variables, then it destroys itself. In the PlayerController script, the function that was called applies the boost to the corresponding variable of either moveSpeed, jumpForce or damage. It then calls the disable coroutine that takes in both variables again. The coroutine then waits for the time to be up and removes the modifier. The health pack works slightly differently, by simply calling the healthPowerUp function on the player then destroying itself. The function simply resets the player's current HP to their max HP and updates the UI.

Fig 1 - Player using speed boost


Fig 2 - Player using jump boost


Fig 3 - Player using damage boost


Fig 4 - Player using health pack

Power-up Spawner

The power-up spawner uses multiple function to correctly spawn the power-ups at different location and after various times. On start, it calls the PickRandomTime function and sets timerOn to be true. PickRandomTime get two variables passed to it, a minimum and maximum time and picks a random number between the two and set the randomTime variable to it. In the update function, the timer function gets called, if timerOn is true it adds Time.deltaTime to a timer variable, otherwise it sets it to zero. During update a check is also done to see if the timer is near to the randomTime picked earlier and that a power-up isn't currently in the game,  if both conditions are true it spawns a new power-up and set the timer for 5 seconds, when the 5 seconds are up it picks a new randomTime and waits to spawn a new power-up. To keep numbers small every 60 seconds the timer is reset back to zero. When the Spawn function is called, it calls two other functions, PickRandomLocation and PickRandomPowerUp. PickRandomLocation selects a random collider from an array of colliders, then it picks a random location within the bounds of the collider. This makes it so the power-ups get spawned in set locations but still have a level on randomness to them. PickRandomPowerUp selects a random power-up prefab from an array. Back in the Spawn function, the power-up is instantiated at the random location, and then its parent is set to be the collider it was spawned in, this makes it so that if the power-up is spawned in a collider that is on a moving platform it continues to move with it. Destroy is then called after 5 seconds.

Warp Zones

When a player enters the trigger of a warp zone, a check is done to see if the player can currently warp. If they can, canWarp is set to false and the FadeOut coroutine is started. FadeOut lowers the opacity of the player from 1 to 0 over 0.5 seconds then calls the StartWarp coroutine. StartWarp moves the player off screen so they cannot be hit during the warp waits for 0.5 seconds then moves them to the corresponding warp location and starts the FadeIn coroutine. FadeIn increases the player's opacity from 0 to 1 over 0.5 seconds then calls the players NoWarp function. NoWarp keeps canWarp set to falls and then waits for 2 seconds before setting it to true. This stops the player from getting caught in an infinite warp loop.

Fig 5 - Player using the warp zone

Level Select Screen

When the player presses play on the main screen, they are shown the level select screen which features seven levels. Each image of the level has a button component attached which calls a function that loads the corresponding scene. When the play again button is pressed at the end of a match the selected level will be reloaded. If the menu button is pressed the player can select a different level.

Fig 6 - How the level select screen appears in the game

7 New Levels

Candyland :

Features a moving platform in the middle and two upper platform, this level also has a full floor so player's are not able to fall to their deaths.

Fig 7 - Candyland level's moving platform

Grass:

The simplest level with one large platform and a full floor so, player's are not able to fall to their death. 

Fig 8 - Grass level as it appears in the game

Ice:

A more advanced level with multiple small platforms and a large pit that player's can fall into and lose a life. Also features a set of warp points on the upper platforms.

Fig 9 - Ice level as it appears in the game

Metal:

Another advanced level with multiple pits for players to fall into and one small platform. Also features a set of warp points.

Fig 10 - Metal level as it appears in the game

Mushroom:

A moderately challenging level with 3 moving platforms and a full floor.

Fig 11 - Mushroom level's multiple moving platforms

Stone:

A pretty easy levels featuring only 2 small pits on either side and 3 platforms.

Fig 12 - Stone level as it appears in the game

Bad Dev:

Included as a joke, where the entire level is only made up of simple shapes, the player's appear as capsules and the power-ups and projectiles are both circles. This level features 2 small pits on either side. All other features of the game still work properly this is only a visual difference.

Fig 13 - Bad dev level as it appears in the game

Feedback

People noted that the power-ups are not super obvious as to what they do, currently working on better icon and particles to show what they do and if when they are active.

A ground pound bug was also brought up where they player can get stuck in the ground pound state for a bit after they hit the ground. Currently working on a fix for this.

A new powerup idea for increasing the players mass so you can push each other around easier was noted, I really like this idea and it will be coming in a future update.

Leave a comment

Log in with itch.io to leave a comment.