Factor out AnimatableTile{Factory}

This commit is contained in:
Ian Gulliver
2021-05-11 05:28:20 +00:00
parent 4e65819183
commit 8f76317ccc
16 changed files with 80 additions and 51 deletions

View File

@@ -1,13 +1,9 @@
import { SimpleTile } from './simple_tile.js';
import { TileFactory } from './tile_factory.js';
export class SimpleTileFactory extends TileFactory {
import { AnimatableTileFactory } from './animatable_tile_factory.js';
export class SimpleTileFactory extends AnimatableTileFactory {
constructor(layer_name, width, height, name) {
super(layer_name, width, height);
this.name = name;
this.animations = new Map();
}
add_animation(name, keyframes, options) {
this.animations.set(name, [keyframes, options]);
}
build(tileset) {
return new SimpleTile(this.width, this.height, `images/${tileset}/${this.name}.svg`, this.animations);