Skip to content

Instantly share code, notes, and snippets.

@clooth
Created August 28, 2012 21:21
Show Gist options
  • Save clooth/3504469 to your computer and use it in GitHub Desktop.
Save clooth/3504469 to your computer and use it in GitHub Desktop.
# Loop through the whole tileset and create rectangles
# for each tile position.
tileIndex = 0
for y in [0..@tilesHigh]
for x in [0..@tilesWide]
@tileRectangles[tileIndex] = new Rectangle(
x * @tileWidth,
y * @tileHeight,
@tileWidth,
@tileHeight
)
tileIndex++
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment