LynxJam2023 - day 4
Today I finally took the time to optimize the way to define sprites.
Actually, you have to write, for EACH sprite, this kind of line of the main makefile
src/gfx/hero1_01.spr:src/gfx/game_assets.bmp $(SPRPCK) -s4 -p2 -t6 -o128010 -S016022 -a010000 -r001001 $< $(basename $@)
If your sprites are loaded from standalone bitmap, the process is easier but if you're using a tileset, it takes hours to get sprite position, size and anchor using any image editor.
And if you ever update the source tileset, you have to restart !
For this game, the required tileset is made of 200+ sprites so I had to find another way.
I don't remember how and where, but I recently learnt about the "slice" feature of Aseprite, mainly used to support patch9 on Unity.
I was reading the doc about it and it explains how you can export the data on a json file.
I'm not a python fan but it supports json natively so I gave it a go.
At first, I was only planning to parse the file and extract some values...but it ran so smoothly that some hours later, I was able to convert the JSON to a makefile!
It allowed me to clean the main makefile which was a mess full of sprites definition.
So, if you're interested :
Edit your tileset under Aseprite
Export the json on Export spritesheet
Add it with the tileset in BMP format (required by sprpck) on your source folder
Add the python script on makefile path
Edit the 2 vars on top of the script (segment and sprpck)
Update your makefile
assets_makefiles=src/game_assets.mk all: $(assets_makefiles) %.mk:%.json python3 convert.py -a $(basename $@).bmp include src/game_assets.mk
This will convert the JSON to a makefile
Of course, sprite will only be generated if requested to be linked to the rom.
Get Hero Dust
Hero Dust
Mini First person Dungeon Explorer for Atari Lynx
Status | Released |
Author | KanedaFr |
Genre | Role Playing |
More posts
- LynxJam2023 - day 11Dec 09, 2023
- LynxJam2023 - day 10Dec 07, 2023
- LynxJam2023 - day 9Dec 06, 2023
- LynxJam2023 - day 5Dec 01, 2023
- LynxJam2023 - day 3Nov 29, 2023
- LynxJam2023 - day 2Nov 28, 2023
- LynxJam2023 - day 1Nov 28, 2023
- LynxJam2023 - day 0Nov 28, 2023
Leave a comment
Log in with itch.io to leave a comment.