Skip to content

Instantly share code, notes, and snippets.

@zeffii
Created April 19, 2017 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/48b8c7c761e43c4e74a5b4b754329ae5 to your computer and use it in GitHub Desktop.
Save zeffii/48b8c7c761e43c4e74a5b4b754329ae5 to your computer and use it in GitHub Desktop.
2d grid
def get_location(i):
items_wide = 40
offset_x = 5
offset_y = 5
x = offset_x * (i % items_wide)
y = offset_y * math.floor(i / items_wide)
return [x, y]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment