How to use plugins? (Board plugin by Rex)

Here is a demo of using rexBoard plugin.
To use rexBoard plugin in your project, try these steps:

  1. Get minify source code from here, or here
  2. Import rexBoard:
    • If you don’t use webpack, try include this minify rexBoard file by <script> tag, like that demo does.
    • If you use webpack, try include the rexBoard module by
      import RexBoardPlugin from path
      
  3. Install rexBoard plugin:
    • If you don’t use webpack, try install plugin by
      plugins: {
            scene: [{
                key: 'rexBoard',
                plugin: rexboardplugin,
                mapping: 'rexBoard'
            }]
      }
      
      the value of plugin property ought to be rexboardplugin, see that demo, line 135-141
    • If you use webpack, try install plugin by
      plugins: {
            scene: [{
                key: 'rexBoard',
                plugin: RexBoardPlugin,
                mapping: 'rexBoard'
            }]
      }
      
      the value of plugin property is equal to the import name in step 2.

Here is another demo of using rexBoard plugin, which install rexBoard in preload stage. See line 13-17

this.load.scenePlugin({
    key: 'rexboardplugin',
    url: 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/plugins/dist/rexboardplugin.min.js',
    sceneKey: 'rexBoard'
});       
3 Likes