Question by
k0042n · Oct 11, 2016 at 02:57 PM ·
androidcharactercontroller
Convert Arrow Key control into Touch Screen Control
HI
I am trying to convert the following code so that I could use touch screen control instead of arrow key.
void ComChangeD()
{
if(NESW != 2 && Input.GetKeyDown(KeyCode.UpArrow))
{
NESW = 0;
}
if (NESW != 3 && Input.GetKeyDown(KeyCode.RightArrow))
{
NESW = 1;
}
if (NESW != 0 && Input.GetKeyDown(KeyCode.DownArrow))
{
NESW = 2;
}
if (NESW != 1 && Input.GetKeyDown(KeyCode.LeftArrow))
{
NESW = 3;
}
}
Do u guys have any idea about it?
Comment
Answer by LZakhar · Oct 13, 2016 at 12:22 AM
In Rogue2D free tutorial there is very fine example about mobile controls and how to "move" them frm KB into touch screen. https://unity3d.com/ru/learn/tutorials/projects/2d-roguelike-tutorial
Your answer
![](https://koobas.hobune.stream/wayback/20220612094422im_/https://answers.unity.com/themes/thub/images/avi.jpg)