Player Movement — Dungeon Escape Game Dev

Going over how I implemented player movement for my 2D mobile game Dungeon Escape

Objective: Show how I created player movement in my 2D Unity mobile game.

Player Movement

Today, I will only be focusing on the horizontal movement and jumping functionality needed. The code I used to implement both can be found below

As you can see, to get accomplish this functionality, I used a combination of raycasts, co-routines, and return-type functions. To get this to work, it is also very important you set a layer in the editor that represents your ground. Without this, the jumping functionality will not work properly.

As can be seen, the Floor GameObject in my editor has the Ground layer I created. All of this gives me the result we see here:

That is all for today! Thank you for taking the time to read today’s article. In the next article, I will be creating a few animations to make these movements a bit more exciting.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store