How does "A new touch has started" work?

I am trying to achieve swipe controls for mobile. If you swipe up, character moves up. Swipe left, character moves left and so on.

For this I wanted to store the touch position when the user starts to touch the screen in two variables, one for X and one for Y. Then I store the current touch position in two other variables and when the user stops touching the screen I compare these four variables to see in which direction he moved. I can store the current position, but I have trouble storing the initial position. It looks like this:

The second and third condition is working as intended, but the first isn’t. The fourth condition was to check what is wrong. When I run it and hold the left mouse button down I can see that the variables for current position are constantly updating, when I let the mouse button go they stay at the last values when the mousebutton was pressed. But the variables for initial touch are always 0. Also ne Variable newTouchStarted never gets true. Why? Is there an error in my code or does “A new touch has started” not work with the mouse? I thought the mouse emulates touches.

Mouse emulates single touch, but I’m not sure it works with the multitouch instructions.
You can use the network preview to test on your mobile without having to export. Click on the button next to the preview button. :slight_smile:

Thanks.

I did a workaround by checking Touch or left mouse button is down only once and this works with mouse and touch. But still good to know I don’t have to upload it for every test. :slight_smile: