Updated sprites and pet logic

This commit is contained in:
2026-05-18 11:56:09 -07:00
parent 4cd0d8c589
commit abf39ce4b8
81 changed files with 658 additions and 50 deletions

View File

@@ -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
View 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'
}
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

View File

@@ -0,0 +1,6 @@
{
"id": "maple",
"displayName": "Maple",
"description": "A tiny brownish-gray cat, fiercely protective and playful.",
"spritesheetPath": "spritesheet.webp"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB