let dt = 1.; let currentTime = new Date(); function game() { if(player==null) return; player.update(squares, circles, dt); for (let i = 0;i { c.Update(); if(c.collide(player.x,player.y)) { net.died(player.id,-1); player.x=-50; player.deaths++; player.health=10; } }); PNJS.forEach((pnj)=>{ pnj.update(dt); }) updateBullets(dt); renderer.ReloadAff(); LB.ReloadAff(); let newTime = new Date(); dt=newTime - currentTime; currentTime=newTime; } net.connect(); //connect to server, create a player, and retrieve all players info setInterval(game);