koreezgames / phaser3-ninepatch-plugin

Nine Patch plugin for Phaser3!
MIT License
71 stars 3 forks source link

NinePatch is not defined #32

Open DannyT opened 4 years ago

DannyT commented 4 years ago

I'm trying to use the constructor method as per the readme:

//Add an nineslice image with an texture atlas
var ninePatch = new NinePatch(
    this, // Phaser.Scene
    150, // x position
    100, // y position
    200, // expected width
    100, // expected height
    "buttons", // atlas key
    "btn_clean.png", // Image frame
    {
        top: 20, // Amount of pixels for top
        bottom: 23, // Amount of pixels for bottom
        left: 27, // Amount of pixels for left
        right: 28 // Amount of pixels for right
    }
);
this.add.existing(ninePatch);

However I'm getting NinePatch is not defined.

The this.make and this.add methods work fine so I'm assuming I need to import the class somewhere or similar?

jonchun commented 4 years ago

This is how I do it: import { NinePatchPlugin, NinePatch } from "@koreez/phaser3-ninepatch";

DannyT commented 4 years ago

@Jonchun thanks, can you also share what your plugins config looks like?