Browse Source

assets.py: output a full JS file that can be sourced directly

main
Colin McMillen 5 years ago
parent
commit
c82e19470c
  1. 4
      scripts/assets.py

4
scripts/assets.py

@ -304,10 +304,12 @@ def stitch_sprites(metadata, filename_base):
image_filename = os.path.expanduser(filename_base) + '.png'
print('saving image to', image_filename)
pygame.image.save(output, image_filename)
json_filename = os.path.expanduser(filename_base) + '.json'
json_filename = os.path.expanduser(filename_base) + '.js'
print('saving json to', json_filename)
with open(json_filename, 'w') as json_file:
json_file.write(' const spritesheet_json = ')
json.dump(output_json, json_file, sort_keys=True, indent=2)
json_file.write(';')
def main(args):

Loading…
Cancel
Save