how to check x and y axis of screen touch | Sololearn: Learn to code for FREE!

+1

how to check x and y axis of screen touch

3/10/2021 3:40:34 AM

Michael

5 Answers

New Answer

+3

by using event.touches array: on each touches, you can access its position through clientX, clientY, pageX, pageY... (client give you coordinates relative to viewport, while page relative to whole document -- later are not affected by scroll amount) this code may help you: it log touch events properties: https://code.sololearn.com/WO8wrPV40Fzn/?ref=app

+1

you just need to reset x variable to its initial value, and compute new heights for the pipes, when x becomes lower than -width of pipes: https://code.sololearn.com/WM9W0H8sFjLo/?ref=app however, it's better to post a brand new question than having a thread with multiple subjects ;)

0

Thank you!

0

Also can you help me make loop for this game, for the pipes

0

visph https://code.sololearn.com/WfMYEmYWImOW/?ref=app