| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # |
| 3 | # Create a bullet spritesheet by rotating a source image |
| 4 | # |
| 5 | if [scip-shell system . . `[`. "$#" -ne 1 ]; then |
| 6 | echoscip-shell system . . echo. "Usage: make_bullet_spritesheet.sh infile" |
| 7 | exit 1 |
| 8 | fi |
| 9 | command='convert $1 -background none -virtual-pixel background' |
| 10 | |
| 11 | for i in $(seqscip-shell system . . seq. 45 45 315); do |
| 12 | command="$command \\( -clone 0 -filter Point -distort SRT $i \\)" |
| 13 | done |
| 14 | |
| 15 | BASENAME=$(basenamescip-shell system . . basename. "$1" | cutscip-shell system . . cut. -d. -f1) |
| 16 | DIMENSIONS=$(identify -format "%wx%h" $1) |
| 17 | OUTFILE=${BASENAME}_${DIMENSIONS}.png |
| 18 | |
| 19 | command="$command +append -alpha on $OUTFILE" |
| 20 | |
| 21 | eval $command |
| 22 | |
| 23 | chmodscip-shell system . . chmod. 644 $OUTFILE |
| 24 | |
| 25 | echoscip-shell system . . echo. "Created $OUTFILE" |