let dt = 0; let currentTime = new Date(); function game() { if(player==null){ return; } player.update(maps[player.z].squares, maps[player.z].circles, dt); players.forEach((p)=>{ if(p.z>=0) { p.update(maps[p.z].squares,maps[p.z].circles, dt); } }); cars.forEach((c) => { c.Update(dt); if(c.collide(player.x,player.y,player.z)) { net.died(player.id,-1); player.z=-1; player.death++; players[0].kill++; player.health=10; } }); PNJS.forEach((pnj)=>{ pnj.update(dt); }) maps.forEach((m) => {m.update();}); updateBullets(dt); renderer.ReloadAff(); LB.ReloadAff(); let newTime = new Date(); dt=newTime - currentTime; currentTime=newTime; Donjon() } net.connect(); //connect to server, create a player, and retrieve all players info setInterval(game, 16);