I have a student creating an Asteroids style game.
His issue is that his WASD controls are getting stuck. His code seems logical. It isn't happening on my machine, so I can't seem to reproduce it. I am curious why it might be happening.
He is running Google Chrome on Windows 10.
His project is here:
Basically hitting the green flag (even multiple times) will keep reading his character as moving left. Pressing the left button ('A' key) will reset this. It just gets stuck moving left.
Pressing up or down ('W' and 'S' keys) will override this somehow and move vertically, while pausing this errant move left.
I can't find any errors in his code.
The reason he used a separate loop and the vertical/horizontal variables is because he was having lag with one large loop. Separating it this way greatly cut down on his lag.
Again, I can't seem to reproduce it, but I just feel bad for this student. He is one of my more advanced students and has had a lot of issues with Clones lagging (posted about his other project a few days ago with lots of lag) and now he is getting stuck or having variables not reset correctly. Since I can't reproduce it I can't figure out why it is happening.