bullet fix

This commit is contained in:
Marty Killian 2023-12-13 14:11:10 +01:00
parent da44834191
commit 7411743481
2 changed files with 2 additions and 1 deletions

View file

@ -28,7 +28,7 @@ class Input {
let b = new Bullet(player.x,player.y,dx/norm,dy/norm,player.id); let b = new Bullet(player.x,player.y,dx/norm,dy/norm,player.id);
bullets.push(b); bullets.push(b);
net.newBullet(b.x,b.y,b.dx,b.dy,b.parentId); net.newBullet(b.x,b.y,b.dx,b.dy,b.shooterId);
}); });
window.addEventListener("keydown", (e)=>{ window.addEventListener("keydown", (e)=>{

View file

@ -72,6 +72,7 @@ class Network{
newBullet(x,y,dx,dy,parentId) newBullet(x,y,dx,dy,parentId)
{ {
console.log(parentId)
this.socket.send(JSON.stringify({type:"newBullet",data:{x: x,y: y,dx: dx,dy: dy,id:parentId}})); this.socket.send(JSON.stringify({type:"newBullet",data:{x: x,y: y,dx: dx,dy: dy,id:parentId}}));
} }