This commit is contained in:
Baptiste 2023-12-07 09:35:40 +01:00
commit 02f3c87804

View file

@ -37,6 +37,9 @@ class Network{
case "newBullet":
this.bulletsToAdd.push(new Bullet(data.data.x,data.data.y,data.data.dx,data.data.dy,data.data.id));
break;
case "died":
console.log(data.data);
console.log("someone died");
default:
break;
}
@ -52,8 +55,8 @@ class Network{
})
}
died(id){
this.socket.send(JSON.stringify({type:"died",data:{id: id}}));
died(id, killerId){
this.socket.send(JSON.stringify({type:"died",data:{id: id, killerId: killerId}}));
}
update(obj){ //send data to server in order to broadcast