code cleaning
This commit is contained in:
parent
45902fd0f1
commit
7cd3c8e8dd
3 changed files with 6 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue