phaser - v4.0.0-rc.4
    Preparing search index...

    The Game Object Creator is a Scene plugin that allows you to quickly create many common types of Game Objects and return them using a configuration object, rather than having to specify a limited set of parameters such as with the GameObjectFactory.

    Game Objects made via this class are automatically added to the Scene and Update List unless you explicitly set the add property in the configuration object to false.

    Index

    Constructors

    Properties

    displayList: DisplayList

    A reference to the Scene Display List.

    events: EventEmitter

    A reference to the Scene Event Emitter.

    scene: Scene

    The Scene to which this Game Object Creator belongs.

    systems: Systems

    A reference to the Scene.Systems.

    updateList: UpdateList

    A reference to the Scene Update List.

    Methods

    • 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.

      Parameters

      • config: BitmapTextConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns GameObjects.BitmapText

    • 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.

      Parameters

      • config: SpriteConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns Blitter

    • Creates a new CaptureFrame Game Object and returns it.

      Note: This method will only be available if the CaptureFrame Game Object has been built into Phaser.

      Parameters

      • config: SpriteConfig

        The configuration object this Game Object will use to create itself. CaptureFrame only uses the key, visible, depth, and add properties.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns CaptureFrame

    • 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.

      Parameters

      • config: ContainerConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns GameObjects.Container

    • 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.

      Parameters

      • config: BitmapTextConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns DynamicBitmapText

    • 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.

      Parameters

      • Optionalconfig: Options

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns GameObjects.Graphics

    • 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.

      Parameters

      • config: SpriteConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns GameObjects.Image

    • 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.

      Parameters

      • config: SpriteConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns Layer

    • Creates a new Nine Slice Game Object and returns it.

      Note: This method will only be available if the Nine Slice Game Object and WebGL support have been built into Phaser.

      Parameters

      • config: NineSliceConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns GameObjects.NineSlice

    • Creates a new Particle Emitter Game Object and returns it.

      Prior to Phaser v3.60 this function would create a ParticleEmitterManager. These were removed in v3.60 and replaced with creating a ParticleEmitter instance directly. Please see the updated function parameters and class documentation for more details.

      Note: This method will only be available if the Particles Game Object has been built into Phaser.

      Parameters

      • config: ParticleEmitterCreatorConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns ParticleEmitter

    • 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.

      Parameters

      • config: object

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns PointLight

    • 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.

      A Render Texture is a combination of Dynamic Texture and an Image Game Object, that uses the Dynamic Texture to display itself with.

      A Dynamic Texture is a special texture that allows you to draw textures, frames and most kind of Game Objects directly to it.

      You can take many complex objects and draw them to this one texture, which can then be used as the base texture for other Game Objects, such as Sprites. Should you then update this texture, all Game Objects using it will instantly be updated as well, reflecting the changes immediately.

      It's a powerful way to generate dynamic textures at run-time that are WebGL friendly and don't invoke expensive GPU uploads on each change.

      Parameters

      • config: RenderTextureConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns GameObjects.RenderTexture

    • 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.

      Parameters

      • config: RopeConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns GameObjects.Rope

    • 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.

      Parameters

      • config: ShaderConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns GameObjects.Shader

    • 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.

      Parameters

      • config: SpriteConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object. Default true.

      Returns GameObjects.Sprite

    • Creates a new SpriteGPULayer Game Object and returns it.

      Note: This method will only be available if the SpriteGPULayer Game Object has been built into Phaser.

      Parameters

      • config: SpriteGPULayerConfig

        The configuration object this Game Object will use to create itself. Must include { size: number }.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns GameObjects.SpriteGPULayer

    • Creates a new Stamp Game Object and returns it.

      Note: This method will only be available if the Stamp Game Object has been built into Phaser.

      Parameters

      • config: SpriteConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns Stamp

    • 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.

      Parameters

      • config: TextConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns GameObjects.Text

    • 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.

      Parameters

      • Optionalconfig: TilemapConfig

        The config options for the Tilemap.

      Returns Tilemaps.Tilemap

    • 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.

      Parameters

      • config: TileSpriteConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns GameObjects.TileSprite

    • 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.

      Parameters

      • config: VideoConfig

        The configuration object this Game Object will use to create itself.

      • OptionaladdToScene: boolean

        Add this Game Object to the Scene after creating it? If set this argument overrides the add property in the config object.

      Returns GameObjects.Video

    • 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.

      Parameters

      • 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.

      Returns void

    • 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.

      Parameters

      • factoryType: string

        The key of the factory that you want to remove from the GameObjectCreator.

      Returns void