From aa4348c4075d5db61f8da07f04e265bb3aa8f6dc Mon Sep 17 00:00:00 2001 From: Atsuyo-INSA Date: Wed, 6 Dec 2023 10:14:15 +0100 Subject: [PATCH] names --- js/game.js | 2 +- js/render.js | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/js/game.js b/js/game.js index 1a452a3..11518b1 100644 --- a/js/game.js +++ b/js/game.js @@ -103,8 +103,8 @@ function updateBullets(list,target,dt) list[i].checkCollisions(target,squares,circles); if(list[i].deleted) { - list.splice(i,1); Renderer.remBullet(list[i]); + list.splice(i,1); } } } diff --git a/js/render.js b/js/render.js index 0ed9115..ddbea68 100644 --- a/js/render.js +++ b/js/render.js @@ -44,9 +44,9 @@ class Render { this.ctx.rotate(player.angle); this.ctx.drawImage(imgPlayer, -playerSize / 2, -playerSize / 2, playerSize, playerSize); this.ctx.restore(); - //this.ctx.fillStyle="#FF0000"; - //this.ctx.font="10pt arial"; - //this.ctx.fillText(player.name,player.x-player.name.length*10/3,player.y-playerSize/1.8); + 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); } RenderBullet(bullet) { @@ -54,9 +54,6 @@ class Render { this.ctx.translate(bullet.x, bullet.y); this.ctx.drawImage(imgBullet, -playerSize / 2, -playerSize / 2, playerSize, playerSize); 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() {