S
S
SpeNch2020-11-15 14:17:25
Canvas
SpeNch, 2020-11-15 14:17:25

Why are there lags in the canvas game?

https://codepen.io/vasilij-shinkorenko/pen/PozVgZw

why does the animation lag? ps. keyboard arrow control

if the game is hard to see, copy the code to a new file on your computer,

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2020-11-15
@GavriKos

1. Because you don't need to draw in the keyboard event!
2. Of course, I don't rummage in JS - but what is this addEventListener for EVERY arrow click? Load everything once and then ONLY change the coordinates

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question