Skip to content

Instantly share code, notes, and snippets.

@evilpaul-atebit
Created December 11, 2018 20:05
collide(typeA, typeB) {
// Collide every object of typeA against every object of typeB
this.objectLists[typeA].forEach(objectA => {
this.objectLists[typeB].forEach(objectB => {
if (isColliding(objectA, objectB)) {
// Notify both objects of collision
objectA.onCollision();
objectB.onCollision();
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment