This commit is contained in:
Atsuyo-INSA 2023-11-14 18:07:23 +01:00
parent dbbdaec43a
commit e24771131e
2 changed files with 13 additions and 9 deletions

View file

@ -1,7 +1,7 @@
const mapWidth = 210.;
const mapHeith = 100.;
const playerSize = 50.;
const playerSpeed=5.;
const playerSpeed=2.;
const halfSqrtTwo=0.70710678118;
class Player
{
@ -57,7 +57,7 @@ class Player
{
case 1: dx=0.;dy=-playerSpeed;break;
case 2: dx=halfSqrtTwo*playerSpeed;dy=-halfSqrtTwo*playerSpeed;break;
case 3: dx=1.;dy=0.;break;
case 3: dx=playerSpeed;dy=0.;break;
case 4: dx=halfSqrtTwo*playerSpeed;dy=halfSqrtTwo*playerSpeed;break;
case 5: dx=0.;dy=playerSpeed;break;
case 6: dx=-halfSqrtTwo*playerSpeed;dy=halfSqrtTwo*playerSpeed;break;

18
game.js
View file

@ -2,12 +2,16 @@ 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 vincent = new Player(3, 600, 70, "vincent");
let migliore = new Player(4, 700, 70, "migliore");
let leroux = new Player(5, 200, 30, "leroux");
let lele = new Player(6, 700, 700, "lele");
rubiks.visibleDir=3;
rubiks.dir=3;
atsuyo.dir=5;
atsuyo.visibleDir=5;
Renderer.AddPlayer(rubiks);
Renderer.AddPlayer(atsuyo);
@ -20,8 +24,8 @@ 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;
rubiks.update([],[]);
atsuyo.update([],[]);//.visibleDir=atsuyo.visibleDir-0.1;
//migliore.x=migliore.x-0.1;
Renderer.ReloadAff();
}