use witch sprites by default, elide others

This commit is contained in:
Colin McMillen 2019-10-29 14:57:48 -04:00
parent 3011e5eaab
commit f9b11e5833
3 changed files with 14 additions and 10 deletions

14
main.js
View File

@ -378,7 +378,7 @@ class Player {
for (const name in spritesheet_json) { for (const name in spritesheet_json) {
this.spriteNames_.push(name); this.spriteNames_.push(name);
} }
this.spriteNamesIdx_ = 8; this.spriteNamesIdx_ = 0;
} }
get spriteName() { get spriteName() {
@ -395,24 +395,24 @@ class Player {
moveLeft() { moveLeft() {
this.orientation = Orientation.LEFT; this.orientation = Orientation.LEFT;
this.x -= 2; this.x -= 2;
if (this.x < -4) { if (this.x < -2) {
this.x = -4; this.x = -2;
} }
} }
moveRight() { moveRight() {
this.orientation = Orientation.RIGHT; this.orientation = Orientation.RIGHT;
this.x += 2; this.x += 2;
if (this.x > SNES_WIDTH - 21) { if (this.x > SNES_WIDTH - 23) {
this.x = SNES_WIDTH - 21; this.x = SNES_WIDTH - 23;
} }
} }
moveUp() { moveUp() {
this.orientation = Orientation.UP; this.orientation = Orientation.UP;
this.y -= 2; this.y -= 2;
if (this.y < -7) { if (this.y < -2) {
this.y = -7; this.y = -2;
} }
} }

View File

@ -274,8 +274,11 @@ def check_sprites(metadata):
json.dump(metadata, f, sort_keys=True, indent=2) 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) 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 max_height = 0
total_width = 0 total_width = 0
for sprite_name, sprite in sprites.items(): for sprite_name, sprite in sprites.items():
@ -343,7 +346,8 @@ def main(args):
print('need FILENAME_BASE') print('need FILENAME_BASE')
return return
filename_base = args[1] filename_base = args[1]
stitch_sprites(metadata, filename_base) sprite_names = args[2:]
stitch_sprites(metadata, filename_base, sprite_names)
else: else:
print('unrecognized command "%s"' % command) print('unrecognized command "%s"' % command)

View File

@ -4,6 +4,6 @@ cd $SNEJ_ROOT
echo "deploying to $1" echo "deploying to $1"
mkdir -p bundle/ 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 scp -r index.html main.js bundle/ $1
echo "success!" echo "success!"