Skip to content

Instantly share code, notes, and snippets.

@securas
Created August 25, 2021 08:15
Show Gist options
  • Save securas/0433a604dc97b152fdc0896c0339ed31 to your computer and use it in GitHub Desktop.
Save securas/0433a604dc97b152fdc0896c0339ed31 to your computer and use it in GitHub Desktop.
# Example of a makefile to bulk export aseprite art onto a game.
# For windows, it is necessary to install some version of make such as:
# http://gnuwin32.sourceforge.net/packages/make.htm
#
# Details and specialized use of make are beyond this example. That's
# a whole different can of worms... Here I'm using the most simple of
# simples but any experts looking at this are welcome to improve.
# This assumes that all the pics are placed within this folder. Subfolders for each pic can be used but this was
# a game jam game so I just placed everything in the same folder.
TARGET := ../game/assets/
.PHONY = all
ASEPRITE := C:/Program Files (x86)/Steam/steamapps/common/Aseprite/Aseprite.exe
# TODO: add spikes, swinging lights
all: \
$(TARGET)player.png \
$(TARGET)player_dust.png \
$(TARGET)spritesheet.png \
$(TARGET)background_sky.png \
$(TARGET)explosion_particles.png \
$(TARGET)spider_enemy.png \
$(TARGET)flying_enemy.png \
$(TARGET)start_screen_background.png \
# Check the ASEPRITE CLI interface for help on the commands. Otherwise google is your friend.
# In this case, the aseprite animation is exported as a spritesheet. width and height may be replaced with row and column counts
$(TARGET)player.png: player.aseprite
$(ASEPRITE) -b player.aseprite -sheet $(TARGET)player.png --sheet-width 128 --sheet-height 128
# In this case, the aseprite animation is exported as a spritesheet. width and height may be replaced with row and column counts
$(TARGET)player_dust.png: player_dust.aseprite
$(ASEPRITE) -b player_dust.aseprite -sheet $(TARGET)player_dust.png --sheet-width 192 --sheet-height 96
# This just saves a single image as a png
$(TARGET)spritesheet.png: spritesheet.aseprite
$(ASEPRITE) -b spritesheet.aseprite --save-as $(TARGET)spritesheet.png
# In this case, each layer of the original aseprite file is saved as a different file to make a parallax background
$(TARGET)background_sky.png: background.aseprite
"$(ASEPRITE)" -b --layer "Layer 1" background.aseprite -sheet $(TARGET)background_clouds_front.png
"$(ASEPRITE)" -b --layer "Layer 2" background.aseprite -sheet $(TARGET)background_clouds_back.png
"$(ASEPRITE)" -b --layer "sky" background.aseprite -sheet $(TARGET)background_sky.png
# In this case, the aseprite animation is exported as a spritesheet. width and height may be replaced with row and column counts
$(TARGET)explosion_particles.png: explosion_particles.aseprite
$(ASEPRITE) -b explosion_particles.aseprite -sheet $(TARGET)explosion_particles.png --sheet-width 256 --sheet-height 128
# In this case, the final image depends on two aseprite files - Two versions of an enemy with different colors
$(TARGET)spider_enemy.png: spider_enemy.aseprite spider_enemy_2.aseprite
$(ASEPRITE) -b spider_enemy.aseprite -sheet $(TARGET)spider_enemy.png --sheet-width 128 --sheet-height 128
$(ASEPRITE) -b spider_enemy_2.aseprite -sheet $(TARGET)spider_enemy_2.png --sheet-width 128 --sheet-height 128
# Same as before
$(TARGET)flying_enemy.png: flying_enemy.aseprite flying_enemy_2.aseprite
$(ASEPRITE) -b flying_enemy.aseprite -sheet $(TARGET)flying_enemy.png --sheet-width 128 --sheet-height 32
$(ASEPRITE) -b flying_enemy_2.aseprite -sheet $(TARGET)flying_enemy_2.png --sheet-width 128 --sheet-height 32
# In this case, each layer of the original aseprite file is saved as a different file to make a parallax background
$(TARGET)start_screen_background.png: start_screen.aseprite
"$(ASEPRITE)" -b --layer "title" start_screen.aseprite -sheet $(TARGET)start_screen_title.png
"$(ASEPRITE)" -b --layer "actor" start_screen.aseprite -sheet $(TARGET)start_screen_actor.png
"$(ASEPRITE)" -b --layer "background" start_screen.aseprite -sheet $(TARGET)start_screen_background.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment