1.7.1 • Published 10 months ago

@theatrejs/plugin-aseprite v1.7.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Copyright License Bundle Size (Gzipped) NPM Version

Aseprite Plugin

🛠️ A Plugin for Aseprite exported files.

Installation

npm install @theatrejs/plugin-aseprite --save

Quick Start

⚠️ This example does not include the preloading of assets.

import {Stage} from '@theatrejs/theatrejs';
import * as PLUGIN_ASEPRITE from '@theatrejs/plugin-aseprite';

import asepriteDataHero from './hero-16x16.json';
import asepriteTextureHero from './hero-16x16.png';

const asepriteHero = new PLUGIN_ASEPRITE.Aseprite(asepriteTextureHero, asepriteDataHero);

class Level1 extends Stage {
    onCreate() {
        this.createActor(
            PLUGIN_ASEPRITE.FACTORIES.ActorWithSpritesheet({
                $aseprite: asepriteHero,
                $loop: true,
                $tag: 'idle'
            })
        );
    }
}

With Preloading

import {FACTORIES} from '@theatrejs/theatrejs';
import * as PLUGIN_ASEPRITE from '@theatrejs/plugin-aseprite';

import asepriteDataHero from './hero-16x16.json';
import asepriteTextureHero from './hero-16x16.png';

const asepriteHero = new PLUGIN_ASEPRITE.Aseprite(asepriteTextureHero, asepriteDataHero);

class Level1 extends FACTORIES.StageWithPreloadables([PLUGIN_ASEPRITE.FACTORIES.PreloadableAseprite(asepriteHero)]) {
    onCreate() {
        this.createActor(
            PLUGIN_ASEPRITE.FACTORIES.ActorWithSpritesheet({
                $aseprite: asepriteHero,
                $loop: true,
                $tag: 'idle'
            })
        );
    }
}

Actor With Text

import {FACTORIES} from '@theatrejs/theatrejs';
import * as PLUGIN_ASEPRITE from '@theatrejs/plugin-aseprite';

import asepriteDataFont from './font-16.json';
import asepriteTextureFont from './font-16.png';

const asepriteFont = new PLUGIN_ASEPRITE.Aseprite(asepriteTextureFont, asepriteDataFont);

class Level1 extends FACTORIES.StageWithPreloadables([PLUGIN_ASEPRITE.FACTORIES.PreloadableAseprite(asepriteFont)]) {
    onCreate() {
        this.createActor(
            PLUGIN_ASEPRITE.FACTORIES.ActorWithText({
                $font: asepriteFont,
                $text:
                'First line of text.\n' +
                'Second line of text.'
            })
        );
    }
}

Actor With Text (Advanced Options)

import {FACTORIES} from '@theatrejs/theatrejs';
import * as PLUGIN_ASEPRITE from '@theatrejs/plugin-aseprite';

import asepriteDataFont from './font-16.json';
import asepriteTextureFont from './font-16.png';

const asepriteFont = new PLUGIN_ASEPRITE.Aseprite(asepriteTextureFont, asepriteDataFont);

class Level1 extends FACTORIES.StageWithPreloadables([PLUGIN_ASEPRITE.FACTORIES.PreloadableAseprite(asepriteFont)]) {
    onCreate() {
        this.createActor(
            PLUGIN_ASEPRITE.FACTORIES.ActorWithText({
                $align: 'left',
                $anchor: 'center',
                $font: asepriteFont,
                $heightLines: 16,
                $spacingCharacters: 1,
                $text:
                'First line of text.\n' +
                'Second line of text.'
            })
        );
    }
}

API

1.7.1

10 months ago

1.7.0

10 months ago

1.6.0

10 months ago

1.5.1

11 months ago

1.5.0

11 months ago

1.4.0

11 months ago

1.3.0

12 months ago

1.2.1

12 months ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

2.0.0

1 year ago