This commit is contained in:
Baptiste 2023-12-07 10:03:55 +01:00
parent f636d6de6a
commit 17446bf1f0
3 changed files with 5 additions and 2 deletions

View file

@ -1,7 +1,7 @@
let mapWidth = 210.;
let mapHeith = 100.;
const playerSize = 50.;
const carSize = 50.;
const carSize = 40.;
const playerSpeed=.2;
const bulletSpeed=playerSpeed*2;
const halfSqrtTwo=0.70710678118;

View file

@ -108,6 +108,7 @@ function updateBullets(dt)
}
let currentTime = new Date();
let carx=0
function game() {
if(playerId==null)
{
@ -146,12 +147,14 @@ function game() {
}
Renderer.ReloadAff();
updateBullets(dt);
Renderer.RenderCar(200+carx,75, 0);
LB.ReloadAff(players, player);
}
let newTime = new Date();
dt=newTime - currentTime;
currentTime=newTime;
carx=carx+3
}
Net.connect(); //connect to server, create a player, and retrieve all players info

View file

@ -69,7 +69,7 @@ class Render {
this.ctx.save();
this.ctx.translate(x, y);
this.ctx.rotate(angle);
this.ctx.drawImage(imgCar, -carSize / 2, -carSize / 2, carSize, carSize);
this.ctx.drawImage(imgCar, -carSize*1513/750 / 2, -carSize / 2, carSize*1513/750, carSize);
this.ctx.restore();
}