summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pokemontools/gfx.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pokemontools/gfx.py b/pokemontools/gfx.py
index 066811a..90d6213 100644
--- a/pokemontools/gfx.py
+++ b/pokemontools/gfx.py
@@ -141,8 +141,9 @@ def condense_tiles_to_map(image, pic=0):
new_tiles += [tile]
# Match the first frame where possible.
- if tile == new_tiles[i % pic]:
- tilemap += [i % pic]
+ this_i = i % pic if pic else i
+ if tile == new_tiles[this_i]:
+ tilemap += [this_i]
else:
tilemap += [new_tiles.index(tile)]