Mario Kart Item Post 2

Overview

The first item implementation: Banana Peel and Green Shell


Banana Peel

The banana peel is a classic item in Mario kart. The player can hold it behind themselves to block other items until the player decides to drop it behind them. When a player collides with a dropped banana peel they slow down and their car spin around. This is done using animation functions created by another group member. They can also be thrown in front of the player instead of dropping.

Green Shell

The green shell is another classic item in Mario kart. Similar to the banana, the player can trail the green shell behind them and then when the player uses it, it gets thrown in front of them. Once thrown the green shell will bounce off of walls until they collide with a player or another item or bounce of five walls. Currently, however, the green shell lasts for ten seconds before deleting itself instead of bouncing off of five walls. When a green shell hits a player it stops the player from moving for a second and causes them to jump in the air and flip using the previously mentioned animation functions. Players can also throw green shells backwards.

The implementation for the green shell uses the trailing item script already created but when used the use function in the green shell is called. This function sets the position of the shell in front of the player and gets given a velocity in the forward direction of the using player. The bouncing is done by wall collisions written by another team member.

Player immunity

Initially when the green shell was used the using player would collide with it as soon as it was used. To prevent this the green shell stored a player pointer of the using player which is checked when the player is intersecting with the shell. If the intersecting player is the using player then the collision response is skipped. The green shell keeps this reference of the player for 0.5 seconds before setting it to nullptr.

Alternate use

As previously mentioned the banana peel can be thrown as well as dropped and the green shell can be fired backwards as well as forwards. Many items also have an alternate use for them. To implement this a bool was added to the items use to function the checks if altUse is true if so then the item’s alternate use is called. When the player class calls the items use function input for the left bumper on a controller is passed in for the altUse bool. This makes pressing the left bumper the alternate use button

Previous
Previous

Mario Kart Item Post 3

Next
Next

Mario Kart Item Post 1