let player = null; let players = []; let renderer = new Render("canvas"); let LB = new LeaderBoard("canvas"); let bulletSound = new Sound("./assets/sounds/shoot.mp3"); let driftSound = new Sound("./assets/sounds/drift.mp3"); let net = new Network("wss://ws.gta6.insat.fr:8080?name=" + getCookie("pseudo")); let inp = new Input("canvas"); let bullets = []; let circles = []; let squares = []; let PNJS = [new PNJ(500, 100,0), new PNJ(700, 100,0), new PNJ(500, 600,0), new PNJ(200, 700,0)]; let cars = [new Car(0, 0), new Car(1, 7), new Car(1, 13), new Car(1, 14), new Car(0, 7), new Car(0, 15)]; players.push(new Player(-1,-50,-50,-1,"VOITURES",0)); function updatePlayer(data) { if(data.id==player.id) { player.x=data.x; player.y=data.y; player.z=data.z; } else { for(let i=0;i { if(p.id==idKilled) p.death++; if(p.id==idKiller) p.kill++; }); } function updateBullets(dt) { for(let i = bullets.length-1;i>=0;i--) { bullets[i].update(dt); bullets[i].checkCollisions(squares,circles); if(bullets[i].deleted) { bullets.splice(i,1); } } }