The Game Object Creator is a Scene plugin that allows you to quickly create many common types of Game Objects and return them. Unlike the Game Object Factory, they are not automatically added to the Scene.
Game Objects directly register themselves with the Creator and inject their own creation methods into the class.
new GameObjectCreator(scene)
name | type | description |
---|---|---|
scene | Phaser.Scene |
The Scene to which this Game Object Factory belongs. |
A reference to the Scene Display List.
A reference to the Scene Event Emitter.
The Scene to which this Game Object Creator belongs.
A reference to the Scene.Systems.
A reference to the Scene Update List.
Creates a new Bitmap Text Game Object and returns it.
Note: This method will only be available if the Bitmap Text Game Object has been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | Phaser.Types.GameObjects.BitmapText.BitmapTextConfig |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new Blitter Game Object and returns it.
Note: This method will only be available if the Blitter Game Object has been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | object |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new Container Game Object and returns it.
Note: This method will only be available if the Container Game Object has been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | object |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new Dynamic Bitmap Text Game Object and returns it.
Note: This method will only be available if the Dynamic Bitmap Text Game Object has been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | Phaser.Types.GameObjects.BitmapText.BitmapTextConfig |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new Graphics Game Object and returns it.
Note: This method will only be available if the Graphics Game Object has been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | object |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new Group Game Object and returns it.
Note: This method will only be available if the Group Game Object has been built into Phaser.
name | type | description |
---|---|---|
config | Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig |
The configuration object this Game Object will use to create itself. |
The Game Object that was created.
Creates a new Image Game Object and returns it.
Note: This method will only be available if the Image Game Object has been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | object |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new Layer Game Object and returns it.
Note: This method will only be available if the Layer Game Object has been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | object |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new Mesh Game Object and returns it.
Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | object |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new Particle Emitter Manager Game Object and returns it.
Note: This method will only be available if the Particles Game Object has been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | object |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new Point Light Game Object and returns it.
Note: This method will only be available if the Point Light Game Object has been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | object |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new Render Texture Game Object and returns it.
Note: This method will only be available if the Render Texture Game Object has been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | Phaser.Types.GameObjects.RenderTexture.RenderTextureConfig |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new Rope Game Object and returns it.
Note: This method will only be available if the Rope Game Object and WebGL support have been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | object |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new Shader Game Object and returns it.
Note: This method will only be available if the Shader Game Object and WebGL support have been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | object |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new Sprite Game Object and returns it.
Note: This method will only be available if the Sprite Game Object has been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | Phaser.Types.GameObjects.Sprite.SpriteConfig |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new Text Game Object and returns it.
Note: This method will only be available if the Text Game Object has been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | Phaser.Types.GameObjects.Text.TextConfig |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new TileSprite Game Object and returns it.
Note: This method will only be available if the TileSprite Game Object has been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | Phaser.Types.GameObjects.TileSprite.TileSpriteConfig |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. When loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing from a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map data. For an empty map, you should specify tileWidth, tileHeight, width & height.
name | type | arguments | description |
---|---|---|---|
config | Phaser.Types.Tilemaps.TilemapConfig | <optional> |
The config options for the Tilemap. |
Creates a new Tween object and returns it.
Note: This method will only be available if Tweens have been built into Phaser.
name | type | description |
---|---|---|
config | object | Phaser.Types.Tweens.TweenBuilderConfig |
The Tween configuration. |
The Tween that was created.
Creates a new Video Game Object and returns it.
Note: This method will only be available if the Video Game Object has been built into Phaser.
name | type | arguments | description |
---|---|---|---|
config | object |
The configuration object this Game Object will use to create itself. |
|
addToScene | boolean | <optional> |
Add this Game Object to the Scene after creating it? If set this argument overrides the |
The Game Object that was created.
Creates a new Zone Game Object and returns it.
Note: This method will only be available if the Zone Game Object has been built into Phaser.
name | type | description |
---|---|---|
config | object |
The configuration object this Game Object will use to create itself. |
The Game Object that was created.
Static method called directly by the Game Object creator functions.
With this method you can register a custom GameObject factory in the GameObjectCreator,
providing a name (factoryType
) and the constructor (factoryFunction
) in order
to be called when you invoke Phaser.Scene.make[ factoryType ] method.
name | type | description |
---|---|---|
factoryType | string |
The key of the factory that you will use to call to Phaser.Scene.make[ factoryType ] method. |
factoryFunction | function |
The constructor function to be called when you invoke to the Phaser.Scene.make method. |
Static method called directly by the Game Object Creator functions.
With this method you can remove a custom Game Object Creator that has been previously
registered in the Game Object Creator. Pass in its factoryType
in order to remove it.
name | type | description |
---|---|---|
factoryType | string |
The key of the factory that you want to remove from the GameObjectCreator. |