Pokemon Unity Tutorial - Player Movement [Pt.2]

August 13, 2019

Unity Pokemon Tutorial

Player Movement

Youtube - Lets Make... Pokemon in Unity! - Episode 2 Basic Player Movement
By: BrainStorm Games

Player movement in the overworld of Pokemon games is tile based. To emulate this, the tutorial uses a Coroutine which can move the player a full tile at a time while locking the player out from further inputs until the player character has completed its full tile of motion. It also uses a simple setup where it reads the player's horizontal and vertical input, but checks which is greater and reduces the other to zero to ensure the player is moving only on the two intended directions.

Since the player is a 2D sprite, they used an Enum setup to tie certain sprites to certain movement directions. This way it would look like the character is facing the direction they are moving. This setup had the 4 directions (North, South, East, West) for the Enum Direction. The player's input would set the Direction variable, currentDir, to a corresponding direction. This would then be referenced in a switch case to determine which sprite to display for the character's SpriteRenderer at the time.

Comments

Popular posts from this blog

Online Multiplayer Networking Solution Tutorial Using Unity and Mirror - Tutorial by: Jason Weimann

Sebastian Lague A* Tutorial Series - Path Smoothing - Pt. 08 and Pt. 09

Exporting FBX from Houdini with Color