SEMICOLON_BAPTISTE_PAR_PITIE!!!!!!
This commit is contained in:
parent
9decb74a0a
commit
dbbdaec43a
3 changed files with 26 additions and 26 deletions
2
class.js
2
class.js
|
@ -2,7 +2,7 @@ const mapWidth = 210.;
|
||||||
const mapHeith = 100.;
|
const mapHeith = 100.;
|
||||||
const playerSize = 50.;
|
const playerSize = 50.;
|
||||||
const playerSpeed=5.;
|
const playerSpeed=5.;
|
||||||
const halfSqrtTwo=sqrt(2.)/2.;
|
const halfSqrtTwo=0.70710678118;
|
||||||
class Player
|
class Player
|
||||||
{
|
{
|
||||||
constructor (id,x,y,name)
|
constructor (id,x,y,name)
|
||||||
|
|
36
game.js
36
game.js
|
@ -1,27 +1,27 @@
|
||||||
Renderer = new Render("canvas")
|
Renderer = new Render("canvas");
|
||||||
|
|
||||||
let rubiks = new Player(1, 100, 50, "rubiks")
|
let rubiks = new Player(1, 100, 50, "rubiks");
|
||||||
let atsuyo = new Player(2, 500, 70, "atsuyo")
|
let atsuyo = new Player(2, 500, 70, "atsuyo");
|
||||||
let vincent = new Player(3, 600, 70, "atsuyo")
|
let vincent = new Player(3, 600, 70, "atsuyo");
|
||||||
let migliore = new Player(4, 700, 70, "atsuyo")
|
let migliore = new Player(4, 700, 70, "atsuyo");
|
||||||
let leroux = new Player(5, 200, 30, "atsuyo")
|
let leroux = new Player(5, 200, 30, "atsuyo");
|
||||||
let lele = new Player(6, 700, 700, "atsuyo")
|
let lele = new Player(6, 700, 700, "atsuyo");
|
||||||
|
|
||||||
rubiks.visibleDir=3
|
rubiks.visibleDir=3;
|
||||||
|
|
||||||
Renderer.AddPlayer(rubiks)
|
Renderer.AddPlayer(rubiks);
|
||||||
Renderer.AddPlayer(atsuyo)
|
Renderer.AddPlayer(atsuyo);
|
||||||
Renderer.AddPlayer(vincent)
|
Renderer.AddPlayer(vincent);
|
||||||
Renderer.AddPlayer(migliore)
|
Renderer.AddPlayer(migliore);
|
||||||
Renderer.AddPlayer(leroux)
|
Renderer.AddPlayer(leroux);
|
||||||
Renderer.AddPlayer(lele)
|
Renderer.AddPlayer(lele);
|
||||||
|
|
||||||
|
|
||||||
setInterval(game);
|
setInterval(game);
|
||||||
|
|
||||||
function game() {
|
function game() {
|
||||||
rubiks.visibleDir=rubiks.visibleDir+0.03
|
rubiks.visibleDir=rubiks.visibleDir+0.03;
|
||||||
atsuyo.visibleDir=atsuyo.visibleDir-0.1
|
atsuyo.visibleDir=atsuyo.visibleDir-0.1;
|
||||||
migliore.x=migliore.x-0.1
|
migliore.x=migliore.x-0.1;
|
||||||
Renderer.ReloadAff()
|
Renderer.ReloadAff();
|
||||||
}
|
}
|
14
render.js
14
render.js
|
@ -1,13 +1,13 @@
|
||||||
class Render {
|
class Render {
|
||||||
constructor(id) {
|
constructor(id) {
|
||||||
this.canvas = document.getElementById(id)
|
this.canvas = document.getElementById(id);
|
||||||
this.ctx = canvas.getContext("2d")
|
this.ctx = canvas.getContext("2d");
|
||||||
this.players = []
|
this.players = [];
|
||||||
this.ReloadAff()
|
this.ReloadAff();
|
||||||
}
|
}
|
||||||
|
|
||||||
AddPlayer(player) {
|
AddPlayer(player) {
|
||||||
this.players[player.id] = player
|
this.players[player.id] = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderPlayer(player) {
|
RenderPlayer(player) {
|
||||||
|
@ -21,11 +21,11 @@ class Render {
|
||||||
}
|
}
|
||||||
|
|
||||||
ReloadAff() {
|
ReloadAff() {
|
||||||
this.ctx.fillStyle = "red"
|
this.ctx.fillStyle = "red";
|
||||||
this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);
|
this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);
|
||||||
|
|
||||||
this.players.forEach((player) => {
|
this.players.forEach((player) => {
|
||||||
this.RenderPlayer(player)
|
this.RenderPlayer(player);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue