Updated sprites and pet logic
@@ -1,9 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
const cat = require('./cat');
|
||||
const maple = require('./maple');
|
||||
|
||||
const PET_ASSETS = {
|
||||
cat
|
||||
cat: maple,
|
||||
maple,
|
||||
legacyCat: cat
|
||||
};
|
||||
|
||||
function getPetAsset(type) {
|
||||
|
||||
135
assets/pets/maple.js
Normal file
@@ -0,0 +1,135 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const { pathToFileURL } = require('url');
|
||||
|
||||
const SHEET_WIDTH = 1536;
|
||||
const SHEET_HEIGHT = 1872;
|
||||
const CELL_WIDTH = 192;
|
||||
const CELL_HEIGHT = 208;
|
||||
const SHEET_URL = pathToFileURL(path.join(__dirname, 'maple', 'spritesheet.webp')).href;
|
||||
|
||||
function cell(row, col, facingBasis) {
|
||||
return {
|
||||
sheetUrl: SHEET_URL,
|
||||
sheetWidth: SHEET_WIDTH,
|
||||
sheetHeight: SHEET_HEIGHT,
|
||||
frameX: col * CELL_WIDTH,
|
||||
frameY: row * CELL_HEIGHT,
|
||||
frameWidth: CELL_WIDTH,
|
||||
frameHeight: CELL_HEIGHT,
|
||||
facingBasis: facingBasis || 'left'
|
||||
};
|
||||
}
|
||||
|
||||
function rowFrames(row, startCol, count, facingBasis) {
|
||||
const frames = [];
|
||||
for (let index = 0; index < count; index += 1) {
|
||||
frames.push(cell(row, startCol + index, facingBasis));
|
||||
}
|
||||
return frames;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
width: 48,
|
||||
height: 52,
|
||||
clips: {
|
||||
idle0: {
|
||||
fps: 1.4,
|
||||
frames: rowFrames(0, 0, 6, 'left')
|
||||
},
|
||||
idle1: {
|
||||
fps: 1.4,
|
||||
frames: rowFrames(6, 0, 6, 'left')
|
||||
},
|
||||
idle2: {
|
||||
fps: 1.4,
|
||||
frames: rowFrames(7, 0, 6, 'left')
|
||||
},
|
||||
idle3: {
|
||||
fps: 1.4,
|
||||
frames: rowFrames(8, 0, 6, 'left')
|
||||
},
|
||||
walkRight: {
|
||||
fps: 4.4,
|
||||
frames: rowFrames(1, 0, 8, 'right')
|
||||
},
|
||||
walkLeft: {
|
||||
fps: 4.4,
|
||||
frames: rowFrames(2, 0, 8, 'left')
|
||||
},
|
||||
inspectLeft: {
|
||||
fps: 2.2,
|
||||
frames: rowFrames(3, 0, 4, 'left')
|
||||
},
|
||||
inspectRight: {
|
||||
fps: 2.2,
|
||||
frames: rowFrames(3, 0, 4, 'left')
|
||||
},
|
||||
pounceLeft: {
|
||||
fps: 4,
|
||||
frames: rowFrames(4, 0, 5, 'left')
|
||||
},
|
||||
pounceRight: {
|
||||
fps: 4,
|
||||
frames: rowFrames(4, 0, 5, 'left')
|
||||
},
|
||||
sleep: {
|
||||
fps: 1,
|
||||
frames: [
|
||||
cell(5, 3, 'left')
|
||||
]
|
||||
},
|
||||
sleepWakeLeft: {
|
||||
fps: 2.6,
|
||||
frames: rowFrames(5, 4, 3, 'left'),
|
||||
nextClip: 'idle0'
|
||||
},
|
||||
sleepWakeRight: {
|
||||
fps: 2.6,
|
||||
frames: rowFrames(5, 4, 3, 'left'),
|
||||
nextClip: 'idle0'
|
||||
},
|
||||
transitionIdleWalkLeft: {
|
||||
fps: 3,
|
||||
frames: rowFrames(2, 0, 3, 'left'),
|
||||
nextClip: 'walkLeft'
|
||||
},
|
||||
transitionIdleWalkRight: {
|
||||
fps: 3,
|
||||
frames: rowFrames(1, 0, 3, 'right'),
|
||||
nextClip: 'walkRight'
|
||||
},
|
||||
transitionIdleSleep: {
|
||||
fps: 2.8,
|
||||
frames: rowFrames(5, 0, 4, 'left'),
|
||||
nextClip: 'sleep'
|
||||
}
|
||||
},
|
||||
transitions: {
|
||||
'idle0->walkLeft': 'transitionIdleWalkLeft',
|
||||
'idle1->walkLeft': 'transitionIdleWalkLeft',
|
||||
'idle2->walkLeft': 'transitionIdleWalkLeft',
|
||||
'idle3->walkLeft': 'transitionIdleWalkLeft',
|
||||
'idle0->walkRight': 'transitionIdleWalkRight',
|
||||
'idle1->walkRight': 'transitionIdleWalkRight',
|
||||
'idle2->walkRight': 'transitionIdleWalkRight',
|
||||
'idle3->walkRight': 'transitionIdleWalkRight',
|
||||
'idle0->sleep': 'transitionIdleSleep',
|
||||
'idle1->sleep': 'transitionIdleSleep',
|
||||
'idle2->sleep': 'transitionIdleSleep',
|
||||
'idle3->sleep': 'transitionIdleSleep',
|
||||
'inspectLeft->walkLeft': 'transitionIdleWalkLeft',
|
||||
'inspectRight->walkRight': 'transitionIdleWalkRight',
|
||||
'sleep->idle0': 'sleepWakeLeft',
|
||||
'sleep->idle1': 'sleepWakeLeft',
|
||||
'sleep->idle2': 'sleepWakeLeft',
|
||||
'sleep->idle3': 'sleepWakeLeft',
|
||||
'sleep->walkLeft': 'sleepWakeLeft',
|
||||
'sleep->walkRight': 'sleepWakeRight',
|
||||
'sleep->inspectLeft': 'sleepWakeLeft',
|
||||
'sleep->inspectRight': 'sleepWakeRight',
|
||||
'sleep->pounceLeft': 'sleepWakeLeft',
|
||||
'sleep->pounceRight': 'sleepWakeRight'
|
||||
}
|
||||
};
|
||||
BIN
assets/pets/maple/frames/maple-r01-c01.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
assets/pets/maple/frames/maple-r01-c02.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
assets/pets/maple/frames/maple-r01-c03.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
assets/pets/maple/frames/maple-r01-c04.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
assets/pets/maple/frames/maple-r01-c05.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
assets/pets/maple/frames/maple-r01-c06.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
assets/pets/maple/frames/maple-r01-c07.png
Normal file
|
After Width: | Height: | Size: 652 B |
BIN
assets/pets/maple/frames/maple-r01-c08.png
Normal file
|
After Width: | Height: | Size: 652 B |
BIN
assets/pets/maple/frames/maple-r02-c01.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
assets/pets/maple/frames/maple-r02-c02.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
assets/pets/maple/frames/maple-r02-c03.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
assets/pets/maple/frames/maple-r02-c04.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
assets/pets/maple/frames/maple-r02-c05.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
assets/pets/maple/frames/maple-r02-c06.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
assets/pets/maple/frames/maple-r02-c07.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
assets/pets/maple/frames/maple-r02-c08.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
assets/pets/maple/frames/maple-r03-c01.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
assets/pets/maple/frames/maple-r03-c02.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
assets/pets/maple/frames/maple-r03-c03.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
assets/pets/maple/frames/maple-r03-c04.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
assets/pets/maple/frames/maple-r03-c05.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
assets/pets/maple/frames/maple-r03-c06.png
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
assets/pets/maple/frames/maple-r03-c07.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
assets/pets/maple/frames/maple-r03-c08.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
assets/pets/maple/frames/maple-r04-c01.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
assets/pets/maple/frames/maple-r04-c02.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
assets/pets/maple/frames/maple-r04-c03.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
assets/pets/maple/frames/maple-r04-c04.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
assets/pets/maple/frames/maple-r04-c05.png
Normal file
|
After Width: | Height: | Size: 823 B |
BIN
assets/pets/maple/frames/maple-r04-c06.png
Normal file
|
After Width: | Height: | Size: 823 B |
BIN
assets/pets/maple/frames/maple-r04-c07.png
Normal file
|
After Width: | Height: | Size: 823 B |
BIN
assets/pets/maple/frames/maple-r04-c08.png
Normal file
|
After Width: | Height: | Size: 823 B |
BIN
assets/pets/maple/frames/maple-r05-c01.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
assets/pets/maple/frames/maple-r05-c02.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
assets/pets/maple/frames/maple-r05-c03.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
assets/pets/maple/frames/maple-r05-c04.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
assets/pets/maple/frames/maple-r05-c05.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
assets/pets/maple/frames/maple-r05-c06.png
Normal file
|
After Width: | Height: | Size: 687 B |
BIN
assets/pets/maple/frames/maple-r05-c07.png
Normal file
|
After Width: | Height: | Size: 687 B |
BIN
assets/pets/maple/frames/maple-r05-c08.png
Normal file
|
After Width: | Height: | Size: 687 B |
BIN
assets/pets/maple/frames/maple-r06-c01.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
assets/pets/maple/frames/maple-r06-c02.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
assets/pets/maple/frames/maple-r06-c03.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
assets/pets/maple/frames/maple-r06-c04.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
assets/pets/maple/frames/maple-r06-c05.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
assets/pets/maple/frames/maple-r06-c06.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
assets/pets/maple/frames/maple-r06-c07.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
assets/pets/maple/frames/maple-r06-c08.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
assets/pets/maple/frames/maple-r07-c01.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
assets/pets/maple/frames/maple-r07-c02.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
assets/pets/maple/frames/maple-r07-c03.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
assets/pets/maple/frames/maple-r07-c04.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
assets/pets/maple/frames/maple-r07-c05.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
assets/pets/maple/frames/maple-r07-c06.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
assets/pets/maple/frames/maple-r07-c07.png
Normal file
|
After Width: | Height: | Size: 807 B |
BIN
assets/pets/maple/frames/maple-r07-c08.png
Normal file
|
After Width: | Height: | Size: 807 B |
BIN
assets/pets/maple/frames/maple-r08-c01.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
assets/pets/maple/frames/maple-r08-c02.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
assets/pets/maple/frames/maple-r08-c03.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
assets/pets/maple/frames/maple-r08-c04.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
assets/pets/maple/frames/maple-r08-c05.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
assets/pets/maple/frames/maple-r08-c06.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
assets/pets/maple/frames/maple-r08-c07.png
Normal file
|
After Width: | Height: | Size: 780 B |
BIN
assets/pets/maple/frames/maple-r08-c08.png
Normal file
|
After Width: | Height: | Size: 780 B |
BIN
assets/pets/maple/frames/maple-r09-c01.png
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
assets/pets/maple/frames/maple-r09-c02.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
assets/pets/maple/frames/maple-r09-c03.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
assets/pets/maple/frames/maple-r09-c04.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
assets/pets/maple/frames/maple-r09-c05.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
assets/pets/maple/frames/maple-r09-c06.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
assets/pets/maple/frames/maple-r09-c07.png
Normal file
|
After Width: | Height: | Size: 775 B |
BIN
assets/pets/maple/frames/maple-r09-c08.png
Normal file
|
After Width: | Height: | Size: 775 B |
6
assets/pets/maple/pet.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"id": "maple",
|
||||
"displayName": "Maple",
|
||||
"description": "A tiny brownish-gray cat, fiercely protective and playful.",
|
||||
"spritesheetPath": "spritesheet.webp"
|
||||
}
|
||||
BIN
assets/pets/maple/spritesheet.webp
Normal file
|
After Width: | Height: | Size: 1.9 MiB |