Jump to content

Phaser 3 nine slice plugin!


jdotr
 Share

Recommended Posts

Hey All!

I needed to display some dialog boxes in a recent game and the old 9-slice plugin wasn't ported to v3 yet so I wrote one (github repo). I have a live demo here and a gif of it in use follows. Would love to see this get some use outside of my projects so give it a spin. I'm pretty active on the discord and try to check in here weekly so feel free to ping if you have any questions!

9slice-demo.gif.aec8b2b888294055b8488fa0677c7808.gif

 

Happy hacking!

Link to comment
Share on other sites

  • 2 months later...
On 6/20/2018 at 8:32 AM, jdotr said:

Hey All!

I needed to display some dialog boxes in a recent game and the old 9-slice plugin wasn't ported to v3 yet so I wrote one (github repo). I have a live demo here and a gif of it in use follows. Would love to see this get some use outside of my projects so give it a spin. I'm pretty active on the discord and try to check in here weekly so feel free to ping if you have any questions!

9slice-demo.gif.aec8b2b888294055b8488fa0677c7808.gif

 

Happy hacking!

@jdotr I am trying to use this plugin in my game. Getting the following error: Uncaught ReferenceError: NineSlicePlugin is not defined. 
My code is look like this.

    <script
  type="text/javascript"
  src="https://github.com/jdotrjs/phaser3-nineslice/releases/download/v0.3.7/nineslice.js"
></script>
var conf = {
  type: Phaser.AUTO,
  width: window.innerWidth,
  height: window.innerHeight,
  backgroundColor: 0x57407c,
  plugins: {
    global: [ NineSlicePlugin.DefaultCfg ],
  },
  scene: [gameScene]
};

game = new Phaser.Game(conf);
let gameScene = new Phaser.Scene('Game');

gameScene.create = function () {

    this.dlg = this.add.nineslice(
        110, 110,   // this is the starting x/y location
        340, 240,   // the width and height of your object
        'dlgLarge', // a key to an already loaded image
        88,         // the width and height to offset for a corner slice
        24          // (optional) pixels to offset when computing the safe usage area
      )
   };
Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...

Thanks for making this! I'm trying to use it with Phaser 3.1.16 (my code is very similar to the example code in your demo) and an error (t.save is not a function) popped up. It seems that error was fixed in a previous build, but maybe only for earlier Phaser 3 version?

 

EDIT: Just update to latest phaser and plugin, and that works fine! Thanks again for an excellent plugin. 

Edited by Frederik
Issue obsolete
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...