Bird/Pipe collision assumes the bird has a square shape, when in reality we should be applying circle collision.
Here is a snippet from the current Pipe/bird collision method.
This method returns true when the bird is colliding with a Pipe.
|
isColliding(bird) { |
|
return ( |
|
wnx / 2 > this.x - 3 && |
|
wnx / 2 < this.x + this.width + 3 && |
|
(bird.y < this.y - this.gapSize + 3 || |
|
bird.y > this.y - 3) |
|
); |
|
} |
NOTE:
Ideally we would move this method in the Bird class, and implement a system tracking the nearest Pipe instance. Only 1 Pipe instance should check collision at a time as mentionned in #2
Bird/Pipe collision assumes the bird has a square shape, when in reality we should be applying circle collision.
Here is a snippet from the current Pipe/bird collision method.
This method returns true when the bird is colliding with a Pipe.
flappy-bird/public/classes/pipe.js
Lines 33 to 40 in d18635d
NOTE:
Ideally we would move this method in the
Birdclass, and implement a system tracking the nearestPipeinstance. Only 1Pipeinstance should check collision at a time as mentionned in #2