Skip to content

Instantly share code, notes, and snippets.

@maryrosecook
Created January 14, 2011 23:24
Show Gist options
  • Save maryrosecook/780487 to your computer and use it in GitHub Desktop.
Save maryrosecook/780487 to your computer and use it in GitHub Desktop.
// Make a structure to hold all the grid squares
For each grid square
Make a grid square container
// Put all the objects in the right grid square container
For each object in the world
Get the object's x and y coordinates
Determine which grid square the coordinate falls into
Add the object to that grid square container
// Get all the objects that a certain object is colliding with
Get the object's grid square
Return all the other objects in that grid squaresdfjksdjkfkds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment