diff --git a/car.js b/car.js index c12e8ee..fa24ed7 100644 --- a/car.js +++ b/car.js @@ -45,8 +45,6 @@ class Car { this.score = 0; this.colour = col; - - this.checkpointsReached = 0; } draw() { diff --git a/checkpoint.js b/checkpoint.js deleted file mode 100644 index 0ba837e..0000000 --- a/checkpoint.js +++ /dev/null @@ -1,13 +0,0 @@ -class Checkpoint { - constructor(pos) { - this.posA = pos[0]; - this.posB = pos[1]; - } - - draw() { - push(); - stroke(0, 255, 0); - line(this.posA.x, this.posA.y, this.posB.x, this.posB.y); - pop(); - } -} diff --git a/index.html b/index.html index a26d103..4d89ea2 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,6 @@ - diff --git a/racetrack.js b/racetrack.js index 4a0cdac..8357263 100644 --- a/racetrack.js +++ b/racetrack.js @@ -1,8 +1,7 @@ class RaceTrack { - constructor(innerPos, outerPos, checkpointsPos) { + constructor(innerPos, outerPos) { this.innerWalls = []; this.outerWalls = []; - this.checkpoints = []; for (let i = 0; i < innerPos.length; i++) { this.innerWalls.push(new Wall(innerPos[i])); @@ -11,10 +10,6 @@ class RaceTrack { for (let i = 0; i < outerPos.length; i++) { this.outerWalls.push(new Wall(outerPos[i])); } - - for (let i = 0; i < checkpointsPos.length; i++) { - this.checkpoints.push(new Checkpoint(checkpointsPos[i])); - } } draw() { @@ -25,9 +20,5 @@ class RaceTrack { for (let i = 0; i < this.outerWalls.length; i++) { this.outerWalls[i].draw(); } - - for (let i = 0; i < this.checkpoints.length; i++) { - this.checkpoints[i].draw(); - } } } diff --git a/sketch.js b/sketch.js index bee088a..cd5f74a 100644 --- a/sketch.js +++ b/sketch.js @@ -1,9 +1,3 @@ -// Amount of checkpoints reached is the same as the index of the array of -// checkpoints. This means that you only have to figure out if the car is -// colliding with one of the checkpoints at a time, and that also means that -// it's impossible for it to accidentally count twice or count wrong - - // The amount of cars, the amount of frames the direction lags behind the // rotation (used for drifting), and the positions of the walls of the track let amount = 256; @@ -48,7 +42,7 @@ function setup() { defineTrack(); - raceTrack = new RaceTrack(innerPos, outerPos, checkpoints); + raceTrack = new RaceTrack(innerPos, outerPos); makeElements(); @@ -353,8 +347,4 @@ function defineTrack() { [createVector(275, 10), createVector(335, 25)], [createVector(335, 25), createVector(400, 80)], ]; - - checkpoints = [ - [createVector(350, 150), createVector(400, 80)] - ] }