diff options
Diffstat (limited to 'cars/js/main.js')
| -rw-r--r-- | cars/js/main.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/cars/js/main.js b/cars/js/main.js index 010a278..6e551f2 100644 --- a/cars/js/main.js +++ b/cars/js/main.js @@ -72,12 +72,12 @@ class Wall { this.width = width / 36; this.length = this.width * 2; this.isAccelerating = false; - this.rotation = 0; + this.rotation = 0; // If you set this to 100, it goes wack lmao 9/15/2019 this.color = paintColor; this.history = []; const options = { density: 0.01, - friction: 0.2, + friction: 0.0, // Usually 0.2 but Jared wanted to move easier 9/15/2019 mass: 50 }; this.body = Bodies.rectangle( @@ -205,7 +205,7 @@ class Wall { let engine; let world; - const exaustClouds = 25; + const exaustClouds = 25; // Set this to anything above 50, it goes wild 9/15/2019 let car; let computerCar; let ball; @@ -247,19 +247,21 @@ class Wall { } function keyReleased() { - if (keyCode == UP_ARROW) { + if (keyCode == 87) { // UP_ARROW car.accelerating(false); - } else if (keyCode == RIGHT_ARROW || keyCode == LEFT_ARROW) { + } else if (keyCode == 68 || keyCode == 65) { // RIGHT_ARROW, LEFT_ARROW car.rotate(0); } } + // TODO: Add multiple key layout functionality, eg. both WASD and arrow keys. + function keyPressed() { - if (keyCode == RIGHT_ARROW) { + if (keyCode == 68) { // RIGHT_ARROW car.rotate(PI / 72); - } else if (keyCode == LEFT_ARROW) { + } else if (keyCode == 65) { // LEFT_ARROW car.rotate(-PI / 72); - } else if (keyCode == UP_ARROW) { + } else if (keyCode == 87) { // UP_ARROW car.accelerating(true); } } |