+ 1

how to check x and y axis of screen touch

10th Mar 2021, 3:40 AM
Michael
Michael - avatar
5 Respostas
+ 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
10th Mar 2021, 3:50 AM
visph
visph - avatar
+ 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 ;)
10th Mar 2021, 4:10 AM
visph
visph - avatar
0
Thank you!
10th Mar 2021, 3:54 AM
Michael
Michael - avatar
0
Also can you help me make loop for this game, for the pipes
10th Mar 2021, 3:55 AM
Michael
Michael - avatar