From 1dd378518b5918210660931ec503ca10fc1d501f Mon Sep 17 00:00:00 2001 From: Atsuyo-INSA Date: Tue, 14 Nov 2023 17:10:20 +0100 Subject: [PATCH] SmallClassChanges --- class.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/class.js b/class.js index 53dd1e8..32a3f88 100644 --- a/class.js +++ b/class.js @@ -4,11 +4,13 @@ const playerSize = 10.; class Player { - constructor (x,y,id) + constructor (id,x,y,name) { + this.name=name; this.x=x; this.y=y; this.id=id; + this.visibleDir=1; this.dir=0;//0=standStill //1=North //2=North-East @@ -31,6 +33,13 @@ class Player //this.reset() } } + + + + get angle() + { + return (this.visibleDir-1)*3.1415926535/8.; + } } function dist(A,B) @@ -69,13 +78,6 @@ class Bullet return; } - /*squares.forEach(square => { - if (collideSquare(this,square)) - { - this.deleted=true; - break; - } - });*/ for(let square in squares) { if(square.collide(this))