Skip to content

Repo containing scripts to generate the spritesheet for pokedextracker.com

Notifications You must be signed in to change notification settings

pokedextracker/pokesprite

Repository files navigation

pokesprite

Inspired by msikma/pokesprite, this repo is a simplified version that generates a spritesheet and stylesheet that are meant to be used for PokedexTracker.

It currently consists of 6 scripts:

  • rename - This renames icons from msikma/pokesprite to names that can be used by the other scripts. Only use this one if you're copying sprites from that repo. Read the comment at the top of the file for more info.
  • chop - This takes in a JSON file explaining the details of an existing spritesheet, and it chops it up into individual images.
  • scale - This takes any images in the images directory that are greater than the threshold (default 100px) in either dimension (height or width) and either scales it by the provided factor (default 0.5) or to the set dimensions passed in. This script will modify the images in place.
  • trim - This takes all images in the images directory and trims any excess transparency from it. This is so that we can center the sprites based on content (non-transparent pixels) and control the padding through CSS.
  • spritesheet - This takes all the images in the images directory and stitches them together into a single image.
  • scss - This uses the images in the images directory to generate a .scss file that lists classes with the correct positions so the spritesheet can be used.
  • copy - This takes the final outputs (the spritesheet and the .scss file) and copies them into their appropriate location in pokedextracker/pokedextracker.com. It assumes that this repo and that repo are both cloned in the same parent directory. If that is not the case, this script will err.

To run any of them, it's a simple task command:

task rename
task chop -- data.json
task scale
task trim
task spritesheet
task scss
task copy

Setup

Task

Instead of make, this project uses task. It seems to be a bit cleaner for some specific things that we want to do.

You can find instructions on how to install it here.

Go

To have everything working as expected, you need to have a module-aware version of Go installed (v1.11 or greater) and pngcrush.

To install Go, you can do it any way you prefer. We recommend using goenv so that you can use the correct version of Go for different projects depending on .go-version files. In its current state, the v2 beta of goenv can't be installed through brew normally, so you need to fetch from HEAD using the following command:

brew install --HEAD goenv

Note: If you already have a v1 version of goenv installed, you need to uninstall it first.

Once installed, you can go into this projects directory and run the following to install the correct version of Go:

goenv install

pngcrush

pngcrush is required for the spritesheet command. To install it, you can just run the following command:

task setup

About

Repo containing scripts to generate the spritesheet for pokedextracker.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages