This commit is contained in:
Atsuyo-INSA 2023-12-06 10:14:15 +01:00
parent 3ef3d50b59
commit aa4348c407
2 changed files with 4 additions and 7 deletions

View file

@ -103,8 +103,8 @@ function updateBullets(list,target,dt)
list[i].checkCollisions(target,squares,circles); list[i].checkCollisions(target,squares,circles);
if(list[i].deleted) if(list[i].deleted)
{ {
list.splice(i,1);
Renderer.remBullet(list[i]); Renderer.remBullet(list[i]);
list.splice(i,1);
} }
} }
} }

View file

@ -44,9 +44,9 @@ class Render {
this.ctx.rotate(player.angle); this.ctx.rotate(player.angle);
this.ctx.drawImage(imgPlayer, -playerSize / 2, -playerSize / 2, playerSize, playerSize); this.ctx.drawImage(imgPlayer, -playerSize / 2, -playerSize / 2, playerSize, playerSize);
this.ctx.restore(); this.ctx.restore();
//this.ctx.fillStyle="#FF0000"; this.ctx.fillStyle = 'white';
//this.ctx.font="10pt arial"; this.ctx.font="10pt arial";
//this.ctx.fillText(player.name,player.x-player.name.length*10/3,player.y-playerSize/1.8); this.ctx.fillText(player.name,player.x-player.name.length*10/3,player.y-playerSize/1.8);
} }
RenderBullet(bullet) { RenderBullet(bullet) {
@ -54,9 +54,6 @@ class Render {
this.ctx.translate(bullet.x, bullet.y); this.ctx.translate(bullet.x, bullet.y);
this.ctx.drawImage(imgBullet, -playerSize / 2, -playerSize / 2, playerSize, playerSize); this.ctx.drawImage(imgBullet, -playerSize / 2, -playerSize / 2, playerSize, playerSize);
this.ctx.restore(); this.ctx.restore();
this.ctx.fillStyle = 'white';
this.ctx.font="10pt arial";
this.ctx.fillText(player.name,player.x-player.name.length*10/3,player.y-playerSize/1.8);
} }
ReloadAff() { ReloadAff() {