Merge branch 'dev' of https://git.etud.insa-toulouse.fr/rebillar/GrandTabernacleAutoVI into dev
This commit is contained in:
commit
e5a274496c
4 changed files with 19 additions and 10 deletions
BIN
assets/body.png
Normal file
BIN
assets/body.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 968 B |
18
class.js
18
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))
|
||||
|
|
4
game.js
4
game.js
|
@ -3,5 +3,7 @@ setInterval(game);
|
|||
function game() {
|
||||
Renderer = new Render("canvas")
|
||||
|
||||
Renderer.AddPlayer(3, 5, )
|
||||
let rubiks = new Player(1, 100, 50, "rubiks")
|
||||
console.log(rubiks)
|
||||
Renderer.AddPlayer(rubiks)
|
||||
}
|
|
@ -2,13 +2,18 @@ class Render {
|
|||
constructor(id) {
|
||||
this.canvas = document.getElementById(id)
|
||||
this.ctx = canvas.getContext("2d")
|
||||
|
||||
this.players = []
|
||||
this.ReloadAff()
|
||||
}
|
||||
|
||||
AddPlayer(id, pseudo, x, y, angle) {
|
||||
this.players[id] = (id, pseudo, x, y, angle)
|
||||
}
|
||||
|
||||
ReloadAff() {
|
||||
this.ctx.fillStyle = "red"
|
||||
this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);
|
||||
|
||||
/*this.ctx.stokeStyle = "black"
|
||||
this.ctx.lineWidth = 1;
|
||||
ctx.beginPath();
|
||||
|
|
Loading…
Reference in a new issue