diff --git a/public_html/js/class.js b/public_html/js/class.js index e88d46e..3130ef3 100644 --- a/public_html/js/class.js +++ b/public_html/js/class.js @@ -229,33 +229,32 @@ class Car Update(dt) { - if(this.tick==0 && (new Date()).getSeconds()%20==this.spawn) { - this.tick=1; + if(this.tick==0 && (new Date()).getSeconds()%60==this.spawn) { + this.tick=1; } - if(this.tick==0) - return; - - this.ChangeDirection(); + if(this.tick>0) { + this.ChangeDirection(); - switch (this.dir) { - case 1: - this.x=this.x+this.tick - break; - case 2: - this.y=this.y-this.tick - break; - case 3: - this.x=this.x-this.tick - break; - case 4: - this.y=this.y+this.tick - break; - } - if(this.drift > 0) { - this.drift-=dt; - }else{ - this.drift = 0; + switch (this.dir) { + case 1: + this.x=this.x+this.tick + break; + case 2: + this.y=this.y-this.tick + break; + case 3: + this.x=this.x-this.tick + break; + case 4: + this.y=this.y+this.tick + break; + } + if(this.drift > 0) { + this.drift-=dt; + }else{ + this.drift = 0; + } } } diff --git a/public_html/js/game.js b/public_html/js/game.js index b871655..bf840e3 100644 --- a/public_html/js/game.js +++ b/public_html/js/game.js @@ -10,7 +10,7 @@ function game() { } cars.forEach((c) => { - c.Update(); + c.Update(dt); if(c.collide(player.x,player.y,player.z)) { net.died(player.id,-1); diff --git a/public_html/js/global.js b/public_html/js/global.js index b3ae65f..2592f07 100644 --- a/public_html/js/global.js +++ b/public_html/js/global.js @@ -16,12 +16,17 @@ let PNJS = [new PNJ(500, 100,0), new PNJ(500, 600,0), new PNJ(200, 700,0)]; -let cars = [new Car(0, 0), - new Car(1, 7), - new Car(1, 13), - new Car(1, 14), - new Car(0, 7), - new Car(0, 15)]; +let cars = [new Car(1, 7), + //new Car(1, 12), + new Car(1, 20), + //new Car(1, 34), + new Car(1, 58), + new Car(0, 0), + //new Car(0, 7), + new Car(0, 18), + //new Car(0, 26), + new Car(0, 45), + new Car(0, 52)]; let portals = [new Portal(250,457,0,500,500,0),//O new Portal(344,758,0,500,500,0), // SO new Portal(1190,211,0,500,500,0),// NE diff --git a/public_html/js/render.js b/public_html/js/render.js index 391235d..975ccce 100644 --- a/public_html/js/render.js +++ b/public_html/js/render.js @@ -125,7 +125,7 @@ class Render { this.RenderPlayer(player,true); cars.forEach((car) => { - this.RenderCar(car.x,car.y,car.angle+(car.drift>0?car.drift/150:0)); + this.RenderCar(car.x,car.y,0,car.angle/*+(car.drift>0?car.drift/150:0)*/); }); players.forEach((player) => { this.RenderPlayer(player,false);