UNPKG

phaser

Version:

A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers from the team at Phaser Studio Inc.

29 lines (26 loc) 1.15 kB
/** * @author Richard Davey <rich@phaser.io> * @author Felipe Alfonso <@bitnenfer> * @copyright 2013-2025 Phaser Studio Inc. * @license {@link https://opensource.org/licenses/MIT|MIT License} */ var Container = require('./Container'); var GameObjectFactory = require('../GameObjectFactory'); /** * Creates a new Container Game Object and adds it to the Scene. * * Note: This method will only be available if the Container Game Object has been built into Phaser. * * @method Phaser.GameObjects.GameObjectFactory#container * @since 3.4.0 * * @param {number} [x=0] - The horizontal position of this Game Object in the world. * @param {number} [y=0] - The vertical position of this Game Object in the world. * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to this Container. * * @return {Phaser.GameObjects.Container} The Game Object that was created. */ GameObjectFactory.register('container', function (x, y, children) { return this.displayList.add(new Container(this.scene, x, y, children)); });