almost perfect
This commit is contained in:
parent
f6cbebe532
commit
9f88b162ea
5 changed files with 7 additions and 6 deletions
|
@ -16,6 +16,7 @@ function game() {
|
|||
net.died(player.id,-1);
|
||||
player.z=-1;
|
||||
player.deaths++;
|
||||
players[0].kill++;
|
||||
player.health=10;
|
||||
}
|
||||
});
|
||||
|
@ -36,4 +37,4 @@ function game() {
|
|||
net.connect(); //connect to server, create a player, and retrieve all players info
|
||||
|
||||
|
||||
setInterval(game);
|
||||
setInterval(game,16);
|
|
@ -21,6 +21,7 @@ let cars = [new Car(0, 0),
|
|||
new Car(0, 7),
|
||||
new Car(0, 15)];
|
||||
|
||||
players.push(new Player(-1,-50,-50,-1,"VOITURES",0));
|
||||
|
||||
function updatePlayer(data)
|
||||
{
|
||||
|
|
|
@ -22,8 +22,7 @@ class Input {
|
|||
|
||||
let b = new Bullet(player.x,player.y,player.z,dx/norm,dy/norm,player.id);
|
||||
bullets.push(b);
|
||||
|
||||
net.newBullet(b.x,b.y,b.z,b.dx,b.dy,b.parentId);
|
||||
net.newBullet(b.x,b.y,b.z,b.dx,b.dy,b.shooterId);
|
||||
});
|
||||
|
||||
window.addEventListener("keydown", (e)=>{
|
||||
|
|
|
@ -31,10 +31,10 @@ class Network{
|
|||
break;
|
||||
|
||||
case "newBullet":
|
||||
bullets.push(new Bullet(data.data.x,data.data.y,data.z,data.data.dx,data.data.dy,data.data.id, this.sound));
|
||||
bullets.push(new Bullet(data.data.x,data.data.y,data.data.z==undefined?0:data.data.z,data.data.dx,data.data.dy,data.data.id));
|
||||
break;
|
||||
|
||||
case "died":
|
||||
case "died":
|
||||
console.log("player",data.data.id,"was killed by",data.data.killerId);
|
||||
addKill(data.data.id,data.data.killerId);
|
||||
break;
|
||||
|
|
|
@ -87,7 +87,7 @@ class Render {
|
|||
ReloadAff() {
|
||||
let background;
|
||||
|
||||
if(player.z==0)
|
||||
if(player.z<=0)
|
||||
{
|
||||
let date = new Date();
|
||||
if(date.getMinutes()%10>=5){
|
||||
|
|
Loading…
Reference in a new issue