loading...

Grid-based Movement using Tilemap and Input System in Unity 2020

samyam_utube profile image samyam ・1 min read

Make a grid-based movement character using tilemaps and the new input system.

Discussion

markdown guide
 

Amazing! Was trying to set up my grid game with the new input system. This works perfectly! One question. How would you allow the character to move two grids instantly by using a int variable. In other words...Say while holding "shift " extraSteps = 1. How would you convert this int to the proper direction and to a Vector 2?

 

I think it might be the same as adding the grid tile, but multiply the result by 2 if shift is held.

At least that's how I'd try and tackle it, then check both positions to make sure the second position isn't a cliff or something. 😄

 

That's a good question, I could see this mechanic used for "jumping" over an object. I'm curious what the answer is too :)

 

If you want to jump over an object you can check when the Jump is triggered and the direction that is currently being held down, then you could move from the current tile to the tile next to the object you want to jump over while performing a jumping animation over a small period of time.

 

I'm going to Pokemon and how you could jump over bushes.

Would this be its own tilemap for jumpable terrain that you check against?

Yes you could have a seperate tilemap just for environmental collisions that you could check against

 

Yes as Chris said you would move 2 units instead of and it would be the same process as in the video. And you would first check if the shift key has been triggered