Mario Kart Item Post 2

Mario Kart Item Post 2

Mar 30, 2019. | By: Evan Diamond
2 mins

The second post in making items for mario kart in DirectX12

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 been thrown in front of the player instead of dropping.

Spinning Mario

The implementation for the banana peel just uses the basic item implementation already created (in last post).

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 bounce off of five walls. When a green shell its a player it stops the player form 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.

Green Shell

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 to 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 a alternate use for them. To implement this a bool was added to the items use 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 an 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

About

Gamers developing new games.

Social Links

Our Bunker

University of the West of England,
Frenchay Campus, Bristol, BS16 1QY,
United Kingdom.