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.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Finding The Most Important Sentences Using TF-IDF by Python

CS50‘s Web Programming with Python and JavaScript學習筆記: Testing, CI/CD

30 Days of API Testing Challenge

Developing Badge-worthy Standards

10 free stock photos you would actually use (Thursday 2nd 01PM edition)

Here are the 4 Best Websites to Learn Programming in 2022

Web hosting is of mainly 3 types:

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
Gabe Gomez

Gabe Gomez

More from Medium

2D Game Development: Colliding with Colliders

Getting started with GAME DEVELOPMENT.

My journey becoming a Unity game developer: 2.5D Infinite Runner-Regular jump to double jumping

Indy Pro ’22: IWTV