🛠️ A Plugin for Aseprite exported files.
npm install @theatrejs/plugin-aseprite --save
⚠️ This example does not include the preloading of assets.
import {Stage} from '@theatrejs/theatrejs';
import * as PLUGINASEPRITE from '@theatrejs/plugin-aseprite';
import asepriteDataHero from './hero-16x16.json';
import asepriteTextureHero from './hero-16x16.png';
const asepriteHero = new PLUGINASEPRITE.Aseprite(asepriteTextureHero, asepriteDataHero);
class Level1 extends Stage {
onCreate() {
this.createActor(
PLUGINASEPRITE.FACTORIES.ActorWithSpritesheet({
$aseprite: asepriteHero,
$loop: true,
$tag: 'idle'
})
);
}
}
import {FACTORIES} from '@theatrejs/theatrejs';
import * as PLUGINASEPRITE from '@theatrejs/plugin-aseprite';
import asepriteDataHero from './hero-16x16.json';
import asepriteTextureHero from './hero-16x16.png';
const asepriteHero = new PLUGINASEPRITE.Aseprite(asepriteTextureHero, asepriteDataHero);
class Level1 extends FACTORIES.StageWithPreloadables([PLUGINASEPRITE.FACTORIES.PreloadableAseprite(asepriteHero)]) {
onCreate() {
this.createActor(
PLUGINASEPRITE.FACTORIES.ActorWithSpritesheet({
$aseprite: asepriteHero,
$loop: true,
$tag: 'idle'
})
);
}
}
import {FACTORIES} from '@theatrejs/theatrejs';
import * as PLUGINASEPRITE from '@theatrejs/plugin-aseprite';
import asepriteDataFont from './font-16.json';
import asepriteTextureFont from './font-16.png';
const asepriteFont = new PLUGINASEPRITE.Aseprite(asepriteTextureFont, asepriteDataFont);
class Level1 extends FACTORIES.StageWithPreloadables([PLUGINASEPRITE.FACTORIES.PreloadableAseprite(asepriteFont)]) {
onCreate() {
this.createActor(
PLUGINASEPRITE.FACTORIES.ActorWithText({
$font: asepriteFont,
$text:
'First line of text.\n' +
'Second line of text.'
})
);
}
}
import {FACTORIES} from '@theatrejs/theatrejs';
import * as PLUGINASEPRITE from '@theatrejs/plugin-aseprite';
import asepriteDataFont from './font-16.json';
import asepriteTextureFont from './font-16.png';
const asepriteFont = new PLUGINASEPRITE.Aseprite(asepriteTextureFont, asepriteDataFont);
class Level1 extends FACTORIES.StageWithPreloadables([PLUGINASEPRITE.FACTORIES.PreloadableAseprite(asepriteFont)]) {
onCreate() {
this.createActor(
PLUGINASEPRITE.FACTORIES.ActorWithText({
$align: 'left',
$anchor: 'center',
$font: asepriteFont,
$heightLines: 16,
$spacingCharacters: 1,
$text:
'First line of text.\n' +
'Second line of text.'
})
);
}
}