code cleaning

This commit is contained in:
Killian Marty 2023-12-09 10:58:00 +01:00
parent 45902fd0f1
commit 7cd3c8e8dd
3 changed files with 6 additions and 1 deletions

View file

@ -36,8 +36,9 @@ class Player
if(this.health<=0)
{
this.death++;
net.died(this.id,killerId);
this.health=defaulthealth;
net.died(this.id,killerId);
}
}

View file

@ -30,6 +30,7 @@ function game() {
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))
@ -40,6 +41,7 @@ function game() {
player.health=10;
}
});
updateBullets(dt);
renderer.ReloadAff();
LB.ReloadAff();

View file

@ -22,8 +22,10 @@ class Input {
let dy = mouseY-player.y;
let norm = Math.sqrt(dx*dx+dy*dy);
let b = new Bullet(player.x,player.y,dx/norm,dy/norm,player.id);
bullets.push(b);
net.newBullet(b.x,b.y,b.dx,b.dy,b.parentId);
});