How To Make Terrain Effect Direction With A Top Down 2D View

Making the terrain your character is walking on have an impact on the controls can add extra depth to your control scheme.

For a top down 2D game there is not any gravity and your player is not using collision detection to walk on surfaces so doing things like walking up a set of stairs or falling off of a platform can require a little extra thought. There are many ways you could approach a problem like this, however a quick and easy way is to check what surface the player is walking on and then calculate how the player should move based on the surface.

In the example the player can go up the stairs and fall off the cliffs if they approach them. When pressing left or right on the stairs the player needs to actually move up the stairs and not just into them in order for the control scheme to feel natural.

Continue reading

Jump Up Onto And Down From Platforms

How can we make a platform decide if a player can move through it or get stopped by it? An easy solution is to use the y coordinate of the player to turn the platform’s collider off and on. If the player is lower than the platform then they should be able to jump up through it and land safely on top.  You can also hop down off the platform by turning off the collider for a short amount of time.

You can play test it here (full screen is not working at the moment).

Continue reading