Hey everyone.
I have a code that when the player touches (or clicks with mouse) any location on the screen it will go to it’s closest corresponding anchor point.
here is the example code of how i’ve restricted screen movement.
_myPosition = _touchPosition;
if (_myPosition.x >= 0f && _myPosition.x <= 3.5f && _myPosition.y >= -6f && _myPosition.y <= -1.2f)
{
_myPosition = new Vector3(1.74f, -2.4f, 0);
}
I’m trying to figure out how to do this with the arrow keys. Im pretty sure I have write one for each arrow (ie keycode.leftarrow etc), but i’m not sure what the starting point is for
if (input.getkeydown(keycode.leftarrow)
{
//what is supposed to go here to make it move from point 1 to point 2
}