Skip to content

Commit

Permalink
Remove checkpoints
Browse files Browse the repository at this point in the history
Removing checkpoints from the neuro-evolution branch, as development on them is going to continue on the checkpoints branch
  • Loading branch information
FintasticMan committed Jan 19, 2021
1 parent ce60972 commit 7d1a78d
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 37 deletions.
2 changes: 0 additions & 2 deletions car.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class Car {
this.score = 0;

this.colour = col;

this.checkpointsReached = 0;
}

draw() {
Expand Down
13 changes: 0 additions & 13 deletions checkpoint.js

This file was deleted.

1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<script defer src="lib/matrix.js"></script>
<script defer src="racetrack.js"></script>
<script defer src="wall.js"></script>
<script defer src="checkpoint.js"></script>
<script defer src="ray.js"></script>
<script defer src="car.js"></script>
<script defer src="sketch.js"></script>
Expand Down
11 changes: 1 addition & 10 deletions racetrack.js
Original file line number Diff line number Diff line change
@@ -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]));
Expand All @@ -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() {
Expand All @@ -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();
}
}
}
12 changes: 1 addition & 11 deletions sketch.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -48,7 +42,7 @@ function setup() {

defineTrack();

raceTrack = new RaceTrack(innerPos, outerPos, checkpoints);
raceTrack = new RaceTrack(innerPos, outerPos);

makeElements();

Expand Down Expand Up @@ -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)]
]
}

0 comments on commit 7d1a78d

Please sign in to comment.