Extend the CC2 tile definition with some custom stuff

This commit is contained in:
Eevee (Evelyn Woods) 2020-09-19 23:32:13 -06:00
parent 9e66bc46bb
commit ddfa7f562a
2 changed files with 26 additions and 2 deletions

View File

@ -6,7 +6,7 @@ import * as dat from './format-dat.js';
import * as format_util from './format-util.js';
import { Level } from './game.js';
import CanvasRenderer from './renderer-canvas.js';
import { Tileset, CC2_TILESET_LAYOUT, TILE_WORLD_TILESET_LAYOUT } from './tileset.js';
import { Tileset, CC2_TILESET_LAYOUT, LL_TILESET_LAYOUT, TILE_WORLD_TILESET_LAYOUT } from './tileset.js';
import TILE_TYPES from './tiletypes.js';
import { random_choice, mk, promise_event, fetch, walk_grid } from './util.js';
@ -1758,7 +1758,7 @@ async function main() {
else if (query.get('tileset') === 'lexy') {
tilesheet.src = 'tileset-lexy.png';
tilesize = 32;
tilelayout = CC2_TILESET_LAYOUT;
tilelayout = LL_TILESET_LAYOUT;
}
else {
tilesheet.src = 'tileset-tworld.png';

View File

@ -534,6 +534,30 @@ export const TILE_WORLD_TILESET_LAYOUT = {
},
};
export const LL_TILESET_LAYOUT = Object.assign({}, CC2_TILESET_LAYOUT, {
// Completed teeth sprites
teeth: Object.assign({}, CC2_TILESET_LAYOUT.teeth, {
north: [[0, 32], [1, 32], [2, 32], [1, 32]],
}),
// Extra player sprites
player: Object.assign({}, CC2_TILESET_LAYOUT.player, {
skating: {
north: [0, 33],
east: [1, 33],
south: [2, 33],
west: [3, 33],
},
forced: 'skating',
burned: {
north: [4, 33],
east: [5, 33],
south: [6, 33],
west: [7, 33],
},
}),
});
export class Tileset {
constructor(image, layout, size_x, size_y) {
this.image = image;