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

#freestockphoto (Thursday 5th 07AM)

How to Convert ODS to XLSX in C/C++

Composite Pattern — Go Example

Onec-NaaS (NFT as a Service)

5 Signs You Need to Start Using Kanban for Software Development

Python Packages For Data Science

How to Solve “Outlook PST is not a personal folders file” Error

How to Solve “Outlook PST is not a personal folders file” Error

The fine world of AWS Idxxxxty and Access Management

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

Adding enemies to our greybox Prototype

Animating Sprites In Unity

2D Mobile: Setting Up The Player

Building A Stealth Game — Using The Mouse For Movement