From f9b11e5833602ed4ba16d5af8ac20cd4ee650208 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Tue, 29 Oct 2019 14:57:48 -0400 Subject: [PATCH] use witch sprites by default, elide others --- main.js | 14 +++++++------- scripts/assets.py | 8 ++++++-- scripts/deploy.sh | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/main.js b/main.js index 9b60a4b..20cc6b1 100644 --- a/main.js +++ b/main.js @@ -378,7 +378,7 @@ class Player { for (const name in spritesheet_json) { this.spriteNames_.push(name); } - this.spriteNamesIdx_ = 8; + this.spriteNamesIdx_ = 0; } get spriteName() { @@ -395,24 +395,24 @@ class Player { moveLeft() { this.orientation = Orientation.LEFT; this.x -= 2; - if (this.x < -4) { - this.x = -4; + if (this.x < -2) { + this.x = -2; } } moveRight() { this.orientation = Orientation.RIGHT; this.x += 2; - if (this.x > SNES_WIDTH - 21) { - this.x = SNES_WIDTH - 21; + if (this.x > SNES_WIDTH - 23) { + this.x = SNES_WIDTH - 23; } } moveUp() { this.orientation = Orientation.UP; this.y -= 2; - if (this.y < -7) { - this.y = -7; + if (this.y < -2) { + this.y = -2; } } diff --git a/scripts/assets.py b/scripts/assets.py index 7386d88..4e7e9ba 100755 --- a/scripts/assets.py +++ b/scripts/assets.py @@ -274,8 +274,11 @@ def check_sprites(metadata): json.dump(metadata, f, sort_keys=True, indent=2) -def stitch_sprites(metadata, filename_base): +def stitch_sprites(metadata, filename_base, sprite_names=None): sprites = get_named_sprites(metadata) + if sprite_names: + sprites = dict([(x[0], x[1]) + for x in sprites.items() if x[0] in sprite_names]) max_height = 0 total_width = 0 for sprite_name, sprite in sprites.items(): @@ -343,7 +346,8 @@ def main(args): print('need FILENAME_BASE') return filename_base = args[1] - stitch_sprites(metadata, filename_base) + sprite_names = args[2:] + stitch_sprites(metadata, filename_base, sprite_names) else: print('unrecognized command "%s"' % command) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 693c720..07d297d 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -4,6 +4,6 @@ cd $SNEJ_ROOT echo "deploying to $1" mkdir -p bundle/ -python3 scripts/assets.py stitch-sprites $SNEJ_ROOT/bundle/spritesheet +python3 scripts/assets.py stitch-sprites $SNEJ_ROOT/bundle/spritesheet witch_gray witch_green scp -r index.html main.js bundle/ $1 echo "success!"