`
* then this property is a direct reference to that element within the dom.
*/
node: Element;
/**
* By default a DOM Element will have its transform, display, opacity, zIndex and blend mode properties
* updated when its rendered. If, for some reason, you don't want any of these changed other than the
* CSS transform, then set this flag to `true`. When `true` only the CSS Transform is applied and it's
* up to you to keep track of and set the other properties as required.
*
* This can be handy if, for example, you've a nested DOM Element and you don't want the opacity to be
* picked-up by any of its children.
*/
transformOnly: boolean;
/**
* The angle, in radians, by which to skew the DOM Element on the horizontal axis.
*
* https://developer.mozilla.org/en-US/docs/Web/CSS/transform
*/
skewX: number;
/**
* The angle, in radians, by which to skew the DOM Element on the vertical axis.
*
* https://developer.mozilla.org/en-US/docs/Web/CSS/transform
*/
skewY: number;
/**
* A Vector4 that contains the 3D rotation of this DOM Element around a fixed axis in 3D space.
*
* All values in the Vector4 are treated as degrees, unless the `rotate3dAngle` property is changed.
*
* For more details see the following MDN page:
*
* https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/rotate3d
*/
rotate3d: Phaser.Math.Vector4;
/**
* The unit that represents the 3D rotation values. By default this is `deg` for degrees, but can
* be changed to any supported unit. See this page for further details:
*
* https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/rotate3d
*/
rotate3dAngle: string;
/**
* Sets the CSS `pointerEvents` attribute on the DOM Element during rendering.
*
* This is 'auto' by default. Changing it may have unintended side-effects with
* internal Phaser input handling, such as dragging, so only change this if you
* understand the implications.
*/
pointerEvents: string;
/**
* The native (un-scaled) width of this Game Object.
*
* For a DOM Element this property is read-only.
*
* The property `displayWidth` holds the computed bounds of this DOM Element, factoring in scaling.
*/
readonly width: number;
/**
* The native (un-scaled) height of this Game Object.
*
* For a DOM Element this property is read-only.
*
* The property `displayHeight` holds the computed bounds of this DOM Element, factoring in scaling.
*/
readonly height: number;
/**
* The computed display width of this Game Object, based on the `getBoundingClientRect` DOM call.
*
* The property `width` holds the un-scaled width of this DOM Element.
*/
readonly displayWidth: number;
/**
* The computed display height of this Game Object, based on the `getBoundingClientRect` DOM call.
*
* The property `height` holds the un-scaled height of this DOM Element.
*/
readonly displayHeight: number;
/**
* Sets the horizontal and vertical skew values of this DOM Element.
*
* For more information see: https://developer.mozilla.org/en-US/docs/Web/CSS/transform
* @param x The angle, in radians, by which to skew the DOM Element on the horizontal axis. Default 0.
* @param y The angle, in radians, by which to skew the DOM Element on the vertical axis. Default x.
*/
setSkew(x?: number, y?: number): this;
/**
* Sets the perspective CSS property of the _parent DOM Container_. This determines the distance between the z=0
* plane and the user in order to give a 3D-positioned element some perspective. Each 3D element with
* z > 0 becomes larger; each 3D-element with z < 0 becomes smaller. The strength of the effect is determined
* by the value of this property.
*
* For more information see: https://developer.mozilla.org/en-US/docs/Web/CSS/perspective
*
* **Changing this value changes it globally for all DOM Elements, as they all share the same parent container.**
* @param value The perspective value, in pixels, that determines the distance between the z plane and the user.
*/
setPerspective(value: number): this;
/**
* The perspective CSS property value of the _parent DOM Container_. This determines the distance between the z=0
* plane and the user in order to give a 3D-positioned element some perspective. Each 3D element with
* z > 0 becomes larger; each 3D-element with z < 0 becomes smaller. The strength of the effect is determined
* by the value of this property.
*
* For more information see: https://developer.mozilla.org/en-US/docs/Web/CSS/perspective
*
* **Changing this value changes it globally for all DOM Elements, as they all share the same parent container.**
*/
perspective: number;
/**
* Adds one or more native DOM event listeners onto the underlying Element of this Game Object.
* The event is then dispatched via this Game Objects standard event emitter.
*
* For example:
*
* ```javascript
* var div = this.add.dom(x, y, element);
*
* div.addListener('click');
*
* div.on('click', handler);
* ```
* @param events The DOM event/s to listen for. You can specify multiple events by separating them with spaces.
*/
addListener(events: string): this;
/**
* Removes one or more native DOM event listeners from the underlying Element of this Game Object.
* @param events The DOM event/s to stop listening for. You can specify multiple events by separating them with spaces.
*/
removeListener(events: string): this;
/**
* Creates a native DOM Element, adds it to the parent DOM Container and then binds it to this Game Object,
* so you can control it. The `tagName` should be a string and is passed to `document.createElement`:
*
* ```javascript
* this.add.dom().createElement('div');
* ```
*
* For more details on acceptable tag names see: https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement
*
* You can also pass in a DOMString or style object to set the CSS on the created element, and an optional `innerText`
* value as well. Here is an example of a DOMString:
*
* ```javascript
* this.add.dom().createElement('div', 'background-color: lime; width: 220px; height: 100px; font: 48px Arial', 'Phaser');
* ```
*
* And using a style object:
*
* ```javascript
* var style = {
* 'background-color': 'lime';
* 'width': '200px';
* 'height': '100px';
* 'font': '48px Arial';
* };
*
* this.add.dom().createElement('div', style, 'Phaser');
* ```
*
* If this Game Object already has an Element, it is removed from the DOM entirely first.
* Any event listeners you may have previously created will need to be re-created after this call.
* @param tagName A string that specifies the type of element to be created. The nodeName of the created element is initialized with the value of tagName. Don't use qualified names (like "html:a") with this method.
* @param style Either a DOMString that holds the CSS styles to be applied to the created element, or an object the styles will be ready from.
* @param innerText A DOMString that holds the text that will be set as the innerText of the created element.
*/
createElement(tagName: string, style?: string | any, innerText?: string): this;
/**
* Binds a new DOM Element to this Game Object. If this Game Object already has an Element it is removed from the DOM
* entirely first. Any event listeners you may have previously created will need to be re-created on the new element.
*
* The `element` argument you pass to this method can be either a string tagName:
*
* ```javascript
*
Phaser
*
* this.add.dom().setElement('heading');
* ```
*
* Or a reference to an Element instance:
*
* ```javascript
*
Phaser
*
* var h1 = document.getElementById('heading');
*
* this.add.dom().setElement(h1);
* ```
*
* You can also pass in a DOMString or style object to set the CSS on the created element, and an optional `innerText`
* value as well. Here is an example of a DOMString:
*
* ```javascript
* this.add.dom().setElement(h1, 'background-color: lime; width: 220px; height: 100px; font: 48px Arial', 'Phaser');
* ```
*
* And using a style object:
*
* ```javascript
* var style = {
* 'background-color': 'lime';
* 'width': '200px';
* 'height': '100px';
* 'font': '48px Arial';
* };
*
* this.add.dom().setElement(h1, style, 'Phaser');
* ```
* @param element If a string it is passed to `getElementById()`, or it should be a reference to an existing Element.
* @param style Either a DOMString that holds the CSS styles to be applied to the created element, or an object the styles will be ready from.
* @param innerText A DOMString that holds the text that will be set as the innerText of the created element.
*/
setElement(element: string | Element, style?: string | any, innerText?: string): this;
/**
* Takes a block of html from the HTML Cache, that has previously been preloaded into the game, and then
* creates a DOM Element from it. The loaded HTML is set as the `innerHTML` property of the created
* element.
*
* Assume the following html is stored in a file called `loginform.html`:
*
* ```html
*
*
* ```
*
* Which is loaded into your game using the cache key 'login':
*
* ```javascript
* this.load.html('login', 'assets/loginform.html');
* ```
*
* You can create a DOM Element from it using the cache key:
*
* ```javascript
* this.add.dom().createFromCache('login');
* ```
*
* The optional `elementType` argument controls the container that is created, into which the loaded html is inserted.
* The default is a plain `div` object, but any valid tagName can be given.
*
* If this Game Object already has an Element, it is removed from the DOM entirely first.
* Any event listeners you may have previously created will need to be re-created after this call.
* @param The key of the html cache entry to use for this DOM Element.
* @param tagName The tag name of the element into which all of the loaded html will be inserted. Defaults to a plain div tag. Default 'div'.
*/
createFromCache(The: string, tagName?: string): this;
/**
* Takes a string of html and then creates a DOM Element from it. The HTML is set as the `innerHTML`
* property of the created element.
*
* ```javascript
* let form = `
*
*
* `;
* ```
*
* You can create a DOM Element from it using the string:
*
* ```javascript
* this.add.dom().createFromHTML(form);
* ```
*
* The optional `elementType` argument controls the type of container that is created, into which the html is inserted.
* The default is a plain `div` object, but any valid tagName can be given.
*
* If this Game Object already has an Element, it is removed from the DOM entirely first.
* Any event listeners you may have previously created will need to be re-created after this call.
* @param html A string of html to be set as the `innerHTML` property of the created element.
* @param tagName The tag name of the element into which all of the html will be inserted. Defaults to a plain div tag. Default 'div'.
*/
createFromHTML(html: string, tagName?: string): this;
/**
* Removes the current DOM Element bound to this Game Object from the DOM entirely and resets the
* `node` property of this Game Object to be `null`.
*/
removeElement(): this;
/**
* Internal method that calls `getBoundingClientRect` on the `node` and then sets the bounds width
* and height into the `displayWidth` and `displayHeight` properties, and the `clientWidth` and `clientHeight`
* values into the `width` and `height` properties respectively.
*
* This is called automatically whenever a new element is created or set.
*/
updateSize(): this;
/**
* Gets all children from this DOM Elements node, using `querySelectorAll('*')` and then iterates through
* them, looking for the first one that has a property matching the given key and value. It then returns this child
* if found, or `null` if not.
* @param property The property to search the children for.
* @param value The value the property must strictly equal.
*/
getChildByProperty(property: string, value: string): Element | null;
/**
* Gets all children from this DOM Elements node, using `querySelectorAll('*')` and then iterates through
* them, looking for the first one that has a matching id. It then returns this child if found, or `null` if not.
*
* Be aware that class and id names are case-sensitive.
* @param id The id to search the children for.
*/
getChildByID(id: string): Element | null;
/**
* Gets all children from this DOM Elements node, using `querySelectorAll('*')` and then iterates through
* them, looking for the first one that has a matching name. It then returns this child if found, or `null` if not.
*
* Be aware that class and id names are case-sensitive.
* @param name The name to search the children for.
*/
getChildByName(name: string): Element | null;
/**
* Sets the `className` property of the DOM Element node and updates the internal sizes.
* @param className A string representing the class or space-separated classes of the element.
*/
setClassName(className: string): this;
/**
* Sets the `innerText` property of the DOM Element node and updates the internal sizes.
*
* Note that only certain types of Elements can have `innerText` set on them.
* @param text A DOMString representing the rendered text content of the element.
*/
setText(text: string): this;
/**
* Sets the `innerHTML` property of the DOM Element node and updates the internal sizes.
* @param html A DOMString of html to be set as the `innerHTML` property of the element.
*/
setHTML(html: string): this;
/**
* Compares the renderMask with the renderFlags to see if this Game Object will render or not.
*
* DOMElements always return `true` as they need to still set values during the render pass, even if not visible.
*/
willRender(): boolean;
/**
* Clears all alpha values associated with this Game Object.
*
* Immediately sets the alpha levels back to 1 (fully opaque).
*/
clearAlpha(): this;
/**
* Set the Alpha level of this Game Object. The alpha controls the opacity of the Game Object as it renders.
* Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque.
* @param value The alpha value applied across the whole Game Object. Default 1.
*/
setAlpha(value?: number): this;
/**
* The alpha value of the Game Object.
*
* This is a global value, impacting the entire Game Object, not just a region of it.
*/
alpha: number;
/**
* Sets the Blend Mode being used by this Game Object.
*
* This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay)
*
* Under WebGL only the following Blend Modes are available:
*
* * NORMAL
* * ADD
* * MULTIPLY
* * SCREEN
* * ERASE
*
* Canvas has more available depending on browser support.
*
* You can also create your own custom Blend Modes in WebGL.
*
* Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending
* on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these
* reasons try to be careful about the construction of your Scene and the frequency of which blend modes
* are used.
*/
blendMode: Phaser.BlendModes | string | number;
/**
* Sets the Blend Mode being used by this Game Object.
*
* This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay)
*
* Under WebGL only the following Blend Modes are available:
*
* * NORMAL
* * ADD
* * MULTIPLY
* * SCREEN
* * ERASE (only works when rendering to a framebuffer, like a Render Texture)
*
* Canvas has more available depending on browser support.
*
* You can also create your own custom Blend Modes in WebGL.
*
* Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending
* on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these
* reasons try to be careful about the construction of your Scene and the frequency in which blend modes
* are used.
* @param value The BlendMode value. Either a string, a CONST or a number.
*/
setBlendMode(value: string | Phaser.BlendModes | number): this;
/**
* The depth of this Game Object within the Scene. Ensure this value is only ever set to a number data-type.
*
* The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order
* of Game Objects, without actually moving their position in the display list.
*
* The default depth is zero. A Game Object with a higher depth
* value will always render in front of one with a lower value.
*
* Setting the depth will queue a depth sort event within the Scene.
*/
depth: number;
/**
* The depth of this Game Object within the Scene.
*
* The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order
* of Game Objects, without actually moving their position in the display list.
*
* The default depth is zero. A Game Object with a higher depth
* value will always render in front of one with a lower value.
*
* Setting the depth will queue a depth sort event within the Scene.
* @param value The depth of this Game Object. Ensure this value is only ever a number data-type.
*/
setDepth(value: number): this;
/**
* The horizontal origin of this Game Object.
* The origin maps the relationship between the size and position of the Game Object.
* The default value is 0.5, meaning all Game Objects are positioned based on their center.
* Setting the value to 0 means the position now relates to the left of the Game Object.
* Set this value with `setOrigin()`.
*/
readonly originX: number;
/**
* The vertical origin of this Game Object.
* The origin maps the relationship between the size and position of the Game Object.
* The default value is 0.5, meaning all Game Objects are positioned based on their center.
* Setting the value to 0 means the position now relates to the top of the Game Object.
* Set this value with `setOrigin()`.
*/
readonly originY: number;
/**
* The horizontal display origin of this Game Object.
* The origin is a normalized value between 0 and 1.
* The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin.
*/
displayOriginX: number;
/**
* The vertical display origin of this Game Object.
* The origin is a normalized value between 0 and 1.
* The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin.
*/
displayOriginY: number;
/**
* Sets the origin of this Game Object.
*
* The values are given in the range 0 to 1.
* @param x The horizontal origin value. Default 0.5.
* @param y The vertical origin value. If not defined it will be set to the value of `x`. Default x.
*/
setOrigin(x?: number, y?: number): this;
/**
* Sets the origin of this Game Object based on the Pivot values in its Frame.
*/
setOriginFromFrame(): this;
/**
* Sets the display origin of this Game Object.
* The difference between this and setting the origin is that you can use pixel values for setting the display origin.
* @param x The horizontal display origin value. Default 0.
* @param y The vertical display origin value. If not defined it will be set to the value of `x`. Default x.
*/
setDisplayOrigin(x?: number, y?: number): this;
/**
* Updates the Display Origin cached values internally stored on this Game Object.
* You don't usually call this directly, but it is exposed for edge-cases where you may.
*/
updateDisplayOrigin(): this;
/**
* The horizontal scroll factor of this Game Object.
*
* The scroll factor controls the influence of the movement of a Camera upon this Game Object.
*
* When a camera scrolls it will change the location at which this Game Object is rendered on-screen.
* It does not change the Game Objects actual position values.
*
* A value of 1 means it will move exactly in sync with a camera.
* A value of 0 means it will not move at all, even if the camera moves.
* Other values control the degree to which the camera movement is mapped to this Game Object.
*
* Please be aware that scroll factor values other than 1 are not taken in to consideration when
* calculating physics collisions. Bodies always collide based on their world position, but changing
* the scroll factor is a visual adjustment to where the textures are rendered, which can offset
* them from physics bodies if not accounted for in your code.
*/
scrollFactorX: number;
/**
* The vertical scroll factor of this Game Object.
*
* The scroll factor controls the influence of the movement of a Camera upon this Game Object.
*
* When a camera scrolls it will change the location at which this Game Object is rendered on-screen.
* It does not change the Game Objects actual position values.
*
* A value of 1 means it will move exactly in sync with a camera.
* A value of 0 means it will not move at all, even if the camera moves.
* Other values control the degree to which the camera movement is mapped to this Game Object.
*
* Please be aware that scroll factor values other than 1 are not taken in to consideration when
* calculating physics collisions. Bodies always collide based on their world position, but changing
* the scroll factor is a visual adjustment to where the textures are rendered, which can offset
* them from physics bodies if not accounted for in your code.
*/
scrollFactorY: number;
/**
* Sets the scroll factor of this Game Object.
*
* The scroll factor controls the influence of the movement of a Camera upon this Game Object.
*
* When a camera scrolls it will change the location at which this Game Object is rendered on-screen.
* It does not change the Game Objects actual position values.
*
* A value of 1 means it will move exactly in sync with a camera.
* A value of 0 means it will not move at all, even if the camera moves.
* Other values control the degree to which the camera movement is mapped to this Game Object.
*
* Please be aware that scroll factor values other than 1 are not taken in to consideration when
* calculating physics collisions. Bodies always collide based on their world position, but changing
* the scroll factor is a visual adjustment to where the textures are rendered, which can offset
* them from physics bodies if not accounted for in your code.
* @param x The horizontal scroll factor of this Game Object.
* @param y The vertical scroll factor of this Game Object. If not set it will use the `x` value. Default x.
*/
setScrollFactor(x: number, y?: number): this;
/**
* A property indicating that a Game Object has this component.
*/
readonly hasTransformComponent: boolean;
/**
* The x position of this Game Object.
*/
x: number;
/**
* The y position of this Game Object.
*/
y: number;
/**
* The z position of this Game Object.
*
* Note: The z position does not control the rendering order of 2D Game Objects. Use
* {@link Phaser.GameObjects.Components.Depth#depth} instead.
*/
z: number;
/**
* The w position of this Game Object.
*/
w: number;
/**
* This is a special setter that allows you to set both the horizontal and vertical scale of this Game Object
* to the same value, at the same time. When reading this value the result returned is `(scaleX + scaleY) / 2`.
*
* Use of this property implies you wish the horizontal and vertical scales to be equal to each other. If this
* isn't the case, use the `scaleX` or `scaleY` properties instead.
*/
scale: number;
/**
* The horizontal scale of this Game Object.
*/
scaleX: number;
/**
* The vertical scale of this Game Object.
*/
scaleY: number;
/**
* The angle of this Game Object as expressed in degrees.
*
* Phaser uses a right-hand clockwise rotation system, where 0 is right, 90 is down, 180/-180 is left
* and -90 is up.
*
* If you prefer to work in radians, see the `rotation` property instead.
*/
angle: number;
/**
* The angle of this Game Object in radians.
*
* Phaser uses a right-hand clockwise rotation system, where 0 is right, PI/2 is down, +-PI is left
* and -PI/2 is up.
*
* If you prefer to work in degrees, see the `angle` property instead.
*/
rotation: number;
/**
* Sets the position of this Game Object.
* @param x The x position of this Game Object. Default 0.
* @param y The y position of this Game Object. If not set it will use the `x` value. Default x.
* @param z The z position of this Game Object. Default 0.
* @param w The w position of this Game Object. Default 0.
*/
setPosition(x?: number, y?: number, z?: number, w?: number): this;
/**
* Copies an object's coordinates to this Game Object's position.
* @param source An object with numeric 'x', 'y', 'z', or 'w' properties. Undefined values are not copied.
*/
copyPosition(source: Phaser.Types.Math.Vector2Like | Phaser.Types.Math.Vector3Like | Phaser.Types.Math.Vector4Like): this;
/**
* Sets the position of this Game Object to be a random position within the confines of
* the given area.
*
* If no area is specified a random position between 0 x 0 and the game width x height is used instead.
*
* The position does not factor in the size of this Game Object, meaning that only the origin is
* guaranteed to be within the area.
* @param x The x position of the top-left of the random area. Default 0.
* @param y The y position of the top-left of the random area. Default 0.
* @param width The width of the random area.
* @param height The height of the random area.
*/
setRandomPosition(x?: number, y?: number, width?: number, height?: number): this;
/**
* Sets the rotation of this Game Object.
* @param radians The rotation of this Game Object, in radians. Default 0.
*/
setRotation(radians?: number): this;
/**
* Sets the angle of this Game Object.
* @param degrees The rotation of this Game Object, in degrees. Default 0.
*/
setAngle(degrees?: number): this;
/**
* Sets the scale of this Game Object.
* @param x The horizontal scale of this Game Object. Default 1.
* @param y The vertical scale of this Game Object. If not set it will use the `x` value. Default x.
*/
setScale(x?: number, y?: number): this;
/**
* Sets the x position of this Game Object.
* @param value The x position of this Game Object. Default 0.
*/
setX(value?: number): this;
/**
* Sets the y position of this Game Object.
* @param value The y position of this Game Object. Default 0.
*/
setY(value?: number): this;
/**
* Sets the z position of this Game Object.
*
* Note: The z position does not control the rendering order of 2D Game Objects. Use
* {@link Phaser.GameObjects.Components.Depth#setDepth} instead.
* @param value The z position of this Game Object. Default 0.
*/
setZ(value?: number): this;
/**
* Sets the w position of this Game Object.
* @param value The w position of this Game Object. Default 0.
*/
setW(value?: number): this;
/**
* Gets the local transform matrix for this Game Object.
* @param tempMatrix The matrix to populate with the values from this Game Object.
*/
getLocalTransformMatrix(tempMatrix?: Phaser.GameObjects.Components.TransformMatrix): Phaser.GameObjects.Components.TransformMatrix;
/**
* Gets the world transform matrix for this Game Object, factoring in any parent Containers.
* @param tempMatrix The matrix to populate with the values from this Game Object.
* @param parentMatrix A temporary matrix to hold parent values during the calculations.
*/
getWorldTransformMatrix(tempMatrix?: Phaser.GameObjects.Components.TransformMatrix, parentMatrix?: Phaser.GameObjects.Components.TransformMatrix): Phaser.GameObjects.Components.TransformMatrix;
/**
* Takes the given `x` and `y` coordinates and converts them into local space for this
* Game Object, taking into account parent and local transforms, and the Display Origin.
*
* The returned Vector2 contains the translated point in its properties.
*
* A Camera needs to be provided in order to handle modified scroll factors. If no
* camera is specified, it will use the `main` camera from the Scene to which this
* Game Object belongs.
* @param x The x position to translate.
* @param y The y position to translate.
* @param point A Vector2, or point-like object, to store the results in.
* @param camera The Camera which is being tested against. If not given will use the Scene default camera.
*/
getLocalPoint(x: number, y: number, point?: Phaser.Math.Vector2, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Math.Vector2;
/**
* Gets the sum total rotation of all of this Game Objects parent Containers.
*
* The returned value is in radians and will be zero if this Game Object has no parent container.
*/
getParentRotation(): number;
/**
* The visible state of the Game Object.
*
* An invisible Game Object will skip rendering, but will still process update logic.
*/
visible: boolean;
/**
* Sets the visibility of this Game Object.
*
* An invisible Game Object will skip rendering, but will still process update logic.
* @param value The visible state of the Game Object.
*/
setVisible(value: boolean): this;
}
namespace Events {
/**
* The Game Object Added to Scene Event.
*
* This event is dispatched when a Game Object is added to a Scene.
*
* Listen for it on a Game Object instance using `GameObject.on('addedtoscene', listener)`.
*/
const ADDED_TO_SCENE: string;
/**
* The Game Object Destroy Event.
*
* This event is dispatched when a Game Object instance is being destroyed.
*
* Listen for it on a Game Object instance using `GameObject.on('destroy', listener)`.
*/
const DESTROY: string;
/**
* The Game Object Removed from Scene Event.
*
* This event is dispatched when a Game Object is removed from a Scene.
*
* Listen for it on a Game Object instance using `GameObject.on('removedfromscene', listener)`.
*/
const REMOVED_FROM_SCENE: string;
/**
* The Video Game Object Complete Event.
*
* This event is dispatched when a Video finishes playback by reaching the end of its duration. It
* is also dispatched if a video marker sequence is being played and reaches the end.
*
* Note that not all videos can fire this event. Live streams, for example, have no fixed duration,
* so never technically 'complete'.
*
* If a video is stopped from playback, via the `Video.stop` method, it will emit the
* `VIDEO_STOP` event instead of this one.
*
* Listen for it from a Video Game Object instance using `Video.on('complete', listener)`.
*/
const VIDEO_COMPLETE: string;
/**
* The Video Game Object Created Event.
*
* This event is dispatched when the texture for a Video has been created. This happens
* when enough of the video source has been loaded that the browser is able to render a
* frame from it.
*
* Listen for it from a Video Game Object instance using `Video.on('created', listener)`.
*/
const VIDEO_CREATED: string;
/**
* The Video Game Object Error Event.
*
* This event is dispatched when a Video tries to play a source that does not exist, or is the wrong file type.
*
* Listen for it from a Video Game Object instance using `Video.on('error', listener)`.
*/
const VIDEO_ERROR: string;
/**
* The Video Game Object Locked Event.
*
* This event is dispatched when a Video was attempted to be played, but the browser prevented it
* from doing so due to the Media Engagement Interaction policy.
*
* If you get this event you will need to wait for the user to interact with the browser before
* the video will play. This is a browser security measure to prevent autoplaying videos with
* audio. An interaction includes a mouse click, a touch, or a key press.
*
* Listen for it from a Video Game Object instance using `Video.on('locked', listener)`.
*/
const VIDEO_LOCKED: string;
/**
* The Video Game Object Loop Event.
*
* This event is dispatched when a Video that is currently playing has looped. This only
* happens if the `loop` parameter was specified, or the `setLoop` method was called,
* and if the video has a fixed duration. Video streams, for example, cannot loop, as
* they have no duration.
*
* Looping is based on the result of the Video `timeupdate` event. This event is not
* frame-accurate, due to the way browsers work, so please do not rely on this loop
* event to be time or frame precise.
*
* Listen for it from a Video Game Object instance using `Video.on('loop', listener)`.
*/
const VIDEO_LOOP: string;
/**
* The Video Game Object Playing Event.
*
* The playing event is fired after playback is first started,
* and whenever it is restarted. For example it is fired when playback
* resumes after having been paused or delayed due to lack of data.
*
* Listen for it from a Video Game Object instance using `Video.on('playing', listener)`.
*/
const VIDEO_PLAYING: string;
/**
* The Video Game Object Play Event.
*
* This event is dispatched when a Video begins playback. For videos that do not require
* interaction unlocking, this is usually as soon as the `Video.play` method is called.
* However, for videos that require unlocking, it is fired once playback begins after
* they've been unlocked.
*
* Listen for it from a Video Game Object instance using `Video.on('play', listener)`.
*/
const VIDEO_PLAY: string;
/**
* The Video Game Object Seeked Event.
*
* This event is dispatched when a Video completes seeking to a new point in its timeline.
*
* Listen for it from a Video Game Object instance using `Video.on('seeked', listener)`.
*/
const VIDEO_SEEKED: string;
/**
* The Video Game Object Seeking Event.
*
* This event is dispatched when a Video _begins_ seeking to a new point in its timeline.
* When the seek is complete, it will dispatch the `VIDEO_SEEKED` event to conclude.
*
* Listen for it from a Video Game Object instance using `Video.on('seeking', listener)`.
*/
const VIDEO_SEEKING: string;
/**
* The Video Game Object Stalled Event.
*
* This event is dispatched by a Video Game Object when the video playback stalls.
*
* This can happen if the video is buffering.
*
* If will fire for any of the following native DOM events:
*
* `stalled`
* `suspend`
* `waiting`
*
* Listen for it from a Video Game Object instance using `Video.on('stalled', listener)`.
*
* Note that being stalled isn't always a negative thing. A video can be stalled if it
* has downloaded enough data in to its buffer to not need to download any more until
* the current batch of frames have rendered.
*/
const VIDEO_STALLED: string;
/**
* The Video Game Object Stopped Event.
*
* This event is dispatched when a Video is stopped from playback via a call to the `Video.stop` method,
* either directly via game code, or indirectly as the result of changing a video source or destroying it.
*
* Listen for it from a Video Game Object instance using `Video.on('stop', listener)`.
*/
const VIDEO_STOP: string;
/**
* The Video Game Object Texture Ready Event.
*
* This event is dispatched by a Video Game Object when it has finished creating its texture.
*
* This happens when the video has finished loading enough data for its first frame.
*
* If you wish to use the Video texture elsewhere in your game, such as as a Sprite texture,
* then you should listen for this event first, before creating the Sprites that use it.
*
* Listen for it from a Video Game Object instance using `Video.on('textureready', listener)`.
*/
const VIDEO_TEXTURE: string;
/**
* The Video Game Object Unlocked Event.
*
* This event is dispatched when a Video that was prevented from playback due to the browsers
* Media Engagement Interaction policy, is unlocked by a user gesture.
*
* Listen for it from a Video Game Object instance using `Video.on('unlocked', listener)`.
*/
const VIDEO_UNLOCKED: string;
/**
* The Video Game Object Unsupported Event.
*
* This event is dispatched by a Video Game Object if the media source
* (which may be specified as a MediaStream, MediaSource, Blob, or File,
* for example) doesn't represent a supported media format.
*
* Listen for it from a Video Game Object instance using `Video.on('unsupported', listener)`.
*/
const VIDEO_UNSUPPORTED: string;
}
/**
* An Extern Game Object is a special type of Game Object that allows you to pass
* rendering off to a 3rd party.
*
* When you create an Extern and place it in the display list of a Scene, the renderer will
* process the list as usual. When it finds an Extern it will flush the current batch,
* clear down the pipeline and prepare a transform matrix which your render function can
* take advantage of, if required.
*
* The WebGL context is then left in a 'clean' state, ready for you to bind your own shaders,
* or draw to it, whatever you wish to do. This should all take place in the `render` method.
* The correct way to deploy an Extern object is to create a class that extends it, then
* override the `render` (and optionally `preUpdate`) methods and pass off control to your
* 3rd party libraries or custom WebGL code there.
*
* Once you've finished, you should free-up any of your resources.
* The Extern will then rebind the Phaser pipeline and carry on rendering the display list.
*
* Although this object has lots of properties such as Alpha, Blend Mode and Tint, none of
* them are used during rendering unless you take advantage of them in your own render code.
*/
class Extern extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.Alpha, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Flip, Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Size, Phaser.GameObjects.Components.Texture, Phaser.GameObjects.Components.Tint, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible {
/**
*
* @param scene The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time.
*/
constructor(scene: Phaser.Scene);
/**
* Clears all alpha values associated with this Game Object.
*
* Immediately sets the alpha levels back to 1 (fully opaque).
*/
clearAlpha(): this;
/**
* Set the Alpha level of this Game Object. The alpha controls the opacity of the Game Object as it renders.
* Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque.
*
* If your game is running under WebGL you can optionally specify four different alpha values, each of which
* correspond to the four corners of the Game Object. Under Canvas only the `topLeft` value given is used.
* @param topLeft The alpha value used for the top-left of the Game Object. If this is the only value given it's applied across the whole Game Object. Default 1.
* @param topRight The alpha value used for the top-right of the Game Object. WebGL only.
* @param bottomLeft The alpha value used for the bottom-left of the Game Object. WebGL only.
* @param bottomRight The alpha value used for the bottom-right of the Game Object. WebGL only.
*/
setAlpha(topLeft?: number, topRight?: number, bottomLeft?: number, bottomRight?: number): this;
/**
* The alpha value of the Game Object.
*
* This is a global value, impacting the entire Game Object, not just a region of it.
*/
alpha: number;
/**
* The alpha value starting from the top-left of the Game Object.
* This value is interpolated from the corner to the center of the Game Object.
*/
alphaTopLeft: number;
/**
* The alpha value starting from the top-right of the Game Object.
* This value is interpolated from the corner to the center of the Game Object.
*/
alphaTopRight: number;
/**
* The alpha value starting from the bottom-left of the Game Object.
* This value is interpolated from the corner to the center of the Game Object.
*/
alphaBottomLeft: number;
/**
* The alpha value starting from the bottom-right of the Game Object.
* This value is interpolated from the corner to the center of the Game Object.
*/
alphaBottomRight: number;
/**
* Sets the Blend Mode being used by this Game Object.
*
* This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay)
*
* Under WebGL only the following Blend Modes are available:
*
* * NORMAL
* * ADD
* * MULTIPLY
* * SCREEN
* * ERASE
*
* Canvas has more available depending on browser support.
*
* You can also create your own custom Blend Modes in WebGL.
*
* Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending
* on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these
* reasons try to be careful about the construction of your Scene and the frequency of which blend modes
* are used.
*/
blendMode: Phaser.BlendModes | string | number;
/**
* Sets the Blend Mode being used by this Game Object.
*
* This can be a const, such as `Phaser.BlendModes.SCREEN`, or an integer, such as 4 (for Overlay)
*
* Under WebGL only the following Blend Modes are available:
*
* * NORMAL
* * ADD
* * MULTIPLY
* * SCREEN
* * ERASE (only works when rendering to a framebuffer, like a Render Texture)
*
* Canvas has more available depending on browser support.
*
* You can also create your own custom Blend Modes in WebGL.
*
* Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending
* on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these
* reasons try to be careful about the construction of your Scene and the frequency in which blend modes
* are used.
* @param value The BlendMode value. Either a string, a CONST or a number.
*/
setBlendMode(value: string | Phaser.BlendModes | number): this;
/**
* The depth of this Game Object within the Scene. Ensure this value is only ever set to a number data-type.
*
* The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order
* of Game Objects, without actually moving their position in the display list.
*
* The default depth is zero. A Game Object with a higher depth
* value will always render in front of one with a lower value.
*
* Setting the depth will queue a depth sort event within the Scene.
*/
depth: number;
/**
* The depth of this Game Object within the Scene.
*
* The depth is also known as the 'z-index' in some environments, and allows you to change the rendering order
* of Game Objects, without actually moving their position in the display list.
*
* The default depth is zero. A Game Object with a higher depth
* value will always render in front of one with a lower value.
*
* Setting the depth will queue a depth sort event within the Scene.
* @param value The depth of this Game Object. Ensure this value is only ever a number data-type.
*/
setDepth(value: number): this;
/**
* The horizontally flipped state of the Game Object.
*
* A Game Object that is flipped horizontally will render inversed on the horizontal axis.
* Flipping always takes place from the middle of the texture and does not impact the scale value.
* If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.
*/
flipX: boolean;
/**
* The vertically flipped state of the Game Object.
*
* A Game Object that is flipped vertically will render inversed on the vertical axis (i.e. upside down)
* Flipping always takes place from the middle of the texture and does not impact the scale value.
* If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.
*/
flipY: boolean;
/**
* Toggles the horizontal flipped state of this Game Object.
*
* A Game Object that is flipped horizontally will render inversed on the horizontal axis.
* Flipping always takes place from the middle of the texture and does not impact the scale value.
* If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.
*/
toggleFlipX(): this;
/**
* Toggles the vertical flipped state of this Game Object.
*/
toggleFlipY(): this;
/**
* Sets the horizontal flipped state of this Game Object.
*
* A Game Object that is flipped horizontally will render inversed on the horizontal axis.
* Flipping always takes place from the middle of the texture and does not impact the scale value.
* If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.
* @param value The flipped state. `false` for no flip, or `true` to be flipped.
*/
setFlipX(value: boolean): this;
/**
* Sets the vertical flipped state of this Game Object.
* @param value The flipped state. `false` for no flip, or `true` to be flipped.
*/
setFlipY(value: boolean): this;
/**
* Sets the horizontal and vertical flipped state of this Game Object.
*
* A Game Object that is flipped will render inversed on the flipped axis.
* Flipping always takes place from the middle of the texture and does not impact the scale value.
* If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.
* @param x The horizontal flipped state. `false` for no flip, or `true` to be flipped.
* @param y The horizontal flipped state. `false` for no flip, or `true` to be flipped.
*/
setFlip(x: boolean, y: boolean): this;
/**
* Resets the horizontal and vertical flipped state of this Game Object back to their default un-flipped state.
*/
resetFlip(): this;
/**
* The horizontal origin of this Game Object.
* The origin maps the relationship between the size and position of the Game Object.
* The default value is 0.5, meaning all Game Objects are positioned based on their center.
* Setting the value to 0 means the position now relates to the left of the Game Object.
* Set this value with `setOrigin()`.
*/
readonly originX: number;
/**
* The vertical origin of this Game Object.
* The origin maps the relationship between the size and position of the Game Object.
* The default value is 0.5, meaning all Game Objects are positioned based on their center.
* Setting the value to 0 means the position now relates to the top of the Game Object.
* Set this value with `setOrigin()`.
*/
readonly originY: number;
/**
* The horizontal display origin of this Game Object.
* The origin is a normalized value between 0 and 1.
* The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin.
*/
displayOriginX: number;
/**
* The vertical display origin of this Game Object.
* The origin is a normalized value between 0 and 1.
* The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin.
*/
displayOriginY: number;
/**
* Sets the origin of this Game Object.
*
* The values are given in the range 0 to 1.
* @param x The horizontal origin value. Default 0.5.
* @param y The vertical origin value. If not defined it will be set to the value of `x`. Default x.
*/
setOrigin(x?: number, y?: number): this;
/**
* Sets the origin of this Game Object based on the Pivot values in its Frame.
*/
setOriginFromFrame(): this;
/**
* Sets the display origin of this Game Object.
* The difference between this and setting the origin is that you can use pixel values for setting the display origin.
* @param x The horizontal display origin value. Default 0.
* @param y The vertical display origin value. If not defined it will be set to the value of `x`. Default x.
*/
setDisplayOrigin(x?: number, y?: number): this;
/**
* Updates the Display Origin cached values internally stored on this Game Object.
* You don't usually call this directly, but it is exposed for edge-cases where you may.
*/
updateDisplayOrigin(): this;
/**
* The horizontal scroll factor of this Game Object.
*
* The scroll factor controls the influence of the movement of a Camera upon this Game Object.
*
* When a camera scrolls it will change the location at which this Game Object is rendered on-screen.
* It does not change the Game Objects actual position values.
*
* A value of 1 means it will move exactly in sync with a camera.
* A value of 0 means it will not move at all, even if the camera moves.
* Other values control the degree to which the camera movement is mapped to this Game Object.
*
* Please be aware that scroll factor values other than 1 are not taken in to consideration when
* calculating physics collisions. Bodies always collide based on their world position, but changing
* the scroll factor is a visual adjustment to where the textures are rendered, which can offset
* them from physics bodies if not accounted for in your code.
*/
scrollFactorX: number;
/**
* The vertical scroll factor of this Game Object.
*
* The scroll factor controls the influence of the movement of a Camera upon this Game Object.
*
* When a camera scrolls it will change the location at which this Game Object is rendered on-screen.
* It does not change the Game Objects actual position values.
*
* A value of 1 means it will move exactly in sync with a camera.
* A value of 0 means it will not move at all, even if the camera moves.
* Other values control the degree to which the camera movement is mapped to this Game Object.
*
* Please be aware that scroll factor values other than 1 are not taken in to consideration when
* calculating physics collisions. Bodies always collide based on their world position, but changing
* the scroll factor is a visual adjustment to where the textures are rendered, which can offset
* them from physics bodies if not accounted for in your code.
*/
scrollFactorY: number;
/**
* Sets the scroll factor of this Game Object.
*
* The scroll factor controls the influence of the movement of a Camera upon this Game Object.
*
* When a camera scrolls it will change the location at which this Game Object is rendered on-screen.
* It does not change the Game Objects actual position values.
*
* A value of 1 means it will move exactly in sync with a camera.
* A value of 0 means it will not move at all, even if the camera moves.
* Other values control the degree to which the camera movement is mapped to this Game Object.
*
* Please be aware that scroll factor values other than 1 are not taken in to consideration when
* calculating physics collisions. Bodies always collide based on their world position, but changing
* the scroll factor is a visual adjustment to where the textures are rendered, which can offset
* them from physics bodies if not accounted for in your code.
* @param x The horizontal scroll factor of this Game Object.
* @param y The vertical scroll factor of this Game Object. If not set it will use the `x` value. Default x.
*/
setScrollFactor(x: number, y?: number): this;
/**
* The native (un-scaled) width of this Game Object.
*
* Changing this value will not change the size that the Game Object is rendered in-game.
* For that you need to either set the scale of the Game Object (`setScale`) or use
* the `displayWidth` property.
*/
width: number;
/**
* The native (un-scaled) height of this Game Object.
*
* Changing this value will not change the size that the Game Object is rendered in-game.
* For that you need to either set the scale of the Game Object (`setScale`) or use
* the `displayHeight` property.
*/
height: number;
/**
* The displayed width of this Game Object.
*
* This value takes into account the scale factor.
*
* Setting this value will adjust the Game Object's scale property.
*/
displayWidth: number;
/**
* The displayed height of this Game Object.
*
* This value takes into account the scale factor.
*
* Setting this value will adjust the Game Object's scale property.
*/
displayHeight: number;
/**
* Sets the size of this Game Object to be that of the given Frame.
*
* This will not change the size that the Game Object is rendered in-game.
* For that you need to either set the scale of the Game Object (`setScale`) or call the
* `setDisplaySize` method, which is the same thing as changing the scale but allows you
* to do so by giving pixel values.
*
* If you have enabled this Game Object for input, changing the size will _not_ change the
* size of the hit area. To do this you should adjust the `input.hitArea` object directly.
* @param frame The frame to base the size of this Game Object on.
*/
setSizeToFrame(frame?: Phaser.Textures.Frame | boolean): this;
/**
* Sets the internal size of this Game Object, as used for frame or physics body creation.
*
* This will not change the size that the Game Object is rendered in-game.
* For that you need to either set the scale of the Game Object (`setScale`) or call the
* `setDisplaySize` method, which is the same thing as changing the scale but allows you
* to do so by giving pixel values.
*
* If you have enabled this Game Object for input, changing the size will _not_ change the
* size of the hit area. To do this you should adjust the `input.hitArea` object directly.
* @param width The width of this Game Object.
* @param height The height of this Game Object.
*/
setSize(width: number, height: number): this;
/**
* Sets the display size of this Game Object.
*
* Calling this will adjust the scale.
* @param width The width of this Game Object.
* @param height The height of this Game Object.
*/
setDisplaySize(width: number, height: number): this;
/**
* The Texture this Game Object is using to render with.
*/
texture: Phaser.Textures.Texture | Phaser.Textures.CanvasTexture;
/**
* The Texture Frame this Game Object is using to render with.
*/
frame: Phaser.Textures.Frame;
/**
* Sets the texture and frame this Game Object will use to render with.
*
* Textures are referenced by their string-based keys, as stored in the Texture Manager.
* @param key The key of the texture to be used, as stored in the Texture Manager, or a Texture instance.
* @param frame The name or index of the frame within the Texture.
*/
setTexture(key: string | Phaser.Textures.Texture, frame?: string | number): this;
/**
* Sets the frame this Game Object will use to render with.
*
* If you pass a string or index then the Frame has to belong to the current Texture being used
* by this Game Object.
*
* If you pass a Frame instance, then the Texture being used by this Game Object will also be updated.
*
* Calling `setFrame` will modify the `width` and `height` properties of your Game Object.
*
* It will also change the `origin` if the Frame has a custom pivot point, as exported from packages like Texture Packer.
* @param frame The name or index of the frame within the Texture, or a Frame instance.
* @param updateSize Should this call adjust the size of the Game Object? Default true.
* @param updateOrigin Should this call adjust the origin of the Game Object? Default true.
*/
setFrame(frame: string | number | Phaser.Textures.Frame, updateSize?: boolean, updateOrigin?: boolean): this;
/**
* The tint value being applied to the top-left vertice of the Game Object.
* This value is interpolated from the corner to the center of the Game Object.
* The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple.
*/
tintTopLeft: number;
/**
* The tint value being applied to the top-right vertice of the Game Object.
* This value is interpolated from the corner to the center of the Game Object.
* The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple.
*/
tintTopRight: number;
/**
* The tint value being applied to the bottom-left vertice of the Game Object.
* This value is interpolated from the corner to the center of the Game Object.
* The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple.
*/
tintBottomLeft: number;
/**
* The tint value being applied to the bottom-right vertice of the Game Object.
* This value is interpolated from the corner to the center of the Game Object.
* The value should be set as a hex number, i.e. 0xff0000 for red, or 0xff00ff for purple.
*/
tintBottomRight: number;
/**
* The tint fill mode.
*
* `false` = An additive tint (the default), where vertices colors are blended with the texture.
* `true` = A fill tint, where the vertices colors replace the texture, but respects texture alpha.
*/
tintFill: boolean;
/**
* Clears all tint values associated with this Game Object.
*
* Immediately sets the color values back to 0xffffff and the tint type to 'additive',
* which results in no visible change to the texture.
*/
clearTint(): this;
/**
* Sets an additive tint on this Game Object.
*
* The tint works by taking the pixel color values from the Game Objects texture, and then
* multiplying it by the color value of the tint. You can provide either one color value,
* in which case the whole Game Object will be tinted in that color. Or you can provide a color
* per corner. The colors are blended together across the extent of the Game Object.
*
* To modify the tint color once set, either call this method again with new values or use the
* `tint` property to set all colors at once. Or, use the properties `tintTopLeft`, `tintTopRight,
* `tintBottomLeft` and `tintBottomRight` to set the corner color values independently.
*
* To remove a tint call `clearTint`.
*
* To swap this from being an additive tint to a fill based tint set the property `tintFill` to `true`.
* @param topLeft The tint being applied to the top-left of the Game Object. If no other values are given this value is applied evenly, tinting the whole Game Object. Default 0xffffff.
* @param topRight The tint being applied to the top-right of the Game Object.
* @param bottomLeft The tint being applied to the bottom-left of the Game Object.
* @param bottomRight The tint being applied to the bottom-right of the Game Object.
*/
setTint(topLeft?: number, topRight?: number, bottomLeft?: number, bottomRight?: number): this;
/**
* Sets a fill-based tint on this Game Object.
*
* Unlike an additive tint, a fill-tint literally replaces the pixel colors from the texture
* with those in the tint. You can use this for effects such as making a player flash 'white'
* if hit by something. You can provide either one color value, in which case the whole
* Game Object will be rendered in that color. Or you can provide a color per corner. The colors
* are blended together across the extent of the Game Object.
*
* To modify the tint color once set, either call this method again with new values or use the
* `tint` property to set all colors at once. Or, use the properties `tintTopLeft`, `tintTopRight,
* `tintBottomLeft` and `tintBottomRight` to set the corner color values independently.
*
* To remove a tint call `clearTint`.
*
* To swap this from being a fill-tint to an additive tint set the property `tintFill` to `false`.
* @param topLeft The tint being applied to the top-left of the Game Object. If not other values are given this value is applied evenly, tinting the whole Game Object. Default 0xffffff.
* @param topRight The tint being applied to the top-right of the Game Object.
* @param bottomLeft The tint being applied to the bottom-left of the Game Object.
* @param bottomRight The tint being applied to the bottom-right of the Game Object.
*/
setTintFill(topLeft?: number, topRight?: number, bottomLeft?: number, bottomRight?: number): this;
/**
* The tint value being applied to the whole of the Game Object.
* This property is a setter-only. Use the properties `tintTopLeft` etc to read the current tint value.
*/
tint: number;
/**
* Does this Game Object have a tint applied?
*
* It checks to see if the 4 tint properties are set to the value 0xffffff
* and that the `tintFill` property is `false`. This indicates that a Game Object isn't tinted.
*/
readonly isTinted: boolean;
/**
* A property indicating that a Game Object has this component.
*/
readonly hasTransformComponent: boolean;
/**
* The x position of this Game Object.
*/
x: number;
/**
* The y position of this Game Object.
*/
y: number;
/**
* The z position of this Game Object.
*
* Note: The z position does not control the rendering order of 2D Game Objects. Use
* {@link Phaser.GameObjects.Components.Depth#depth} instead.
*/
z: number;
/**
* The w position of this Game Object.
*/
w: number;
/**
* This is a special setter that allows you to set both the horizontal and vertical scale of this Game Object
* to the same value, at the same time. When reading this value the result returned is `(scaleX + scaleY) / 2`.
*
* Use of this property implies you wish the horizontal and vertical scales to be equal to each other. If this
* isn't the case, use the `scaleX` or `scaleY` properties instead.
*/
scale: number;
/**
* The horizontal scale of this Game Object.
*/
scaleX: number;
/**
* The vertical scale of this Game Object.
*/
scaleY: number;
/**
* The angle of this Game Object as expressed in degrees.
*
* Phaser uses a right-hand clockwise rotation system, where 0 is right, 90 is down, 180/-180 is left
* and -90 is up.
*
* If you prefer to work in radians, see the `rotation` property instead.
*/
angle: number;
/**
* The angle of this Game Object in radians.
*
* Phaser uses a right-hand clockwise rotation system, where 0 is right, PI/2 is down, +-PI is left
* and -PI/2 is up.
*
* If you prefer to work in degrees, see the `angle` property instead.
*/
rotation: number;
/**
* Sets the position of this Game Object.
* @param x The x position of this Game Object. Default 0.
* @param y The y position of this Game Object. If not set it will use the `x` value. Default x.
* @param z The z position of this Game Object. Default 0.
* @param w The w position of this Game Object. Default 0.
*/
setPosition(x?: number, y?: number, z?: number, w?: number): this;
/**
* Copies an object's coordinates to this Game Object's position.
* @param source An object with numeric 'x', 'y', 'z', or 'w' properties. Undefined values are not copied.
*/
copyPosition(source: Phaser.Types.Math.Vector2Like | Phaser.Types.Math.Vector3Like | Phaser.Types.Math.Vector4Like): this;
/**
* Sets the position of this Game Object to be a random position within the confines of
* the given area.
*
* If no area is specified a random position between 0 x 0 and the game width x height is used instead.
*
* The position does not factor in the size of this Game Object, meaning that only the origin is
* guaranteed to be within the area.
* @param x The x position of the top-left of the random area. Default 0.
* @param y The y position of the top-left of the random area. Default 0.
* @param width The width of the random area.
* @param height The height of the random area.
*/
setRandomPosition(x?: number, y?: number, width?: number, height?: number): this;
/**
* Sets the rotation of this Game Object.
* @param radians The rotation of this Game Object, in radians. Default 0.
*/
setRotation(radians?: number): this;
/**
* Sets the angle of this Game Object.
* @param degrees The rotation of this Game Object, in degrees. Default 0.
*/
setAngle(degrees?: number): this;
/**
* Sets the scale of this Game Object.
* @param x The horizontal scale of this Game Object. Default 1.
* @param y The vertical scale of this Game Object. If not set it will use the `x` value. Default x.
*/
setScale(x?: number, y?: number): this;
/**
* Sets the x position of this Game Object.
* @param value The x position of this Game Object. Default 0.
*/
setX(value?: number): this;
/**
* Sets the y position of this Game Object.
* @param value The y position of this Game Object. Default 0.
*/
setY(value?: number): this;
/**
* Sets the z position of this Game Object.
*
* Note: The z position does not control the rendering order of 2D Game Objects. Use
* {@link Phaser.GameObjects.Components.Depth#setDepth} instead.
* @param value The z position of this Game Object. Default 0.
*/
setZ(value?: number): this;
/**
* Sets the w position of this Game Object.
* @param value The w position of this Game Object. Default 0.
*/
setW(value?: number): this;
/**
* Gets the local transform matrix for this Game Object.
* @param tempMatrix The matrix to populate with the values from this Game Object.
*/
getLocalTransformMatrix(tempMatrix?: Phaser.GameObjects.Components.TransformMatrix): Phaser.GameObjects.Components.TransformMatrix;
/**
* Gets the world transform matrix for this Game Object, factoring in any parent Containers.
* @param tempMatrix The matrix to populate with the values from this Game Object.
* @param parentMatrix A temporary matrix to hold parent values during the calculations.
*/
getWorldTransformMatrix(tempMatrix?: Phaser.GameObjects.Components.TransformMatrix, parentMatrix?: Phaser.GameObjects.Components.TransformMatrix): Phaser.GameObjects.Components.TransformMatrix;
/**
* Takes the given `x` and `y` coordinates and converts them into local space for this
* Game Object, taking into account parent and local transforms, and the Display Origin.
*
* The returned Vector2 contains the translated point in its properties.
*
* A Camera needs to be provided in order to handle modified scroll factors. If no
* camera is specified, it will use the `main` camera from the Scene to which this
* Game Object belongs.
* @param x The x position to translate.
* @param y The y position to translate.
* @param point A Vector2, or point-like object, to store the results in.
* @param camera The Camera which is being tested against. If not given will use the Scene default camera.
*/
getLocalPoint(x: number, y: number, point?: Phaser.Math.Vector2, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Math.Vector2;
/**
* Gets the sum total rotation of all of this Game Objects parent Containers.
*
* The returned value is in radians and will be zero if this Game Object has no parent container.
*/
getParentRotation(): number;
/**
* The visible state of the Game Object.
*
* An invisible Game Object will skip rendering, but will still process update logic.
*/
visible: boolean;
/**
* Sets the visibility of this Game Object.
*
* An invisible Game Object will skip rendering, but will still process update logic.
* @param value The visible state of the Game Object.
*/
setVisible(value: boolean): this;
}
/**
* The base class that all Game Objects extend.
* You don't create GameObjects directly and they cannot be added to the display list.
* Instead, use them as the base for your own custom classes.
*/
class GameObject extends Phaser.Events.EventEmitter {
/**
*
* @param scene The Scene to which this Game Object belongs.
* @param type A textual representation of the type of Game Object, i.e. `sprite`.
*/
constructor(scene: Phaser.Scene, type: string);
/**
* A reference to the Scene to which this Game Object belongs.
*
* Game Objects can only belong to one Scene.
*
* You should consider this property as being read-only. You cannot move a
* Game Object to another Scene by simply changing it.
*/
scene: Phaser.Scene;
/**
* Holds a reference to the Display List that contains this Game Object.
*
* This is set automatically when this Game Object is added to a Scene or Layer.
*
* You should treat this property as being read-only.
*/
displayList: Phaser.GameObjects.DisplayList | Phaser.GameObjects.Layer;
/**
* A textual representation of this Game Object, i.e. `sprite`.
* Used internally by Phaser but is available for your own custom classes to populate.
*/
type: string;
/**
* The current state of this Game Object.
*
* Phaser itself will never modify this value, although plugins may do so.
*
* Use this property to track the state of a Game Object during its lifetime. For example, it could change from
* a state of 'moving', to 'attacking', to 'dead'. The state value should be an integer (ideally mapped to a constant
* in your game code), or a string. These are recommended to keep it light and simple, with fast comparisons.
* If you need to store complex data about your Game Object, look at using the Data Component instead.
*/
state: number | string;
/**
* The parent Container of this Game Object, if it has one.
*/
parentContainer: Phaser.GameObjects.Container;
/**
* The name of this Game Object.
* Empty by default and never populated by Phaser, this is left for developers to use.
*/
name: string;
/**
* The active state of this Game Object.
* A Game Object with an active state of `true` is processed by the Scenes UpdateList, if added to it.
* An active object is one which is having its logic and internal systems updated.
*/
active: boolean;
/**
* The Tab Index of the Game Object.
* Reserved for future use by plugins and the Input Manager.
*/
tabIndex: number;
/**
* A Data Manager.
* It allows you to store, query and get key/value paired information specific to this Game Object.
* `null` by default. Automatically created if you use `getData` or `setData` or `setDataEnabled`.
*/
data: Phaser.Data.DataManager;
/**
* The flags that are compared against `RENDER_MASK` to determine if this Game Object will render or not.
* The bits are 0001 | 0010 | 0100 | 1000 set by the components Visible, Alpha, Transform and Texture respectively.
* If those components are not used by your custom class then you can use this bitmask as you wish.
*/
renderFlags: number;
/**
* A bitmask that controls if this Game Object is drawn by a Camera or not.
* Not usually set directly, instead call `Camera.ignore`, however you can
* set this property directly using the Camera.id property:
*/
cameraFilter: number;
/**
* If this Game Object is enabled for input then this property will contain an InteractiveObject instance.
* Not usually set directly. Instead call `GameObject.setInteractive()`.
*/
input: Phaser.Types.Input.InteractiveObject | null;
/**
* If this Game Object is enabled for Arcade or Matter Physics then this property will contain a reference to a Physics Body.
*/
body: Phaser.Physics.Arcade.Body | Phaser.Physics.Arcade.StaticBody | MatterJS.BodyType | null;
/**
* This Game Object will ignore all calls made to its destroy method if this flag is set to `true`.
* This includes calls that may come from a Group, Container or the Scene itself.
* While it allows you to persist a Game Object across Scenes, please understand you are entirely
* responsible for managing references to and from this Game Object.
*/
ignoreDestroy: boolean;
/**
* Sets the `active` property of this Game Object and returns this Game Object for further chaining.
* A Game Object with its `active` property set to `true` will be updated by the Scenes UpdateList.
* @param value True if this Game Object should be set as active, false if not.
*/
setActive(value: boolean): this;
/**
* Sets the `name` property of this Game Object and returns this Game Object for further chaining.
* The `name` property is not populated by Phaser and is presented for your own use.
* @param value The name to be given to this Game Object.
*/
setName(value: string): this;
/**
* Sets the current state of this Game Object.
*
* Phaser itself will never modify the State of a Game Object, although plugins may do so.
*
* For example, a Game Object could change from a state of 'moving', to 'attacking', to 'dead'.
* The state value should typically be an integer (ideally mapped to a constant
* in your game code), but could also be a string. It is recommended to keep it light and simple.
* If you need to store complex data about your Game Object, look at using the Data Component instead.
* @param value The state of the Game Object.
*/
setState(value: number | string): this;
/**
* Adds a Data Manager component to this Game Object.
*/
setDataEnabled(): this;
/**
* Allows you to store a key value pair within this Game Objects Data Manager.
*
* If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled
* before setting the value.
*
* If the key doesn't already exist in the Data Manager then it is created.
*
* ```javascript
* sprite.setData('name', 'Red Gem Stone');
* ```
*
* You can also pass in an object of key value pairs as the first argument:
*
* ```javascript
* sprite.setData({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 });
* ```
*
* To get a value back again you can call `getData`:
*
* ```javascript
* sprite.getData('gold');
* ```
*
* Or you can access the value directly via the `values` property, where it works like any other variable:
*
* ```javascript
* sprite.data.values.gold += 50;
* ```
*
* When the value is first set, a `setdata` event is emitted from this Game Object.
*
* If the key already exists, a `changedata` event is emitted instead, along an event named after the key.
* For example, if you updated an existing key called `PlayerLives` then it would emit the event `changedata-PlayerLives`.
* These events will be emitted regardless if you use this method to set the value, or the direct `values` setter.
*
* Please note that the data keys are case-sensitive and must be valid JavaScript Object property strings.
* This means the keys `gold` and `Gold` are treated as two unique values within the Data Manager.
* @param key The key to set the value for. Or an object of key value pairs. If an object the `data` argument is ignored.
* @param data The value to set for the given key. If an object is provided as the key this argument is ignored.
*/
setData(key: (string|T), data?: any): this;
/**
* Increase a value for the given key within this Game Objects Data Manager. If the key doesn't already exist in the Data Manager then it is increased from 0.
*
* If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled
* before setting the value.
*
* If the key doesn't already exist in the Data Manager then it is created.
*
* When the value is first set, a `setdata` event is emitted from this Game Object.
* @param key The key to increase the value for.
* @param data The value to increase for the given key.
*/
incData(key: (string|T), data?: any): this;
/**
* Toggle a boolean value for the given key within this Game Objects Data Manager. If the key doesn't already exist in the Data Manager then it is toggled from false.
*
* If the Game Object has not been enabled for data (via `setDataEnabled`) then it will be enabled
* before setting the value.
*
* If the key doesn't already exist in the Data Manager then it is created.
*
* When the value is first set, a `setdata` event is emitted from this Game Object.
* @param key The key to toggle the value for.
*/
toggleData(key: (string|T)): this;
/**
* Retrieves the value for the given key in this Game Objects Data Manager, or undefined if it doesn't exist.
*
* You can also access values via the `values` object. For example, if you had a key called `gold` you can do either:
*
* ```javascript
* sprite.getData('gold');
* ```
*
* Or access the value directly:
*
* ```javascript
* sprite.data.values.gold;
* ```
*
* You can also pass in an array of keys, in which case an array of values will be returned:
*
* ```javascript
* sprite.getData([ 'gold', 'armor', 'health' ]);
* ```
*
* This approach is useful for destructuring arrays in ES6.
* @param key The key of the value to retrieve, or an array of keys.
*/
getData(key: string | string[]): any;
/**
* Pass this Game Object to the Input Manager to enable it for Input.
*
* Input works by using hit areas, these are nearly always geometric shapes, such as rectangles or circles, that act as the hit area
* for the Game Object. However, you can provide your own hit area shape and callback, should you wish to handle some more advanced
* input detection.
*
* If no arguments are provided it will try and create a rectangle hit area based on the texture frame the Game Object is using. If
* this isn't a texture-bound object, such as a Graphics or BitmapText object, this will fail, and you'll need to provide a specific
* shape for it to use.
*
* You can also provide an Input Configuration Object as the only argument to this method.
* @param hitArea Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not given it will try to create a Rectangle based on the texture frame.
* @param callback The callback that determines if the pointer is within the Hit Area shape or not. If you provide a shape you must also provide a callback.
* @param dropZone Should this Game Object be treated as a drop zone target? Default false.
*/
setInteractive(hitArea?: Phaser.Types.Input.InputConfiguration | any, callback?: Phaser.Types.Input.HitAreaCallback, dropZone?: boolean): this;
/**
* If this Game Object has previously been enabled for input, this will disable it.
*
* An object that is disabled for input stops processing or being considered for
* input events, but can be turned back on again at any time by simply calling
* `setInteractive()` with no arguments provided.
*
* If want to completely remove interaction from this Game Object then use `removeInteractive` instead.
*/
disableInteractive(): this;
/**
* If this Game Object has previously been enabled for input, this will queue it
* for removal, causing it to no longer be interactive. The removal happens on
* the next game step, it is not immediate.
*
* The Interactive Object that was assigned to this Game Object will be destroyed,
* removed from the Input Manager and cleared from this Game Object.
*
* If you wish to re-enable this Game Object at a later date you will need to
* re-create its InteractiveObject by calling `setInteractive` again.
*
* If you wish to only temporarily stop an object from receiving input then use
* `disableInteractive` instead, as that toggles the interactive state, where-as
* this erases it completely.
*
* If you wish to resize a hit area, don't remove and then set it as being
* interactive. Instead, access the hitarea object directly and resize the shape
* being used. I.e.: `sprite.input.hitArea.setSize(width, height)` (assuming the
* shape is a Rectangle, which it is by default.)
*/
removeInteractive(): this;
/**
* This callback is invoked when this Game Object is added to a Scene.
*
* Can be overriden by custom Game Objects, but be aware of some Game Objects that
* will use this, such as Sprites, to add themselves into the Update List.
*
* You can also listen for the `ADDED_TO_SCENE` event from this Game Object.
*/
addedToScene(): void;
/**
* This callback is invoked when this Game Object is removed from a Scene.
*
* Can be overriden by custom Game Objects, but be aware of some Game Objects that
* will use this, such as Sprites, to removed themselves from the Update List.
*
* You can also listen for the `REMOVED_FROM_SCENE` event from this Game Object.
*/
removedFromScene(): void;
/**
* To be overridden by custom GameObjects. Allows base objects to be used in a Pool.
* @param args args
*/
update(...args: any[]): void;
/**
* Returns a JSON representation of the Game Object.
*/
toJSON(): Phaser.Types.GameObjects.JSONGameObject;
/**
* Compares the renderMask with the renderFlags to see if this Game Object will render or not.
* Also checks the Game Object against the given Cameras exclusion list.
* @param camera The Camera to check against this Game Object.
*/
willRender(camera: Phaser.Cameras.Scene2D.Camera): boolean;
/**
* Returns an array containing the display list index of either this Game Object, or if it has one,
* its parent Container. It then iterates up through all of the parent containers until it hits the
* root of the display list (which is index 0 in the returned array).
*
* Used internally by the InputPlugin but also useful if you wish to find out the display depth of
* this Game Object and all of its ancestors.
*/
getIndexList(): number[];
/**
* Adds this Game Object to the given Display List.
*
* If no Display List is specified, it will default to the Display List owned by the Scene to which
* this Game Object belongs.
*
* A Game Object can only exist on one Display List at any given time, but may move freely between them.
*
* If this Game Object is already on another Display List when this method is called, it will first
* be removed from it, before being added to the new list.
*
* You can query which list it is on by looking at the `Phaser.GameObjects.GameObject#displayList` property.
*
* If a Game Object isn't on any display list, it will not be rendered. If you just wish to temporarly
* disable it from rendering, consider using the `setVisible` method, instead.
* @param displayList The Display List to add to. Defaults to the Scene Display List.
*/
addToDisplayList(displayList?: Phaser.GameObjects.DisplayList | Phaser.GameObjects.Layer): this;
/**
* Adds this Game Object to the Update List belonging to the Scene.
*
* When a Game Object is added to the Update List it will have its `preUpdate` method called
* every game frame. This method is passed two parameters: `delta` and `time`.
*
* If you wish to run your own logic within `preUpdate` then you should always call
* `super.preUpdate(delta, time)` within it, or it may fail to process required operations,
* such as Sprite animations.
*/
addToUpdateList(): this;
/**
* Removes this Game Object from the Display List it is currently on.
*
* A Game Object can only exist on one Display List at any given time, but may move freely removed
* and added back at a later stage.
*
* You can query which list it is on by looking at the `Phaser.GameObjects.GameObject#displayList` property.
*
* If a Game Object isn't on any Display List, it will not be rendered. If you just wish to temporarly
* disable it from rendering, consider using the `setVisible` method, instead.
*/
removeFromDisplayList(): this;
/**
* Removes this Game Object from the Scene's Update List.
*
* When a Game Object is on the Update List, it will have its `preUpdate` method called
* every game frame. Calling this method will remove it from the list, preventing this.
*
* Removing a Game Object from the Update List will stop most internal functions working.
* For example, removing a Sprite from the Update List will prevent it from being able to
* run animations.
*/
removeFromUpdateList(): this;
/**
* Destroys this Game Object removing it from the Display List and Update List and
* severing all ties to parent resources.
*
* Also removes itself from the Input Manager and Physics Manager if previously enabled.
*
* Use this to remove a Game Object from your game if you don't ever plan to use it again.
* As long as no reference to it exists within your own code it should become free for
* garbage collection by the browser.
*
* If you just want to temporarily disable an object then look at using the
* Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected.
* @param fromScene `True` if this Game Object is being destroyed by the Scene, `false` if not. Default false.
*/
destroy(fromScene?: boolean): void;
/**
* The bitmask that `GameObject.renderFlags` is compared against to determine if the Game Object will render or not.
*/
static readonly RENDER_MASK: number;
}
/**
* 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`.
*/
class GameObjectCreator {
/**
*
* @param scene The Scene to which this Game Object Factory belongs.
*/
constructor(scene: Phaser.Scene);
/**
* 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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
dynamicBitmapText(config: Phaser.Types.GameObjects.BitmapText.BitmapTextConfig, addToScene?: boolean): Phaser.GameObjects.DynamicBitmapText;
/**
* 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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
bitmapText(config: Phaser.Types.GameObjects.BitmapText.BitmapTextConfig, addToScene?: boolean): Phaser.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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
blitter(config: Phaser.Types.GameObjects.Sprite.SpriteConfig, addToScene?: boolean): Phaser.GameObjects.Blitter;
/**
* 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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
container(config: Phaser.Types.GameObjects.Container.ContainerConfig, addToScene?: boolean): Phaser.GameObjects.Container;
/**
* The Scene to which this Game Object Creator belongs.
*/
protected scene: Phaser.Scene;
/**
* A reference to the Scene.Systems.
*/
protected systems: Phaser.Scenes.Systems;
/**
* A reference to the Scene Event Emitter.
*/
protected events: Phaser.Events.EventEmitter;
/**
* A reference to the Scene Display List.
*/
protected displayList: Phaser.GameObjects.DisplayList;
/**
* A reference to the Scene Update List.
*/
protected updateList: Phaser.GameObjects.UpdateList;
/**
* 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.
* @param factoryType The key of the factory that you will use to call to Phaser.Scene.make[ factoryType ] method.
* @param factoryFunction The constructor function to be called when you invoke to the Phaser.Scene.make method.
*/
static register(factoryType: string, factoryFunction: Function): 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.
* @param factoryType The key of the factory that you want to remove from the GameObjectCreator.
*/
static remove(factoryType: string): void;
/**
* 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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
graphics(config?: Phaser.Types.GameObjects.Graphics.Options, addToScene?: boolean): Phaser.GameObjects.Graphics;
/**
* 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.
* @param config The configuration object this Game Object will use to create itself.
*/
group(config: Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig): Phaser.GameObjects.Group;
/**
* 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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
image(config: Phaser.Types.GameObjects.Sprite.SpriteConfig, addToScene?: boolean): Phaser.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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
layer(config: Phaser.Types.GameObjects.Sprite.SpriteConfig, addToScene?: boolean): Phaser.GameObjects.Layer;
/**
* 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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
mesh(config: Phaser.Types.GameObjects.Mesh.MeshConfig, addToScene?: boolean): Phaser.GameObjects.Mesh;
/**
* 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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
nineslice(config: Phaser.Types.GameObjects.NineSlice.NineSliceConfig, addToScene?: boolean): Phaser.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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
particles(config: Phaser.Types.GameObjects.Particles.ParticleEmitterCreatorConfig, addToScene?: boolean): Phaser.GameObjects.Particles.ParticleEmitter;
/**
* Creates a new Plane Game Object and returns it.
*
* Note: This method will only be available if the Plane Game Object and WebGL support have been built into Phaser.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
plane(config: Phaser.Types.GameObjects.Plane.PlaneConfig, addToScene?: boolean): Phaser.GameObjects.Plane;
/**
* 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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
pointlight(config: object, addToScene?: boolean): Phaser.GameObjects.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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
renderTexture(config: Phaser.Types.GameObjects.RenderTexture.RenderTextureConfig, addToScene?: boolean): Phaser.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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
rope(config: Phaser.Types.GameObjects.Rope.RopeConfig, addToScene?: boolean): Phaser.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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
shader(config: Phaser.Types.GameObjects.Shader.ShaderConfig, addToScene?: boolean): Phaser.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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
sprite(config: Phaser.Types.GameObjects.Sprite.SpriteConfig, addToScene?: boolean): Phaser.GameObjects.Sprite;
/**
* 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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
text(config: Phaser.Types.GameObjects.Text.TextConfig, addToScene?: boolean): Phaser.GameObjects.Text;
/**
* 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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
tileSprite(config: Phaser.Types.GameObjects.TileSprite.TileSpriteConfig, addToScene?: boolean): Phaser.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.
* @param config The configuration object this Game Object will use to create itself.
* @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
*/
video(config: Phaser.Types.GameObjects.Video.VideoConfig, addToScene?: boolean): Phaser.GameObjects.Video;
/**
* 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.
* @param config The configuration object this Game Object will use to create itself.
*/
zone(config: Phaser.Types.GameObjects.Zone.ZoneConfig): Phaser.GameObjects.Zone;
/**
* 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.
* @param config The config options for the Tilemap.
*/
tilemap(config?: Phaser.Types.Tilemaps.TilemapConfig): Phaser.Tilemaps.Tilemap;
/**
* Creates a new Tween object and returns it.
*
* Note: This method will only be available if Tweens have been built into Phaser.
* @param config A Tween Configuration object, or a Tween or TweenChain instance.
*/
tween(config: Phaser.Types.Tweens.TweenBuilderConfig | Phaser.Types.Tweens.TweenChainBuilderConfig | Phaser.Tweens.Tween | Phaser.Tweens.TweenChain): Phaser.Tweens.Tween;
/**
* Creates a new TweenChain object and returns it, without adding it to the Tween Manager.
*
* Note: This method will only be available if Tweens have been built into Phaser.
* @param config The TweenChain configuration.
*/
tweenchain(config: Phaser.Types.Tweens.TweenBuilderConfig | object): Phaser.Tweens.TweenChain;
}
/**
* The Game Object Factory is a Scene plugin that allows you to quickly create many common
* types of Game Objects and have them automatically registered with the Scene.
*
* Game Objects directly register themselves with the Factory and inject their own creation
* methods into the class.
*/
class GameObjectFactory {
/**
*
* @param scene The Scene to which this Game Object Factory belongs.
*/
constructor(scene: Phaser.Scene);
/**
* Creates a new Path Object.
* @param x The horizontal position of this Path.
* @param y The vertical position of this Path.
*/
path(x: number, y: number): Phaser.Curves.Path;
/**
* A Bitmap Mask combines the alpha (opacity) of a masked pixel with the alpha of another pixel.
* Unlike the Geometry Mask, which is a clipping path, a Bitmap Mask behaves like an alpha mask,
* not a clipping path. It is only available when using the WebGL Renderer.
*
* A Bitmap Mask can use any Game Object, or Dynamic Texture, to determine the alpha of each pixel of the masked Game Object(s).
* For any given point of a masked Game Object's texture, the pixel's alpha will be multiplied by the alpha
* of the pixel at the same position in the Bitmap Mask's Game Object. The color of the pixel from the
* Bitmap Mask doesn't matter.
*
* For example, if a pure blue pixel with an alpha of 0.95 is masked with a pure red pixel with an
* alpha of 0.5, the resulting pixel will be pure blue with an alpha of 0.475. Naturally, this means
* that a pixel in the mask with an alpha of 0 will hide the corresponding pixel in all masked Game Objects
* A pixel with an alpha of 1 in the masked Game Object will receive the same alpha as the
* corresponding pixel in the mask.
*
* Note: You cannot combine Bitmap Masks and Blend Modes on the same Game Object. You can, however,
* combine Geometry Masks and Blend Modes together.
*
* The Bitmap Mask's location matches the location of its Game Object, not the location of the
* masked objects. Moving or transforming the underlying Game Object will change the mask
* (and affect the visibility of any masked objects), whereas moving or transforming a masked object
* will not affect the mask.
*
* The Bitmap Mask will not render its Game Object by itself. If the Game Object is not in a
* Scene's display list, it will only be used for the mask and its full texture will not be directly
* visible. Adding the underlying Game Object to a Scene will not cause any problems - it will
* render as a normal Game Object and will also serve as a mask.
* @param maskObject The Game Object or Texture that will be used as the mask. If `null` it will generate an Image Game Object using the rest of the arguments.
* @param x If creating a Game Object, the horizontal position in the world.
* @param y If creating a Game Object, the vertical position in the world.
* @param texture If creating a Game Object, the key, or instance of the Texture it will use to render with, as stored in the Texture Manager.
* @param frame If creating a Game Object, an optional frame from the Texture this Game Object is rendering with.
*/
bitmapMask(maskObject?: Phaser.GameObjects.GameObject | Phaser.Textures.DynamicTexture, x?: number, y?: number, texture?: string | Phaser.Textures.Texture, frame?: string | number | Phaser.Textures.Frame): Phaser.Display.Masks.BitmapMask;
/**
* Creates a new Dynamic Bitmap Text Game Object and adds it to the Scene.
*
* BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure.
*
* During rendering for each letter of the text is rendered to the display, proportionally spaced out and aligned to
* match the font structure.
*
* Dynamic Bitmap Text objects are different from Static Bitmap Text in that they invoke a callback for each
* letter being rendered during the render pass. This callback allows you to manipulate the properties of
* each letter being rendered, such as its position, scale or tint, allowing you to create interesting effects
* like jiggling text, which can't be done with Static text. This means that Dynamic Text takes more processing
* time, so only use them if you require the callback ability they have.
*
* BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability
* to use Web Fonts, however you trade this flexibility for rendering speed. You can also create visually compelling BitmapTexts by
* processing the font texture in an image editor, applying fills and any other effects required.
*
* To create multi-line text insert \r, \n or \r\n escape codes into the text string.
*
* To create a BitmapText data files you need a 3rd party app such as:
*
* BMFont (Windows, free): http://www.angelcode.com/products/bmfont/
* Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner
* Littera (Web-based, free): http://kvazars.com/littera/
*
* For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of
* converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: http://codebeautify.org/xmltojson
*
* Note: This method will only be available if the Dynamic Bitmap Text Game Object has been built into Phaser.
* @param x The x position of the Game Object.
* @param y The y position of the Game Object.
* @param font The key of the font to use from the BitmapFont cache.
* @param text The string, or array of strings, to be set as the content of this Bitmap Text.
* @param size The font size to set.
*/
dynamicBitmapText(x: number, y: number, font: string, text?: string | string[], size?: number): Phaser.GameObjects.DynamicBitmapText;
/**
* Creates a new Bitmap Text Game Object and adds it to the Scene.
*
* BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure.
*
* During rendering for each letter of the text is rendered to the display, proportionally spaced out and aligned to
* match the font structure.
*
* BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability
* to use Web Fonts, however you trade this flexibility for rendering speed. You can also create visually compelling BitmapTexts by
* processing the font texture in an image editor, applying fills and any other effects required.
*
* To create multi-line text insert \r, \n or \r\n escape codes into the text string.
*
* To create a BitmapText data files you need a 3rd party app such as:
*
* BMFont (Windows, free): http://www.angelcode.com/products/bmfont/
* Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner
* Littera (Web-based, free): http://kvazars.com/littera/
*
* For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of
* converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: http://codebeautify.org/xmltojson
*
* Note: This method will only be available if the Bitmap Text Game Object has been built into Phaser.
* @param x The x position of the Game Object.
* @param y The y position of the Game Object.
* @param font The key of the font to use from the BitmapFont cache.
* @param text The string, or array of strings, to be set as the content of this Bitmap Text.
* @param size The font size to set.
* @param align The alignment of the text in a multi-line BitmapText object. Default 0.
*/
bitmapText(x: number, y: number, font: string, text?: string | string[], size?: number, align?: number): Phaser.GameObjects.BitmapText;
/**
* Creates a new Blitter Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Blitter Game Object has been built into Phaser.
* @param x The x position of the Game Object.
* @param y The y position of the Game Object.
* @param texture The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager.
* @param frame The default Frame children of the Blitter will use.
*/
blitter(x: number, y: number, texture: string | Phaser.Textures.Texture, frame?: string | number): Phaser.GameObjects.Blitter;
/**
* 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.
* @param x The horizontal position of this Game Object in the world. Default 0.
* @param y The vertical position of this Game Object in the world. Default 0.
* @param children An optional array of Game Objects to add to this Container.
*/
container(x?: number, y?: number, children?: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[]): Phaser.GameObjects.Container;
/**
* DOM Element Game Objects are a way to control and manipulate HTML Elements over the top of your game.
*
* In order for DOM Elements to display you have to enable them by adding the following to your game
* configuration object:
*
* ```javascript
* dom {
* createContainer: true
* }
* ```
*
* When this is added, Phaser will automatically create a DOM Container div that is positioned over the top
* of the game canvas. This div is sized to match the canvas, and if the canvas size changes, as a result of
* settings within the Scale Manager, the dom container is resized accordingly.
*
* You can create a DOM Element by either passing in DOMStrings, or by passing in a reference to an existing
* Element that you wish to be placed under the control of Phaser. For example:
*
* ```javascript
* this.add.dom(x, y, 'div', 'background-color: lime; width: 220px; height: 100px; font: 48px Arial', 'Phaser');
* ```
*
* The above code will insert a div element into the DOM Container at the given x/y coordinate. The DOMString in
* the 4th argument sets the initial CSS style of the div and the final argument is the inner text. In this case,
* it will create a lime colored div that is 220px by 100px in size with the text Phaser in it, in an Arial font.
*
* You should nearly always, without exception, use explicitly sized HTML Elements, in order to fully control
* alignment and positioning of the elements next to regular game content.
*
* Rather than specify the CSS and HTML directly you can use the `load.html` File Loader to load it into the
* cache and then use the `createFromCache` method instead. You can also use `createFromHTML` and various other
* methods available in this class to help construct your elements.
*
* Once the element has been created you can then control it like you would any other Game Object. You can set its
* position, scale, rotation, alpha and other properties. It will move as the main Scene Camera moves and be clipped
* at the edge of the canvas. It's important to remember some limitations of DOM Elements: The obvious one is that
* they appear above or below your game canvas. You cannot blend them into the display list, meaning you cannot have
* a DOM Element, then a Sprite, then another DOM Element behind it.
*
* They also cannot be enabled for input. To do that, you have to use the `addListener` method to add native event
* listeners directly. The final limitation is to do with cameras. The DOM Container is sized to match the game canvas
* entirely and clipped accordingly. DOM Elements respect camera scrolling and scrollFactor settings, but if you
* change the size of the camera so it no longer matches the size of the canvas, they won't be clipped accordingly.
*
* Also, all DOM Elements are inserted into the same DOM Container, regardless of which Scene they are created in.
*
* DOM Elements are a powerful way to align native HTML with your Phaser Game Objects. For example, you can insert
* a login form for a multiplayer game directly into your title screen. Or a text input box for a highscore table.
* Or a banner ad from a 3rd party service. Or perhaps you'd like to use them for high resolution text display and
* UI. The choice is up to you, just remember that you're dealing with standard HTML and CSS floating over the top
* of your game, and should treat it accordingly.
*
* Note: This method will only be available if the DOM Element Game Object has been built into Phaser.
* @param x The horizontal position of this DOM Element in the world.
* @param y The vertical position of this DOM Element in the world.
* @param element An existing DOM element, or a string. If a string starting with a # it will do a `getElementById` look-up on the string (minus the hash). Without a hash, it represents the type of element to create, i.e. 'div'.
* @param style If a string, will be set directly as the elements `style` property value. If a plain object, will be iterated and the values transferred. In both cases the values replacing whatever CSS styles may have been previously set.
* @param innerText If given, will be set directly as the elements `innerText` property value, replacing whatever was there before.
*/
dom(x: number, y: number, element?: HTMLElement | string, style?: string | any, innerText?: string): Phaser.GameObjects.DOMElement;
/**
* Creates a new Extern Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Extern Game Object has been built into Phaser.
*/
extern(): Phaser.GameObjects.Extern;
/**
* The Scene to which this Game Object Factory belongs.
*/
protected scene: Phaser.Scene;
/**
* A reference to the Scene.Systems.
*/
protected systems: Phaser.Scenes.Systems;
/**
* A reference to the Scene Event Emitter.
*/
protected events: Phaser.Events.EventEmitter;
/**
* A reference to the Scene Display List.
*/
protected displayList: Phaser.GameObjects.DisplayList;
/**
* A reference to the Scene Update List.
*/
protected updateList: Phaser.GameObjects.UpdateList;
/**
* Adds an existing Game Object to this Scene.
*
* If the Game Object renders, it will be added to the Display List.
* If it has a `preUpdate` method, it will be added to the Update List.
* @param child The child to be added to this Scene.
*/
existing(child: G): G;
/**
* Static method called directly by the Game Object factory functions.
* With this method you can register a custom GameObject factory in the GameObjectFactory,
* providing a name (`factoryType`) and the constructor (`factoryFunction`) in order
* to be called when you call to Phaser.Scene.add[ factoryType ] method.
* @param factoryType The key of the factory that you will use to call to Phaser.Scene.add[ factoryType ] method.
* @param factoryFunction The constructor function to be called when you invoke to the Phaser.Scene.add method.
*/
static register(factoryType: string, factoryFunction: Function): void;
/**
* Static method called directly by the Game Object factory functions.
* With this method you can remove a custom GameObject factory registered in the GameObjectFactory,
* providing a its `factoryType`.
* @param factoryType The key of the factory that you want to remove from the GameObjectFactory.
*/
static remove(factoryType: string): void;
/**
* Creates a new Graphics Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Graphics Game Object has been built into Phaser.
* @param config The Graphics configuration.
*/
graphics(config?: Phaser.Types.GameObjects.Graphics.Options): Phaser.GameObjects.Graphics;
/**
* Creates a new Group Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Group Game Object has been built into Phaser.
* @param children Game Objects to add to this Group; or the `config` argument.
* @param config A Group Configuration object.
*/
group(children?: Phaser.GameObjects.GameObject[] | Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupConfig[] | Phaser.Types.GameObjects.Group.GroupCreateConfig, config?: Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig): Phaser.GameObjects.Group;
/**
* Creates a new Image Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Image Game Object has been built into Phaser.
* @param x The horizontal position of this Game Object in the world.
* @param y The vertical position of this Game Object in the world.
* @param texture The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager.
* @param frame An optional frame from the Texture this Game Object is rendering with.
*/
image(x: number, y: number, texture: string | Phaser.Textures.Texture, frame?: string | number): Phaser.GameObjects.Image;
/**
* Creates a new Layer Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Layer Game Object has been built into Phaser.
* @param children An optional array of Game Objects to add to this Layer.
*/
layer(children?: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[]): Phaser.GameObjects.Layer;
/**
* Creates a new Mesh Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser.
* @param x The horizontal position of this Game Object in the world.
* @param y The vertical position of this Game Object in the world.
* @param texture The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager.
* @param frame An optional frame from the Texture this Game Object is rendering with.
* @param vertices The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`.
* @param uvs The UVs pairs array.
* @param indicies Optional vertex indicies array. If you don't have one, pass `null` or an empty array.
* @param containsZ Does the vertices data include a `z` component? Default false.
* @param normals Optional vertex normals array. If you don't have one, pass `null` or an empty array.
* @param colors An array of colors, one per vertex, or a single color value applied to all vertices. Default 0xffffff.
* @param alphas An array of alpha values, one per vertex, or a single alpha value applied to all vertices. Default 1.
*/
mesh(x?: number, y?: number, texture?: string | Phaser.Textures.Texture, frame?: string | number, vertices?: number[], uvs?: number[], indicies?: number[], containsZ?: boolean, normals?: number[], colors?: number | number[], alphas?: number | number[]): Phaser.GameObjects.Mesh;
/**
* A Nine Slice Game Object allows you to display a texture-based object that
* can be stretched both horizontally and vertically, but that retains
* fixed-sized corners. The dimensions of the corners are set via the
* parameters to this class.
*
* This is extremely useful for UI and button like elements, where you need
* them to expand to accommodate the content without distorting the texture.
*
* The texture you provide for this Game Object should be based on the
* following layout structure:
*
* ```
* A B
* +---+----------------------+---+
* C | 1 | 2 | 3 |
* +---+----------------------+---+
* | | | |
* | 4 | 5 | 6 |
* | | | |
* +---+----------------------+---+
* D | 7 | 8 | 9 |
* +---+----------------------+---+
* ```
*
* When changing this objects width and / or height:
*
* areas 1, 3, 7 and 9 (the corners) will remain unscaled
* areas 2 and 8 will be stretched horizontally only
* areas 4 and 6 will be stretched vertically only
* area 5 will be stretched both horizontally and vertically
*
* You can also create a 3 slice Game Object:
*
* This works in a similar way, except you can only stretch it horizontally.
* Therefore, it requires less configuration:
*
* ```
* A B
* +---+----------------------+---+
* | | | |
* C | 1 | 2 | 3 |
* | | | |
* +---+----------------------+---+
* ```
*
* When changing this objects width (you cannot change its height)
*
* areas 1 and 3 will remain unscaled
* area 2 will be stretched horizontally
*
* The above configuration concept is adapted from the Pixi NineSlicePlane.
*
* To specify a 3 slice object instead of a 9 slice you should only
* provide the `leftWidth` and `rightWidth` parameters. To create a 9 slice
* you must supply all parameters.
*
* The _minimum_ width this Game Object can be is the total of
* `leftWidth` + `rightWidth`. The _minimum_ height this Game Object
* can be is the total of `topHeight` + `bottomHeight`.
* If you need to display this object at a smaller size, you can scale it.
*
* In terms of performance, using a 3 slice Game Object is the equivalent of
* having 3 Sprites in a row. Using a 9 slice Game Object is the equivalent
* of having 9 Sprites in a row. The vertices of this object are all batched
* together and can co-exist with other Sprites and graphics on the display
* list, without incurring any additional overhead.
*
* As of Phaser 3.60 this Game Object is WebGL only.
* @param x The horizontal position of the center of this Game Object in the world.
* @param y The vertical position of the center of this Game Object in the world.
* @param texture The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager.
* @param frame An optional frame from the Texture this Game Object is rendering with.
* @param width The width of the Nine Slice Game Object. You can adjust the width post-creation. Default 256.
* @param height The height of the Nine Slice Game Object. If this is a 3 slice object the height will be fixed to the height of the texture and cannot be changed. Default 256.
* @param leftWidth The size of the left vertical column (A). Default 10.
* @param rightWidth The size of the right vertical column (B). Default 10.
* @param topHeight The size of the top horiztonal row (C). Set to zero or undefined to create a 3 slice object. Default 0.
* @param bottomHeight The size of the bottom horiztonal row (D). Set to zero or undefined to create a 3 slice object. Default 0.
*/
nineslice(x: number, y: number, texture: string | Phaser.Textures.Texture, frame?: string | number, width?: number, height?: number, leftWidth?: number, rightWidth?: number, topHeight?: number, bottomHeight?: number): Phaser.GameObjects.NineSlice;
/**
* Creates a new Particle Emitter Game Object and adds it to the Scene.
*
* If you wish to configure the Emitter after creating it, use the `ParticleEmitter.setConfig` method.
*
* 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.
* @param x The horizontal position of this Game Object in the world.
* @param y The vertical position of this Game Object in the world.
* @param texture The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager.
* @param config Configuration settings for the Particle Emitter.
*/
particles(x?: number, y?: number, texture?: string | Phaser.Textures.Texture, config?: Phaser.Types.GameObjects.Particles.ParticleEmitterConfig): Phaser.GameObjects.Particles.ParticleEmitter;
/**
* Creates a new PathFollower Game Object and adds it to the Scene.
*
* Note: This method will only be available if the PathFollower Game Object has been built into Phaser.
* @param path The Path this PathFollower is connected to.
* @param x The horizontal position of this Game Object in the world.
* @param y The vertical position of this Game Object in the world.
* @param texture The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager.
* @param frame An optional frame from the Texture this Game Object is rendering with.
*/
follower(path: Phaser.Curves.Path, x: number, y: number, texture: string | Phaser.Textures.Texture, frame?: string | number): Phaser.GameObjects.PathFollower;
/**
* Creates a new Plane Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Plane Game Object has been built into Phaser.
* @param x The horizontal position of this Plane in the world.
* @param y The vertical position of this Plane in the world.
* @param texture The key, or instance of the Texture this Plane will use to render with, as stored in the Texture Manager.
* @param frame An optional frame from the Texture this Plane is rendering with.
* @param width The width of this Plane, in cells, not pixels. Default 8.
* @param height The height of this Plane, in cells, not pixels. Default 8.
* @param tile Is the texture tiled? I.e. repeated across each cell. Default false.
*/
plane(x?: number, y?: number, texture?: string | Phaser.Textures.Texture, frame?: string | number, width?: number, height?: number, tile?: boolean): Phaser.GameObjects.Plane;
/**
* Creates a new Point Light Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Point Light Game Object has been built into Phaser.
*
* The Point Light Game Object provides a way to add a point light effect into your game,
* without the expensive shader processing requirements of the traditional Light Game Object.
*
* The difference is that the Point Light renders using a custom shader, designed to give the
* impression of a point light source, of variable radius, intensity and color, in your game.
* However, unlike the Light Game Object, it does not impact any other Game Objects, or use their
* normal maps for calcuations. This makes them extremely fast to render compared to Lights
* and perfect for special effects, such as flickering torches or muzzle flashes.
*
* For maximum performance you should batch Point Light Game Objects together. This means
* ensuring they follow each other consecutively on the display list. Ideally, use a Layer
* Game Object and then add just Point Lights to it, so that it can batch together the rendering
* of the lights. You don't _have_ to do this, and if you've only a handful of Point Lights in
* your game then it's perfectly safe to mix them into the dislay list as normal. However, if
* you're using a large number of them, please consider how they are mixed into the display list.
*
* The renderer will automatically cull Point Lights. Those with a radius that does not intersect
* with the Camera will be skipped in the rendering list. This happens automatically and the
* culled state is refreshed every frame, for every camera.
*
* The origin of a Point Light is always 0.5 and it cannot be changed.
*
* Point Lights are a WebGL only feature and do not have a Canvas counterpart.
* @param x The horizontal position of this Point Light in the world.
* @param y The vertical position of this Point Light in the world.
* @param color The color of the Point Light, given as a hex value. Default 0xffffff.
* @param radius The radius of the Point Light. Default 128.
* @param intensity The intensity, or color blend, of the Point Light. Default 1.
* @param attenuation The attenuation of the Point Light. This is the reduction of light from the center point. Default 0.1.
*/
pointlight(x: number, y: number, color?: number, radius?: number, intensity?: number, attenuation?: number): Phaser.GameObjects.PointLight;
/**
* Creates a new Render Texture Game Object and adds it to the Scene.
*
* 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.
* @param x The horizontal position of this Game Object in the world.
* @param y The vertical position of this Game Object in the world.
* @param width The width of the Render Texture. Default 32.
* @param height The height of the Render Texture. De