Skip to content

Commit f6f70d3

Browse files
committed
Added game.add.plugin, a shotcut for game.plugins.add
1 parent 6ce1831 commit f6f70d3

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/gameobjects/GameObjectFactory.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,25 @@ Phaser.GameObjectFactory.prototype = {
411411

412412
return filter;
413413

414+
},
415+
416+
/**
417+
* Add a new Plugin into the PluginManager.
418+
* The Plugin must have 2 properties: game and parent. Plugin.game is set to ths game reference the PluginManager uses, and parent is set to the PluginManager.
419+
*
420+
* @method Phaser.GameObjectFactory#plugin
421+
* @param {object|Phaser.Plugin} plugin - The Plugin to add into the PluginManager. This can be a function or an existing object.
422+
* @param {...*} parameter - Additional parameters that will be passed to the Plugin.init method.
423+
* @return {Phaser.Plugin} The Plugin that was added to the manager.
424+
*/
425+
plugin: function (plugin) {
426+
427+
return this.game.plugins.add(plugin);
428+
414429
}
415430

431+
432+
416433
};
417434

418435
Phaser.GameObjectFactory.prototype.constructor = Phaser.GameObjectFactory;

0 commit comments

Comments
 (0)