Do touch coordinates change when the screen is moved?
-
@Murtaza if you touch an object and then move the screen, will the coordinates for the touch behavior be different when the screen moves?
-
If you're have the "world coordinates" switch on, then it it won't change. If the switch is set to use screen coordinates then it does change.
-
@Murtaza i tried with world coordinates on with a while touching behavior. I had the while touching behavior set a label to the the touch point (world coordinates on) and then when i touched the object it would move the screen. When i played it i touched the object, and the coordinates where i touched were not what it showed.
-
@iTap-Development I'm not sure what you mean. Can you either share a link to your project or post a screenshot of the behaviours?
-
-
Sorry, I told @Murtaza the setup backwards. Screen coordinates will be the same, world coordinates will be different. So if you have world coordinates selected then that is how it should be working.
-
@Hamed how do you put it on screen coordinates? There is only a toggle for world coordinates, or does turning that off make it screen coordinates? Even with world coordinates off I still have the same problem.
-
@iTap-Development World Coordinates returns the coordinates in the world, relative to 0,0 of the world coordinates. Turning it off returns where you touched, relative to the object you are touching. To get the screen coordinates, subtract the touching world coordinates from the screen position and add the screen offset (by default, 16 to x and 12 to y).
-
-
yeah that works....but isn't there a way to use screen coordinates without doing that @Murtaza ?
-
Can you make me a quick project to see whats going on? And tell me what you expect to happen and what is happening?
Thanks.
-
@Hamed I sent you a project in an email!
-
I see whats happening. I assumed you were talking about touches using global behaviours. When turning off world coordinates, it outputs the position relative to itself.
eg. you have a blue box in the middle of the screen and you output the y coordinates of the finger with world coordinates off. As soon as your finger goes under neath the blue box, it will be less than zero. If your finger goes above the blue box, it will output the the height of the blue box + the distance away from the edge of the blue box.
-
@Hamed so can I output the coordinates relative to the screen? Sorry if I'm confused🙈
-
@iTap-Development not directly, but as I said before you can find the coordinates relative to 0,0 of the screen by doing this (for default zoom):
X=Touching.X(World Coords)-Screen.X+16
Y=Touching.Y(World Coords)-Screen.Y+12
When you change the zoom, this won't work anymore since the screen centre would change. To fix this, change the 16 and 12 offsets to the centre of the screen when you zoom.