Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » What are the coordinates of the mouse on a mobile device when you're not tapping the screen?
- pedrolg
-
42 posts
What are the coordinates of the mouse on a mobile device when you're not tapping the screen?
I am trying to detect whether you are using a mobile device, and was thinking that the x and y coordinates of the “mouse” on a mobile device would be something like N/A, which I could then detect and find out if you're using a mobile device, but I don't know if this will work. Can anyone with a mobile device test this out? TYSM
when green flag clicked
if <(mouse y) = [None]> then
say [MOBILE DEVICE USER!!!]
end
- p-p-p-p-p-p-p-p-p-p-
-
1000+ posts
What are the coordinates of the mouse on a mobile device when you're not tapping the screen?
You can also tell if a user is on mobile by asking them to press a key to continue
but that's not a foolproof way.

- PhiPhenomenon
-
500+ posts
What are the coordinates of the mouse on a mobile device when you're not tapping the screen?
Coordinates on mobile function the same as on computer. The only thing different is how the mouse x and mouse y change. You can use this mobile detector, since it's mostly accurate.
- alebro6DW
-
100+ posts
What are the coordinates of the mouse on a mobile device when you're not tapping the screen?
when green flag clicked
forever
if <<not <(mouse x) = (x)>> and <not <(mouse y) = (y)>>> then
mobile code :: grey
else
computer code :: grey
end
end
when this sprite clicked
set [x v] to (mouse x)
set [y v] to (mouse y)
or
asking telling them to press a key to continueYou can also tell if a user is on mobile bybut that's not a foolproof way.
- pedrolg
-
42 posts
What are the coordinates of the mouse on a mobile device when you're not tapping the screen?
Thanks @alebro6DWwhen green flag clicked
forever
if <<not <(mouse x) = (x)>> and <not <(mouse y) = (y)>>> then
mobile code :: grey
else
computer code :: grey
end
end
when this sprite clicked
set [x v] to (mouse x)
set [y v] to (mouse y)asking telling them to press a key to continueYou can also tell if a user is on mobile bybut that's not a foolproof way.
- Discussion Forums
- » Help with Scripts
-
» What are the coordinates of the mouse on a mobile device when you're not tapping the screen?