Move object towards Touch position

Hey guys and possibly gals,

Having some drama’s in getting my object on screen to move to position of a touch, I am using:
Condition: Touch or mouse click held
Action: Add force so as to move to position

action reads as follows:

Move “Object” to TouchX(1,"",0);TouchY(1,"",0) with a force of 400 pixels

problem is all the object does is move to top left of the screen regardless of where the mouse click is.

Any ideas for this one, also any idea’s on if its possible to auto re-size the screen resolution to that of the device its on as my built app had white borders which are quite ugly.

Thanks for any help

The first touch has the identifier “0”, so it’s :

TouchX(0,"",0);TouchY(0,"",0)
2 Likes

I have tried that and with same result

That’s problem : you’re using the mouse but getting the touch position. You can maybe use the MouseX() and MouseY() expressions to get the mouse position (and the first touch also simulates the mouse so it will work on a touch device).

1 Like

Ahh, awesome I’ll try that later thanks