Advertisement
Guest User

gen_automaps.py

a guest
Feb 18th, 2016
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. import Image
  2. import os.path
  3.  
  4. fpx = 64
  5. # max +/- Y coordinate
  6. fy = 40
  7. # max +/- X coordinate
  8. fx = 90
  9. # ~max number of maps.
  10. mn = 60
  11. hasmaps = False
  12.  
  13. for n in range(0, mn):
  14.   hasmaps = False
  15.   new_im = Image.new('RGB', (fpx*fx*2, fpx*fy*2))
  16.   for y in range(-fy, fy):
  17.       for x in range(-fx, fx):
  18.           # Look for files one directory up.
  19.           fname = "../%d_%d_%d.bmp"%(n, x, y)
  20.           if os.path.isfile(fname):
  21.               hasmaps = True
  22.               im = Image.open(fname)
  23.               new_im.paste(im, ((x+fx)*fpx, (y+fy)*fpx))
  24.   if hasmaps:
  25.     new_im.save("map_%d.bmp"%n, 'BMP')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement