+ 2

touching screen in javascript

I'm making a car game and anytime i touch the screen the car everything on the canvas flickers which means it disappears for like some noticeable milliseconds and comeback real quick...how can i work around this? It works fine when entering through a keyboard though https://code.sololearn.com/WKuNgZyatOX4/?ref=app

25th Dec 2021, 8:51 PM
Jamari McFarlane
Jamari McFarlane - avatar
4 odpowiedzi
+ 3
25th Dec 2021, 10:14 PM
CGM
CGM - avatar
0
Ok, I think I found the problem, it's an advance. Apparently the problem it's the background, if you remove the background, the road, it stops disappearing, in fact it appears too much
25th Dec 2021, 9:23 PM
CGM
CGM - avatar
0
bro😂 what did you do? Thanks btw
25th Dec 2021, 10:16 PM
Jamari McFarlane
Jamari McFarlane - avatar
0
Line 263, I added this ctx.clearRect(0,0,500,700); roadLoop(); And commented some code but I'm not sure what jaja😅 Ah and I added user-select: none; in the button's css to prevent the text in them from being selected. Anyway, it still fails but it's more playable.
25th Dec 2021, 10:22 PM
CGM
CGM - avatar