hey
I have a Question about 2D Movement.
I can controll my player just fine and everything, but I want my Player to move in a kind of grid.
So if i would put a grid as Backgound (just to make it clear) taht he would always stand in one of the squares after the movement.
This is also seen in games like pokemon for example (the old ones).
Here is what I have so far:
if (Input.GetKey (KeyCode.D))
{
toRight = true;
toLeft = false;
toUp = false;
toDown = false;
walk = true;
transform.position = new Vector3
(transform.position.x + walkDistance,
transform.position.y,
transform.position.z);
}
(This might not be the best way to go, but i am rather new to unity)
(also I am using c#)
The Booleans are just for the animation.
So to sum up my Question:
I know how to move the Player, but he should only move in a "grid".
I hope I made it clear
Hope someone will help
Tanks :)
↧