maanantai 17. huhtikuuta 2017

UNITY PLATFORMER - jumping through platforms

To be able to jump through platforms is essential part of platformer games. This time we’re going to make a mechanic for that.

First you’ll need a platform. Create two colliders for it. Change the size and position of the colliders so that the bottom one is a bit smaller than the top one. Put checkmark to the is trigger section of the bottom collider.


Now create new FSM for the platform. This FSM has three states in it.


First state has action trigger 2D event. Select your player tag as collide tag and remember to tag your player as player. Make it send deactivate event and link the transition to the second state.


Second state has two actions. First action is created by dragging the second collider from the platform to the state. Now choose enabled from the list under property and add wait action to the state. Choose finish event for the wait action and the amount of wait time is related to how much time it takes for the player to land from the jump.



Last state has the same set property action for the collider as the second state. Choose enabled again but this time put a checkmark to the enabled section so that the collider is activated and player can land on it.


Ei kommentteja:

Lähetä kommentti