SmallClassChanges
This commit is contained in:
parent
a560445dcc
commit
1dd378518b
1 changed files with 10 additions and 8 deletions
18
class.js
18
class.js
|
@ -4,11 +4,13 @@ const playerSize = 10.;
|
||||||
|
|
||||||
class Player
|
class Player
|
||||||
{
|
{
|
||||||
constructor (x,y,id)
|
constructor (id,x,y,name)
|
||||||
{
|
{
|
||||||
|
this.name=name;
|
||||||
this.x=x;
|
this.x=x;
|
||||||
this.y=y;
|
this.y=y;
|
||||||
this.id=id;
|
this.id=id;
|
||||||
|
this.visibleDir=1;
|
||||||
this.dir=0;//0=standStill
|
this.dir=0;//0=standStill
|
||||||
//1=North
|
//1=North
|
||||||
//2=North-East
|
//2=North-East
|
||||||
|
@ -31,6 +33,13 @@ class Player
|
||||||
//this.reset()
|
//this.reset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
get angle()
|
||||||
|
{
|
||||||
|
return (this.visibleDir-1)*3.1415926535/8.;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function dist(A,B)
|
function dist(A,B)
|
||||||
|
@ -69,13 +78,6 @@ class Bullet
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*squares.forEach(square => {
|
|
||||||
if (collideSquare(this,square))
|
|
||||||
{
|
|
||||||
this.deleted=true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
for(let square in squares)
|
for(let square in squares)
|
||||||
{
|
{
|
||||||
if(square.collide(this))
|
if(square.collide(this))
|
||||||
|
|
Loading…
Reference in a new issue