Mario Kart Item Post 4

Mario Kart Item Post 4

Apr 15, 2019. | By: Evan Diamond
6 mins

The fourth post in making items for mario kart in DirectX12

Overview

Implentations of triple green shells, fake item boxes, golden mushroom, star and giant mushroom. A bug with triple banana peels also fixed.

Triple Green Shell

Triple green shells consists of three green shells which when used spin around the player. They can then be fired one at a time with the shells following the normal movement. Also since they’re spinning around the player the player can use them as a form of bumper and drive into other players in order to hit them with a shell.

Green Shell

The implementation for this was very similar to the triple banana peel, 3 green shells spawn when triple green shells are set to spawn and are added to the trailing item vector. The trailing item vector is set to the green shells immune items vector. The triple item bool is also flagged in order for the input scheme to be the same a the triple banana peel and triple mushroom input scheme. When the shells are trailied however they spin around the player. To do this the current active item is checked to be triple green shell in the player’s trailing item function and then the green shells use orbit code written by another group member to orbit around the player.

Fake Item Box

Fake item box looks like a red verion of the regular item box and works the same as the banana peel. The only differences being when a player collides with them their velocity is set to 0 and they flip into the air. The other difference is that if a player is trailing the item box behind them and the box gets hit by another item the item box collides with the trailing player.

Fake Item Box

The implementaion of this is the same of the banana peel except that the when a player collides with it the flip animation is used instead of the spin and the player’s velocity is set to 0. In order for the trailing player to be hit by the item box when another item hit its a checker in the collision manager was added to see when items collide if either item is a fake item box. If one of the item’s is a fake item box then the collide with player function is called and the using player (which the fake item box holds a pointer to ) is passed in.

Golden Mushroom

Golden Mushroom is similar to a regular mushroom except that it can be used to give a mushroom boost for 7.5 seconds.

Golden Mushroom

For the implementaion of this a golden mushroom class was created which when called to spawn in the player class gets used instead which starts a timer in the class. For as long as the timer persists the player can use the golden mushroom which gives them the same boost as the regular mushroom except it lasts less. Once the timer ends the mushroom is flagged to destory. Also when the golden mushroom is set to spawn it is not removed from the player’s inventory, instead is stays there untill the timer ends.

Ground Types

In mario kart when a player drives over rough terrain instead of track they slow down massively. This system has been implemented by other group members and a use ground type bool was added to the player class so that if true this effect would be active on that player. So when a mushroom boost is used this bool in the using player class is set to false so that players boost over rough terrain easily. Once the boost ended this bool is se t to true again.

Star

Star is an item in mario kart that makes you invincible. Whilst invincible no items effect the player on collison and any other players that collide with them get knocked sideways. The player also gets a speed boost and ignores the ground types mentioned above.

Golden Mushroom

The implementaion for this is similar to the mushroom. When called to spawn in the player class the star is just used and flips a used bool in start class to true. When this bool is true the star class’s update function gives a continuous mushroom boost to the player and sets a invincible bool in the player class to true along with use ground types being set to false. After 12 seconds the boost ends and the invibility bool and use groun type bool are set to true and false respectfully. In the collision manager the invincible bool in the player class is checked whilst applying collision responses. If the response is with an item then the hit by player function in the item class is skipped and the item is destroyed. If it is a player response then the non-invincilbe player is flipped into the air (the same as the green shell). There is no rainbow effect or sound implemented yet.

Giant Mushroom

The giant mushroom is an item that causes the using player to grow in size and become invincibles similar to the star. When the player collides with another however, the other player is flattened.

Giant Mushroom

When the giant mushroom is called to spawn it is used and sets the used bool to true (this has been moved to the parent item class). The current size of the player is then stored in a vector in the mushroom class along with a vector holding 2 times the the players size. An enum is used to hold the current scale state that the player is in either growing, mantaining or shrinking. In the update function when the item is used a switch is done on the current scale state if in the growing state a vector lerp is applied to the player’s current scale with the starting scale vector being the first value in the lerp and the 2 times scale vector being the sceond. A lerp percentage is then increased by 2 times delta time untill it reaches 1. At this point the scale state is switched to maintain. Whilst in the maintian state a timer of 12 seconds is applied and the player is invincible using the same system as the star. Once the timer is finished the player is no longer invincible and the scale state is set to shrink. When in the shrink state the same lerp is applied the player’s scale as the growth state except the the lerp percent is reduced by 3 timed delta time untill it reaches 0. Once at 0 the mushrom is flagged to destory.

Triple Banana Peel Bug

It was discovered that when a player spawns triple banana peels whilst also getting triple banana peels 6 banana peels spawn instead of 3. To fix this a bool called a pressed was added to player class. This bool is checked when the a button is pressed and a triple item is trailing. If true then it prevents any more triple items from spawning. This bool is set to true when the use button (a button on controller) is pressed and false when it is not pressed.

About

Gamers developing new games.

Social Links

Our Bunker

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