Skip to content

Circle collision for Bird #1

Description

@matiasvlevi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions