diff --git a/examples/neuroevolution-flappybird/bird.js b/examples/neuroevolution-flappybird/bird.js index 2cccc5b..2cfa5db 100644 --- a/examples/neuroevolution-flappybird/bird.js +++ b/examples/neuroevolution-flappybird/bird.js @@ -62,7 +62,7 @@ class Bird { let closest = null; let record = Infinity; for (let i = 0; i < pipes.length; i++) { - let diff = pipes[i].x - this.x; + let diff = pipes[i].x - this.x + pipes[i].w; if (diff > 0 && diff < record) { record = diff; closest = pipes[i]; @@ -111,4 +111,4 @@ class Bird { // Every frame it is alive increases the score this.score++; } -} \ No newline at end of file +}