SEMICOLON_BAPTISTE_PAR_PITIE!!!!!!

This commit is contained in:
Atsuyo-INSA 2023-11-14 17:53:29 +01:00
parent 9decb74a0a
commit dbbdaec43a
3 changed files with 26 additions and 26 deletions

View file

@ -2,7 +2,7 @@ const mapWidth = 210.;
const mapHeith = 100.;
const playerSize = 50.;
const playerSpeed=5.;
const halfSqrtTwo=sqrt(2.)/2.;
const halfSqrtTwo=0.70710678118;
class Player
{
constructor (id,x,y,name)

36
game.js
View file

@ -1,27 +1,27 @@
Renderer = new Render("canvas")
Renderer = new Render("canvas");
let rubiks = new Player(1, 100, 50, "rubiks")
let atsuyo = new Player(2, 500, 70, "atsuyo")
let vincent = new Player(3, 600, 70, "atsuyo")
let migliore = new Player(4, 700, 70, "atsuyo")
let leroux = new Player(5, 200, 30, "atsuyo")
let lele = new Player(6, 700, 700, "atsuyo")
let rubiks = new Player(1, 100, 50, "rubiks");
let atsuyo = new Player(2, 500, 70, "atsuyo");
let vincent = new Player(3, 600, 70, "atsuyo");
let migliore = new Player(4, 700, 70, "atsuyo");
let leroux = new Player(5, 200, 30, "atsuyo");
let lele = new Player(6, 700, 700, "atsuyo");
rubiks.visibleDir=3
rubiks.visibleDir=3;
Renderer.AddPlayer(rubiks)
Renderer.AddPlayer(atsuyo)
Renderer.AddPlayer(vincent)
Renderer.AddPlayer(migliore)
Renderer.AddPlayer(leroux)
Renderer.AddPlayer(lele)
Renderer.AddPlayer(rubiks);
Renderer.AddPlayer(atsuyo);
Renderer.AddPlayer(vincent);
Renderer.AddPlayer(migliore);
Renderer.AddPlayer(leroux);
Renderer.AddPlayer(lele);
setInterval(game);
function game() {
rubiks.visibleDir=rubiks.visibleDir+0.03
atsuyo.visibleDir=atsuyo.visibleDir-0.1
migliore.x=migliore.x-0.1
Renderer.ReloadAff()
rubiks.visibleDir=rubiks.visibleDir+0.03;
atsuyo.visibleDir=atsuyo.visibleDir-0.1;
migliore.x=migliore.x-0.1;
Renderer.ReloadAff();
}

View file

@ -1,13 +1,13 @@
class Render {
constructor(id) {
this.canvas = document.getElementById(id)
this.ctx = canvas.getContext("2d")
this.players = []
this.ReloadAff()
this.canvas = document.getElementById(id);
this.ctx = canvas.getContext("2d");
this.players = [];
this.ReloadAff();
}
AddPlayer(player) {
this.players[player.id] = player
this.players[player.id] = player;
}
RenderPlayer(player) {
@ -21,11 +21,11 @@ class Render {
}
ReloadAff() {
this.ctx.fillStyle = "red"
this.ctx.fillStyle = "red";
this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);
this.players.forEach((player) => {
this.RenderPlayer(player)
this.RenderPlayer(player);
})
}
}