GrandTabernacleAutoVI/public_html/js/game.js
2023-12-18 09:51:20 +01:00

42 lines
No EOL
761 B
JavaScript

let dt = 0;
let currentTime = new Date();
function game() {
if(player==null)
return;
player.update(squares, circles, dt);
for (let i = 0;i<players.length; i++) {
players[i].update(squares, circles, dt);
}
cars.forEach((c) => {
c.Update();
if(c.collide(player.x,player.y,player.z))
{
net.died(player.id,-1);
player.z=-1;
player.deaths++;
players[0].kill++;
player.health=10;
}
});
PNJS.forEach((pnj)=>{
pnj.update(dt);
})
portals.forEach((portal) => {portal.update();});
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,16);