Why is this for loop running parallel in this class?

Why is the for loop on line 244 running parallel and not waiting until done?

It should draw the barrels in order and run the code after the loop once the loop finished, but it doesn’t, and it makes it look really wierd.

(The barrels are the grey rectangles)
Repl link:
(The code is large, look at the REPL)

EDIT: I did a test with console.log, and there was a line of As and Bs perfectly in order, which were put at the beginnings and end of the for loop. Then there was a C, which was printed after the for loop was done, and oddly enough, it printed after the As and Bs. Yet, it still overrides with player drawing and the other barrels also glitch around on the same layer.


You can insert in console.log("A") inside the loop and console.log("B") to verify that the loop is working as intended or not.
If B is the last line printed, then it is working as intended.

Also what is the issue exactly, because I see a tank with a 2 barrels + a desmos like barrel in the middle. (I assume you know arras.io)

I want the tank to look like triple shot (or whatever it was called). Also, I’m making a remake of scenexe.io, but some arras.io stuff may appear in it. I’ll try what you said with another additional console.log(“C”) for where the player is drawn to see if it’s actually conflicting with that. Also, behind the blue circle part of the player, moving will make you notice another grey circle below the player which I think is the barrel’s for loop running the code after it while running the for loop.

Oddly enough, the C came at the end after the for loop, but yet it doesn’t draw right. Also, I made it only run one frame so I can better see the logs. Also, the for loop doesn’t appear to be running parallel in the console, saying a line of A, B, A, B, A, B. Ignore the log “A server has been initialized.”

Still however, the rendering of the barrels conflict with eachother and the player itself.