Skip to content

Instantly share code, notes, and snippets.

@joshblack
Last active January 18, 2016 18:11
Show Gist options
  • Save joshblack/0a2efd519a16f0dfdece to your computer and use it in GitHub Desktop.
Save joshblack/0a2efd519a16f0dfdece to your computer and use it in GitHub Desktop.
/**
* Given two item objects with the following shape:
*
* {
* x: number,
* y: number,
* width: number,
* height: number
* }
*
* where (x, y) denotes the position of the item's top-left corner
* with respect to the top left area of the screen, and width and
* height correspond to the dimensions of the item,
*
* Write a function, `collides`, that takes in two items and returns a
* boolean indicating if the two items overlap.
*/
/**
* Determine if two items overlap
*
* @param {Item} l1
* @param {Item} l2
* @return {boolean}
*/
function collides(l1, l2) {
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment