2 mins
The second post in making items for mario kart in DirectX12
The first item implementation: Banana Peel and Green Shell
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.
The implementation for the banana peel just uses the basic item implementation already created (in last post).
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.
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.
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.
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
Subscribe to this blog via RSS.
C++ 30
Directx12 11
Mario kart 11
Commercial games development 15
Unity 15
Low-level programming (19) C++ (30) Text based adventure (5) Ex-machina (9) Game engine programming (11) Directx12 (11) Mario kart (11) Land of gold (5) Audio visual production (1) Commercial games development (15) Unity (15) Don't walk by (15)