car fix
This commit is contained in:
parent
1c220d8950
commit
b4cd2a8517
2 changed files with 5 additions and 2 deletions
|
@ -213,7 +213,7 @@ class Car
|
|||
let collide = (cx<=x && x<=cx+carSize && cy<=y && y<=cy+carSize);
|
||||
if(collide) {
|
||||
driftSound.play()
|
||||
this.drift=75*dt;
|
||||
this.drift=1000;
|
||||
}
|
||||
return collide;
|
||||
}
|
||||
|
@ -245,6 +245,8 @@ class Car
|
|||
}
|
||||
if(this.drift > 0) {
|
||||
this.drift-=dt;
|
||||
}else{
|
||||
this.drift = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,8 +118,9 @@ class Render {
|
|||
this.ctx.canvas.height = mapHeight;
|
||||
this.ctx.drawImage(fond, 0, 0, mapWidth, mapHeight);
|
||||
this.RenderPlayer(player,true);
|
||||
|
||||
cars.forEach((car) => {
|
||||
this.RenderCar(car.x,car.y,car.angle+(car.drift>0?car.drift/200:0));
|
||||
this.RenderCar(car.x,car.y,car.angle+(car.drift>0?car.drift/150:0));
|
||||
});
|
||||
players.forEach((player) => {
|
||||
this.RenderPlayer(player,false);
|
||||
|
|
Loading…
Reference in a new issue