`
* 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.
*
* Calling this method 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 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.
* @param updateSize Should this call adjust the size of the Game Object? Default true.
* @param updateOrigin Should this call change the origin of the Game Object? Default true.
*/
setTexture(key: string | Phaser.Textures.Texture, frame?: string | number, updateSize?: boolean, updateOrigin?: boolean): 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.
* Return `tintTopLeft` when read this tint property.
*/
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 change the value for.
* @param amount The amount to increase the given key by. Pass a negative value to decrease the key. Default 1.
*/
incData(key: string, amount?: number): 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): 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. Default true.
*/
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. Default 32.
*/
renderTexture(x: number, y: number, width?: number, height?: number): Phaser.GameObjects.RenderTexture;
/**
* Creates a new Rope Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Rope 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 points An array containing the vertices data for this Rope. If none is provided a simple quad is created. See `setPoints` to set this post-creation.
* @param horizontal Should the vertices of this Rope be aligned horizontally (`true`), or vertically (`false`)? Default true.
* @param colors An optional array containing the color data for this Rope. You should provide one color value per pair of vertices.
* @param alphas An optional array containing the alpha data for this Rope. You should provide one alpha value per pair of vertices.
*/
rope(x: number, y: number, texture: string | Phaser.Textures.Texture, frame?: string | number, points?: Phaser.Types.Math.Vector2Like[], horizontal?: boolean, colors?: number[], alphas?: number[]): Phaser.GameObjects.Rope;
/**
* Creates a new Shader Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Shader Game Object and WebGL support have been built into Phaser.
* @param key The key of the shader to use from the shader cache, or a BaseShader instance.
* @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 width The width of the Game Object. Default 128.
* @param height The height of the Game Object. Default 128.
* @param textures Optional array of texture keys to bind to the iChannel0...3 uniforms. The textures must already exist in the Texture Manager.
* @param textureData Optional additional texture data.
*/
shader(key: string | Phaser.Display.BaseShader, x?: number, y?: number, width?: number, height?: number, textures?: string[], textureData?: object): Phaser.GameObjects.Shader;
/**
* Creates a new Arc Shape Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Arc Game Object has been built into Phaser.
*
* The Arc Shape is a Game Object that can be added to a Scene, Group or Container. You can
* treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
* it for input or physics. It provides a quick and easy way for you to render this shape in your
* game without using a texture, while still taking advantage of being fully batched in WebGL.
*
* This shape supports both fill and stroke colors.
*
* When it renders it displays an arc shape. You can control the start and end angles of the arc,
* as well as if the angles are winding clockwise or anti-clockwise. With the default settings
* it renders as a complete circle. By changing the angles you can create other arc shapes,
* such as half-circles.
* @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 radius The radius of the arc. Default 128.
* @param startAngle The start angle of the arc, in degrees. Default 0.
* @param endAngle The end angle of the arc, in degrees. Default 360.
* @param anticlockwise The winding order of the start and end angles. Default false.
* @param fillColor The color the arc will be filled with, i.e. 0xff0000 for red.
* @param fillAlpha The alpha the arc will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
*/
arc(x?: number, y?: number, radius?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Arc;
/**
* Creates a new Circle Shape Game Object and adds it to the Scene.
*
* A Circle is an Arc with no defined start and end angle, making it render as a complete circle.
*
* Note: This method will only be available if the Arc 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 radius The radius of the circle. Default 128.
* @param fillColor The color the circle will be filled with, i.e. 0xff0000 for red.
* @param fillAlpha The alpha the circle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
*/
circle(x?: number, y?: number, radius?: number, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Arc;
/**
* Creates a new Curve Shape Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Curve Game Object has been built into Phaser.
*
* The Curve Shape is a Game Object that can be added to a Scene, Group or Container. You can
* treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
* it for input or physics. It provides a quick and easy way for you to render this shape in your
* game without using a texture, while still taking advantage of being fully batched in WebGL.
*
* This shape supports both fill and stroke colors.
*
* To render a Curve Shape you must first create a `Phaser.Curves.Curve` object, then pass it to
* the Curve Shape in the constructor.
*
* The Curve shape also has a `smoothness` property and corresponding `setSmoothness` method.
* This allows you to control how smooth the shape renders in WebGL, by controlling the number of iterations
* that take place during construction. Increase and decrease the default value for smoother, or more
* jagged, shapes.
* @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 curve The Curve object to use to create the Shape.
* @param fillColor The color the curve will be filled with, i.e. 0xff0000 for red.
* @param fillAlpha The alpha the curve will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
*/
curve(x?: number, y?: number, curve?: Phaser.Curves.Curve, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Curve;
/**
* Creates a new Ellipse Shape Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Ellipse Game Object has been built into Phaser.
*
* The Ellipse Shape is a Game Object that can be added to a Scene, Group or Container. You can
* treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
* it for input or physics. It provides a quick and easy way for you to render this shape in your
* game without using a texture, while still taking advantage of being fully batched in WebGL.
*
* This shape supports both fill and stroke colors.
*
* When it renders it displays an ellipse shape. You can control the width and height of the ellipse.
* If the width and height match it will render as a circle. If the width is less than the height,
* it will look more like an egg shape.
*
* The Ellipse shape also has a `smoothness` property and corresponding `setSmoothness` method.
* This allows you to control how smooth the shape renders in WebGL, by controlling the number of iterations
* that take place during construction. Increase and decrease the default value for smoother, or more
* jagged, shapes.
* @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 width The width of the ellipse. An ellipse with equal width and height renders as a circle. Default 128.
* @param height The height of the ellipse. An ellipse with equal width and height renders as a circle. Default 128.
* @param fillColor The color the ellipse will be filled with, i.e. 0xff0000 for red.
* @param fillAlpha The alpha the ellipse will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
*/
ellipse(x?: number, y?: number, width?: number, height?: number, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Ellipse;
/**
* Creates a new Grid Shape Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Grid Game Object has been built into Phaser.
*
* The Grid Shape is a Game Object that can be added to a Scene, Group or Container. You can
* treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
* it for input or physics. It provides a quick and easy way for you to render this shape in your
* game without using a texture, while still taking advantage of being fully batched in WebGL.
*
* This shape supports only fill colors and cannot be stroked.
*
* A Grid Shape allows you to display a grid in your game, where you can control the size of the
* grid as well as the width and height of the grid cells. You can set a fill color for each grid
* cell as well as an alternate fill color. When the alternate fill color is set then the grid
* cells will alternate the fill colors as they render, creating a chess-board effect. You can
* also optionally have an outline fill color. If set, this draws lines between the grid cells
* in the given color. If you specify an outline color with an alpha of zero, then it will draw
* the cells spaced out, but without the lines between them.
* @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 width The width of the grid. Default 128.
* @param height The height of the grid. Default 128.
* @param cellWidth The width of one cell in the grid. Default 32.
* @param cellHeight The height of one cell in the grid. Default 32.
* @param fillColor The color the grid cells will be filled with, i.e. 0xff0000 for red.
* @param fillAlpha The alpha the grid cells will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
* @param outlineFillColor The color of the lines between the grid cells.
* @param outlineFillAlpha The alpha of the lines between the grid cells.
*/
grid(x?: number, y?: number, width?: number, height?: number, cellWidth?: number, cellHeight?: number, fillColor?: number, fillAlpha?: number, outlineFillColor?: number, outlineFillAlpha?: number): Phaser.GameObjects.Grid;
/**
* Creates a new IsoBox Shape Game Object and adds it to the Scene.
*
* Note: This method will only be available if the IsoBox Game Object has been built into Phaser.
*
* The IsoBox Shape is a Game Object that can be added to a Scene, Group or Container. You can
* treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
* it for input or physics. It provides a quick and easy way for you to render this shape in your
* game without using a texture, while still taking advantage of being fully batched in WebGL.
*
* This shape supports only fill colors and cannot be stroked.
*
* An IsoBox is an 'isometric' rectangle. Each face of it has a different fill color. You can set
* the color of the top, left and right faces of the rectangle respectively. You can also choose
* which of the faces are rendered via the `showTop`, `showLeft` and `showRight` properties.
*
* You cannot view an IsoBox from under-neath, however you can change the 'angle' by setting
* the `projection` property.
* @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 size The width of the iso box in pixels. The left and right faces will be exactly half this value. Default 48.
* @param height The height of the iso box. The left and right faces will be this tall. The overall height of the isobox will be this value plus half the `size` value. Default 32.
* @param fillTop The fill color of the top face of the iso box. Default 0xeeeeee.
* @param fillLeft The fill color of the left face of the iso box. Default 0x999999.
* @param fillRight The fill color of the right face of the iso box. Default 0xcccccc.
*/
isobox(x?: number, y?: number, size?: number, height?: number, fillTop?: number, fillLeft?: number, fillRight?: number): Phaser.GameObjects.IsoBox;
/**
* Creates a new IsoTriangle Shape Game Object and adds it to the Scene.
*
* Note: This method will only be available if the IsoTriangle Game Object has been built into Phaser.
*
* The IsoTriangle Shape is a Game Object that can be added to a Scene, Group or Container. You can
* treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
* it for input or physics. It provides a quick and easy way for you to render this shape in your
* game without using a texture, while still taking advantage of being fully batched in WebGL.
*
* This shape supports only fill colors and cannot be stroked.
*
* An IsoTriangle is an 'isometric' triangle. Think of it like a pyramid. Each face has a different
* fill color. You can set the color of the top, left and right faces of the triangle respectively
* You can also choose which of the faces are rendered via the `showTop`, `showLeft` and `showRight` properties.
*
* You cannot view an IsoTriangle from under-neath, however you can change the 'angle' by setting
* the `projection` property. The `reversed` property controls if the IsoTriangle is rendered upside
* down or not.
* @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 size The width of the iso triangle in pixels. The left and right faces will be exactly half this value. Default 48.
* @param height The height of the iso triangle. The left and right faces will be this tall. The overall height of the iso triangle will be this value plus half the `size` value. Default 32.
* @param reversed Is the iso triangle upside down? Default false.
* @param fillTop The fill color of the top face of the iso triangle. Default 0xeeeeee.
* @param fillLeft The fill color of the left face of the iso triangle. Default 0x999999.
* @param fillRight The fill color of the right face of the iso triangle. Default 0xcccccc.
*/
isotriangle(x?: number, y?: number, size?: number, height?: number, reversed?: boolean, fillTop?: number, fillLeft?: number, fillRight?: number): Phaser.GameObjects.IsoTriangle;
/**
* Creates a new Line Shape Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Line Game Object has been built into Phaser.
*
* The Line Shape is a Game Object that can be added to a Scene, Group or Container. You can
* treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
* it for input or physics. It provides a quick and easy way for you to render this shape in your
* game without using a texture, while still taking advantage of being fully batched in WebGL.
*
* This shape supports only stroke colors and cannot be filled.
*
* A Line Shape allows you to draw a line between two points in your game. You can control the
* stroke color and thickness of the line. In WebGL only you can also specify a different
* thickness for the start and end of the line, allowing you to render lines that taper-off.
*
* If you need to draw multiple lines in a sequence you may wish to use the Polygon Shape instead.
* @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 x1 The horizontal position of the start of the line. Default 0.
* @param y1 The vertical position of the start of the line. Default 0.
* @param x2 The horizontal position of the end of the line. Default 128.
* @param y2 The vertical position of the end of the line. Default 0.
* @param strokeColor The color the line will be drawn in, i.e. 0xff0000 for red.
* @param strokeAlpha The alpha the line will be drawn in. You can also set the alpha of the overall Shape using its `alpha` property.
*/
line(x?: number, y?: number, x1?: number, y1?: number, x2?: number, y2?: number, strokeColor?: number, strokeAlpha?: number): Phaser.GameObjects.Line;
/**
* Creates a new Polygon Shape Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Polygon Game Object has been built into Phaser.
*
* The Polygon Shape is a Game Object that can be added to a Scene, Group or Container. You can
* treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
* it for input or physics. It provides a quick and easy way for you to render this shape in your
* game without using a texture, while still taking advantage of being fully batched in WebGL.
*
* This shape supports both fill and stroke colors.
*
* The Polygon Shape is created by providing a list of points, which are then used to create an
* internal Polygon geometry object. The points can be set from a variety of formats:
*
* - An array of Point or Vector2 objects: `[new Phaser.Math.Vector2(x1, y1), ...]`
* - An array of objects with public x/y properties: `[obj1, obj2, ...]`
* - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]`
* - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]`
*
* By default the `x` and `y` coordinates of this Shape refer to the center of it. However, depending
* on the coordinates of the points provided, the final shape may be rendered offset from its origin.
* @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 points The points that make up the polygon.
* @param fillColor The color the polygon will be filled with, i.e. 0xff0000 for red.
* @param fillAlpha The alpha the polygon will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
*/
polygon(x?: number, y?: number, points?: any, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Polygon;
/**
* Creates a new Rectangle Shape Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Rectangle Game Object has been built into Phaser.
*
* The Rectangle Shape is a Game Object that can be added to a Scene, Group or Container. You can
* treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
* it for input or physics. It provides a quick and easy way for you to render this shape in your
* game without using a texture, while still taking advantage of being fully batched in WebGL.
*
* This shape supports both fill and stroke colors.
*
* You can change the size of the rectangle by changing the `width` and `height` properties.
* @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 width The width of the rectangle. Default 128.
* @param height The height of the rectangle. Default 128.
* @param fillColor The color the rectangle will be filled with, i.e. 0xff0000 for red.
* @param fillAlpha The alpha the rectangle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
*/
rectangle(x?: number, y?: number, width?: number, height?: number, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Rectangle;
/**
* Creates a new Star Shape Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Star Game Object has been built into Phaser.
*
* The Star Shape is a Game Object that can be added to a Scene, Group or Container. You can
* treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
* it for input or physics. It provides a quick and easy way for you to render this shape in your
* game without using a texture, while still taking advantage of being fully batched in WebGL.
*
* This shape supports both fill and stroke colors.
*
* As the name implies, the Star shape will display a star in your game. You can control several
* aspects of it including the number of points that constitute the star. The default is 5. If
* you change it to 4 it will render as a diamond. If you increase them, you'll get a more spiky
* star shape.
*
* You can also control the inner and outer radius, which is how 'long' each point of the star is.
* Modify these values to create more interesting shapes.
* @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 points The number of points on the star. Default 5.
* @param innerRadius The inner radius of the star. Default 32.
* @param outerRadius The outer radius of the star. Default 64.
* @param fillColor The color the star will be filled with, i.e. 0xff0000 for red.
* @param fillAlpha The alpha the star will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
*/
star(x?: number, y?: number, points?: number, innerRadius?: number, outerRadius?: number, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Star;
/**
* Creates a new Triangle Shape Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Triangle Game Object has been built into Phaser.
*
* The Triangle Shape is a Game Object that can be added to a Scene, Group or Container. You can
* treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
* it for input or physics. It provides a quick and easy way for you to render this shape in your
* game without using a texture, while still taking advantage of being fully batched in WebGL.
*
* This shape supports both fill and stroke colors.
*
* The Triangle consists of 3 lines, joining up to form a triangular shape. You can control the
* position of each point of these lines. The triangle is always closed and cannot have an open
* face. If you require that, consider using a Polygon instead.
* @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 x1 The horizontal position of the first point in the triangle. Default 0.
* @param y1 The vertical position of the first point in the triangle. Default 128.
* @param x2 The horizontal position of the second point in the triangle. Default 64.
* @param y2 The vertical position of the second point in the triangle. Default 0.
* @param x3 The horizontal position of the third point in the triangle. Default 128.
* @param y3 The vertical position of the third point in the triangle. Default 128.
* @param fillColor The color the triangle will be filled with, i.e. 0xff0000 for red.
* @param fillAlpha The alpha the triangle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
*/
triangle(x?: number, y?: number, x1?: number, y1?: number, x2?: number, y2?: number, x3?: number, y3?: number, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Triangle;
/**
* Creates a new Sprite Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Sprite 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.
*/
sprite(x: number, y: number, texture: string | Phaser.Textures.Texture, frame?: string | number): Phaser.GameObjects.Sprite;
/**
* Creates a new Text Game Object and adds it to the Scene.
*
* A Text Game Object.
*
* Text objects work by creating their own internal hidden Canvas and then renders text to it using
* the standard Canvas `fillText` API. It then creates a texture from this canvas which is rendered
* to your game during the render pass.
*
* Because it uses the Canvas API you can take advantage of all the features this offers, such as
* applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts
* loaded externally, such as Google or TypeKit Web fonts.
*
* You can only display fonts that are currently loaded and available to the browser: therefore fonts must
* be pre-loaded. Phaser does not do this for you, so you will require the use of a 3rd party font loader,
* or have the fonts ready available in the CSS on the page in which your Phaser game resides.
*
* See {@link http://www.jordanm.co.uk/tinytype this compatibility table} for the available default fonts
* across mobile browsers.
*
* A note on performance: Every time the contents of a Text object changes, i.e. changing the text being
* displayed, or the style of the text, it needs to remake the Text canvas, and if on WebGL, re-upload the
* new texture to the GPU. This can be an expensive operation if used often, or with large quantities of
* Text objects in your game. If you run into performance issues you would be better off using Bitmap Text
* instead, as it benefits from batching and avoids expensive Canvas API calls.
*
* Note: This method will only be available if the Text 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 text The text this Text object will display.
* @param style The Text style configuration object.
*/
text(x: number, y: number, text: string | string[], style?: Phaser.Types.GameObjects.Text.TextStyle): Phaser.GameObjects.Text;
/**
* Creates a new TileSprite Game Object and adds it to the Scene.
*
* Note: This method will only be available if the TileSprite 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 width The width of the Game Object. If zero it will use the size of the texture frame.
* @param height The height of the Game Object. If zero it will use the size of the texture frame.
* @param texture The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. Cannot be a DynamicTexture.
* @param frame An optional frame from the Texture this Game Object is rendering with.
*/
tileSprite(x: number, y: number, width: number, height: number, texture: string | Phaser.Textures.Texture, frame?: string | number): Phaser.GameObjects.TileSprite;
/**
* Creates a new Video Game Object and adds it to the Scene.
*
* This Game Object is capable of handling playback of a video file, video stream or media stream.
*
* You can optionally 'preload' the video into the Phaser Video Cache:
*
* ```javascript
* preload () {
* this.load.video('ripley', 'assets/aliens.mp4');
* }
*
* create () {
* this.add.video(400, 300, 'ripley');
* }
* ```
*
* You don't have to 'preload' the video. You can also play it directly from a URL:
*
* ```javascript
* create () {
* this.add.video(400, 300).loadURL('assets/aliens.mp4');
* }
* ```
*
* To all intents and purposes, a video is a standard Game Object, just like a Sprite. And as such, you can do
* all the usual things to it, such as scaling, rotating, cropping, tinting, making interactive, giving a
* physics body, etc.
*
* Transparent videos are also possible via the WebM file format. Providing the video file has was encoded with
* an alpha channel, and providing the browser supports WebM playback (not all of them do), then it will render
* in-game with full transparency.
*
* ### Autoplaying Videos
*
* Videos can only autoplay if the browser has been unlocked with an interaction, or satisfies the MEI settings.
* The policies that control autoplaying are vast and vary between browser. You can, and should, read more about
* it here: https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
*
* If your video doesn't contain any audio, then set the `noAudio` parameter to `true` when the video is _loaded_,
* and it will often allow the video to play immediately:
*
* ```javascript
* preload () {
* this.load.video('pixar', 'nemo.mp4', true);
* }
* ```
*
* The 3rd parameter in the load call tells Phaser that the video doesn't contain any audio tracks. Video without
* audio can autoplay without requiring a user interaction. Video with audio cannot do this unless it satisfies
* the browsers MEI settings. See the MDN Autoplay Guide for further details.
*
* Or:
*
* ```javascript
* create () {
* this.add.video(400, 300).loadURL('assets/aliens.mp4', true);
* }
* ```
*
* You can set the `noAudio` parameter to `true` even if the video does contain audio. It will still allow the video
* to play immediately, but the audio will not start.
*
* Note that due to a bug in IE11 you cannot play a video texture to a Sprite in WebGL. For IE11 force Canvas mode.
*
* More details about video playback and the supported media formats can be found on MDN:
*
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement
* https://developer.mozilla.org/en-US/docs/Web/Media/Formats
*
* Note: This method will only be available if the Video 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 key Optional key of the Video this Game Object will play, as stored in the Video Cache.
*/
video(x: number, y: number, key?: string): Phaser.GameObjects.Video;
/**
* Creates a new Zone Game Object and adds it to the Scene.
*
* Note: This method will only be available if the Zone 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 width The width of the Game Object.
* @param height The height of the Game Object.
*/
zone(x: number, y: number, width: number, height: number): 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 key The key in the Phaser cache that corresponds to the loaded tilemap data.
* @param tileWidth The width of a tile in pixels. Pass in `null` to leave as the
* default. Default 32.
* @param tileHeight The height of a tile in pixels. Pass in `null` to leave as the
* default. Default 32.
* @param width The width of the map in tiles. Pass in `null` to leave as the
* default. Default 10.
* @param height The height of the map in tiles. Pass in `null` to leave as the
* default. Default 10.
* @param data Instead of loading from the cache, you can also load directly from
* a 2D array of tile indexes. Pass in `null` for no data.
* @param insertNull Controls how empty tiles, tiles with an index of -1, in the
* map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty
* location will get a Tile object with an index of -1. If you've a large sparsely populated map and
* the tile data doesn't need to change then setting this value to `true` will help with memory
* consumption. However if your map is small or you need to update the tiles dynamically, then leave
* the default value set. Default false.
*/
tilemap(key?: string, tileWidth?: number, tileHeight?: number, width?: number, height?: number, data?: number[][], insertNull?: boolean): Phaser.Tilemaps.Tilemap;
/**
* A Timeline is a way to schedule events to happen at specific times in the future.
*
* You can think of it as an event sequencer for your game, allowing you to schedule the
* running of callbacks, events and other actions at specific times in the future.
*
* A Timeline is a Scene level system, meaning you can have as many Timelines as you like, each
* belonging to a different Scene. You can also have multiple Timelines running at the same time.
*
* If the Scene is paused, the Timeline will also pause. If the Scene is destroyed, the Timeline
* will be automatically destroyed. However, you can control the Timeline directly, pausing,
* resuming and stopping it at any time.
*
* Create an instance of a Timeline via the Game Object Factory:
*
* ```js
* const timeline = this.add.timeline();
* ```
*
* The Timeline always starts paused. You must call `play` on it to start it running.
*
* You can also pass in a configuration object on creation, or an array of them:
*
* ```js
* const timeline = this.add.timeline({
* at: 1000,
* run: () => {
* this.add.sprite(400, 300, 'logo');
* }
* });
*
* timeline.play();
* ```
*
* In this example we sequence a few different events:
*
* ```js
* const timeline = this.add.timeline([
* {
* at: 1000,
* run: () => { this.logo = this.add.sprite(400, 300, 'logo'); },
* sound: 'TitleMusic'
* },
* {
* at: 2500,
* tween: {
* targets: this.logo,
* y: 600,
* yoyo: true
* },
* sound: 'Explode'
* },
* {
* at: 8000,
* event: 'HURRY_PLAYER',
* target: this.background,
* set: {
* tint: 0xff0000
* }
* }
* ]);
*
* timeline.play();
* ```
*
* There are lots of options available to you via the configuration object. See the
* {@link Phaser.Types.Time.TimelineEventConfig} typedef for more details.
* @param config The configuration object for this Timeline Event, or an array of them.
*/
timeline(config: Phaser.Types.Time.TimelineEventConfig | Phaser.Types.Time.TimelineEventConfig[]): Phaser.Time.Timeline;
/**
* Creates a new Tween object.
*
* 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 adds 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;
}
/**
* Calculates the Transform Matrix of the given Game Object and Camera, factoring in
* the parent matrix if provided.
*
* Note that the object this results contains _references_ to the Transform Matrices,
* not new instances of them. Therefore, you should use their values immediately, or
* copy them to your own matrix, as they will be replaced as soon as another Game
* Object is rendered.
* @param src The Game Object to calculate the transform matrix for.
* @param camera The camera being used to render the Game Object.
* @param parentMatrix The transform matrix of the parent container, if any.
*/
function GetCalcMatrix(src: Phaser.GameObjects.GameObject, camera: Phaser.Cameras.Scene2D.Camera, parentMatrix?: Phaser.GameObjects.Components.TransformMatrix): Phaser.Types.GameObjects.GetCalcMatrixResults;
/**
* A Graphics object is a way to draw primitive shapes to your game. Primitives include forms of geometry, such as
* Rectangles, Circles, and Polygons. They also include lines, arcs and curves. When you initially create a Graphics
* object it will be empty.
*
* To draw to it you must first specify a line style or fill style (or both), draw shapes using paths, and finally
* fill or stroke them. For example:
*
* ```javascript
* graphics.lineStyle(5, 0xFF00FF, 1.0);
* graphics.beginPath();
* graphics.moveTo(100, 100);
* graphics.lineTo(200, 200);
* graphics.closePath();
* graphics.strokePath();
* ```
*
* There are also many helpful methods that draw and fill/stroke common shapes for you.
*
* ```javascript
* graphics.lineStyle(5, 0xFF00FF, 1.0);
* graphics.fillStyle(0xFFFFFF, 1.0);
* graphics.fillRect(50, 50, 400, 200);
* graphics.strokeRect(50, 50, 400, 200);
* ```
*
* When a Graphics object is rendered it will render differently based on if the game is running under Canvas or WebGL.
* Under Canvas it will use the HTML Canvas context drawing operations to draw the path.
* Under WebGL the graphics data is decomposed into polygons. Both of these are expensive processes, especially with
* complex shapes.
*
* If your Graphics object doesn't change much (or at all) once you've drawn your shape to it, then you will help
* performance by calling {@link Phaser.GameObjects.Graphics#generateTexture}. This will 'bake' the Graphics object into
* a Texture, and return it. You can then use this Texture for Sprites or other display objects. If your Graphics object
* updates frequently then you should avoid doing this, as it will constantly generate new textures, which will consume
* memory.
*
* As you can tell, Graphics objects are a bit of a trade-off. While they are extremely useful, you need to be careful
* in their complexity and quantity of them in your game.
*/
class Graphics extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.AlphaSingle, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Mask, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.PostPipeline, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible, Phaser.GameObjects.Components.ScrollFactor {
/**
*
* @param scene The Scene to which this Graphics object belongs.
* @param options Options that set the position and default style of this Graphics object.
*/
constructor(scene: Phaser.Scene, options?: Phaser.Types.GameObjects.Graphics.Options);
/**
* The horizontal display origin of the Graphics.
*/
displayOriginX: number;
/**
* The vertical display origin of the Graphics.
*/
displayOriginY: number;
/**
* The array of commands used to render the Graphics.
*/
commandBuffer: any[];
/**
* The default fill color for shapes rendered by this Graphics object.
* Set this value with `setDefaultStyles()`.
*/
readonly defaultFillColor: number;
/**
* The default fill alpha for shapes rendered by this Graphics object.
* Set this value with `setDefaultStyles()`.
*/
readonly defaultFillAlpha: number;
/**
* The default stroke width for shapes rendered by this Graphics object.
* Set this value with `setDefaultStyles()`.
*/
readonly defaultStrokeWidth: number;
/**
* The default stroke color for shapes rendered by this Graphics object.
* Set this value with `setDefaultStyles()`.
*/
readonly defaultStrokeColor: number;
/**
* The default stroke alpha for shapes rendered by this Graphics object.
* Set this value with `setDefaultStyles()`.
*/
readonly defaultStrokeAlpha: number;
/**
* Set the default style settings for this Graphics object.
* @param options The styles to set as defaults.
*/
setDefaultStyles(options: Phaser.Types.GameObjects.Graphics.Styles): this;
/**
* Set the current line style. Used for all 'stroke' related functions.
* @param lineWidth The stroke width.
* @param color The stroke color.
* @param alpha The stroke alpha. Default 1.
*/
lineStyle(lineWidth: number, color: number, alpha?: number): this;
/**
* Set the current fill style. Used for all 'fill' related functions.
* @param color The fill color.
* @param alpha The fill alpha. Default 1.
*/
fillStyle(color: number, alpha?: number): this;
/**
* Sets a gradient fill style. This is a WebGL only feature.
*
* The gradient color values represent the 4 corners of an untransformed rectangle.
* The gradient is used to color all filled shapes and paths drawn after calling this method.
* If you wish to turn a gradient off, call `fillStyle` and provide a new single fill color.
*
* When filling a triangle only the first 3 color values provided are used for the 3 points of a triangle.
*
* This feature is best used only on rectangles and triangles. All other shapes will give strange results.
*
* Note that for objects such as arcs or ellipses, or anything which is made out of triangles, each triangle used
* will be filled with a gradient on its own. There is no ability to gradient fill a shape or path as a single
* entity at this time.
* @param topLeft The top left fill color.
* @param topRight The top right fill color.
* @param bottomLeft The bottom left fill color.
* @param bottomRight The bottom right fill color. Not used when filling triangles.
* @param alphaTopLeft The top left alpha value. If you give only this value, it's used for all corners. Default 1.
* @param alphaTopRight The top right alpha value. Default 1.
* @param alphaBottomLeft The bottom left alpha value. Default 1.
* @param alphaBottomRight The bottom right alpha value. Default 1.
*/
fillGradientStyle(topLeft: number, topRight: number, bottomLeft: number, bottomRight: number, alphaTopLeft?: number, alphaTopRight?: number, alphaBottomLeft?: number, alphaBottomRight?: number): this;
/**
* Sets a gradient line style. This is a WebGL only feature.
*
* The gradient color values represent the 4 corners of an untransformed rectangle.
* The gradient is used to color all stroked shapes and paths drawn after calling this method.
* If you wish to turn a gradient off, call `lineStyle` and provide a new single line color.
*
* This feature is best used only on single lines. All other shapes will give strange results.
*
* Note that for objects such as arcs or ellipses, or anything which is made out of triangles, each triangle used
* will be filled with a gradient on its own. There is no ability to gradient stroke a shape or path as a single
* entity at this time.
* @param lineWidth The stroke width.
* @param topLeft The tint being applied to the top-left of the Game Object.
* @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.
* @param alpha The fill alpha. Default 1.
*/
lineGradientStyle(lineWidth: number, topLeft: number, topRight: number, bottomLeft: number, bottomRight: number, alpha?: number): this;
/**
* Start a new shape path.
*/
beginPath(): this;
/**
* Close the current path.
*/
closePath(): this;
/**
* Fill the current path.
*/
fillPath(): this;
/**
* Fill the current path.
*
* This is an alias for `Graphics.fillPath` and does the same thing.
* It was added to match the CanvasRenderingContext 2D API.
*/
fill(): this;
/**
* Stroke the current path.
*/
strokePath(): this;
/**
* Stroke the current path.
*
* This is an alias for `Graphics.strokePath` and does the same thing.
* It was added to match the CanvasRenderingContext 2D API.
*/
stroke(): this;
/**
* Fill the given circle.
* @param circle The circle to fill.
*/
fillCircleShape(circle: Phaser.Geom.Circle): this;
/**
* Stroke the given circle.
* @param circle The circle to stroke.
*/
strokeCircleShape(circle: Phaser.Geom.Circle): this;
/**
* Fill a circle with the given position and radius.
* @param x The x coordinate of the center of the circle.
* @param y The y coordinate of the center of the circle.
* @param radius The radius of the circle.
*/
fillCircle(x: number, y: number, radius: number): this;
/**
* Stroke a circle with the given position and radius.
* @param x The x coordinate of the center of the circle.
* @param y The y coordinate of the center of the circle.
* @param radius The radius of the circle.
*/
strokeCircle(x: number, y: number, radius: number): this;
/**
* Fill the given rectangle.
* @param rect The rectangle to fill.
*/
fillRectShape(rect: Phaser.Geom.Rectangle): this;
/**
* Stroke the given rectangle.
* @param rect The rectangle to stroke.
*/
strokeRectShape(rect: Phaser.Geom.Rectangle): this;
/**
* Fill a rectangle with the given position and size.
* @param x The x coordinate of the top-left of the rectangle.
* @param y The y coordinate of the top-left of the rectangle.
* @param width The width of the rectangle.
* @param height The height of the rectangle.
*/
fillRect(x: number, y: number, width: number, height: number): this;
/**
* Stroke a rectangle with the given position and size.
* @param x The x coordinate of the top-left of the rectangle.
* @param y The y coordinate of the top-left of the rectangle.
* @param width The width of the rectangle.
* @param height The height of the rectangle.
*/
strokeRect(x: number, y: number, width: number, height: number): this;
/**
* Fill a rounded rectangle with the given position, size and radius.
* @param x The x coordinate of the top-left of the rectangle.
* @param y The y coordinate of the top-left of the rectangle.
* @param width The width of the rectangle.
* @param height The height of the rectangle.
* @param radius The corner radius; It can also be an object to specify different radius for corners. Default 20.
*/
fillRoundedRect(x: number, y: number, width: number, height: number, radius?: Phaser.Types.GameObjects.Graphics.RoundedRectRadius | number): this;
/**
* Stroke a rounded rectangle with the given position, size and radius.
* @param x The x coordinate of the top-left of the rectangle.
* @param y The y coordinate of the top-left of the rectangle.
* @param width The width of the rectangle.
* @param height The height of the rectangle.
* @param radius The corner radius; It can also be an object to specify different radii for corners. Default 20.
*/
strokeRoundedRect(x: number, y: number, width: number, height: number, radius?: Phaser.Types.GameObjects.Graphics.RoundedRectRadius | number): this;
/**
* Fill the given point.
*
* Draws a square at the given position, 1 pixel in size by default.
* @param point The point to fill.
* @param size The size of the square to draw. Default 1.
*/
fillPointShape(point: Phaser.Geom.Point | Phaser.Math.Vector2 | object, size?: number): this;
/**
* Fill a point at the given position.
*
* Draws a square at the given position, 1 pixel in size by default.
* @param x The x coordinate of the point.
* @param y The y coordinate of the point.
* @param size The size of the square to draw. Default 1.
*/
fillPoint(x: number, y: number, size?: number): this;
/**
* Fill the given triangle.
* @param triangle The triangle to fill.
*/
fillTriangleShape(triangle: Phaser.Geom.Triangle): this;
/**
* Stroke the given triangle.
* @param triangle The triangle to stroke.
*/
strokeTriangleShape(triangle: Phaser.Geom.Triangle): this;
/**
* Fill a triangle with the given points.
* @param x0 The x coordinate of the first point.
* @param y0 The y coordinate of the first point.
* @param x1 The x coordinate of the second point.
* @param y1 The y coordinate of the second point.
* @param x2 The x coordinate of the third point.
* @param y2 The y coordinate of the third point.
*/
fillTriangle(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number): this;
/**
* Stroke a triangle with the given points.
* @param x0 The x coordinate of the first point.
* @param y0 The y coordinate of the first point.
* @param x1 The x coordinate of the second point.
* @param y1 The y coordinate of the second point.
* @param x2 The x coordinate of the third point.
* @param y2 The y coordinate of the third point.
*/
strokeTriangle(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number): this;
/**
* Draw the given line.
* @param line The line to stroke.
*/
strokeLineShape(line: Phaser.Geom.Line): this;
/**
* Draw a line between the given points.
* @param x1 The x coordinate of the start point of the line.
* @param y1 The y coordinate of the start point of the line.
* @param x2 The x coordinate of the end point of the line.
* @param y2 The y coordinate of the end point of the line.
*/
lineBetween(x1: number, y1: number, x2: number, y2: number): this;
/**
* Draw a line from the current drawing position to the given position.
*
* Moves the current drawing position to the given position.
* @param x The x coordinate to draw the line to.
* @param y The y coordinate to draw the line to.
*/
lineTo(x: number, y: number): this;
/**
* Move the current drawing position to the given position.
* @param x The x coordinate to move to.
* @param y The y coordinate to move to.
*/
moveTo(x: number, y: number): this;
/**
* Stroke the shape represented by the given array of points.
*
* Pass `closeShape` to automatically close the shape by joining the last to the first point.
*
* Pass `closePath` to automatically close the path before it is stroked.
* @param points The points to stroke.
* @param closeShape When `true`, the shape is closed by joining the last point to the first point. Default false.
* @param closePath When `true`, the path is closed before being stroked. Default false.
* @param endIndex The index of `points` to stop drawing at. Defaults to `points.length`.
*/
strokePoints(points: any[] | Phaser.Geom.Point[], closeShape?: boolean, closePath?: boolean, endIndex?: number): this;
/**
* Fill the shape represented by the given array of points.
*
* Pass `closeShape` to automatically close the shape by joining the last to the first point.
*
* Pass `closePath` to automatically close the path before it is filled.
* @param points The points to fill.
* @param closeShape When `true`, the shape is closed by joining the last point to the first point. Default false.
* @param closePath When `true`, the path is closed before being stroked. Default false.
* @param endIndex The index of `points` to stop at. Defaults to `points.length`.
*/
fillPoints(points: any[] | Phaser.Geom.Point[], closeShape?: boolean, closePath?: boolean, endIndex?: number): this;
/**
* Stroke the given ellipse.
* @param ellipse The ellipse to stroke.
* @param smoothness The number of points to draw the ellipse with. Default 32.
*/
strokeEllipseShape(ellipse: Phaser.Geom.Ellipse, smoothness?: number): this;
/**
* Stroke an ellipse with the given position and size.
* @param x The x coordinate of the center of the ellipse.
* @param y The y coordinate of the center of the ellipse.
* @param width The width of the ellipse.
* @param height The height of the ellipse.
* @param smoothness The number of points to draw the ellipse with. Default 32.
*/
strokeEllipse(x: number, y: number, width: number, height: number, smoothness?: number): this;
/**
* Fill the given ellipse.
* @param ellipse The ellipse to fill.
* @param smoothness The number of points to draw the ellipse with. Default 32.
*/
fillEllipseShape(ellipse: Phaser.Geom.Ellipse, smoothness?: number): this;
/**
* Fill an ellipse with the given position and size.
* @param x The x coordinate of the center of the ellipse.
* @param y The y coordinate of the center of the ellipse.
* @param width The width of the ellipse.
* @param height The height of the ellipse.
* @param smoothness The number of points to draw the ellipse with. Default 32.
*/
fillEllipse(x: number, y: number, width: number, height: number, smoothness?: number): this;
/**
* Draw an arc.
*
* This method can be used to create circles, or parts of circles.
*
* Make sure you call `beginPath` before starting the arc unless you wish for the arc to automatically
* close when filled or stroked.
*
* Use the optional `overshoot` argument increase the number of iterations that take place when
* the arc is rendered in WebGL. This is useful if you're drawing an arc with an especially thick line,
* as it will allow the arc to fully join-up. Try small values at first, i.e. 0.01.
*
* Call {@link Phaser.GameObjects.Graphics#fillPath} or {@link Phaser.GameObjects.Graphics#strokePath} after calling
* this method to draw the arc.
* @param x The x coordinate of the center of the circle.
* @param y The y coordinate of the center of the circle.
* @param radius The radius of the circle.
* @param startAngle The starting angle, in radians.
* @param endAngle The ending angle, in radians.
* @param anticlockwise Whether the drawing should be anticlockwise or clockwise. Default false.
* @param overshoot This value allows you to increase the segment iterations in WebGL rendering. Useful if the arc has a thick stroke and needs to overshoot to join-up cleanly. Use small numbers such as 0.01 to start with and increase as needed. Default 0.
*/
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean, overshoot?: number): this;
/**
* Creates a pie-chart slice shape centered at `x`, `y` with the given radius.
* You must define the start and end angle of the slice.
*
* Setting the `anticlockwise` argument to `true` creates a shape similar to Pacman.
* Setting it to `false` creates a shape like a slice of pie.
*
* This method will begin a new path and close the path at the end of it.
* To display the actual slice you need to call either `strokePath` or `fillPath` after it.
* @param x The horizontal center of the slice.
* @param y The vertical center of the slice.
* @param radius The radius of the slice.
* @param startAngle The start angle of the slice, given in radians.
* @param endAngle The end angle of the slice, given in radians.
* @param anticlockwise Whether the drawing should be anticlockwise or clockwise. Default false.
* @param overshoot This value allows you to overshoot the endAngle by this amount. Useful if the arc has a thick stroke and needs to overshoot to join-up cleanly. Default 0.
*/
slice(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean, overshoot?: number): this;
/**
* Saves the state of the Graphics by pushing the current state onto a stack.
*
* The most recently saved state can then be restored with {@link Phaser.GameObjects.Graphics#restore}.
*/
save(): this;
/**
* Restores the most recently saved state of the Graphics by popping from the state stack.
*
* Use {@link Phaser.GameObjects.Graphics#save} to save the current state, and call this afterwards to restore that state.
*
* If there is no saved state, this command does nothing.
*/
restore(): this;
/**
* Inserts a translation command into this Graphics objects command buffer.
*
* All objects drawn _after_ calling this method will be translated
* by the given amount.
*
* This does not change the position of the Graphics object itself,
* only of the objects drawn by it after calling this method.
* @param x The horizontal translation to apply.
* @param y The vertical translation to apply.
*/
translateCanvas(x: number, y: number): this;
/**
* Inserts a scale command into this Graphics objects command buffer.
*
* All objects drawn _after_ calling this method will be scaled
* by the given amount.
*
* This does not change the scale of the Graphics object itself,
* only of the objects drawn by it after calling this method.
* @param x The horizontal scale to apply.
* @param y The vertical scale to apply.
*/
scaleCanvas(x: number, y: number): this;
/**
* Inserts a rotation command into this Graphics objects command buffer.
*
* All objects drawn _after_ calling this method will be rotated
* by the given amount.
*
* This does not change the rotation of the Graphics object itself,
* only of the objects drawn by it after calling this method.
* @param radians The rotation angle, in radians.
*/
rotateCanvas(radians: number): this;
/**
* Clear the command buffer and reset the fill style and line style to their defaults.
*/
clear(): this;
/**
* Generate a texture from this Graphics object.
*
* If `key` is a string it'll generate a new texture using it and add it into the
* Texture Manager (assuming no key conflict happens).
*
* If `key` is a Canvas it will draw the texture to that canvas context. Note that it will NOT
* automatically upload it to the GPU in WebGL mode.
*
* Please understand that the texture is created via the Canvas API of the browser, therefore some
* Graphics features, such as `fillGradientStyle`, will not appear on the resulting texture,
* as they're unsupported by the Canvas API.
* @param key The key to store the texture with in the Texture Manager, or a Canvas to draw to.
* @param width The width of the graphics to generate.
* @param height The height of the graphics to generate.
*/
generateTexture(key: string | HTMLCanvasElement, width?: number, height?: number): this;
/**
* Internal destroy handler, called as part of the destroy process.
*/
protected preDestroy(): void;
/**
* A Camera used specifically by the Graphics system for rendering to textures.
*/
static TargetCamera: Phaser.Cameras.Scene2D.Camera;
/**
* 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 Mask this Game Object is using during render.
*/
mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask;
/**
* Sets the mask that this Game Object will use to render with.
*
* The mask must have been previously created and can be either a GeometryMask or a BitmapMask.
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* If a mask is already set on this Game Object it will be immediately replaced.
*
* Masks are positioned in global space and are not relative to the Game Object to which they
* are applied. The reason for this is that multiple Game Objects can all share the same mask.
*
* Masks have no impact on physics or input detection. They are purely a rendering component
* that allows you to limit what is visible during the render pass.
* @param mask The mask this Game Object will use when rendering.
*/
setMask(mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask): this;
/**
* Clears the mask that this Game Object was using.
* @param destroyMask Destroy the mask before clearing it? Default false.
*/
clearMask(destroyMask?: boolean): this;
/**
* Creates and returns a Bitmap Mask. This mask can be used by any Game Object,
* including this one, or a Dynamic Texture.
*
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* To create the mask you need to pass in a reference to a renderable Game Object.
* A renderable Game Object is one that uses a texture to render with, such as an
* Image, Sprite, Render Texture or BitmapText.
*
* If you do not provide a renderable object, and this Game Object has a texture,
* it will use itself as the object. This means you can call this method to create
* a Bitmap Mask from any renderable texture-based Game Object.
* @param maskObject The Game Object or Dynamic 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.
*/
createBitmapMask(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 and returns a Geometry Mask. This mask can be used by any Game Object,
* including this one.
*
* To create the mask you need to pass in a reference to a Graphics Game Object.
*
* If you do not provide a graphics object, and this Game Object is an instance
* of a Graphics object, then it will use itself to create the mask.
*
* This means you can call this method to create a Geometry Mask from any Graphics Game Object.
* @param graphics A Graphics Game Object, or any kind of Shape Game Object. The geometry within it will be used as the mask.
*/
createGeometryMask(graphics?: Phaser.GameObjects.Graphics | Phaser.GameObjects.Shape): Phaser.Display.Masks.GeometryMask;
/**
* The initial WebGL pipeline of this Game Object.
*
* If you call `resetPipeline` on this Game Object, the pipeline is reset to this default.
*/
defaultPipeline: Phaser.Renderer.WebGL.WebGLPipeline;
/**
* The current WebGL pipeline of this Game Object.
*/
pipeline: Phaser.Renderer.WebGL.WebGLPipeline;
/**
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
*/
pipelineData: object;
/**
* Sets the initial WebGL Pipeline of this Game Object.
*
* This should only be called during the instantiation of the Game Object. After that, use `setPipeline`.
* @param pipeline Either the string-based name of the pipeline, or a pipeline instance to set.
*/
initPipeline(pipeline?: string | Phaser.Renderer.WebGL.WebGLPipeline): boolean;
/**
* Sets the main WebGL Pipeline of this Game Object.
*
* Also sets the `pipelineData` property, if the parameter is given.
* @param pipeline Either the string-based name of the pipeline, or a pipeline instance to set.
* @param pipelineData Optional pipeline data object that is set in to the `pipelineData` property of this Game Object.
* @param copyData Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead. Default true.
*/
setPipeline(pipeline: string | Phaser.Renderer.WebGL.WebGLPipeline, pipelineData?: object, copyData?: boolean): this;
/**
* Adds an entry to the `pipelineData` object belonging to this Game Object.
*
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
*
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
* @param key The key of the pipeline data to set, update, or delete.
* @param value The value to be set with the key. If `undefined` then `key` will be deleted from the object.
*/
setPipelineData(key: string, value?: any): this;
/**
* Resets the WebGL Pipeline of this Game Object back to the default it was created with.
* @param resetData Reset the `pipelineData` object to being an empty object? Default false.
*/
resetPipeline(resetData?: boolean): boolean;
/**
* Gets the name of the WebGL Pipeline this Game Object is currently using.
*/
getPipelineName(): string;
/**
* Does this Game Object have any Post Pipelines set?
*/
hasPostPipeline: boolean;
/**
* The WebGL Post FX Pipelines this Game Object uses for post-render effects.
*
* The pipelines are processed in the order in which they appear in this array.
*
* If you modify this array directly, be sure to set the
* `hasPostPipeline` property accordingly.
*/
postPipelines: Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
*/
postPipelineData: object;
/**
* The Pre FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.preFX.addBloom();
* ```
*
* Only the following Game Objects support Pre FX:
*
* * Image
* * Sprite
* * TileSprite
* * Text
* * RenderTexture
* * Video
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*/
preFX: Phaser.GameObjects.Components.FX | null;
/**
* The Post FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.postFX.addBloom();
* ```
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*
* This property is always `null` until the `initPostPipeline` method is called.
*/
postFX: Phaser.GameObjects.Components.FX;
/**
* This should only be called during the instantiation of the Game Object.
*
* It is called by default by all core Game Objects and doesn't need
* calling again.
*
* After that, use `setPostPipeline`.
* @param preFX Does this Game Object support Pre FX? Default false.
*/
initPostPipeline(preFX?: boolean): void;
/**
* Sets one, or more, Post Pipelines on this Game Object.
*
* Post Pipelines are invoked after this Game Object has rendered to its target and
* are commonly used for post-fx.
*
* The post pipelines are appended to the `postPipelines` array belonging to this
* Game Object. When the renderer processes this Game Object, it iterates through the post
* pipelines in the order in which they appear in the array. If you are stacking together
* multiple effects, be aware that the order is important.
*
* If you call this method multiple times, the new pipelines will be appended to any existing
* post pipelines already set. Use the `resetPostPipeline` method to clear them first, if required.
*
* You can optionally also set the `postPipelineData` property, if the parameter is given.
* @param pipelines Either the string-based name of the pipeline, or a pipeline instance, or class, or an array of them.
* @param pipelineData Optional pipeline data object that is set in to the `postPipelineData` property of this Game Object.
* @param copyData Should the pipeline data object be _deep copied_ into the `postPipelineData` property of this Game Object? If `false` it will be set by reference instead. Default true.
*/
setPostPipeline(pipelines: string | string[] | Function | Function[] | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[], pipelineData?: object, copyData?: boolean): this;
/**
* Adds an entry to the `postPipelineData` object belonging to this Game Object.
*
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
*
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
* @param key The key of the pipeline data to set, update, or delete.
* @param value The value to be set with the key. If `undefined` then `key` will be deleted from the object.
*/
setPostPipelineData(key: string, value?: any): this;
/**
* Gets a Post Pipeline instance from this Game Object, based on the given name, and returns it.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
getPostPipeline(pipeline: string | Function | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* Resets the WebGL Post Pipelines of this Game Object. It does this by calling
* the `destroy` method on each post pipeline and then clearing the local array.
* @param resetData Reset the `postPipelineData` object to being an empty object? Default false.
*/
resetPostPipeline(resetData?: boolean): void;
/**
* Removes a type of Post Pipeline instances from this Game Object, based on the given name, and destroys them.
*
* If you wish to remove all Post Pipelines use the `resetPostPipeline` method instead.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
removePostPipeline(pipeline: string | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): this;
/**
* Removes all Pre and Post FX Controllers from this Game Object.
*
* If you wish to remove a single controller, use the `preFX.remove(fx)` or `postFX.remove(fx)` methods instead.
*
* If you wish to clear a single controller, use the `preFX.clear()` or `postFX.clear()` methods instead.
*/
clearFX(): 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;
/**
* 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 Group is a way for you to create, manipulate, or recycle similar Game Objects.
*
* Group membership is non-exclusive. A Game Object can belong to several groups, one group, or none.
*
* Groups themselves aren't displayable, and can't be positioned, rotated, scaled, or hidden.
*/
class Group extends Phaser.Events.EventEmitter {
/**
*
* @param scene The scene this group belongs to.
* @param children Game Objects to add to this group; or the `config` argument.
* @param config Settings for this group. If `key` is set, Phaser.GameObjects.Group#createMultiple is also called with these settings.
*/
constructor(scene: Phaser.Scene, children?: Phaser.GameObjects.GameObject[] | Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig, config?: Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig);
/**
* This scene this group belongs to.
*/
scene: Phaser.Scene;
/**
* Members of this group.
*/
children: Phaser.Structs.Set;
/**
* A flag identifying this object as a group.
*/
isParent: boolean;
/**
* A textual representation of this Game Object.
* Used internally by Phaser but is available for your own custom classes to populate.
*/
type: string;
/**
* The class to create new group members from.
*/
classType: Function;
/**
* The name of this group.
* Empty by default and never populated by Phaser, this is left for developers to use.
*/
name: string;
/**
* Whether this group runs its {@link Phaser.GameObjects.Group#preUpdate} method (which may update any members).
*/
active: boolean;
/**
* The maximum size of this group, if used as a pool. -1 is no limit.
*/
maxSize: number;
/**
* A default texture key to use when creating new group members.
*
* This is used in {@link Phaser.GameObjects.Group#create}
* but not in {@link Phaser.GameObjects.Group#createMultiple}.
*/
defaultKey: string;
/**
* A default texture frame to use when creating new group members.
*/
defaultFrame: string | number;
/**
* Whether to call the update method of any members.
*/
runChildUpdate: boolean;
/**
* A function to be called when adding or creating group members.
*/
createCallback: Phaser.Types.GameObjects.Group.GroupCallback | null;
/**
* A function to be called when removing group members.
*/
removeCallback: Phaser.Types.GameObjects.Group.GroupCallback | null;
/**
* A function to be called when creating several group members at once.
*/
createMultipleCallback: Phaser.Types.GameObjects.Group.GroupMultipleCreateCallback | null;
/**
* Creates a new Game Object and adds it to this group, unless the group {@link Phaser.GameObjects.Group#isFull is full}.
*
* Calls {@link Phaser.GameObjects.Group#createCallback}.
* @param x The horizontal position of the new Game Object in the world. Default 0.
* @param y The vertical position of the new Game Object in the world. Default 0.
* @param key The texture key of the new Game Object. Default defaultKey.
* @param frame The texture frame of the new Game Object. Default defaultFrame.
* @param visible The {@link Phaser.GameObjects.Components.Visible#visible} state of the new Game Object. Default true.
* @param active The {@link Phaser.GameObjects.GameObject#active} state of the new Game Object. Default true.
*/
create(x?: number, y?: number, key?: string, frame?: string | number, visible?: boolean, active?: boolean): any;
/**
* Creates several Game Objects and adds them to this group.
*
* If the group becomes {@link Phaser.GameObjects.Group#isFull}, no further Game Objects are created.
*
* Calls {@link Phaser.GameObjects.Group#createMultipleCallback} and {@link Phaser.GameObjects.Group#createCallback}.
* @param config Creation settings. This can be a single configuration object or an array of such objects, which will be applied in turn.
*/
createMultiple(config: Phaser.Types.GameObjects.Group.GroupCreateConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig[]): any[];
/**
* A helper for {@link Phaser.GameObjects.Group#createMultiple}.
* @param options Creation settings.
*/
createFromConfig(options: Phaser.Types.GameObjects.Group.GroupCreateConfig): any[];
/**
* Updates any group members, if {@link Phaser.GameObjects.Group#runChildUpdate} is enabled.
* @param time The current timestamp.
* @param delta The delta time elapsed since the last frame.
*/
preUpdate(time: number, delta: number): void;
/**
* Adds a Game Object to this group.
*
* Calls {@link Phaser.GameObjects.Group#createCallback}.
* @param child The Game Object to add.
* @param addToScene Also add the Game Object to the scene. Default false.
*/
add(child: Phaser.GameObjects.GameObject, addToScene?: boolean): this;
/**
* Adds several Game Objects to this group.
*
* Calls {@link Phaser.GameObjects.Group#createCallback}.
* @param children The Game Objects to add.
* @param addToScene Also add the Game Objects to the scene. Default false.
*/
addMultiple(children: Phaser.GameObjects.GameObject[], addToScene?: boolean): this;
/**
* Removes a member of this Group and optionally removes it from the Scene and / or destroys it.
*
* Calls {@link Phaser.GameObjects.Group#removeCallback}.
* @param child The Game Object to remove.
* @param removeFromScene Optionally remove the Group member from the Scene it belongs to. Default false.
* @param destroyChild Optionally call destroy on the removed Group member. Default false.
*/
remove(child: Phaser.GameObjects.GameObject, removeFromScene?: boolean, destroyChild?: boolean): this;
/**
* Removes all members of this Group and optionally removes them from the Scene and / or destroys them.
*
* Does not call {@link Phaser.GameObjects.Group#removeCallback}.
* @param removeFromScene Optionally remove each Group member from the Scene. Default false.
* @param destroyChild Optionally call destroy on the removed Group members. Default false.
*/
clear(removeFromScene?: boolean, destroyChild?: boolean): this;
/**
* Tests if a Game Object is a member of this group.
* @param child A Game Object.
*/
contains(child: Phaser.GameObjects.GameObject): boolean;
/**
* All members of the group.
*/
getChildren(): Phaser.GameObjects.GameObject[];
/**
* The number of members of the group.
*/
getLength(): number;
/**
* Returns all children in this Group that match the given criteria based on the `property` and `value` arguments.
*
* For example: `getMatching('visible', true)` would return only children that have their `visible` property set.
*
* Optionally, you can specify a start and end index. For example if the Group has 100 elements,
* and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only
* the first 50.
* @param property The property to test on each array element.
* @param value The value to test the property against. Must pass a strict (`===`) comparison check.
* @param startIndex An optional start index to search from.
* @param endIndex An optional end index to search to.
*/
getMatching(property?: string, value?: any, startIndex?: number, endIndex?: number): any[];
/**
* Scans the Group, from top to bottom, for the first member that has an {@link Phaser.GameObjects.GameObject#active} state matching the argument,
* assigns `x` and `y`, and returns the member.
*
* If no matching member is found and `createIfNull` is true and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`.
* Unless a new member is created, `key`, `frame`, and `visible` are ignored.
* @param state The {@link Phaser.GameObjects.GameObject#active} value to match. Default false.
* @param createIfNull Create a new Game Object if no matching members are found, using the following arguments. Default false.
* @param x The horizontal position of the Game Object in the world.
* @param y The vertical position of the Game Object in the world.
* @param key The texture key assigned to a new Game Object (if one is created). Default defaultKey.
* @param frame A texture frame assigned to a new Game Object (if one is created). Default defaultFrame.
* @param visible The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). Default true.
*/
getFirst(state?: boolean, createIfNull?: boolean, x?: number, y?: number, key?: string, frame?: string | number, visible?: boolean): any | null;
/**
* Scans the Group, from top to bottom, for the nth member that has an {@link Phaser.GameObjects.GameObject#active} state matching the argument,
* assigns `x` and `y`, and returns the member.
*
* If no matching member is found and `createIfNull` is true and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`.
* Unless a new member is created, `key`, `frame`, and `visible` are ignored.
* @param nth The nth matching Group member to search for.
* @param state The {@link Phaser.GameObjects.GameObject#active} value to match. Default false.
* @param createIfNull Create a new Game Object if no matching members are found, using the following arguments. Default false.
* @param x The horizontal position of the Game Object in the world.
* @param y The vertical position of the Game Object in the world.
* @param key The texture key assigned to a new Game Object (if one is created). Default defaultKey.
* @param frame A texture frame assigned to a new Game Object (if one is created). Default defaultFrame.
* @param visible The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). Default true.
*/
getFirstNth(nth: number, state?: boolean, createIfNull?: boolean, x?: number, y?: number, key?: string, frame?: string | number, visible?: boolean): any | null;
/**
* Scans the Group for the last member that has an {@link Phaser.GameObjects.GameObject#active} state matching the argument,
* assigns `x` and `y`, and returns the member.
*
* If no matching member is found and `createIfNull` is true and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`.
* Unless a new member is created, `key`, `frame`, and `visible` are ignored.
* @param state The {@link Phaser.GameObjects.GameObject#active} value to match. Default false.
* @param createIfNull Create a new Game Object if no matching members are found, using the following arguments. Default false.
* @param x The horizontal position of the Game Object in the world.
* @param y The vertical position of the Game Object in the world.
* @param key The texture key assigned to a new Game Object (if one is created). Default defaultKey.
* @param frame A texture frame assigned to a new Game Object (if one is created). Default defaultFrame.
* @param visible The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). Default true.
*/
getLast(state?: boolean, createIfNull?: boolean, x?: number, y?: number, key?: string, frame?: string | number, visible?: boolean): any | null;
/**
* Scans the Group for the last nth member that has an {@link Phaser.GameObjects.GameObject#active} state matching the argument,
* assigns `x` and `y`, and returns the member.
*
* If no matching member is found and `createIfNull` is true and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`.
* Unless a new member is created, `key`, `frame`, and `visible` are ignored.
* @param nth The nth matching Group member to search for.
* @param state The {@link Phaser.GameObjects.GameObject#active} value to match. Default false.
* @param createIfNull Create a new Game Object if no matching members are found, using the following arguments. Default false.
* @param x The horizontal position of the Game Object in the world.
* @param y The vertical position of the Game Object in the world.
* @param key The texture key assigned to a new Game Object (if one is created). Default defaultKey.
* @param frame A texture frame assigned to a new Game Object (if one is created). Default defaultFrame.
* @param visible The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). Default true.
*/
getLastNth(nth: number, state?: boolean, createIfNull?: boolean, x?: number, y?: number, key?: string, frame?: string | number, visible?: boolean): any | null;
/**
* Scans the group for the first member that has an {@link Phaser.GameObjects.GameObject#active} state set to `false`,
* assigns `x` and `y`, and returns the member.
*
* If no inactive member is found and the group isn't full then it will create a new Game Object using `x`, `y`, `key`, `frame`, and `visible`.
* The new Game Object will have its active state set to `true`.
* Unless a new member is created, `key`, `frame`, and `visible` are ignored.
* @param x The horizontal position of the Game Object in the world.
* @param y The vertical position of the Game Object in the world.
* @param key The texture key assigned to a new Game Object (if one is created). Default defaultKey.
* @param frame A texture frame assigned to a new Game Object (if one is created). Default defaultFrame.
* @param visible The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). Default true.
*/
get(x?: number, y?: number, key?: string, frame?: string | number, visible?: boolean): any | null;
/**
* Scans the group for the first member that has an {@link Phaser.GameObjects.GameObject#active} state set to `true`,
* assigns `x` and `y`, and returns the member.
*
* If no active member is found and `createIfNull` is `true` and the group isn't full then it will create a new one using `x`, `y`, `key`, `frame`, and `visible`.
* Unless a new member is created, `key`, `frame`, and `visible` are ignored.
* @param createIfNull Create a new Game Object if no matching members are found, using the following arguments. Default false.
* @param x The horizontal position of the Game Object in the world.
* @param y The vertical position of the Game Object in the world.
* @param key The texture key assigned to a new Game Object (if one is created). Default defaultKey.
* @param frame A texture frame assigned to a new Game Object (if one is created). Default defaultFrame.
* @param visible The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). Default true.
*/
getFirstAlive(createIfNull?: boolean, x?: number, y?: number, key?: string, frame?: string | number, visible?: boolean): any;
/**
* Scans the group for the first member that has an {@link Phaser.GameObjects.GameObject#active} state set to `false`,
* assigns `x` and `y`, and returns the member.
*
* If no inactive member is found and `createIfNull` is `true` and the group isn't full then it will create a new one using `x`, `y`, `key`, `frame`, and `visible`.
* The new Game Object will have an active state set to `true`.
* Unless a new member is created, `key`, `frame`, and `visible` are ignored.
* @param createIfNull Create a new Game Object if no matching members are found, using the following arguments. Default false.
* @param x The horizontal position of the Game Object in the world.
* @param y The vertical position of the Game Object in the world.
* @param key The texture key assigned to a new Game Object (if one is created). Default defaultKey.
* @param frame A texture frame assigned to a new Game Object (if one is created). Default defaultFrame.
* @param visible The {@link Phaser.GameObjects.Components.Visible#visible} state of a new Game Object (if one is created). Default true.
*/
getFirstDead(createIfNull?: boolean, x?: number, y?: number, key?: string, frame?: string | number, visible?: boolean): any;
/**
* {@link Phaser.GameObjects.Components.Animation#play Plays} an animation for all members of this group.
* @param key The string-based key of the animation to play.
* @param startFrame Optionally start the animation playing from this frame index. Default 0.
*/
playAnimation(key: string, startFrame?: string): this;
/**
* Whether this group's size at its {@link Phaser.GameObjects.Group#maxSize maximum}.
*/
isFull(): boolean;
/**
* Counts the number of active (or inactive) group members.
* @param value Count active (true) or inactive (false) group members. Default true.
*/
countActive(value?: boolean): number;
/**
* Counts the number of in-use (active) group members.
*/
getTotalUsed(): number;
/**
* The difference of {@link Phaser.GameObjects.Group#maxSize} and the number of active group members.
*
* This represents the number of group members that could be created or reactivated before reaching the size limit.
*/
getTotalFree(): number;
/**
* Sets the `active` property of this Group.
* When active, this Group runs its `preUpdate` method.
* @param value True if this Group should be set as active, false if not.
*/
setActive(value: boolean): this;
/**
* Sets the `name` property of this Group.
* The `name` property is not populated by Phaser and is presented for your own use.
* @param value The name to be given to this Group.
*/
setName(value: string): this;
/**
* Sets the property as defined in `key` of each group member to the given value.
* @param key The property to be updated.
* @param value The amount to set the property to.
* @param step This is added to the `value` amount, multiplied by the iteration counter. Default 0.
* @param index An optional offset to start searching from within the items array. Default 0.
* @param direction The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. Default 1.
*/
propertyValueSet(key: string, value: number, step?: number, index?: number, direction?: number): this;
/**
* Adds the given value to the property as defined in `key` of each group member.
* @param key The property to be updated.
* @param value The amount to set the property to.
* @param step This is added to the `value` amount, multiplied by the iteration counter. Default 0.
* @param index An optional offset to start searching from within the items array. Default 0.
* @param direction The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. Default 1.
*/
propertyValueInc(key: string, value: number, step?: number, index?: number, direction?: number): this;
/**
* Sets the x of each group member.
* @param value The amount to set the property to.
* @param step This is added to the `value` amount, multiplied by the iteration counter. Default 0.
*/
setX(value: number, step?: number): this;
/**
* Sets the y of each group member.
* @param value The amount to set the property to.
* @param step This is added to the `value` amount, multiplied by the iteration counter. Default 0.
*/
setY(value: number, step?: number): this;
/**
* Sets the x, y of each group member.
* @param x The amount to set the `x` property to.
* @param y The amount to set the `y` property to. If `undefined` or `null` it uses the `x` value. Default x.
* @param stepX This is added to the `x` amount, multiplied by the iteration counter. Default 0.
* @param stepY This is added to the `y` amount, multiplied by the iteration counter. Default 0.
*/
setXY(x: number, y?: number, stepX?: number, stepY?: number): this;
/**
* Adds the given value to the x of each group member.
* @param value The amount to be added to the `x` property.
* @param step This is added to the `value` amount, multiplied by the iteration counter. Default 0.
*/
incX(value: number, step?: number): this;
/**
* Adds the given value to the y of each group member.
* @param value The amount to be added to the `y` property.
* @param step This is added to the `value` amount, multiplied by the iteration counter. Default 0.
*/
incY(value: number, step?: number): this;
/**
* Adds the given value to the x, y of each group member.
* @param x The amount to be added to the `x` property.
* @param y The amount to be added to the `y` property. If `undefined` or `null` it uses the `x` value. Default x.
* @param stepX This is added to the `x` amount, multiplied by the iteration counter. Default 0.
* @param stepY This is added to the `y` amount, multiplied by the iteration counter. Default 0.
*/
incXY(x: number, y?: number, stepX?: number, stepY?: number): this;
/**
* Iterate through the group members changing the position of each element to be that of the element that came before
* it in the array (or after it if direction = 1)
*
* The first group member position is set to x/y.
* @param x The x coordinate to place the first item in the array at.
* @param y The y coordinate to place the first item in the array at.
* @param direction The iteration direction. 0 = first to last and 1 = last to first. Default 0.
*/
shiftPosition(x: number, y: number, direction?: number): this;
/**
* Sets the angle of each group member.
* @param value The amount to set the angle to, in degrees.
* @param step This is added to the `value` amount, multiplied by the iteration counter. Default 0.
*/
angle(value: number, step?: number): this;
/**
* Sets the rotation of each group member.
* @param value The amount to set the rotation to, in radians.
* @param step This is added to the `value` amount, multiplied by the iteration counter. Default 0.
*/
rotate(value: number, step?: number): this;
/**
* Rotates each group member around the given point by the given angle.
* @param point Any object with public `x` and `y` properties.
* @param angle The angle to rotate by, in radians.
*/
rotateAround(point: Phaser.Types.Math.Vector2Like, angle: number): this;
/**
* Rotates each group member around the given point by the given angle and distance.
* @param point Any object with public `x` and `y` properties.
* @param angle The angle to rotate by, in radians.
* @param distance The distance from the point of rotation in pixels.
*/
rotateAroundDistance(point: Phaser.Types.Math.Vector2Like, angle: number, distance: number): this;
/**
* Sets the alpha of each group member.
* @param value The amount to set the alpha to.
* @param step This is added to the `value` amount, multiplied by the iteration counter. Default 0.
*/
setAlpha(value: number, step?: number): this;
/**
* Sets the tint of each group member.
* @param topLeft The tint being applied to top-left corner of item. If other parameters are given no value, this tint will be applied to whole item.
* @param topRight The tint to be applied to top-right corner of item.
* @param bottomLeft The tint to be applied to the bottom-left corner of item.
* @param bottomRight The tint to be applied to the bottom-right corner of item.
*/
setTint(topLeft: number, topRight?: number, bottomLeft?: number, bottomRight?: number): this;
/**
* Sets the originX, originY of each group member.
* @param originX The amount to set the `originX` property to.
* @param originY The amount to set the `originY` property to. If `undefined` or `null` it uses the `originX` value.
* @param stepX This is added to the `originX` amount, multiplied by the iteration counter. Default 0.
* @param stepY This is added to the `originY` amount, multiplied by the iteration counter. Default 0.
*/
setOrigin(originX: number, originY?: number, stepX?: number, stepY?: number): this;
/**
* Sets the scaleX of each group member.
* @param value The amount to set the property to.
* @param step This is added to the `value` amount, multiplied by the iteration counter. Default 0.
*/
scaleX(value: number, step?: number): this;
/**
* Sets the scaleY of each group member.
* @param value The amount to set the property to.
* @param step This is added to the `value` amount, multiplied by the iteration counter. Default 0.
*/
scaleY(value: number, step?: number): this;
/**
* Sets the scaleX, scaleY of each group member.
* @param scaleX The amount to be added to the `scaleX` property.
* @param scaleY The amount to be added to the `scaleY` property. If `undefined` or `null` it uses the `scaleX` value.
* @param stepX This is added to the `scaleX` amount, multiplied by the iteration counter. Default 0.
* @param stepY This is added to the `scaleY` amount, multiplied by the iteration counter. Default 0.
*/
scaleXY(scaleX: number, scaleY?: number, stepX?: number, stepY?: number): this;
/**
* Sets the depth of each group member.
* @param value The amount to set the property to.
* @param step This is added to the `value` amount, multiplied by the iteration counter. Default 0.
*/
setDepth(value: number, step?: number): this;
/**
* Sets the blendMode of each group member.
* @param value The amount to set the property to.
*/
setBlendMode(value: number): this;
/**
* Passes all group members to the Input Manager to enable them for input with identical areas and callbacks.
* @param hitArea Either an input configuration object, or a geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used.
* @param hitAreaCallback A callback to be invoked when the Game Object is interacted with. If you provide a shape you must also provide a callback.
*/
setHitArea(hitArea: any, hitAreaCallback: Phaser.Types.Input.HitAreaCallback): this;
/**
* Shuffles the group members in place.
*/
shuffle(): this;
/**
* Deactivates a member of this group.
* @param gameObject A member of this group.
*/
kill(gameObject: Phaser.GameObjects.GameObject): void;
/**
* Deactivates and hides a member of this group.
* @param gameObject A member of this group.
*/
killAndHide(gameObject: Phaser.GameObjects.GameObject): void;
/**
* Sets the visible of each group member.
* @param value The value to set the property to.
* @param index An optional offset to start searching from within the items array. Default 0.
* @param direction The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning. Default 1.
*/
setVisible(value: boolean, index?: number, direction?: number): this;
/**
* Toggles (flips) the visible state of each member of this group.
*/
toggleVisible(): this;
/**
* Empties this Group of all children and removes it from the Scene.
*
* Does not call {@link Phaser.GameObjects.Group#removeCallback}.
*
* Children of this Group will _not_ be removed from the Scene by calling this method
* unless you specify the `removeFromScene` parameter.
*
* Children of this Group will also _not_ be destroyed by calling this method
* unless you specify the `destroyChildren` parameter.
* @param destroyChildren Also {@link Phaser.GameObjects.GameObject#destroy} each Group member. Default false.
* @param removeFromScene Optionally remove each Group member from the Scene. Default false.
*/
destroy(destroyChildren?: boolean, removeFromScene?: boolean): void;
}
/**
* An Image Game Object.
*
* An Image is a light-weight Game Object useful for the display of static images in your game,
* such as logos, backgrounds, scenery or other non-animated elements. Images can have input
* events and physics bodies, or be tweened, tinted or scrolled. The main difference between an
* Image and a Sprite is that you cannot animate an Image as they do not have the Animation component.
*/
class Image extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.Alpha, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Flip, Phaser.GameObjects.Components.GetBounds, Phaser.GameObjects.Components.Mask, Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.PostPipeline, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Size, Phaser.GameObjects.Components.TextureCrop, 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.
* @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.
*/
constructor(scene: Phaser.Scene, x: number, y: number, texture: string | Phaser.Textures.Texture, frame?: string | number);
/**
* 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;
/**
* Gets the center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the top-left corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getTopLeft(output?: O, includeParent?: boolean): O;
/**
* Gets the top-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getTopCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the top-right corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getTopRight(output?: O, includeParent?: boolean): O;
/**
* Gets the left-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getLeftCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the right-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getRightCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the bottom-left corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getBottomLeft(output?: O, includeParent?: boolean): O;
/**
* Gets the bottom-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getBottomCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the bottom-right corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getBottomRight(output?: O, includeParent?: boolean): O;
/**
* Gets the bounds of this Game Object, regardless of origin.
*
* The values are stored and returned in a Rectangle, or Rectangle-like, object.
* @param output An object to store the values in. If not provided a new Rectangle will be created.
*/
getBounds(output?: O): O;
/**
* The Mask this Game Object is using during render.
*/
mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask;
/**
* Sets the mask that this Game Object will use to render with.
*
* The mask must have been previously created and can be either a GeometryMask or a BitmapMask.
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* If a mask is already set on this Game Object it will be immediately replaced.
*
* Masks are positioned in global space and are not relative to the Game Object to which they
* are applied. The reason for this is that multiple Game Objects can all share the same mask.
*
* Masks have no impact on physics or input detection. They are purely a rendering component
* that allows you to limit what is visible during the render pass.
* @param mask The mask this Game Object will use when rendering.
*/
setMask(mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask): this;
/**
* Clears the mask that this Game Object was using.
* @param destroyMask Destroy the mask before clearing it? Default false.
*/
clearMask(destroyMask?: boolean): this;
/**
* Creates and returns a Bitmap Mask. This mask can be used by any Game Object,
* including this one, or a Dynamic Texture.
*
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* To create the mask you need to pass in a reference to a renderable Game Object.
* A renderable Game Object is one that uses a texture to render with, such as an
* Image, Sprite, Render Texture or BitmapText.
*
* If you do not provide a renderable object, and this Game Object has a texture,
* it will use itself as the object. This means you can call this method to create
* a Bitmap Mask from any renderable texture-based Game Object.
* @param maskObject The Game Object or Dynamic 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.
*/
createBitmapMask(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 and returns a Geometry Mask. This mask can be used by any Game Object,
* including this one.
*
* To create the mask you need to pass in a reference to a Graphics Game Object.
*
* If you do not provide a graphics object, and this Game Object is an instance
* of a Graphics object, then it will use itself to create the mask.
*
* This means you can call this method to create a Geometry Mask from any Graphics Game Object.
* @param graphics A Graphics Game Object, or any kind of Shape Game Object. The geometry within it will be used as the mask.
*/
createGeometryMask(graphics?: Phaser.GameObjects.Graphics | Phaser.GameObjects.Shape): Phaser.Display.Masks.GeometryMask;
/**
* 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 initial WebGL pipeline of this Game Object.
*
* If you call `resetPipeline` on this Game Object, the pipeline is reset to this default.
*/
defaultPipeline: Phaser.Renderer.WebGL.WebGLPipeline;
/**
* The current WebGL pipeline of this Game Object.
*/
pipeline: Phaser.Renderer.WebGL.WebGLPipeline;
/**
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
*/
pipelineData: object;
/**
* Sets the initial WebGL Pipeline of this Game Object.
*
* This should only be called during the instantiation of the Game Object. After that, use `setPipeline`.
* @param pipeline Either the string-based name of the pipeline, or a pipeline instance to set.
*/
initPipeline(pipeline?: string | Phaser.Renderer.WebGL.WebGLPipeline): boolean;
/**
* Sets the main WebGL Pipeline of this Game Object.
*
* Also sets the `pipelineData` property, if the parameter is given.
* @param pipeline Either the string-based name of the pipeline, or a pipeline instance to set.
* @param pipelineData Optional pipeline data object that is set in to the `pipelineData` property of this Game Object.
* @param copyData Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead. Default true.
*/
setPipeline(pipeline: string | Phaser.Renderer.WebGL.WebGLPipeline, pipelineData?: object, copyData?: boolean): this;
/**
* Adds an entry to the `pipelineData` object belonging to this Game Object.
*
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
*
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
* @param key The key of the pipeline data to set, update, or delete.
* @param value The value to be set with the key. If `undefined` then `key` will be deleted from the object.
*/
setPipelineData(key: string, value?: any): this;
/**
* Resets the WebGL Pipeline of this Game Object back to the default it was created with.
* @param resetData Reset the `pipelineData` object to being an empty object? Default false.
*/
resetPipeline(resetData?: boolean): boolean;
/**
* Gets the name of the WebGL Pipeline this Game Object is currently using.
*/
getPipelineName(): string;
/**
* Does this Game Object have any Post Pipelines set?
*/
hasPostPipeline: boolean;
/**
* The WebGL Post FX Pipelines this Game Object uses for post-render effects.
*
* The pipelines are processed in the order in which they appear in this array.
*
* If you modify this array directly, be sure to set the
* `hasPostPipeline` property accordingly.
*/
postPipelines: Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
*/
postPipelineData: object;
/**
* The Pre FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.preFX.addBloom();
* ```
*
* Only the following Game Objects support Pre FX:
*
* * Image
* * Sprite
* * TileSprite
* * Text
* * RenderTexture
* * Video
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*/
preFX: Phaser.GameObjects.Components.FX | null;
/**
* The Post FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.postFX.addBloom();
* ```
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*
* This property is always `null` until the `initPostPipeline` method is called.
*/
postFX: Phaser.GameObjects.Components.FX;
/**
* This should only be called during the instantiation of the Game Object.
*
* It is called by default by all core Game Objects and doesn't need
* calling again.
*
* After that, use `setPostPipeline`.
* @param preFX Does this Game Object support Pre FX? Default false.
*/
initPostPipeline(preFX?: boolean): void;
/**
* Sets one, or more, Post Pipelines on this Game Object.
*
* Post Pipelines are invoked after this Game Object has rendered to its target and
* are commonly used for post-fx.
*
* The post pipelines are appended to the `postPipelines` array belonging to this
* Game Object. When the renderer processes this Game Object, it iterates through the post
* pipelines in the order in which they appear in the array. If you are stacking together
* multiple effects, be aware that the order is important.
*
* If you call this method multiple times, the new pipelines will be appended to any existing
* post pipelines already set. Use the `resetPostPipeline` method to clear them first, if required.
*
* You can optionally also set the `postPipelineData` property, if the parameter is given.
* @param pipelines Either the string-based name of the pipeline, or a pipeline instance, or class, or an array of them.
* @param pipelineData Optional pipeline data object that is set in to the `postPipelineData` property of this Game Object.
* @param copyData Should the pipeline data object be _deep copied_ into the `postPipelineData` property of this Game Object? If `false` it will be set by reference instead. Default true.
*/
setPostPipeline(pipelines: string | string[] | Function | Function[] | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[], pipelineData?: object, copyData?: boolean): this;
/**
* Adds an entry to the `postPipelineData` object belonging to this Game Object.
*
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
*
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
* @param key The key of the pipeline data to set, update, or delete.
* @param value The value to be set with the key. If `undefined` then `key` will be deleted from the object.
*/
setPostPipelineData(key: string, value?: any): this;
/**
* Gets a Post Pipeline instance from this Game Object, based on the given name, and returns it.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
getPostPipeline(pipeline: string | Function | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* Resets the WebGL Post Pipelines of this Game Object. It does this by calling
* the `destroy` method on each post pipeline and then clearing the local array.
* @param resetData Reset the `postPipelineData` object to being an empty object? Default false.
*/
resetPostPipeline(resetData?: boolean): void;
/**
* Removes a type of Post Pipeline instances from this Game Object, based on the given name, and destroys them.
*
* If you wish to remove all Post Pipelines use the `resetPostPipeline` method instead.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
removePostPipeline(pipeline: string | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): this;
/**
* Removes all Pre and Post FX Controllers from this Game Object.
*
* If you wish to remove a single controller, use the `preFX.remove(fx)` or `postFX.remove(fx)` methods instead.
*
* If you wish to clear a single controller, use the `preFX.clear()` or `postFX.clear()` methods instead.
*/
clearFX(): 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;
/**
* A boolean flag indicating if this Game Object is being cropped or not.
* You can toggle this at any time after `setCrop` has been called, to turn cropping on or off.
* Equally, calling `setCrop` with no arguments will reset the crop and disable it.
*/
isCropped: boolean;
/**
* Applies a crop to a texture based Game Object, such as a Sprite or Image.
*
* The crop is a rectangle that limits the area of the texture frame that is visible during rendering.
*
* Cropping a Game Object does not change its size, dimensions, physics body or hit area, it just
* changes what is shown when rendered.
*
* The crop coordinates are relative to the texture frame, not the Game Object, meaning 0 x 0 is the top-left.
*
* Therefore, if you had a Game Object that had an 800x600 sized texture, and you wanted to show only the left
* half of it, you could call `setCrop(0, 0, 400, 600)`.
*
* It is also scaled to match the Game Object scale automatically. Therefore a crop rect of 100x50 would crop
* an area of 200x100 when applied to a Game Object that had a scale factor of 2.
*
* You can either pass in numeric values directly, or you can provide a single Rectangle object as the first argument.
*
* Call this method with no arguments at all to reset the crop, or toggle the property `isCropped` to `false`.
*
* You should do this if the crop rectangle becomes the same size as the frame itself, as it will allow
* the renderer to skip several internal calculations.
* @param x The x coordinate to start the crop from. Or a Phaser.Geom.Rectangle object, in which case the rest of the arguments are ignored.
* @param y The y coordinate to start the crop from.
* @param width The width of the crop rectangle in pixels.
* @param height The height of the crop rectangle in pixels.
*/
setCrop(x?: number | Phaser.Geom.Rectangle, y?: number, width?: number, height?: number): this;
/**
* 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.
* @param frame The name or index of the frame within the Texture.
*/
setTexture(key: string, 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.
* Return `tintTopLeft` when read this tint property.
*/
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;
}
/**
* A Layer Game Object.
*
* A Layer is a special type of Game Object that acts as a Display List. You can add any type of Game Object
* to a Layer, just as you would to a Scene. Layers can be used to visually group together 'layers' of Game
* Objects:
*
* ```javascript
* const spaceman = this.add.sprite(150, 300, 'spaceman');
* const bunny = this.add.sprite(400, 300, 'bunny');
* const elephant = this.add.sprite(650, 300, 'elephant');
*
* const layer = this.add.layer();
*
* layer.add([ spaceman, bunny, elephant ]);
* ```
*
* The 3 sprites in the example above will now be managed by the Layer they were added to. Therefore,
* if you then set `layer.setVisible(false)` they would all vanish from the display.
*
* You can also control the depth of the Game Objects within the Layer. For example, calling the
* `setDepth` method of a child of a Layer will allow you to adjust the depth of that child _within the
* Layer itself_, rather than the whole Scene. The Layer, too, can have its depth set as well.
*
* The Layer class also offers many different methods for manipulating the list, such as the
* methods `moveUp`, `moveDown`, `sendToBack`, `bringToTop` and so on. These allow you to change the
* display list position of the Layers children, causing it to adjust the order in which they are
* rendered. Using `setDepth` on a child allows you to override this.
*
* Layers can have Post FX Pipelines set, which allows you to easily enable a post pipeline across
* a whole range of children, which, depending on the effect, can often be far more efficient that doing so
* on a per-child basis.
*
* Layers have no position or size within the Scene. This means you cannot enable a Layer for
* physics or input, or change the position, rotation or scale of a Layer. They also have no scroll
* factor, texture, tint, origin, crop or bounds.
*
* If you need those kind of features then you should use a Container instead. Containers can be added
* to Layers, but Layers cannot be added to Containers.
*
* However, you can set the Alpha, Blend Mode, Depth, Mask and Visible state of a Layer. These settings
* will impact all children being rendered by the Layer.
*/
class Layer extends Phaser.Structs.List implements Phaser.GameObjects.Components.AlphaSingle, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Mask, Phaser.GameObjects.Components.PostPipeline, 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.
* @param children An optional array of Game Objects to add to this Layer.
*/
constructor(scene: Phaser.Scene, children?: Phaser.GameObjects.GameObject[]);
/**
* 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;
/**
* A Layer cannot be placed inside a Container.
*
* This property is kept purely so a Layer has the same
* shape as a Game Object.
*/
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;
/**
* This property is kept purely so a Layer has the same
* shape as a Game Object. You cannot input enable a Layer.
*/
input: Phaser.Types.Input.InteractiveObject | null;
/**
* This property is kept purely so a Layer has the same
* shape as a Game Object. You cannot give a Layer 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;
/**
* A reference to the Scene Systems.
*/
systems: Phaser.Scenes.Systems;
/**
* A reference to the Scene Event Emitter.
*/
events: Phaser.Events.EventEmitter;
/**
* The flag the determines whether Game Objects should be sorted when `depthSort()` is called.
*/
sortChildrenFlag: 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 | object, 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 | object, 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 | object): 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;
/**
* A Layer cannot be enabled for input.
*
* This method does nothing and is kept to ensure
* the Layer has the same shape as a Game Object.
*/
setInteractive(): this;
/**
* A Layer cannot be enabled for input.
*
* This method does nothing and is kept to ensure
* the Layer has the same shape as a Game Object.
*/
disableInteractive(): this;
/**
* A Layer cannot be enabled for input.
*
* This method does nothing and is kept to ensure
* the Layer has the same shape as a Game Object.
*/
removeInteractive(): this;
/**
* Adds the given Game Object, or array of Game Objects, to this Layer.
*
* Each Game Object must be unique within the Layer.
* @param child The Game Object, or array of Game Objects, to add to the Layer.
*/
add(child: (T|T[])): this;
/**
* Removes the given Game Object, or array of Game Objects, from this Layer.
*
* The Game Objects must already be children of this Layer.
*
* You can also optionally call `destroy` on each Game Object that is removed from the Layer.
* @param child The Game Object, or array of Game Objects, to be removed from the Layer.
* @param destroyChild Optionally call `destroy` on each child successfully removed from this Layer. Default false.
*/
remove(child: (T|T[]), destroyChild?: boolean): this;
/**
* Removes all Game Objects from this Layer.
*
* You can also optionally call `destroy` on each Game Object that is removed from the Layer.
* @param destroyChild Optionally call `destroy` on each Game Object successfully removed from this Layer. Default false.
*/
removeAll(destroyChild?: boolean): 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[];
/**
* Force a sort of the display list on the next call to depthSort.
*/
queueDepthSort(): void;
/**
* Immediately sorts the display list if the flag is set.
*/
depthSort(): void;
/**
* Compare the depth of two Game Objects.
* @param childA The first Game Object.
* @param childB The second Game Object.
*/
sortByDepth(childA: Phaser.GameObjects.GameObject, childB: Phaser.GameObjects.GameObject): number;
/**
* Returns an array which contains all Game Objects within this Layer.
*
* This is a reference to the main list array, not a copy of it, so be careful not to modify it.
*/
getChildren(): Phaser.GameObjects.GameObject[];
/**
* Adds this Layer 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 Layer belongs.
*
* A Layer can only exist on one Display List at any given time, but may move freely between them.
*
* If this Layer 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.Layer#displayList` property.
*
* If a Layer isn't on any display list, it will not be rendered. If you just wish to temporarily
* 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;
/**
* Removes this Layer from the Display List it is currently on.
*
* A Layer 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 Layer isn't on any Display List, it will not be rendered. If you just wish to temporarily
* disable it from rendering, consider using the `setVisible` method, instead.
*/
removeFromDisplayList(): this;
/**
* Destroys this Layer removing it from the Display List and Update List and
* severing all ties to parent resources.
*
* Also destroys all children of this Layer. If you do not wish for the
* children to be destroyed, you should move them from this Layer first.
*
* Use this to remove this Layer 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;
/**
* 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 Mask this Game Object is using during render.
*/
mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask;
/**
* Sets the mask that this Game Object will use to render with.
*
* The mask must have been previously created and can be either a GeometryMask or a BitmapMask.
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* If a mask is already set on this Game Object it will be immediately replaced.
*
* Masks are positioned in global space and are not relative to the Game Object to which they
* are applied. The reason for this is that multiple Game Objects can all share the same mask.
*
* Masks have no impact on physics or input detection. They are purely a rendering component
* that allows you to limit what is visible during the render pass.
* @param mask The mask this Game Object will use when rendering.
*/
setMask(mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask): this;
/**
* Clears the mask that this Game Object was using.
* @param destroyMask Destroy the mask before clearing it? Default false.
*/
clearMask(destroyMask?: boolean): this;
/**
* Creates and returns a Bitmap Mask. This mask can be used by any Game Object,
* including this one, or a Dynamic Texture.
*
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* To create the mask you need to pass in a reference to a renderable Game Object.
* A renderable Game Object is one that uses a texture to render with, such as an
* Image, Sprite, Render Texture or BitmapText.
*
* If you do not provide a renderable object, and this Game Object has a texture,
* it will use itself as the object. This means you can call this method to create
* a Bitmap Mask from any renderable texture-based Game Object.
* @param maskObject The Game Object or Dynamic 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.
*/
createBitmapMask(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 and returns a Geometry Mask. This mask can be used by any Game Object,
* including this one.
*
* To create the mask you need to pass in a reference to a Graphics Game Object.
*
* If you do not provide a graphics object, and this Game Object is an instance
* of a Graphics object, then it will use itself to create the mask.
*
* This means you can call this method to create a Geometry Mask from any Graphics Game Object.
* @param graphics A Graphics Game Object, or any kind of Shape Game Object. The geometry within it will be used as the mask.
*/
createGeometryMask(graphics?: Phaser.GameObjects.Graphics | Phaser.GameObjects.Shape): Phaser.Display.Masks.GeometryMask;
/**
* Does this Game Object have any Post Pipelines set?
*/
hasPostPipeline: boolean;
/**
* The WebGL Post FX Pipelines this Game Object uses for post-render effects.
*
* The pipelines are processed in the order in which they appear in this array.
*
* If you modify this array directly, be sure to set the
* `hasPostPipeline` property accordingly.
*/
postPipelines: Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
*/
postPipelineData: object;
/**
* The Pre FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.preFX.addBloom();
* ```
*
* Only the following Game Objects support Pre FX:
*
* * Image
* * Sprite
* * TileSprite
* * Text
* * RenderTexture
* * Video
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*/
preFX: Phaser.GameObjects.Components.FX | null;
/**
* The Post FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.postFX.addBloom();
* ```
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*
* This property is always `null` until the `initPostPipeline` method is called.
*/
postFX: Phaser.GameObjects.Components.FX;
/**
* This should only be called during the instantiation of the Game Object.
*
* It is called by default by all core Game Objects and doesn't need
* calling again.
*
* After that, use `setPostPipeline`.
* @param preFX Does this Game Object support Pre FX? Default false.
*/
initPostPipeline(preFX?: boolean): void;
/**
* Sets one, or more, Post Pipelines on this Game Object.
*
* Post Pipelines are invoked after this Game Object has rendered to its target and
* are commonly used for post-fx.
*
* The post pipelines are appended to the `postPipelines` array belonging to this
* Game Object. When the renderer processes this Game Object, it iterates through the post
* pipelines in the order in which they appear in the array. If you are stacking together
* multiple effects, be aware that the order is important.
*
* If you call this method multiple times, the new pipelines will be appended to any existing
* post pipelines already set. Use the `resetPostPipeline` method to clear them first, if required.
*
* You can optionally also set the `postPipelineData` property, if the parameter is given.
* @param pipelines Either the string-based name of the pipeline, or a pipeline instance, or class, or an array of them.
* @param pipelineData Optional pipeline data object that is set in to the `postPipelineData` property of this Game Object.
* @param copyData Should the pipeline data object be _deep copied_ into the `postPipelineData` property of this Game Object? If `false` it will be set by reference instead. Default true.
*/
setPostPipeline(pipelines: string | string[] | Function | Function[] | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[], pipelineData?: object, copyData?: boolean): this;
/**
* Adds an entry to the `postPipelineData` object belonging to this Game Object.
*
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
*
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
* @param key The key of the pipeline data to set, update, or delete.
* @param value The value to be set with the key. If `undefined` then `key` will be deleted from the object.
*/
setPostPipelineData(key: string, value?: any): this;
/**
* Gets a Post Pipeline instance from this Game Object, based on the given name, and returns it.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
getPostPipeline(pipeline: string | Function | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* Resets the WebGL Post Pipelines of this Game Object. It does this by calling
* the `destroy` method on each post pipeline and then clearing the local array.
* @param resetData Reset the `postPipelineData` object to being an empty object? Default false.
*/
resetPostPipeline(resetData?: boolean): void;
/**
* Removes a type of Post Pipeline instances from this Game Object, based on the given name, and destroys them.
*
* If you wish to remove all Post Pipelines use the `resetPostPipeline` method instead.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
removePostPipeline(pipeline: string | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): this;
/**
* Removes all Pre and Post FX Controllers from this Game Object.
*
* If you wish to remove a single controller, use the `preFX.remove(fx)` or `postFX.remove(fx)` methods instead.
*
* If you wish to clear a single controller, use the `preFX.clear()` or `postFX.clear()` methods instead.
*/
clearFX(): this;
/**
* 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;
}
/**
* A 2D point light.
*
* These are typically created by a {@link Phaser.GameObjects.LightsManager}, available from within a scene via `this.lights`.
*
* Any Game Objects using the Light2D pipeline will then be affected by these Lights as long as they have a normal map.
*
* They can also simply be used to represent a point light for your own purposes.
*
* As of Phaser 3.60 this Game Object now has the Transform and Origin components. However, changing the scale,
* rotation or origin properties will not make any difference to the Light. They are simply present to allow you
* to add this Light to a Container, or enable it for Physics.
*/
class Light extends Phaser.Geom.Circle implements Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible {
/**
*
* @param x The horizontal position of the light.
* @param y The vertical position of the light.
* @param radius The radius of the light.
* @param r The red color of the light. A value between 0 and 1.
* @param g The green color of the light. A value between 0 and 1.
* @param b The blue color of the light. A value between 0 and 1.
* @param intensity The intensity of the light.
*/
constructor(x: number, y: number, radius: number, r: number, g: number, b: number, intensity: number);
/**
* The color of the light.
*/
color: Phaser.Display.RGB;
/**
* The intensity of the light.
*/
intensity: number;
/**
* 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;
/**
* The width of this Light Game Object. This is the same as `Light.diameter`.
*/
displayWidth: number;
/**
* The height of this Light Game Object. This is the same as `Light.diameter`.
*/
displayHeight: number;
/**
* The width of this Light Game Object. This is the same as `Light.diameter`.
*/
width: number;
/**
* The height of this Light Game Object. This is the same as `Light.diameter`.
*/
height: number;
/**
* 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;
/**
* Set the color of the light from a single integer RGB value.
* @param rgb The integer RGB color of the light.
*/
setColor(rgb: number): this;
/**
* Set the intensity of the light.
* @param intensity The intensity of the light.
*/
setIntensity(intensity: number): this;
/**
* Set the radius of the light.
* @param radius The radius of the light.
*/
setRadius(radius: number): this;
/**
* The bitmask that `GameObject.renderFlags` is compared against to determine if the Game Object will render or not.
*/
static readonly RENDER_MASK: number;
/**
* 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 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;
/**
* 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;
}
/**
* Manages Lights for a Scene.
*
* Affects the rendering of Game Objects using the `Light2D` pipeline.
*/
class LightsManager {
/**
* The Lights in the Scene.
*/
lights: Phaser.GameObjects.Light[];
/**
* The ambient color.
*/
ambientColor: Phaser.Display.RGB;
/**
* Whether the Lights Manager is enabled.
*/
active: boolean;
/**
* The maximum number of lights that a single Camera and the lights shader can process.
* Change this via the `maxLights` property in your game config, as it cannot be changed at runtime.
*/
readonly maxLights: number;
/**
* The number of lights that the LightPipeline processed in the _previous_ frame.
*/
readonly visibleLights: number;
/**
* 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.
*/
addPointLight(x: number, y: number, color?: number, radius?: number, intensity?: number, attenuation?: number): Phaser.GameObjects.PointLight;
/**
* Enable the Lights Manager.
*/
enable(): this;
/**
* Disable the Lights Manager.
*/
disable(): this;
/**
* Get all lights that can be seen by the given Camera.
*
* It will automatically cull lights that are outside the world view of the Camera.
*
* If more lights are returned than supported by the pipeline, the lights are then culled
* based on the distance from the center of the camera. Only those closest are rendered.
* @param camera The Camera to cull Lights for.
*/
getLights(camera: Phaser.Cameras.Scene2D.Camera): Phaser.GameObjects.Light[];
/**
* Set the ambient light color.
* @param rgb The integer RGB color of the ambient light.
*/
setAmbientColor(rgb: number): this;
/**
* Returns the maximum number of Lights allowed to appear at once.
*/
getMaxVisibleLights(): number;
/**
* Get the number of Lights managed by this Lights Manager.
*/
getLightCount(): number;
/**
* Add a Light.
* @param x The horizontal position of the Light. Default 0.
* @param y The vertical position of the Light. Default 0.
* @param radius The radius of the Light. Default 128.
* @param rgb The integer RGB color of the light. Default 0xffffff.
* @param intensity The intensity of the Light. Default 1.
*/
addLight(x?: number, y?: number, radius?: number, rgb?: number, intensity?: number): Phaser.GameObjects.Light;
/**
* Remove a Light.
* @param light The Light to remove.
*/
removeLight(light: Phaser.GameObjects.Light): this;
/**
* Shut down the Lights Manager.
*
* Recycles all active Lights into the Light pool, resets ambient light color and clears the lists of Lights and
* culled Lights.
*/
shutdown(): void;
/**
* Destroy the Lights Manager.
*
* Cleans up all references by calling {@link Phaser.GameObjects.LightsManager#shutdown}.
*/
destroy(): void;
}
/**
* A Scene plugin that provides a {@link Phaser.GameObjects.LightsManager} for the Light2D pipeline.
*
* Available from within a Scene via `this.lights`.
*
* Add Lights using the {@link Phaser.GameObjects.LightsManager#addLight} method:
*
* ```javascript
* // Enable the Lights Manager because it is disabled by default
* this.lights.enable();
*
* // Create a Light at [400, 300] with a radius of 200
* this.lights.addLight(400, 300, 200);
* ```
*
* For Game Objects to be affected by the Lights when rendered, you will need to set them to use the `Light2D` pipeline like so:
*
* ```javascript
* sprite.setPipeline('Light2D');
* ```
*
* Note that you cannot use this pipeline on Graphics Game Objects or Shape Game Objects.
*/
class LightsPlugin extends Phaser.GameObjects.LightsManager {
/**
*
* @param scene The Scene that this Lights Plugin belongs to.
*/
constructor(scene: Phaser.Scene);
/**
* A reference to the Scene that this Lights Plugin belongs to.
*/
scene: Phaser.Scene;
/**
* A reference to the Scene's systems.
*/
systems: Phaser.Scenes.Systems;
/**
* Boot the Lights Plugin.
*/
boot(): void;
/**
* Destroy the Lights Plugin.
*
* Cleans up all references.
*/
destroy(): void;
}
/**
* A Mesh Game Object.
*
* The Mesh Game Object allows you to render a group of textured vertices and manipulate
* the view of those vertices, such as rotation, translation or scaling.
*
* Support for generating mesh data from grids, model data or Wavefront OBJ Files is included.
*
* Although you can use this to render 3D objects, its primary use is for displaying more complex
* Sprites, or Sprites where you need fine-grained control over the vertex positions in order to
* achieve special effects in your games. Note that rendering still takes place using Phaser's
* orthographic camera (after being transformed via `projectionMesh`, see `setPerspective`,
* `setOrtho`, and `panZ` methods). As a result, all depth and face tests are done in an eventually
* orthographic space.
*
* The rendering process will iterate through the faces of this Mesh and render out each face
* that is considered as being in view of the camera. No depth buffer is used, and because of this,
* you should be careful not to use model data with too many vertices, or overlapping geometry,
* or you'll probably encounter z-depth fighting. The Mesh was designed to allow for more advanced
* 2D layouts, rather than displaying 3D objects, even though it can do this to a degree.
*
* In short, if you want to remake Crysis, use a 3D engine, not a Mesh. However, if you want
* to easily add some small fun 3D elements into your game, or create some special effects involving
* vertex warping, this is the right object for you. Mesh data becomes part of the WebGL batch,
* just like standard Sprites, so doesn't introduce any additional shader overhead. Because
* the Mesh just generates vertices into the WebGL batch, like any other Sprite, you can use all of
* the common Game Object components on a Mesh too, such as a custom pipeline, mask, blend mode
* or texture.
*
* Note that the Mesh object is WebGL only and does not have a Canvas counterpart.
*
* The Mesh origin is always 0.5 x 0.5 and cannot be changed.
*/
class Mesh extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.AlphaSingle, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Mask, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.PostPipeline, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Size, Phaser.GameObjects.Components.Texture, 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.
* @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` (but see note).
* @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? Note: If not, it will be assumed `z=0`, see method `panZ` or `setOrtho`. 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.
*/
constructor(scene: Phaser.Scene, 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[]);
/**
* An array containing the Face instances belonging to this Mesh.
*
* A Face consists of 3 Vertex objects.
*
* This array is populated during calls such as `addVertices` or `addOBJ`.
*/
faces: Phaser.Geom.Mesh.Face[];
/**
* An array containing Vertex instances. One instance per vertex in this Mesh.
*
* This array is populated during calls such as `addVertex` or `addOBJ`.
*/
vertices: Phaser.Geom.Mesh.Vertex[];
/**
* The tint fill mode.
*
* `false` = An additive tint (the default), where vertices colors are blended with the texture.
* `true` = A fill tint, where the vertex colors replace the texture, but respects texture alpha.
*/
tintFill: boolean;
/**
* You can optionally choose to render the vertices of this Mesh to a Graphics instance.
*
* Achieve this by setting the `debugCallback` and the `debugGraphic` properties.
*
* You can do this in a single call via the `Mesh.setDebug` method, which will use the
* built-in debug function. You can also set it to your own callback. The callback
* will be invoked _once per render_ and sent the following parameters:
*
* `debugCallback(src, meshLength, verts)`
*
* `src` is the Mesh instance being debugged.
* `meshLength` is the number of mesh vertices in total.
* `verts` is an array of the translated vertex coordinates.
*
* To disable rendering, set this property back to `null`.
*
* Please note that high vertex count Meshes will struggle to debug properly.
*/
debugCallback: Function;
/**
* The Graphics instance that the debug vertices will be drawn to, if `setDebug` has
* been called.
*/
debugGraphic: Phaser.GameObjects.Graphics;
/**
* When rendering, skip any Face that isn't counter clockwise?
*
* Enable this to hide backward-facing Faces during rendering.
*
* Disable it to render all Faces.
*/
hideCCW: boolean;
/**
* A Vector3 containing the 3D position of the vertices in this Mesh.
*
* Modifying the components of this property will allow you to reposition where
* the vertices are rendered within the Mesh. This happens in the `preUpdate` phase,
* where each vertex is transformed using the view and projection matrices.
*
* Changing this property will impact all vertices being rendered by this Mesh.
*
* You can also adjust the 'view' by using the `pan` methods.
*/
modelPosition: Phaser.Math.Vector3;
/**
* A Vector3 containing the 3D scale of the vertices in this Mesh.
*
* Modifying the components of this property will allow you to scale
* the vertices within the Mesh. This happens in the `preUpdate` phase,
* where each vertex is transformed using the view and projection matrices.
*
* Changing this property will impact all vertices being rendered by this Mesh.
*/
modelScale: Phaser.Math.Vector3;
/**
* A Vector3 containing the 3D rotation of the vertices in this Mesh.
*
* The values should be given in radians, i.e. to rotate the vertices by 90
* degrees you can use `modelRotation.x = Phaser.Math.DegToRad(90)`.
*
* Modifying the components of this property will allow you to rotate
* the vertices within the Mesh. This happens in the `preUpdate` phase,
* where each vertex is transformed using the view and projection matrices.
*
* Changing this property will impact all vertices being rendered by this Mesh.
*/
modelRotation: Phaser.Math.Vector3;
/**
* The transformation matrix for this Mesh.
*/
transformMatrix: Phaser.Math.Matrix4;
/**
* The view position for this Mesh.
*
* Use the methods`panX`, `panY` and `panZ` to adjust the view.
*/
viewPosition: Phaser.Math.Vector3;
/**
* The view matrix for this Mesh.
*/
viewMatrix: Phaser.Math.Matrix4;
/**
* The projection matrix for this Mesh.
*
* Update it with the `setPerspective` or `setOrtho` methods.
*/
projectionMatrix: Phaser.Math.Matrix4;
/**
* How many faces were rendered by this Mesh Game Object in the last
* draw? This is reset in the `preUpdate` method and then incremented
* each time a face is drawn. Note that in multi-camera Scenes this
* value may exceed that found in `Mesh.getFaceCount` due to
* cameras drawing the same faces more than once.
*/
readonly totalRendered: number;
/**
* By default, the Mesh will check to see if its model or view transform has
* changed each frame and only recalculate the vertex positions if they have.
*
* This avoids lots of additional math in the `preUpdate` step when not required.
*
* However, if you are performing per-Face or per-Vertex manipulation on this Mesh,
* such as tweening a Face, or moving it without moving the rest of the Mesh,
* then you may need to disable the dirty cache in order for the Mesh to re-render
* correctly. You can toggle this property to do that. Please note that leaving
* this set to `true` will cause the Mesh to recalculate the position of every single
* vertex in it, every single frame. So only really do this if you know you
* need it.
*/
ignoreDirtyCache: boolean;
/**
* The Camera fov (field of view) in degrees.
*
* This is set automatically as part of the `Mesh.setPerspective` call, but exposed
* here for additional math.
*
* Do not modify this property directly, doing so will not change the fov. For that,
* call the respective Mesh methods.
*/
readonly fov: number;
/**
* Translates the view position of this Mesh on the x axis by the given amount.
* @param v The amount to pan by.
*/
panX(v: number): void;
/**
* Translates the view position of this Mesh on the y axis by the given amount.
* @param v The amount to pan by.
*/
panY(v: number): void;
/**
* Translates the view position of this Mesh on the z axis by the given amount.
*
* As the default `panZ` value is 0, vertices with `z=0` (the default) need special
* care or else they will not display as they are "behind" the camera.
*
* Consider using `mesh.panZ(mesh.height / (2 * Math.tan(Math.PI / 16)))`,
* which will interpret vertex geometry 1:1 with pixel geometry (or see `setOrtho`).
* @param v The amount to pan by.
*/
panZ(v: number): void;
/**
* Builds a new perspective projection matrix from the given values.
*
* These are also the initial projection matrix and parameters for `Mesh` (see `Mesh.panZ` for more discussion).
*
* See also `setOrtho`.
* @param width The width of the projection matrix. Typically the same as the Mesh and/or Renderer.
* @param height The height of the projection matrix. Typically the same as the Mesh and/or Renderer.
* @param fov The field of view, in degrees. Default 45.
* @param near The near value of the view. Default 0.01.
* @param far The far value of the view. Default 1000.
*/
setPerspective(width: number, height: number, fov?: number, near?: number, far?: number): void;
/**
* Builds a new orthographic projection matrix from the given values.
*
* If using this mode you will often need to set `Mesh.hideCCW` to `false` as well.
*
* By default, calling this method with no parameters will set the scaleX value to
* match the renderer's aspect ratio. If you would like to render vertex positions 1:1
* to pixel positions, consider calling as `mesh.setOrtho(mesh.width, mesh.height)`.
*
* See also `setPerspective`.
* @param scaleX The default horizontal scale in relation to the Mesh / Renderer dimensions. Default 1.
* @param scaleY The default vertical scale in relation to the Mesh / Renderer dimensions. Default 1.
* @param near The near value of the view. Default -1000.
* @param far The far value of the view. Default 1000.
*/
setOrtho(scaleX?: number, scaleY?: number, near?: number, far?: number): void;
/**
* Iterates and destroys all current Faces in this Mesh, then resets the
* `faces` and `vertices` arrays.
*/
clear(): this;
/**
* This method will add the data from a triangulated Wavefront OBJ model file to this Mesh.
*
* The data should have been loaded via the OBJFile:
*
* ```javascript
* this.load.obj(key, url);
* ```
*
* Then use the same `key` as the first parameter to this method.
*
* Multiple Mesh Game Objects can use the same model data without impacting on each other.
*
* Make sure your 3D package has triangulated the model data prior to exporting it.
*
* You can add multiple models to a single Mesh, although they will act as one when
* moved or rotated. You can scale the model data, should it be too small, or too large, to see.
* You can also offset the vertices of the model via the `x`, `y` and `z` parameters.
* @param key The key of the model data in the OBJ Cache to add to this Mesh.
* @param scale An amount to scale the model data by. Use this if the model has exported too small, or large, to see. Default 1.
* @param x Translate the model x position by this amount. Default 0.
* @param y Translate the model y position by this amount. Default 0.
* @param z Translate the model z position by this amount. Default 0.
* @param rotateX Rotate the model on the x axis by this amount, in radians. Default 0.
* @param rotateY Rotate the model on the y axis by this amount, in radians. Default 0.
* @param rotateZ Rotate the model on the z axis by this amount, in radians. Default 0.
* @param zIsUp Is the z axis up (true), or is y axis up (false)? Default true.
*/
addVerticesFromObj(key: string, scale?: number, x?: number, y?: number, z?: number, rotateX?: number, rotateY?: number, rotateZ?: number, zIsUp?: boolean): this;
/**
* Compare the depth of two Faces.
* @param faceA The first Face.
* @param faceB The second Face.
*/
sortByDepth(faceA: Phaser.Geom.Mesh.Face, faceB: Phaser.Geom.Mesh.Face): number;
/**
* Runs a depth sort across all Faces in this Mesh, comparing their averaged depth.
*
* This is called automatically if you use any of the `rotate` methods, but you can
* also invoke it to sort the Faces should you manually position them.
*/
depthSort(): this;
/**
* Adds a new Vertex into the vertices array of this Mesh.
*
* Just adding a vertex isn't enough to render it. You need to also
* make it part of a Face, with 3 Vertex instances per Face.
* @param x The x position of the vertex.
* @param y The y position of the vertex.
* @param z The z position of the vertex.
* @param u The UV u coordinate of the vertex.
* @param v The UV v coordinate of the vertex.
* @param color The color value of the vertex. Default 0xffffff.
* @param alpha The alpha value of the vertex. Default 1.
*/
addVertex(x: number, y: number, z: number, u: number, v: number, color?: number, alpha?: number): this;
/**
* Adds a new Face into the faces array of this Mesh.
*
* A Face consists of references to 3 Vertex instances, which must be provided.
* @param vertex1 The first vertex of the Face.
* @param vertex2 The second vertex of the Face.
* @param vertex3 The third vertex of the Face.
*/
addFace(vertex1: Phaser.Geom.Mesh.Vertex, vertex2: Phaser.Geom.Mesh.Vertex, vertex3: Phaser.Geom.Mesh.Vertex): this;
/**
* Adds new vertices to this Mesh by parsing the given data.
*
* This method will take vertex data in one of two formats, based on the `containsZ` parameter.
*
* If your vertex data are `x`, `y` pairs, then `containsZ` should be `false` (this is the default, and will result in `z=0` for each vertex).
*
* If your vertex data is groups of `x`, `y` and `z` values, then the `containsZ` parameter must be true.
*
* The `uvs` parameter is a numeric array consisting of `u` and `v` pairs.
*
* The `normals` parameter is a numeric array consisting of `x`, `y` vertex normal values and, if `containsZ` is true, `z` values as well.
*
* The `indicies` parameter is an optional array that, if given, is an indexed list of vertices to be added.
*
* The `colors` parameter is an optional array, or single value, that if given sets the color of each vertex created.
*
* The `alphas` parameter is an optional array, or single value, that if given sets the alpha of each vertex created.
*
* When providing indexed data it is assumed that _all_ of the arrays are indexed, not just the vertices.
*
* The following example will create a 256 x 256 sized quad using an index array:
*
* ```javascript
* let mesh = new Mesh(this); // Assuming `this` is a scene!
* const vertices = [
* -128, 128,
* 128, 128,
* -128, -128,
* 128, -128
* ];
*
* const uvs = [
* 0, 1,
* 1, 1,
* 0, 0,
* 1, 0
* ];
*
* const indices = [ 0, 2, 1, 2, 3, 1 ];
*
* mesh.addVertices(vertices, uvs, indicies);
* // Note: Otherwise the added points will be "behind" the camera! This value will project vertex `x` & `y` values 1:1 to pixel values.
* mesh.hideCCW = false;
* mesh.setOrtho(mesh.width, mesh.height);
* ```
*
* If the data is not indexed, it's assumed that the arrays all contain sequential data.
* @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? If not, it will be assumed `z=0`, see methods `panZ` or `setOrtho`. 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.
*/
addVertices(vertices: number[], uvs: number[], indicies?: number[], containsZ?: boolean, normals?: number[], colors?: number | number[], alphas?: number | number[]): this;
/**
* Returns the total number of Faces in this Mesh Game Object.
*/
getFaceCount(): number;
/**
* Returns the total number of Vertices in this Mesh Game Object.
*/
getVertexCount(): number;
/**
* Returns the Face at the given index in this Mesh Game Object.
* @param index The index of the Face to get.
*/
getFace(index: number): Phaser.Geom.Mesh.Face;
/**
* Tests to see if _any_ face in this Mesh intersects with the given coordinates.
*
* The given position is translated through the matrix of this Mesh and the given Camera,
* before being compared against the vertices.
* @param x The x position to check against.
* @param y The y position to check against.
* @param camera The camera to pass the coordinates through. If not give, the default Scene Camera is used.
*/
hasFaceAt(x: number, y: number, camera?: Phaser.Cameras.Scene2D.Camera): boolean;
/**
* Return an array of Face objects from this Mesh that intersect with the given coordinates.
*
* The given position is translated through the matrix of this Mesh and the given Camera,
* before being compared against the vertices.
*
* If more than one Face intersects, they will all be returned in the array, but the array will
* be depth sorted first, so the first element will always be that closest to the camera.
* @param x The x position to check against.
* @param y The y position to check against.
* @param camera The camera to pass the coordinates through. If not give, the default Scene Camera is used.
*/
getFaceAt(x: number, y: number, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Geom.Mesh.Face[];
/**
* This method enables rendering of the Mesh vertices to the given Graphics instance.
*
* If you enable this feature, you **must** call `Graphics.clear()` in your Scene `update`,
* otherwise the Graphics instance you provide to debug will fill-up with draw calls,
* eventually crashing the browser. This is not done automatically to allow you to debug
* draw multiple Mesh objects to a single Graphics instance.
*
* The Mesh class has a built-in debug rendering callback `Mesh.renderDebug`, however
* you can also provide your own callback to be used instead. Do this by setting the `callback` parameter.
*
* The callback is invoked _once per render_ and sent the following parameters:
*
* `callback(src, faces)`
*
* `src` is the Mesh instance being debugged.
* `faces` is an array of the Faces that were rendered.
*
* You can get the final drawn vertex position from a Face object like this:
*
* ```javascript
* let face = faces[i];
*
* let x0 = face.vertex1.tx;
* let y0 = face.vertex1.ty;
* let x1 = face.vertex2.tx;
* let y1 = face.vertex2.ty;
* let x2 = face.vertex3.tx;
* let y2 = face.vertex3.ty;
*
* graphic.strokeTriangle(x0, y0, x1, y1, x2, y2);
* ```
*
* If using your own callback you do not have to provide a Graphics instance to this method.
*
* To disable debug rendering, to either your own callback or the built-in one, call this method
* with no arguments.
* @param graphic The Graphic instance to render to if using the built-in callback.
* @param callback The callback to invoke during debug render. Leave as undefined to use the built-in callback.
*/
setDebug(graphic?: Phaser.GameObjects.Graphics, callback?: Function): this;
/**
* Checks if the transformation data in this mesh is dirty.
*
* This is used internally by the `preUpdate` step to determine if the vertices should
* be recalculated or not.
*/
isDirty(): boolean;
/**
* The Mesh update loop. The following takes place in this method:
*
* First, the `totalRendered` and `totalFrame` properties are set.
*
* If the view matrix of this Mesh isn't dirty, and the model position, rotate or scale properties are
* all clean, then the method returns at this point.
*
* Otherwise, if the viewPosition is dirty (i.e. from calling a method like `panZ`), then it will
* refresh the viewMatrix.
*
* After this, a new transformMatrix is built and it then iterates through all Faces in this
* Mesh, calling `transformCoordinatesLocal` on all of them. Internally, this updates every
* vertex, calculating its new transformed position, based on the new transform matrix.
*
* Finally, the faces are depth sorted.
* @param time The current timestamp.
* @param delta The delta time, in ms, elapsed since the last frame.
*/
protected preUpdate(time: number, delta: number): void;
/**
* The built-in Mesh debug rendering method.
*
* See `Mesh.setDebug` for more details.
* @param src The Mesh object being rendered.
* @param faces An array of Faces.
*/
renderDebug(src: Phaser.GameObjects.Mesh, faces: Phaser.Geom.Mesh.Face[]): void;
/**
* Clears all tint values associated with this Game Object.
*
* Immediately sets the color values back to 0xffffff on all vertices,
* which results in no visible change to the texture.
*/
clearTint(): this;
/**
* Pass this Mesh Game Object to the Input Manager to enable it for Input.
*
* Unlike other Game Objects, the Mesh Game Object uses its own special hit area callback, which you cannot override.
*/
setInteractive(): this;
/**
* Sets an additive tint on all vertices of this Mesh 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.
*
* 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.
*
* To remove a tint call `clearTint`.
* @param tint The tint being applied to all vertices of this Mesh Game Object. Default 0xffffff.
*/
setTint(tint?: number): this;
/**
* Scrolls the UV texture coordinates of all faces in this Mesh by
* adding the given x/y amounts to them.
*
* If you only wish to scroll one coordinate, pass a value of zero
* to the other.
*
* Use small values for scrolling. UVs are set from the range 0
* to 1, so you should increment (or decrement) them by suitably
* small values, such as 0.01.
*
* Due to a limitation in WebGL1 you can only UV scroll textures
* that are a power-of-two in size. Scrolling NPOT textures will
* work but will result in clamping the pixels to the edges.
*
* Note that if this Mesh is using a _frame_ from a texture atlas
* then you will be unable to UV scroll its texture.
* @param x The amount to horizontally shift the UV coordinates by.
* @param y The amount to vertically shift the UV coordinates by.
*/
uvScroll(x: number, y: number): this;
/**
* Scales the UV texture coordinates of all faces in this Mesh by
* the exact given amounts.
*
* If you only wish to scale one coordinate, pass a value of one
* to the other.
*
* Due to a limitation in WebGL1 you can only UV scale textures
* that are a power-of-two in size. Scaling NPOT textures will
* work but will result in clamping the pixels to the edges if
* you scale beyond a value of 1. Scaling below 1 will work
* regardless of texture size.
*
* Note that if this Mesh is using a _frame_ from a texture atlas
* then you will be unable to UV scale its texture.
* @param x The amount to horizontally scale the UV coordinates by.
* @param y The amount to vertically scale the UV coordinates by.
*/
uvScale(x: number, y: number): this;
/**
* The tint value being applied to the whole of the Game Object.
* This property is a setter-only.
*/
tint(): number;
/**
* The x rotation of the Model in 3D space, as specified in degrees.
*
* If you need the value in radians use the `modelRotation.x` property directly.
*/
rotateX(): number;
/**
* The y rotation of the Model in 3D space, as specified in degrees.
*
* If you need the value in radians use the `modelRotation.y` property directly.
*/
rotateY(): number;
/**
* The z rotation of the Model in 3D space, as specified in degrees.
*
* If you need the value in radians use the `modelRotation.z` property directly.
*/
rotateZ(): number;
/**
* 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 Mask this Game Object is using during render.
*/
mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask;
/**
* Sets the mask that this Game Object will use to render with.
*
* The mask must have been previously created and can be either a GeometryMask or a BitmapMask.
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* If a mask is already set on this Game Object it will be immediately replaced.
*
* Masks are positioned in global space and are not relative to the Game Object to which they
* are applied. The reason for this is that multiple Game Objects can all share the same mask.
*
* Masks have no impact on physics or input detection. They are purely a rendering component
* that allows you to limit what is visible during the render pass.
* @param mask The mask this Game Object will use when rendering.
*/
setMask(mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask): this;
/**
* Clears the mask that this Game Object was using.
* @param destroyMask Destroy the mask before clearing it? Default false.
*/
clearMask(destroyMask?: boolean): this;
/**
* Creates and returns a Bitmap Mask. This mask can be used by any Game Object,
* including this one, or a Dynamic Texture.
*
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* To create the mask you need to pass in a reference to a renderable Game Object.
* A renderable Game Object is one that uses a texture to render with, such as an
* Image, Sprite, Render Texture or BitmapText.
*
* If you do not provide a renderable object, and this Game Object has a texture,
* it will use itself as the object. This means you can call this method to create
* a Bitmap Mask from any renderable texture-based Game Object.
* @param maskObject The Game Object or Dynamic 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.
*/
createBitmapMask(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 and returns a Geometry Mask. This mask can be used by any Game Object,
* including this one.
*
* To create the mask you need to pass in a reference to a Graphics Game Object.
*
* If you do not provide a graphics object, and this Game Object is an instance
* of a Graphics object, then it will use itself to create the mask.
*
* This means you can call this method to create a Geometry Mask from any Graphics Game Object.
* @param graphics A Graphics Game Object, or any kind of Shape Game Object. The geometry within it will be used as the mask.
*/
createGeometryMask(graphics?: Phaser.GameObjects.Graphics | Phaser.GameObjects.Shape): Phaser.Display.Masks.GeometryMask;
/**
* The initial WebGL pipeline of this Game Object.
*
* If you call `resetPipeline` on this Game Object, the pipeline is reset to this default.
*/
defaultPipeline: Phaser.Renderer.WebGL.WebGLPipeline;
/**
* The current WebGL pipeline of this Game Object.
*/
pipeline: Phaser.Renderer.WebGL.WebGLPipeline;
/**
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
*/
pipelineData: object;
/**
* Sets the initial WebGL Pipeline of this Game Object.
*
* This should only be called during the instantiation of the Game Object. After that, use `setPipeline`.
* @param pipeline Either the string-based name of the pipeline, or a pipeline instance to set.
*/
initPipeline(pipeline?: string | Phaser.Renderer.WebGL.WebGLPipeline): boolean;
/**
* Sets the main WebGL Pipeline of this Game Object.
*
* Also sets the `pipelineData` property, if the parameter is given.
* @param pipeline Either the string-based name of the pipeline, or a pipeline instance to set.
* @param pipelineData Optional pipeline data object that is set in to the `pipelineData` property of this Game Object.
* @param copyData Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead. Default true.
*/
setPipeline(pipeline: string | Phaser.Renderer.WebGL.WebGLPipeline, pipelineData?: object, copyData?: boolean): this;
/**
* Adds an entry to the `pipelineData` object belonging to this Game Object.
*
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
*
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
* @param key The key of the pipeline data to set, update, or delete.
* @param value The value to be set with the key. If `undefined` then `key` will be deleted from the object.
*/
setPipelineData(key: string, value?: any): this;
/**
* Resets the WebGL Pipeline of this Game Object back to the default it was created with.
* @param resetData Reset the `pipelineData` object to being an empty object? Default false.
*/
resetPipeline(resetData?: boolean): boolean;
/**
* Gets the name of the WebGL Pipeline this Game Object is currently using.
*/
getPipelineName(): string;
/**
* Does this Game Object have any Post Pipelines set?
*/
hasPostPipeline: boolean;
/**
* The WebGL Post FX Pipelines this Game Object uses for post-render effects.
*
* The pipelines are processed in the order in which they appear in this array.
*
* If you modify this array directly, be sure to set the
* `hasPostPipeline` property accordingly.
*/
postPipelines: Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
*/
postPipelineData: object;
/**
* The Pre FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.preFX.addBloom();
* ```
*
* Only the following Game Objects support Pre FX:
*
* * Image
* * Sprite
* * TileSprite
* * Text
* * RenderTexture
* * Video
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*/
preFX: Phaser.GameObjects.Components.FX | null;
/**
* The Post FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.postFX.addBloom();
* ```
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*
* This property is always `null` until the `initPostPipeline` method is called.
*/
postFX: Phaser.GameObjects.Components.FX;
/**
* This should only be called during the instantiation of the Game Object.
*
* It is called by default by all core Game Objects and doesn't need
* calling again.
*
* After that, use `setPostPipeline`.
* @param preFX Does this Game Object support Pre FX? Default false.
*/
initPostPipeline(preFX?: boolean): void;
/**
* Sets one, or more, Post Pipelines on this Game Object.
*
* Post Pipelines are invoked after this Game Object has rendered to its target and
* are commonly used for post-fx.
*
* The post pipelines are appended to the `postPipelines` array belonging to this
* Game Object. When the renderer processes this Game Object, it iterates through the post
* pipelines in the order in which they appear in the array. If you are stacking together
* multiple effects, be aware that the order is important.
*
* If you call this method multiple times, the new pipelines will be appended to any existing
* post pipelines already set. Use the `resetPostPipeline` method to clear them first, if required.
*
* You can optionally also set the `postPipelineData` property, if the parameter is given.
* @param pipelines Either the string-based name of the pipeline, or a pipeline instance, or class, or an array of them.
* @param pipelineData Optional pipeline data object that is set in to the `postPipelineData` property of this Game Object.
* @param copyData Should the pipeline data object be _deep copied_ into the `postPipelineData` property of this Game Object? If `false` it will be set by reference instead. Default true.
*/
setPostPipeline(pipelines: string | string[] | Function | Function[] | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[], pipelineData?: object, copyData?: boolean): this;
/**
* Adds an entry to the `postPipelineData` object belonging to this Game Object.
*
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
*
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
* @param key The key of the pipeline data to set, update, or delete.
* @param value The value to be set with the key. If `undefined` then `key` will be deleted from the object.
*/
setPostPipelineData(key: string, value?: any): this;
/**
* Gets a Post Pipeline instance from this Game Object, based on the given name, and returns it.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
getPostPipeline(pipeline: string | Function | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* Resets the WebGL Post Pipelines of this Game Object. It does this by calling
* the `destroy` method on each post pipeline and then clearing the local array.
* @param resetData Reset the `postPipelineData` object to being an empty object? Default false.
*/
resetPostPipeline(resetData?: boolean): void;
/**
* Removes a type of Post Pipeline instances from this Game Object, based on the given name, and destroys them.
*
* If you wish to remove all Post Pipelines use the `resetPostPipeline` method instead.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
removePostPipeline(pipeline: string | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): this;
/**
* Removes all Pre and Post FX Controllers from this Game Object.
*
* If you wish to remove a single controller, use the `preFX.remove(fx)` or `postFX.remove(fx)` methods instead.
*
* If you wish to clear a single controller, use the `preFX.clear()` or `postFX.clear()` methods instead.
*/
clearFX(): 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.
*
* Calling this method 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 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.
* @param updateSize Should this call adjust the size of the Game Object? Default true.
* @param updateOrigin Should this call change the origin of the Game Object? Default true.
*/
setTexture(key: string | Phaser.Textures.Texture, frame?: string | number, updateSize?: boolean, updateOrigin?: boolean): 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;
/**
* 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;
}
/**
* 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.
*
* As of Phaser 2.61 this Game Object can now populate its values automatically
* if they have been set within Texture Packer 7.1.0 or above and exported with
* the atlas json. If this is the case, you can just call this method without
* specifying anything more than the texture key and frame and it will pull the
* area data from the atlas.
*/
class NineSlice extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.AlphaSingle, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.GetBounds, Phaser.GameObjects.Components.Mask, Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.PostPipeline, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Texture, 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.
* @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.
*/
constructor(scene: Phaser.Scene, x: number, y: number, texture: string | Phaser.Textures.Texture, frame?: string | number, width?: number, height?: number, leftWidth?: number, rightWidth?: number, topHeight?: number, bottomHeight?: number);
/**
* An array of Vertex objects that correspond to the quads that make-up
* this Nine Slice Game Object. They are stored in the following order:
*
* Top Left - Indexes 0 - 5
* Top Center - Indexes 6 - 11
* Top Right - Indexes 12 - 17
* Center Left - Indexes 18 - 23
* Center - Indexes 24 - 29
* Center Right - Indexes 30 - 35
* Bottom Left - Indexes 36 - 41
* Bottom Center - Indexes 42 - 47
* Bottom Right - Indexes 48 - 53
*
* Each quad is represented by 6 Vertex instances.
*
* This array will contain 18 elements for a 3 slice object
* and 54 for a nine slice object.
*
* You should never modify this array once it has been populated.
*/
vertices: Phaser.Geom.Mesh.Vertex[];
/**
* The size of the left vertical bar (A).
*/
readonly leftWidth: number;
/**
* The size of the right vertical bar (B).
*/
readonly rightWidth: number;
/**
* The size of the top horizontal bar (C).
*
* If this is a 3 slice object this property will be set to the
* height of the texture being used.
*/
readonly topHeight: number;
/**
* The size of the bottom horizontal bar (D).
*
* If this is a 3 slice object this property will be set to zero.
*/
readonly bottomHeight: number;
/**
* 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.
*/
tint: 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;
/**
* This property is `true` if this Nine Slice Game Object was configured
* with just `leftWidth` and `rightWidth` values, making it a 3-slice
* instead of a 9-slice object.
*/
is3Slice: boolean;
/**
* Resets the width, height and slices for this NineSlice Game Object.
*
* This allows you to modify the texture being used by this object and then reset the slice configuration,
* to avoid having to destroy this Game Object in order to use it for a different game element.
*
* Please note that you cannot change a 9-slice to a 3-slice or vice versa.
* @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.
* @param skipScale9 If this Nine Slice was created from Texture Packer scale9 atlas data, set this property to use the given column sizes instead of those specified in the JSON. Default false.
*/
setSlices(width?: number, height?: number, leftWidth?: number, rightWidth?: number, topHeight?: number, bottomHeight?: number, skipScale9?: boolean): this;
/**
* Updates all of the vertice UV coordinates. This is called automatically
* when the NineSlice Game Object is created, or if the texture frame changes.
*
* Unlike with the `updateVertice` method, you do not need to call this
* method if the Nine Slice changes size. Only if it changes texture frame.
*/
updateUVs(): void;
/**
* Recalculates all of the vertices in this Nine Slice Game Object
* based on the `leftWidth`, `rightWidth`, `topHeight` and `bottomHeight`
* properties, combined with the Game Object size.
*
* This method is called automatically when this object is created
* or if it's origin is changed.
*
* You should not typically need to call this method directly, but it
* is left public should you find a need to modify one of those properties
* after creation.
*/
updateVertices(): void;
/**
* Internally updates the position coordinates across all vertices of the
* given quad offset.
*
* You should not typically need to call this method directly, but it
* is left public should an extended class require it.
* @param offset The offset in the vertices array of the quad to update.
* @param x1 The top-left quad coordinate.
* @param y1 The top-left quad coordinate.
* @param x2 The bottom-right quad coordinate.
* @param y2 The bottom-right quad coordinate.
*/
updateQuad(offset: number, x1: number, y1: number, x2: number, y2: number): void;
/**
* Internally updates the UV coordinates across all vertices of the
* given quad offset, based on the frame size.
*
* You should not typically need to call this method directly, but it
* is left public should an extended class require it.
* @param offset The offset in the vertices array of the quad to update.
* @param u1 The top-left UV coordinate.
* @param v1 The top-left UV coordinate.
* @param u2 The bottom-right UV coordinate.
* @param v2 The bottom-right UV coordinate.
*/
updateQuadUVs(offset: number, u1: number, v1: number, u2: number, v2: number): void;
/**
* 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.
*
* To modify the tint color once set, either call this method again with new values or use the
* `tint` property.
*
* To remove a tint call `clearTint`, or call this method with no parameters.
*
* To swap this from being an additive tint to a fill based tint set the property `tintFill` to `true`.
* @param color The tint being applied to the entire Game Object. Default 0xffffff.
*/
setTint(color?: 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. The whole Game Object will be rendered in the given color.
*
* To modify the tint color once set, either call this method again with new values or use the
* `tint` property.
*
* To remove a tint call `clearTint`, or call this method with no parameters.
*
* To swap this from being a fill-tint to an additive tint set the property `tintFill` to `false`.
* @param color The tint being applied to the entire Game Object. Default 0xffffff.
*/
setTintFill(color?: number): this;
/**
* Does this Game Object have a tint applied?
*
* It checks to see if the tint property is set to a value other than 0xffffff.
* This indicates that a Game Object is tinted.
*/
readonly isTinted: boolean;
/**
* The displayed width of this Game Object.
*
* Setting this value will adjust the way in which this Nine Slice
* object scales horizontally, if configured to do so.
*
* The _minimum_ width this Game Object can be is the total of
* `leftWidth` + `rightWidth`. If you need to display this object
* at a smaller size, you can also scale it.
*/
width: number;
/**
* The displayed height of this Game Object.
*
* Setting this value will adjust the way in which this Nine Slice
* object scales vertically, if configured to do so.
*
* 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 also scale it.
*
* If this is a 3-slice object, you can only stretch it horizontally
* and changing the height will be ignored.
*/
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.
*
* For a Nine Slice Game Object this means it will be stretched (or shrunk) horizontally
* and vertically depending on the dimensions given to this method, in accordance with
* how it has been configured for the various corner sizes.
*
* If this is a 3-slice object, you can only stretch it horizontally
* and changing the height will be ignored.
*
* If you have enabled this Game Object for input, changing the size will also change the
* size of the hit area.
* @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 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.
*/
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.
*/
originY: 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;
/**
* This method is included but does nothing for the Nine Slice Game Object,
* because the size of the object isn't based on the texture frame.
*
* You should not call this method.
*/
setSizeToFrame(): this;
/**
* 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;
/**
* Gets the center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the top-left corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getTopLeft(output?: O, includeParent?: boolean): O;
/**
* Gets the top-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getTopCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the top-right corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getTopRight(output?: O, includeParent?: boolean): O;
/**
* Gets the left-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getLeftCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the right-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getRightCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the bottom-left corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getBottomLeft(output?: O, includeParent?: boolean): O;
/**
* Gets the bottom-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getBottomCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the bottom-right corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getBottomRight(output?: O, includeParent?: boolean): O;
/**
* Gets the bounds of this Game Object, regardless of origin.
*
* The values are stored and returned in a Rectangle, or Rectangle-like, object.
* @param output An object to store the values in. If not provided a new Rectangle will be created.
*/
getBounds(output?: O): O;
/**
* The Mask this Game Object is using during render.
*/
mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask;
/**
* Sets the mask that this Game Object will use to render with.
*
* The mask must have been previously created and can be either a GeometryMask or a BitmapMask.
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* If a mask is already set on this Game Object it will be immediately replaced.
*
* Masks are positioned in global space and are not relative to the Game Object to which they
* are applied. The reason for this is that multiple Game Objects can all share the same mask.
*
* Masks have no impact on physics or input detection. They are purely a rendering component
* that allows you to limit what is visible during the render pass.
* @param mask The mask this Game Object will use when rendering.
*/
setMask(mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask): this;
/**
* Clears the mask that this Game Object was using.
* @param destroyMask Destroy the mask before clearing it? Default false.
*/
clearMask(destroyMask?: boolean): this;
/**
* Creates and returns a Bitmap Mask. This mask can be used by any Game Object,
* including this one, or a Dynamic Texture.
*
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* To create the mask you need to pass in a reference to a renderable Game Object.
* A renderable Game Object is one that uses a texture to render with, such as an
* Image, Sprite, Render Texture or BitmapText.
*
* If you do not provide a renderable object, and this Game Object has a texture,
* it will use itself as the object. This means you can call this method to create
* a Bitmap Mask from any renderable texture-based Game Object.
* @param maskObject The Game Object or Dynamic 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.
*/
createBitmapMask(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 and returns a Geometry Mask. This mask can be used by any Game Object,
* including this one.
*
* To create the mask you need to pass in a reference to a Graphics Game Object.
*
* If you do not provide a graphics object, and this Game Object is an instance
* of a Graphics object, then it will use itself to create the mask.
*
* This means you can call this method to create a Geometry Mask from any Graphics Game Object.
* @param graphics A Graphics Game Object, or any kind of Shape Game Object. The geometry within it will be used as the mask.
*/
createGeometryMask(graphics?: Phaser.GameObjects.Graphics | Phaser.GameObjects.Shape): Phaser.Display.Masks.GeometryMask;
/**
* 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 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 initial WebGL pipeline of this Game Object.
*
* If you call `resetPipeline` on this Game Object, the pipeline is reset to this default.
*/
defaultPipeline: Phaser.Renderer.WebGL.WebGLPipeline;
/**
* The current WebGL pipeline of this Game Object.
*/
pipeline: Phaser.Renderer.WebGL.WebGLPipeline;
/**
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
*/
pipelineData: object;
/**
* Sets the initial WebGL Pipeline of this Game Object.
*
* This should only be called during the instantiation of the Game Object. After that, use `setPipeline`.
* @param pipeline Either the string-based name of the pipeline, or a pipeline instance to set.
*/
initPipeline(pipeline?: string | Phaser.Renderer.WebGL.WebGLPipeline): boolean;
/**
* Sets the main WebGL Pipeline of this Game Object.
*
* Also sets the `pipelineData` property, if the parameter is given.
* @param pipeline Either the string-based name of the pipeline, or a pipeline instance to set.
* @param pipelineData Optional pipeline data object that is set in to the `pipelineData` property of this Game Object.
* @param copyData Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead. Default true.
*/
setPipeline(pipeline: string | Phaser.Renderer.WebGL.WebGLPipeline, pipelineData?: object, copyData?: boolean): this;
/**
* Adds an entry to the `pipelineData` object belonging to this Game Object.
*
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
*
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
* @param key The key of the pipeline data to set, update, or delete.
* @param value The value to be set with the key. If `undefined` then `key` will be deleted from the object.
*/
setPipelineData(key: string, value?: any): this;
/**
* Resets the WebGL Pipeline of this Game Object back to the default it was created with.
* @param resetData Reset the `pipelineData` object to being an empty object? Default false.
*/
resetPipeline(resetData?: boolean): boolean;
/**
* Gets the name of the WebGL Pipeline this Game Object is currently using.
*/
getPipelineName(): string;
/**
* Does this Game Object have any Post Pipelines set?
*/
hasPostPipeline: boolean;
/**
* The WebGL Post FX Pipelines this Game Object uses for post-render effects.
*
* The pipelines are processed in the order in which they appear in this array.
*
* If you modify this array directly, be sure to set the
* `hasPostPipeline` property accordingly.
*/
postPipelines: Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
*/
postPipelineData: object;
/**
* The Pre FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.preFX.addBloom();
* ```
*
* Only the following Game Objects support Pre FX:
*
* * Image
* * Sprite
* * TileSprite
* * Text
* * RenderTexture
* * Video
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*/
preFX: Phaser.GameObjects.Components.FX | null;
/**
* The Post FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.postFX.addBloom();
* ```
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*
* This property is always `null` until the `initPostPipeline` method is called.
*/
postFX: Phaser.GameObjects.Components.FX;
/**
* This should only be called during the instantiation of the Game Object.
*
* It is called by default by all core Game Objects and doesn't need
* calling again.
*
* After that, use `setPostPipeline`.
* @param preFX Does this Game Object support Pre FX? Default false.
*/
initPostPipeline(preFX?: boolean): void;
/**
* Sets one, or more, Post Pipelines on this Game Object.
*
* Post Pipelines are invoked after this Game Object has rendered to its target and
* are commonly used for post-fx.
*
* The post pipelines are appended to the `postPipelines` array belonging to this
* Game Object. When the renderer processes this Game Object, it iterates through the post
* pipelines in the order in which they appear in the array. If you are stacking together
* multiple effects, be aware that the order is important.
*
* If you call this method multiple times, the new pipelines will be appended to any existing
* post pipelines already set. Use the `resetPostPipeline` method to clear them first, if required.
*
* You can optionally also set the `postPipelineData` property, if the parameter is given.
* @param pipelines Either the string-based name of the pipeline, or a pipeline instance, or class, or an array of them.
* @param pipelineData Optional pipeline data object that is set in to the `postPipelineData` property of this Game Object.
* @param copyData Should the pipeline data object be _deep copied_ into the `postPipelineData` property of this Game Object? If `false` it will be set by reference instead. Default true.
*/
setPostPipeline(pipelines: string | string[] | Function | Function[] | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[], pipelineData?: object, copyData?: boolean): this;
/**
* Adds an entry to the `postPipelineData` object belonging to this Game Object.
*
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
*
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
* @param key The key of the pipeline data to set, update, or delete.
* @param value The value to be set with the key. If `undefined` then `key` will be deleted from the object.
*/
setPostPipelineData(key: string, value?: any): this;
/**
* Gets a Post Pipeline instance from this Game Object, based on the given name, and returns it.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
getPostPipeline(pipeline: string | Function | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* Resets the WebGL Post Pipelines of this Game Object. It does this by calling
* the `destroy` method on each post pipeline and then clearing the local array.
* @param resetData Reset the `postPipelineData` object to being an empty object? Default false.
*/
resetPostPipeline(resetData?: boolean): void;
/**
* Removes a type of Post Pipeline instances from this Game Object, based on the given name, and destroys them.
*
* If you wish to remove all Post Pipelines use the `resetPostPipeline` method instead.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
removePostPipeline(pipeline: string | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): this;
/**
* Removes all Pre and Post FX Controllers from this Game Object.
*
* If you wish to remove a single controller, use the `preFX.remove(fx)` or `postFX.remove(fx)` methods instead.
*
* If you wish to clear a single controller, use the `preFX.clear()` or `postFX.clear()` methods instead.
*/
clearFX(): 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 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.
*
* Calling this method 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 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.
* @param updateSize Should this call adjust the size of the Game Object? Default true.
* @param updateOrigin Should this call change the origin of the Game Object? Default true.
*/
setTexture(key: string | Phaser.Textures.Texture, frame?: string | number, updateSize?: boolean, updateOrigin?: boolean): 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;
/**
* 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 Particles {
/**
* This class is responsible for taking control over the color property
* in the Particle class and managing its emission and updating functions.
*
* See the `ParticleEmitter` class for more details on emitter op configuration.
*/
class EmitterColorOp extends Phaser.GameObjects.Particles.EmitterOp {
/**
*
* @param key The name of the property.
*/
constructor(key: string);
/**
* An array containing the red color values.
*
* Populated during the `setMethods` method.
*/
r: number[];
/**
* An array containing the green color values.
*
* Populated during the `setMethods` method.
*/
g: number[];
/**
* An array containing the blue color values.
*
* Populated during the `setMethods` method.
*/
b: number[];
/**
* Checks the type of `EmitterOp.propertyValue` to determine which
* method is required in order to return values from this op function.
*/
getMethod(): number;
/**
* Sets the EmitterColorOp method values, if in use.
*/
setMethods(): this;
/**
* Sets the Ease function to use for Color interpolation.
* @param ease The string-based name of the Ease function to use.
*/
setEase(ease: string): void;
/**
* An `onEmit` callback for an eased property.
*
* It prepares the particle for easing by {@link Phaser.GameObjects.Particles.EmitterColorOp#easeValueUpdate}.
* @param particle The particle.
* @param key The name of the property.
*/
easedValueEmit(particle: Phaser.GameObjects.Particles.Particle, key: string): number;
/**
* An `onUpdate` callback that returns an eased value between the
* {@link Phaser.GameObjects.Particles.EmitterColorOp#start} and {@link Phaser.GameObjects.Particles.EmitterColorOp#end}
* range.
* @param particle The particle.
* @param key The name of the property.
* @param t The current normalized lifetime of the particle, between 0 (birth) and 1 (death).
*/
easeValueUpdate(particle: Phaser.GameObjects.Particles.Particle, key: string, t: number): number;
}
/**
* This class is responsible for taking control over a single property
* in the Particle class and managing its emission and updating functions.
*
* Particles properties such as `x`, `y`, `scaleX`, `lifespan` and others all use
* EmitterOp instances to manage them, as they can be given in a variety of
* formats: from simple values, to functions, to dynamic callbacks.
*
* See the `ParticleEmitter` class for more details on emitter op configuration.
*/
class EmitterOp {
/**
*
* @param key The name of the property.
* @param defaultValue The default value of the property.
* @param emitOnly Whether the property can only be modified when a Particle is emitted. Default false.
*/
constructor(key: string, defaultValue: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType, emitOnly?: boolean);
/**
* The name of this property.
*/
propertyKey: string;
/**
* The current value of this property.
*
* This can be a simple value, an array, a function or an onEmit
* configuration object.
*/
propertyValue: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType;
/**
* The default value of this property.
*
* This can be a simple value, an array, a function or an onEmit
* configuration object.
*/
defaultValue: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType;
/**
* The number of steps for stepped easing between {@link Phaser.GameObjects.Particles.EmitterOp#start} and
* {@link Phaser.GameObjects.Particles.EmitterOp#end} values, per emit.
*/
steps: number;
/**
* The step counter for stepped easing, per emit.
*/
counter: number;
/**
* When the step counter reaches it's maximum, should it then
* yoyo back to the start again, or flip over to it?
*/
yoyo: boolean;
/**
* The counter direction. 0 for up and 1 for down.
*/
direction: number;
/**
* The start value for this property to ease between.
*
* If an interpolation this holds a reference to the number data array.
*/
start: number | number[];
/**
* The most recently calculated value. Updated every time an
* emission or update method is called. Treat as read-only.
*/
current: number;
/**
* The end value for this property to ease between.
*/
end: number;
/**
* The easing function to use for updating this property, if any.
*/
ease: Function | null;
/**
* The interpolation function to use for updating this property, if any.
*/
interpolation: Function | null;
/**
* Whether this property can only be modified when a Particle is emitted.
*
* Set to `true` to allow only {@link Phaser.GameObjects.Particles.EmitterOp#onEmit} callbacks to be set and
* affect this property.
*
* Set to `false` to allow both {@link Phaser.GameObjects.Particles.EmitterOp#onEmit} and
* {@link Phaser.GameObjects.Particles.EmitterOp#onUpdate} callbacks to be set and affect this property.
*/
emitOnly: boolean;
/**
* The callback to run for Particles when they are emitted from the Particle Emitter.
*/
onEmit: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitCallback;
/**
* The callback to run for Particles when they are updated.
*/
onUpdate: Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateCallback;
/**
* Set to `false` to disable this EmitterOp.
*/
active: boolean;
/**
* The onEmit method type of this EmitterOp.
*
* Set as part of `setMethod` and cached here to avoid
* re-setting when only the value changes.
*/
method: number;
/**
* Load the property from a Particle Emitter configuration object.
*
* Optionally accepts a new property key to use, replacing the current one.
* @param config Settings for the Particle Emitter that owns this property.
* @param newKey The new key to use for this property, if any.
*/
loadConfig(config?: Phaser.Types.GameObjects.Particles.ParticleEmitterConfig, newKey?: string): void;
/**
* Build a JSON representation of this Particle Emitter property.
*/
toJSON(): object;
/**
* Change the current value of the property and update its callback methods.
* @param value The new numeric value of this property.
*/
onChange(value: number): this;
/**
* Checks the type of `EmitterOp.propertyValue` to determine which
* method is required in order to return values from this op function.
*/
getMethod(): number;
/**
* Update the {@link Phaser.GameObjects.Particles.EmitterOp#onEmit} and
* {@link Phaser.GameObjects.Particles.EmitterOp#onUpdate} callbacks based on the method returned
* from `getMethod`. The method is stored in the `EmitterOp.method` property
* and is a number between 0 and 9 inclusively.
*/
setMethods(): this;
/**
* Check whether an object has the given property.
* @param object The object to check.
* @param key The key of the property to look for in the object.
*/
has(object: object, key: string): boolean;
/**
* Check whether an object has both of the given properties.
* @param object The object to check.
* @param key1 The key of the first property to check the object for.
* @param key2 The key of the second property to check the object for.
*/
hasBoth(object: object, key1: string, key2: string): boolean;
/**
* Check whether an object has at least one of the given properties.
* @param object The object to check.
* @param key1 The key of the first property to check the object for.
* @param key2 The key of the second property to check the object for.
*/
hasEither(object: object, key1: string, key2: string): boolean;
/**
* The returned value sets what the property will be at the START of the particles life, on emit.
* @param particle The particle.
* @param key The name of the property.
* @param value The current value of the property.
*/
defaultEmit(particle: Phaser.GameObjects.Particles.Particle, key: string, value?: number): number;
/**
* The returned value updates the property for the duration of the particles life.
* @param particle The particle.
* @param key The name of the property.
* @param t The current normalized lifetime of the particle, between 0 (birth) and 1 (death).
* @param value The current value of the property.
*/
defaultUpdate(particle: Phaser.GameObjects.Particles.Particle, key: string, t: number, value: number): number;
/**
* The returned value sets what the property will be at the START of the particles life, on emit.
*
* This method is only used when you have provided a custom emit callback.
* @param particle The particle.
* @param key The name of the property.
* @param value The current value of the property.
*/
proxyEmit(particle: Phaser.GameObjects.Particles.Particle, key: string, value?: number): number;
/**
* The returned value updates the property for the duration of the particles life.
*
* This method is only used when you have provided a custom update callback.
* @param particle The particle.
* @param key The name of the property.
* @param t The current normalized lifetime of the particle, between 0 (birth) and 1 (death).
* @param value The current value of the property.
*/
proxyUpdate(particle: Phaser.GameObjects.Particles.Particle, key: string, t: number, value: number): number;
/**
* An `onEmit` callback that returns the current value of the property.
*/
staticValueEmit(): number;
/**
* An `onUpdate` callback that returns the current value of the property.
*/
staticValueUpdate(): number;
/**
* An `onEmit` callback that returns a random value from the current value array.
*/
randomStaticValueEmit(): number;
/**
* An `onEmit` callback that returns a value between the {@link Phaser.GameObjects.Particles.EmitterOp#start} and
* {@link Phaser.GameObjects.Particles.EmitterOp#end} range.
* @param particle The particle.
* @param key The key of the property.
*/
randomRangedValueEmit(particle: Phaser.GameObjects.Particles.Particle, key: string): number;
/**
* An `onEmit` callback that returns a value between the {@link Phaser.GameObjects.Particles.EmitterOp#start} and
* {@link Phaser.GameObjects.Particles.EmitterOp#end} range.
* @param particle The particle.
* @param key The key of the property.
*/
randomRangedIntEmit(particle: Phaser.GameObjects.Particles.Particle, key: string): number;
/**
* An `onEmit` callback that returns a stepped value between the
* {@link Phaser.GameObjects.Particles.EmitterOp#start} and {@link Phaser.GameObjects.Particles.EmitterOp#end}
* range.
*/
steppedEmit(): number;
/**
* An `onEmit` callback for an eased property.
*
* It prepares the particle for easing by {@link Phaser.GameObjects.Particles.EmitterOp#easeValueUpdate}.
* @param particle The particle.
* @param key The name of the property.
*/
easedValueEmit(particle: Phaser.GameObjects.Particles.Particle, key: string): number;
/**
* An `onUpdate` callback that returns an eased value between the
* {@link Phaser.GameObjects.Particles.EmitterOp#start} and {@link Phaser.GameObjects.Particles.EmitterOp#end}
* range.
* @param particle The particle.
* @param key The name of the property.
* @param t The current normalized lifetime of the particle, between 0 (birth) and 1 (death).
*/
easeValueUpdate(particle: Phaser.GameObjects.Particles.Particle, key: string, t: number): number;
/**
* Destroys this EmitterOp instance and all of its references.
*
* Called automatically when the ParticleEmitter that owns this
* EmitterOp is destroyed.
*/
destroy(): void;
}
namespace Events {
/**
* The Particle Emitter Complete Event.
*
* This event is dispatched when the final particle, emitted from a Particle Emitter that
* has been stopped, dies. Upon receipt of this event you know that no particles are
* still rendering at this point in time.
*
* Listen for it on a Particle Emitter instance using `ParticleEmitter.on('complete', listener)`.
*/
const COMPLETE: string;
/**
* The Particle Emitter Death Zone Event.
*
* This event is dispatched when a Death Zone kills a Particle instance.
*
* Listen for it on a Particle Emitter instance using `ParticleEmitter.on('deathzone', listener)`.
*
* If you wish to know when the final particle is killed, see the `COMPLETE` event.
*/
const DEATH_ZONE: string;
/**
* The Particle Emitter Explode Event.
*
* This event is dispatched when a Particle Emitter explodes a set of particles.
*
* Listen for it on a Particle Emitter instance using `ParticleEmitter.on('explode', listener)`.
*/
const EXPLODE: string;
/**
* The Particle Emitter Start Event.
*
* This event is dispatched when a Particle Emitter starts emission of particles.
*
* Listen for it on a Particle Emitter instance using `ParticleEmitter.on('start', listener)`.
*/
const START: string;
/**
* The Particle Emitter Stop Event.
*
* This event is dispatched when a Particle Emitter is stopped. This can happen either
* when you directly call the `ParticleEmitter.stop` method, or if the emitter has
* been configured to stop after a set time via the `duration` property, or after a
* set number of particles via the `stopAfter` property.
*
* Listen for it on a Particle Emitter instance using `ParticleEmitter.on('stop', listener)`.
*
* Note that just because the emitter has stopped, that doesn't mean there aren't still
* particles alive and rendering. It just means the emitter has stopped emitting particles.
*
* If you wish to know when the final particle is killed, see the `COMPLETE` event.
*/
const STOP: string;
}
/**
* The Gravity Well Particle Processor applies a force on the particles to draw
* them towards, or repel them from, a single point.
*
* The force applied is inversely proportional to the square of the distance
* from the particle to the point, in accordance with Newton's law of gravity.
*
* This simulates the effect of gravity over large distances (as between planets, for example).
*/
class GravityWell extends Phaser.GameObjects.Particles.ParticleProcessor {
/**
*
* @param x The x coordinate of the Gravity Well, in world space. Default 0.
* @param y The y coordinate of the Gravity Well, in world space. Default 0.
* @param power The strength of the gravity force - larger numbers produce a stronger force. Default 0.
* @param epsilon The minimum distance for which the gravity force is calculated. Default 100.
* @param gravity The gravitational force of this Gravity Well. Default 50.
*/
constructor(x?: number | Phaser.Types.GameObjects.Particles.GravityWellConfig, y?: number, power?: number, epsilon?: number, gravity?: number);
/**
* Takes a Particle and updates it based on the properties of this Gravity Well.
* @param particle The Particle to update.
* @param delta The delta time in ms.
* @param step The delta value divided by 1000.
*/
update(particle: Phaser.GameObjects.Particles.Particle, delta: number, step: number): void;
/**
* The minimum distance for which the gravity force is calculated.
*
* Defaults to 100.
*/
epsilon: number;
/**
* The strength of the gravity force - larger numbers produce a stronger force.
*
* Defaults to 0.
*/
power: number;
/**
* The gravitational force of this Gravity Well.
*
* Defaults to 50.
*/
gravity: number;
}
/**
* A Particle is a simple object owned and controlled by a Particle Emitter.
*
* It encapsulates all of the properties required to move and update according
* to the Emitters operations.
*/
class Particle {
/**
*
* @param emitter The Emitter to which this Particle belongs.
*/
constructor(emitter: Phaser.GameObjects.Particles.ParticleEmitter);
/**
* The Emitter to which this Particle belongs.
*
* A Particle can only belong to a single Emitter and is created, updated and destroyed by it.
*/
emitter: Phaser.GameObjects.Particles.ParticleEmitter;
/**
* The texture used by this Particle when it renders.
*/
texture: Phaser.Textures.Texture;
/**
* The texture frame used by this Particle when it renders.
*/
frame: Phaser.Textures.Frame;
/**
* The x coordinate of this Particle.
*/
x: number;
/**
* The y coordinate of this Particle.
*/
y: number;
/**
* The coordinates of this Particle in world space.
*
* Updated as part of `computeVelocity`.
*/
worldPosition: Phaser.Math.Vector2;
/**
* The x velocity of this Particle.
*/
velocityX: number;
/**
* The y velocity of this Particle.
*/
velocityY: number;
/**
* The x acceleration of this Particle.
*/
accelerationX: number;
/**
* The y acceleration of this Particle.
*/
accelerationY: number;
/**
* The maximum horizontal velocity this Particle can travel at.
*/
maxVelocityX: number;
/**
* The maximum vertical velocity this Particle can travel at.
*/
maxVelocityY: number;
/**
* The bounciness, or restitution, of this Particle.
*/
bounce: number;
/**
* The horizontal scale of this Particle.
*/
scaleX: number;
/**
* The vertical scale of this Particle.
*/
scaleY: number;
/**
* The alpha value of this Particle.
*/
alpha: number;
/**
* The angle of this Particle in degrees.
*/
angle: number;
/**
* The angle of this Particle in radians.
*/
rotation: number;
/**
* The tint applied to this Particle.
*/
tint: number;
/**
* The lifespan of this Particle in ms.
*/
life: number;
/**
* The current life of this Particle in ms.
*/
lifeCurrent: number;
/**
* The delay applied to this Particle upon emission, in ms.
*/
delayCurrent: number;
/**
* The hold applied to this Particle before it expires, in ms.
*/
holdCurrent: number;
/**
* The normalized lifespan T value, where 0 is the start and 1 is the end.
*/
lifeT: number;
/**
* The data used by the ease equation.
*/
data: Phaser.Types.GameObjects.Particles.ParticleData;
/**
* 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;
/**
* The Animation State component of this Particle.
*
* This component provides features to apply animations to this Particle.
* It is responsible for playing, loading, queuing animations for later playback,
* mixing between animations and setting the current animation frame to this Particle.
*/
anims: Phaser.Animations.AnimationState;
/**
* A rectangle that holds the bounds of this Particle after a call to
* the `Particle.getBounds` method has been made.
*/
bounds: Phaser.Geom.Rectangle;
/**
* The Event Emitter proxy.
*
* Passes on all parameters to the `ParticleEmitter` to emit directly.
* @param event The event name.
* @param a1 Optional argument 1.
* @param a2 Optional argument 2.
* @param a3 Optional argument 3.
* @param a4 Optional argument 4.
* @param a5 Optional argument 5.
*/
emit(event: string | Symbol, a1?: any, a2?: any, a3?: any, a4?: any, a5?: any): boolean;
/**
* Checks to see if this Particle is alive and updating.
*/
isAlive(): boolean;
/**
* Kills this particle. This sets the `lifeCurrent` value to 0, which forces
* the Particle to be removed the next time its parent Emitter runs an update.
*/
kill(): void;
/**
* Sets the position of this particle to the given x/y coordinates.
*
* If the parameters are left undefined, it resets the particle back to 0x0.
* @param x The x coordinate to set this Particle to. Default 0.
* @param y The y coordinate to set this Particle to. Default 0.
*/
setPosition(x?: number, y?: number): void;
/**
* Starts this Particle from the given coordinates.
* @param x The x coordinate to launch this Particle from.
* @param y The y coordinate to launch this Particle from.
*/
fire(x?: number, y?: number): boolean;
/**
* The main update method for this Particle.
*
* Updates its life values, computes the velocity and repositions the Particle.
* @param delta The delta time in ms.
* @param step The delta value divided by 1000.
* @param processors An array of all active Particle Processors.
*/
update(delta: number, step: number, processors: Phaser.GameObjects.Particles.ParticleProcessor[]): boolean;
/**
* An internal method that calculates the velocity of the Particle and
* its world position. It also runs it against any active Processors
* that are set on the Emitter.
* @param emitter The Emitter that is updating this Particle.
* @param delta The delta time in ms.
* @param step The delta value divided by 1000.
* @param processors An array of all active Particle Processors.
* @param t The current normalized lifetime of the particle, between 0 (birth) and 1 (death).
*/
computeVelocity(emitter: Phaser.GameObjects.Particles.ParticleEmitter, delta: number, step: number, processors: Phaser.GameObjects.Particles.ParticleProcessor[], t: number): void;
/**
* This is a NOOP method and does nothing when called.
*/
setSizeToFrame(): void;
/**
* Gets the bounds of this particle as a Geometry Rectangle, factoring in any
* transforms of the parent emitter and anything else above it in the display list.
*
* Once calculated the bounds can be accessed via the `Particle.bounds` property.
* @param matrix Optional transform matrix to apply to this particle.
*/
getBounds(matrix?: Phaser.GameObjects.Components.TransformMatrix): Phaser.Geom.Rectangle;
/**
* Destroys this Particle.
*/
destroy(): void;
}
/**
* The Particle Bounds Processor.
*
* Defines a rectangular region, in world space, within which particle movement
* is restrained.
*
* Use the properties `collideLeft`, `collideRight`, `collideTop` and
* `collideBottom` to control if a particle will rebound off the sides
* of this boundary, or not.
*
* This happens when the particles worldPosition x/y coordinate hits the boundary.
*
* The strength of the rebound is determined by the `Particle.bounce` property.
*/
class ParticleBounds extends Phaser.GameObjects.Particles.ParticleProcessor {
/**
*
* @param x The x position (top-left) of the bounds, in world space.
* @param y The y position (top-left) of the bounds, in world space.
* @param width The width of the bounds.
* @param height The height of the bounds.
* @param collideLeft Whether particles interact with the left edge of the bounds. Default true.
* @param collideRight Whether particles interact with the right edge of the bounds. Default true.
* @param collideTop Whether particles interact with the top edge of the bounds. Default true.
* @param collideBottom Whether particles interact with the bottom edge of the bounds. Default true.
*/
constructor(x: number, y: number, width: number, height: number, collideLeft?: boolean, collideRight?: boolean, collideTop?: boolean, collideBottom?: boolean);
/**
* A rectangular boundary constraining particle movement. Use the Emitter properties `collideLeft`,
* `collideRight`, `collideTop` and `collideBottom` to control if a particle will rebound off
* the sides of this boundary, or not. This happens when the particles x/y coordinate hits
* the boundary.
*/
bounds: Phaser.Geom.Rectangle;
/**
* Whether particles interact with the left edge of the emitter {@link Phaser.GameObjects.Particles.ParticleEmitter#bounds}.
*/
collideLeft: boolean;
/**
* Whether particles interact with the right edge of the emitter {@link Phaser.GameObjects.Particles.ParticleBounds#bounds}.
*/
collideRight: boolean;
/**
* Whether particles interact with the top edge of the emitter {@link Phaser.GameObjects.Particles.ParticleBounds#bounds}.
*/
collideTop: boolean;
/**
* Whether particles interact with the bottom edge of the emitter {@link Phaser.GameObjects.Particles.ParticleBounds#bounds}.
*/
collideBottom: boolean;
/**
* Takes a Particle and updates it against the bounds.
* @param particle The Particle to update.
*/
update(particle: Phaser.GameObjects.Particles.Particle): void;
}
/**
* A Particle Emitter is a special kind of Game Object that controls a pool of {@link Phaser.GameObjects.Particles.Particle Particles}.
*
* Particle Emitters are created via a configuration object. The properties of this object
* can be specified in a variety of formats, given you plenty of scope over the values they
* return, leading to complex visual effects. Here are the different forms of configuration
* value you can give:
*
* ## An explicit static value:
*
* ```js
* x: 400
* ```
*
* The x value will always be 400 when the particle is spawned.
*
* ## A random value:
*
* ```js
* x: [ 100, 200, 300, 400 ]
* ```
*
* The x value will be one of the 4 elements in the given array, picked at random on emission.
*
* ## A custom callback:
*
* ```js
* x: (particle, key, t, value) => {
* return value + 50;
* }
* ```
*
* The x value is the result of calling this function. This is only used when the
* particle is emitted, so it provides it's initial starting value. It is not used
* when the particle is updated (see the onUpdate callback for that)
*
* ## A start / end object:
*
* This allows you to control the change in value between the given start and
* end parameters over the course of the particles lifetime:
*
* ```js
* scale: { start: 0, end: 1 }
* ```
*
* The particle scale will start at 0 when emitted and ease to a scale of 1
* over the course of its lifetime. You can also specify the ease function
* used for this change (the default is Linear):
*
* ```js
* scale: { start: 0, end: 1, ease: 'bounce.out' }
* ```
*
* ## A start / end random object:
*
* The start and end object can have an optional `random` parameter.
* This forces it to pick a random value between the two values and use
* this as the starting value, then easing to the 'end' parameter over
* its lifetime.
*
* ```js
* scale: { start: 4, end: 0.5, random: true }
* ```
*
* The particle will start with a random scale between 0.5 and 4 and then
* scale to the end value over its lifetime. You can combine the above
* with the `ease` parameter as well to control the value easing.
*
* ## An interpolation object:
*
* You can provide an array of values which will be used for interpolation
* during the particles lifetime. You can also define the interpolation
* function to be used. There are three provided: `linear` (the default),
* `bezier` and `catmull`, or you can provide your own function.
*
* ```js
* x: { values: [ 50, 500, 200, 800 ], interpolation: 'catmull' }
* ```
*
* The particle scale will interpolate from 50 when emitted to 800 via the other
* points over the course of its lifetime. You can also specify an ease function
* used to control the rate of change through the values (the default is Linear):
*
* ```js
* x: { values: [ 50, 500, 200, 800 ], interpolation: 'catmull', ease: 'bounce.out }
* ```
*
* ## A stepped emitter object:
*
* The `steps` parameter allows you to control the placement of sequential
* particles across the start-end range:
*
* ```js
* x: { steps: 32, start: 0, end: 576 }
* ```
*
* Here we have a range of 576 (start to end). This is divided into 32 steps.
*
* The first particle will emit at the x position of 0. The next will emit
* at the next 'step' along, which would be 18. The following particle will emit
* at the next step, which is 36, and so on. Because the range of 576 has been
* divided by 32, creating 18 pixels steps. When a particle reaches the 'end'
* value the next one will start from the beginning again.
*
* ## A stepped emitter object with yoyo:
*
* You can add the optional `yoyo` property to a stepped object:
*
* ```js
* x: { steps: 32, start: 0, end: 576, yoyo: true }
* ```
*
* As with the stepped emitter, particles are emitted in sequence, from 'start'
* to 'end' in step sized jumps. Normally, when a stepped emitter reaches the
* end it snaps around to the start value again. However, if you provide the 'yoyo'
* parameter then when it reaches the end it will reverse direction and start
* emitting back down to 'start' again. Depending on the effect you require this
* can often look better.
*
* ## A min / max object:
*
* This allows you to pick a random float value between the min and max properties:
*
* ```js
* x: { min: 100, max: 700 }
* ```
*
* The x value will be a random float between min and max.
*
* You can force it select an integer by setting the 'int' flag:
*
* ```js
* x: { min: 100, max: 700, int: true }
* ```
*
* Or, you could use the 'random' array approach (see below)
*
* ## A random object:
*
* This allows you to pick a random integer value between the first and second array elements:
*
* ```js
* x: { random: [ 100, 700 ] }
* ```
*
* The x value will be a random integer between 100 and 700 as it takes the first
* element in the 'random' array as the 'min' value and the 2nd element as the 'max' value.
*
* ## Custom onEmit and onUpdate callbacks:
*
* If the above won't give you the effect you're after, you can provide your own
* callbacks that will be used when the particle is both emitted and updated:
*
* ```js
* x: {
* onEmit: (particle, key, t, value) => {
* return value;
* },
* onUpdate: (particle, key, t, value) => {
* return value;
* }
* }
* ```
*
* You can provide either one or both functions. The `onEmit` is called at the
* start of the particles life and defines the value of the property on birth.
*
* The `onUpdate` function is called every time the Particle Emitter updates
* until the particle dies. Both must return a value.
*
* The properties are:
*
* particle - A reference to the Particle instance.
* key - The string based key of the property, i.e. 'x' or 'lifespan'.
* t - The current normalized lifetime of the particle, between 0 (birth) and 1 (death).
* value - The current property value. At a minimum you should return this.
*
* By using the above configuration options you have an unlimited about of
* control over how your particles behave.
*
* ## v3.55 Differences
*
* Prior to v3.60 Phaser used a `ParticleEmitterManager`. This was removed in v3.60
* and now calling `this.add.particles` returns a `ParticleEmitter` instance instead.
*
* In order to streamline memory and the display list we have removed the
* `ParticleEmitterManager` entirely. When you call `this.add.particles` you're now
* creating a `ParticleEmitter` instance, which is being added directly to the
* display list and can be manipulated just like any other Game Object, i.e.
* scaled, rotated, positioned, added to a Container, etc. It now extends the
* `GameObject` base class, meaning it's also an event emitter, which allowed us
* to create some handy new events for particles.
*
* So, to create an emitter, you now give it an xy coordinate, a texture and an
* emitter configuration object (you can also set this later, but most commonly
* you'd do it on creation). I.e.:
*
* ```js
* const emitter = this.add.particles(100, 300, 'flares', {
* frame: 'red',
* angle: { min: -30, max: 30 },
* speed: 150
* });
* ```
*
* This will create a 'red flare' emitter at 100 x 300.
*
* Please update your code to ensure it adheres to the new function signatures.
*/
class ParticleEmitter extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.AlphaSingle, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Mask, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.PostPipeline, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Texture, 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.
* @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 Settings for this emitter.
*/
constructor(scene: Phaser.Scene, x?: number, y?: number, texture?: string | Phaser.Textures.Texture, config?: Phaser.Types.GameObjects.Particles.ParticleEmitterConfig);
/**
* The Particle Class which will be emitted by this Emitter.
*/
particleClass: Function;
/**
* An internal object holding all of the EmitterOp instances.
*
* These are populated as part of the Emitter configuration parsing.
*
* You typically do not access them directly, but instead use the
* provided getters and setters on this class, such as `ParticleEmitter.speedX` etc.
*/
ops: Phaser.Types.GameObjects.Particles.ParticleEmitterOps;
/**
* A radial emitter will emit particles in all directions between angle min and max,
* using {@link Phaser.GameObjects.Particles.ParticleEmitter#speed} as the value. If set to false then this acts as a point Emitter.
* A point emitter will emit particles only in the direction derived from the speedX and speedY values.
*/
radial: boolean;
/**
* Horizontal acceleration applied to emitted particles, in pixels per second squared.
*/
gravityX: number;
/**
* Vertical acceleration applied to emitted particles, in pixels per second squared.
*/
gravityY: number;
/**
* Whether accelerationX and accelerationY are non-zero. Set automatically during configuration.
*/
acceleration: boolean;
/**
* Whether moveToX and moveToY are set. Set automatically during configuration.
*
* When true the particles move toward the moveToX and moveToY coordinates and arrive at the end of their life.
* Emitter angle, speedX, and speedY are ignored.
*/
moveTo: boolean;
/**
* A function to call when a particle is emitted.
*/
emitCallback: Phaser.Types.GameObjects.Particles.ParticleEmitterCallback | null;
/**
* The calling context for {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallback}.
*/
emitCallbackScope: any | null;
/**
* A function to call when a particle dies.
*/
deathCallback: Phaser.Types.GameObjects.Particles.ParticleDeathCallback | null;
/**
* The calling context for {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallback}.
*/
deathCallbackScope: any | null;
/**
* Set to hard limit the amount of particle objects this emitter is allowed to create
* in total. This is the number of `Particle` instances it can create, not the number
* of 'alive' particles.
*
* 0 means unlimited.
*/
maxParticles: number;
/**
* The maximum number of alive and rendering particles this emitter will update.
* When this limit is reached, a particle needs to die before another can be emitted.
*
* 0 means no limits.
*/
maxAliveParticles: number;
/**
* If set, either via the Emitter config, or by directly setting this property,
* the Particle Emitter will stop emitting particles once this total has been
* reached. It will then enter a 'stopped' state, firing the `STOP`
* event. Note that entering a stopped state doesn't mean all the particles
* have finished, just that it's not emitting any further ones.
*
* To know when the final particle expires, listen for the COMPLETE event.
*
* Use this if you wish to launch an exact number of particles and then stop
* your emitter afterwards.
*
* The counter is reset each time the `ParticleEmitter.start` method is called.
*
* 0 means the emitter will not stop based on total emitted particles.
*/
stopAfter: number;
/**
* The number of milliseconds this emitter will emit particles for when in flow mode,
* before it stops emission. A value of 0 (the default) means there is no duration.
*
* When the duration expires the `STOP` event is emitted. Note that entering a
* stopped state doesn't mean all the particles have finished, just that it's
* not emitting any further ones.
*
* To know when the final particle expires, listen for the COMPLETE event.
*
* The counter is reset each time the `ParticleEmitter.start` method is called.
*
* 0 means the emitter will not stop based on duration.
*/
duration: number;
/**
* For a flow emitter, the time interval (>= 0) between particle flow cycles in ms.
* A value of 0 means there is one particle flow cycle for each logic update (the maximum flow frequency). This is the default setting.
* For an exploding emitter, this value will be -1.
* Calling {@link Phaser.GameObjects.Particles.ParticleEmitter#flow} also puts the emitter in flow mode (frequency >= 0).
* Calling {@link Phaser.GameObjects.Particles.ParticleEmitter#explode} also puts the emitter in explode mode (frequency = -1).
*/
frequency: number;
/**
* Controls if the emitter is currently emitting a particle flow (when frequency >= 0).
*
* Already alive particles will continue to update until they expire.
*
* Controlled by {@link Phaser.GameObjects.Particles.ParticleEmitter#start} and {@link Phaser.GameObjects.Particles.ParticleEmitter#stop}.
*/
emitting: boolean;
/**
* Newly emitted particles are added to the top of the particle list, i.e. rendered above those already alive.
*
* Set to false to send them to the back.
*
* Also see the `sortOrder` property for more complex particle sorting.
*/
particleBringToTop: boolean;
/**
* The time rate applied to active particles, affecting lifespan, movement, and tweens. Values larger than 1 are faster than normal.
*/
timeScale: number;
/**
* An array containing Particle Emission Zones. These can be either EdgeZones or RandomZones.
*
* Particles are emitted from a randomly selected zone from this array.
*
* Prior to Phaser v3.60 an Emitter could only have one single Emission Zone.
* In 3.60 they can now have an array of Emission Zones.
*/
emitZones: Phaser.Types.GameObjects.Particles.EmitZoneObject[];
/**
* An array containing Particle Death Zone objects. A particle is immediately killed as soon as its x/y coordinates
* intersect with any of the configured Death Zones.
*
* Prior to Phaser v3.60 an Emitter could only have one single Death Zone.
* In 3.60 they can now have an array of Death Zones.
*/
deathZones: Phaser.GameObjects.Particles.Zones.DeathZone[];
/**
* An optional Rectangle object that is used during rendering to cull Particles from
* display. For example, if your particles are limited to only move within a 300x300
* sized area from their origin, then you can set this Rectangle to those dimensions.
*
* The renderer will check to see if the `viewBounds` Rectangle intersects with the
* Camera bounds during the render step and if not it will skip rendering the Emitter
* entirely.
*
* This allows you to create many emitters in a Scene without the cost of
* rendering if the contents aren't visible.
*
* Note that the Emitter will not perform any checks to see if the Particles themselves
* are outside of these bounds, or not. It will simply check the bounds against the
* camera. Use the `getBounds` method with the `advance` parameter to help define
* the location and placement of the view bounds.
*/
viewBounds: Phaser.Geom.Rectangle | null;
/**
* A Game Object whose position is used as the particle origin.
*/
follow: Phaser.Types.Math.Vector2Like | null;
/**
* The offset of the particle origin from the {@link Phaser.GameObjects.Particles.ParticleEmitter#follow} target.
*/
followOffset: Phaser.Math.Vector2;
/**
* Whether the emitter's {@link Phaser.GameObjects.Particles.ParticleEmitter#visible} state will track
* the {@link Phaser.GameObjects.Particles.ParticleEmitter#follow} target's visibility state.
*/
trackVisible: boolean;
/**
* The texture frames assigned to particles.
*/
frames: Phaser.Textures.Frame[];
/**
* Whether texture {@link Phaser.GameObjects.Particles.ParticleEmitter#frames} are selected at random.
*/
randomFrame: boolean;
/**
* The number of consecutive particles that receive a single texture frame (per frame cycle).
*/
frameQuantity: number;
/**
* The animations assigned to particles.
*/
anims: string[];
/**
* Whether animations {@link Phaser.GameObjects.Particles.ParticleEmitter#anims} are selected at random.
*/
randomAnim: boolean;
/**
* The number of consecutive particles that receive a single animation (per frame cycle).
*/
animQuantity: number;
/**
* An internal property used to tell when the emitter is in fast-forwarc mode.
*/
skipping: boolean;
/**
* An internal Transform Matrix used to cache this emitters world matrix.
*/
worldMatrix: Phaser.GameObjects.Components.TransformMatrix;
/**
* Optionally sort the particles before they render based on this
* property. The property must exist on the `Particle` class, such
* as `y`, `lifeT`, `scaleX`, etc.
*
* When set this overrides the `particleBringToTop` setting.
*
* To reset this and disable sorting, so this property to an empty string.
*/
sortProperty: string;
/**
* When `sortProperty` is defined this controls the sorting order,
* either ascending or descending. Toggle to control the visual effect.
*/
sortOrderAsc: boolean;
/**
* The callback used to sort the particles. Only used if `sortProperty`
* has been set. Set this via the `setSortCallback` method.
*/
sortCallback: Phaser.Types.GameObjects.Particles.ParticleSortCallback | null;
/**
* A list of Particle Processors being managed by this Emitter.
*/
processors: Phaser.Structs.List;
/**
* The tint fill mode used by the Particles in this Emitter.
*
* `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;
/**
* Takes an Emitter Configuration file and resets this Emitter, using any
* properties defined in the config to then set it up again.
* @param config Settings for this emitter.
*/
setConfig(config: Phaser.Types.GameObjects.Particles.ParticleEmitterConfig): this;
/**
* Creates a description of this emitter suitable for JSON serialization.
*/
toJSON(): Phaser.Types.GameObjects.JSONGameObject;
/**
* Resets the internal counter trackers.
*
* You shouldn't ever need to call this directly.
* @param frequency The frequency counter.
* @param on Set the complete flag.
*/
resetCounters(frequency: number, on: boolean): void;
/**
* Continuously moves the particle origin to follow a Game Object's position.
* @param target The Object to follow.
* @param offsetX Horizontal offset of the particle origin from the Game Object. Default 0.
* @param offsetY Vertical offset of the particle origin from the Game Object. Default 0.
* @param trackVisible Whether the emitter's visible state will track the target's visible state. Default false.
*/
startFollow(target: Phaser.Types.Math.Vector2Like, offsetX?: number, offsetY?: number, trackVisible?: boolean): this;
/**
* Stops following a Game Object.
*/
stopFollow(): this;
/**
* Chooses a texture frame from {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}.
*/
getFrame(): Phaser.Textures.Frame;
/**
* Sets a pattern for assigning texture frames to emitted particles. The `frames` configuration can be any of:
*
* frame: 0
* frame: 'red'
* frame: [ 0, 1, 2, 3 ]
* frame: [ 'red', 'green', 'blue', 'pink', 'white' ]
* frame: { frames: [ 'red', 'green', 'blue', 'pink', 'white' ], [cycle: bool], [quantity: int] }
* @param frames One or more texture frames, or a configuration object.
* @param pickRandom Whether frames should be assigned at random from `frames`. Default true.
* @param quantity The number of consecutive particles that will receive each frame. Default 1.
*/
setEmitterFrame(frames: any[] | string | number | Phaser.Types.GameObjects.Particles.ParticleEmitterFrameConfig, pickRandom?: boolean, quantity?: number): this;
/**
* Chooses an animation from {@link Phaser.GameObjects.Particles.ParticleEmitter#anims}, if populated.
*/
getAnim(): string;
/**
* Sets a pattern for assigning animations to emitted particles. The `anims` configuration can be any of:
*
* anim: 'red'
* anim: [ 'red', 'green', 'blue', 'pink', 'white' ]
* anim: { anims: [ 'red', 'green', 'blue', 'pink', 'white' ], [cycle: bool], [quantity: int] }
* @param anims One or more animations, or a configuration object.
* @param pickRandom Whether animations should be assigned at random from `anims`. If a config object is given, this parameter is ignored. Default true.
* @param quantity The number of consecutive particles that will receive each animation. If a config object is given, this parameter is ignored. Default 1.
*/
setAnim(anims: string | string[] | Phaser.Types.GameObjects.Particles.ParticleEmitterAnimConfig, pickRandom?: boolean, quantity?: number): this;
/**
* Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#radial} particle movement on or off.
* @param value Radial mode (true) or point mode (true). Default true.
*/
setRadial(value?: boolean): this;
/**
* Creates a Particle Bounds processor and adds it to this Emitter.
*
* This processor will check to see if any of the active Particles hit
* the defined boundary, as specified by a Rectangle shape in world-space.
*
* If so, they are 'rebounded' back again by having their velocity adjusted.
*
* The strength of the rebound is controlled by the `Particle.bounce`
* property.
*
* You should be careful to ensure that you emit particles within a bounds,
* if set, otherwise it will lead to unpredictable visual results as the
* particles are hastily repositioned.
*
* The Particle Bounds processor is returned from this method. If you wish
* to modify the area you can directly change its `bounds` property, along
* with the `collideLeft` etc values.
*
* To disable the bounds you can either set its `active` property to `false`,
* or if you no longer require it, call `ParticleEmitter.removeParticleProcessor`.
* @param x The x-coordinate of the left edge of the boundary, or an object representing a rectangle.
* @param y The y-coordinate of the top edge of the boundary.
* @param width The width of the boundary.
* @param height The height of the boundary.
* @param collideLeft Whether particles interact with the left edge of the bounds. Default true.
* @param collideRight Whether particles interact with the right edge of the bounds. Default true.
* @param collideTop Whether particles interact with the top edge of the bounds. Default true.
* @param collideBottom Whether particles interact with the bottom edge of the bounds. Default true.
*/
addParticleBounds(x: number | Phaser.Types.GameObjects.Particles.ParticleEmitterBounds | Phaser.Types.GameObjects.Particles.ParticleEmitterBoundsAlt, y?: number, width?: number, height?: number, collideLeft?: boolean, collideRight?: boolean, collideTop?: boolean, collideBottom?: boolean): Phaser.GameObjects.Particles.ParticleBounds;
/**
* Sets the initial radial speed of emitted particles.
*
* Changes the emitter to radial mode.
* @param x The horizontal speed of the emitted Particles.
* @param y The vertical speed of emitted Particles. If not set it will use the `x` value. Default x.
*/
setParticleSpeed(x: number, y?: number): this;
/**
* Sets the vertical and horizontal scale of the emitted particles.
*
* You can also set the scale of the entire emitter via `setScale`.
* @param x The horizontal scale of the emitted Particles. Default 1.
* @param y The vertical scale of emitted Particles. If not set it will use the `x` value. Default x.
*/
setParticleScale(x?: number, y?: number): this;
/**
* Sets the gravity applied to emitted particles.
* @param x Horizontal acceleration due to gravity, in pixels per second squared. Set to zero for no gravity.
* @param y Vertical acceleration due to gravity, in pixels per second squared. Set to zero for no gravity.
*/
setParticleGravity(x: number, y: number): this;
/**
* Sets the opacity (alpha) of emitted particles.
*
* You can also set the alpha of the entire emitter via `setAlpha`.
* @param value A value between 0 (transparent) and 1 (opaque).
*/
setParticleAlpha(value: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType): this;
/**
* Sets the color tint of emitted particles.
*
* This is a WebGL only feature.
* @param value A value between 0 and 0xffffff.
*/
setParticleTint(value: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType): this;
/**
* Sets the angle of a {@link Phaser.GameObjects.Particles.ParticleEmitter#radial} particle stream.
*
* The value is given in degrees using Phaser's right-handed coordinate system.
* @param value The angle of the initial velocity of emitted particles, in degrees.
*/
setEmitterAngle(value: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType): this;
/**
* Sets the lifespan of newly emitted particles in milliseconds.
* @param value The lifespan of a particle, in ms.
*/
setParticleLifespan(value: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType): this;
/**
* Sets the number of particles released at each flow cycle or explosion.
* @param quantity The number of particles to release at each flow cycle or explosion.
*/
setQuantity(quantity: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType): this;
/**
* Sets the emitter's {@link Phaser.GameObjects.Particles.ParticleEmitter#frequency}
* and {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}.
* @param frequency The time interval (>= 0) of each flow cycle, in ms; or -1 to put the emitter in explosion mode.
* @param quantity The number of particles to release at each flow cycle or explosion.
*/
setFrequency(frequency: number, quantity?: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType): this;
/**
* Adds a new Particle Death Zone to this Emitter.
*
* A particle is immediately killed as soon as its x/y coordinates intersect
* with any of the configured Death Zones.
*
* The `source` can be a Geometry Shape, such as a Circle, Rectangle or Triangle.
* Any valid object from the `Phaser.Geometry` namespace is allowed, as long as
* it supports a `contains` function. You can set the `type` to be either `onEnter`
* or `onLeave`.
*
* A single Death Zone instance can only exist once within this Emitter, but can belong
* to multiple Emitters.
* @param config A Death Zone configuration object, a Death Zone instance, a valid Geometry object or an array of them.
*/
addDeathZone(config: Phaser.Types.GameObjects.Particles.DeathZoneObject | Phaser.Types.GameObjects.Particles.DeathZoneObject[]): Phaser.GameObjects.Particles.Zones.DeathZone[];
/**
* Removes the given Particle Death Zone from this Emitter.
* @param zone The Death Zone that should be removed from this Emitter.
*/
removeDeathZone(zone: Phaser.GameObjects.Particles.Zones.DeathZone): this;
/**
* Clear all Death Zones from this Particle Emitter.
*/
clearDeathZones(): this;
/**
* Adds a new Particle Emission Zone to this Emitter.
*
* An {@link Phaser.Types.GameObjects.Particles.ParticleEmitterEdgeZoneConfig EdgeZone} places particles on its edges.
* Its {@link Phaser.Types.GameObjects.Particles.EdgeZoneSource source} can be a Curve, Path, Circle, Ellipse, Line, Polygon, Rectangle, or Triangle;
* or any object with a suitable {@link Phaser.Types.GameObjects.Particles.EdgeZoneSourceCallback getPoints} method.
*
* A {@link Phaser.Types.GameObjects.Particles.ParticleEmitterRandomZoneConfig RandomZone} places the particles randomly within its interior.
* Its {@link RandomZoneSource source} can be a Circle, Ellipse, Line, Polygon, Rectangle, or Triangle; or any object with a suitable {@link Phaser.Types.GameObjects.Particles.RandomZoneSourceCallback getRandomPoint} method.
*
* An Emission Zone can only exist once within this Emitter.
* @param zone An Emission Zone configuration object, a RandomZone or EdgeZone instance, or an array of them.
*/
addEmitZone(zone: Phaser.Types.GameObjects.Particles.EmitZoneData | Phaser.Types.GameObjects.Particles.EmitZoneData[]): Phaser.Types.GameObjects.Particles.EmitZoneObject[];
/**
* Removes the given Particle Emission Zone from this Emitter.
* @param zone The Emission Zone that should be removed from this Emitter.
*/
removeEmitZone(zone: Phaser.GameObjects.Particles.Zones.EdgeZone | Phaser.GameObjects.Particles.Zones.RandomZone): this;
/**
* Clear all Emission Zones from this Particle Emitter.
*/
clearEmitZones(): this;
/**
* Takes the given particle and sets its x/y coordinates to match the next available
* emission zone, if any have been configured. This method is called automatically
* as part of the `Particle.fire` process.
*
* The Emit Zones are iterated in sequence. Once a zone has had a particle emitted
* from it, then the next zone is used and so on, in a loop.
* @param particle The particle to set the emission zone for.
*/
getEmitZone(particle: Phaser.GameObjects.Particles.Particle): void;
/**
* Takes the given particle and checks to see if any of the configured Death Zones
* will kill it and returns the result. This method is called automatically as part
* of the `Particle.update` process.
* @param particle The particle to test against the Death Zones.
*/
getDeathZone(particle: Phaser.GameObjects.Particles.Particle): boolean;
/**
* Changes the currently active Emission Zone. The zones should have already
* been added to this Emitter either via the emitter config, or the
* `addEmitZone` method.
*
* Call this method by passing either a numeric zone index value, or
* the zone instance itself.
*
* Prior to v3.60 an Emitter could only have a single Emit Zone and this
* method was how you set it. From 3.60 and up it now performs a different
* function and swaps between all available active zones.
* @param zone The Emit Zone to set as the active zone.
*/
setEmitZone(zone: number | Phaser.GameObjects.Particles.Zones.EdgeZone | Phaser.GameObjects.Particles.Zones.RandomZone): this;
/**
* Adds a Particle Processor, such as a Gravity Well, to this Emitter.
*
* It will start processing particles from the next update as long as its `active`
* property is set.
* @param processor The Particle Processor to add to this Emitter Manager.
*/
addParticleProcessor(processor: T): T;
/**
* Removes a Particle Processor from this Emitter.
*
* The Processor must belong to this Emitter to be removed.
*
* It is not destroyed when removed, allowing you to move it to another Emitter Manager,
* so if you no longer require it you should call its `destroy` method directly.
* @param processor The Particle Processor to remove from this Emitter Manager.
*/
removeParticleProcessor(processor: T): T | null;
/**
* Gets all active Particle Processors.
*/
getProcessors(): Phaser.GameObjects.Particles.ParticleProcessor[];
/**
* Creates a new Gravity Well, adds it to this Emitter and returns a reference to it.
* @param config Configuration settings for the Gravity Well to create.
*/
createGravityWell(config: Phaser.Types.GameObjects.Particles.GravityWellConfig): Phaser.GameObjects.Particles.GravityWell;
/**
* Creates inactive particles and adds them to this emitter's pool.
*
* If `ParticleEmitter.maxParticles` is set it will limit the
* value passed to this method to make sure it's not exceeded.
* @param count The number of particles to create.
*/
reserve(count: number): this;
/**
* Gets the number of active (in-use) particles in this emitter.
*/
getAliveParticleCount(): number;
/**
* Gets the number of inactive (available) particles in this emitter.
*/
getDeadParticleCount(): number;
/**
* Gets the total number of particles in this emitter.
*/
getParticleCount(): number;
/**
* Whether this emitter is at either its hard-cap limit (maxParticles), if set, or
* the max allowed number of 'alive' particles (maxAliveParticles).
*/
atLimit(): boolean;
/**
* Sets a function to call for each newly emitted particle.
* @param callback The function.
* @param context The calling context.
*/
onParticleEmit(callback: Phaser.Types.GameObjects.Particles.ParticleEmitterCallback, context?: any): this;
/**
* Sets a function to call for each particle death.
* @param callback The function.
* @param context The function's calling context.
*/
onParticleDeath(callback: Phaser.Types.GameObjects.Particles.ParticleDeathCallback, context?: any): this;
/**
* Deactivates every particle in this emitter immediately.
*
* This particles are killed but do not emit an event or callback.
*/
killAll(): this;
/**
* Calls a function for each active particle in this emitter. The function is
* sent two parameters: a reference to the Particle instance and to this Emitter.
* @param callback The function.
* @param context The functions calling context.
*/
forEachAlive(callback: Phaser.Types.GameObjects.Particles.ParticleEmitterCallback, context: any): this;
/**
* Calls a function for each inactive particle in this emitter.
* @param callback The function.
* @param context The functions calling context.
*/
forEachDead(callback: Phaser.Types.GameObjects.Particles.ParticleEmitterCallback, context: any): this;
/**
* Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#on} the emitter and resets the flow counter.
*
* If this emitter is in flow mode (frequency >= 0; the default), the particle flow will start (or restart).
*
* If this emitter is in explode mode (frequency = -1), nothing will happen.
* Use {@link Phaser.GameObjects.Particles.ParticleEmitter#explode} or {@link Phaser.GameObjects.Particles.ParticleEmitter#flow} instead.
*
* Calling this method will emit the `START` event.
* @param advance Advance this number of ms in time through the emitter. Default 0.
* @param duration Limit this emitter to only emit particles for the given number of ms. Setting this parameter will override any duration already set in the Emitter configuration object. Default 0.
*/
start(advance?: number, duration?: number): this;
/**
* Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#emitting off} the emitter and
* stops it from emitting further particles. Currently alive particles will remain
* active until they naturally expire unless you set the `kill` parameter to `true`.
*
* Calling this method will emit the `STOP` event. When the final particle has
* expired the `COMPLETE` event will be emitted.
* @param kill Kill all particles immediately (true), or leave them to die after their lifespan expires? (false, the default) Default false.
*/
stop(kill?: boolean): this;
/**
* {@link Phaser.GameObjects.Particles.ParticleEmitter#active Deactivates} the emitter.
*/
pause(): this;
/**
* {@link Phaser.GameObjects.Particles.ParticleEmitter#active Activates} the emitter.
*/
resume(): this;
/**
* Set the property by which active particles are sorted prior to be rendered.
*
* It allows you to control the rendering order of the particles.
*
* This can be any valid property of the `Particle` class, such as `y`, `alpha`
* or `lifeT`.
*
* The 'alive' particles array is sorted in place each game frame. Setting a
* sort property will override the `particleBringToTop` setting.
*
* If you wish to use your own sorting function, see `setSortCallback` instead.
* @param property The property on the `Particle` class to sort by.
* @param ascending Should the particles be sorted in ascending or descending order? Default true.
*/
setSortProperty(property?: string, ascending?: boolean): this;
/**
* Sets a callback to be used to sort the particles before rendering each frame.
*
* This allows you to define your own logic and behavior in the callback.
*
* The callback will be sent two parameters: the two Particles being compared,
* and must adhere to the criteria of the `compareFn` in `Array.sort`:
*
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description
*
* Call this method with no parameters to reset the sort callback.
*
* Setting your own callback will override both the `particleBringToTop` and
* `sortProperty` settings of this Emitter.
* @param callback The callback to invoke when the particles are sorted. Leave undefined to reset to the default.
*/
setSortCallback(callback?: Phaser.Types.GameObjects.Particles.ParticleSortCallback): this;
/**
* Sorts active particles with {@link Phaser.GameObjects.Particles.ParticleEmitter#depthSortCallback}.
*/
depthSort(): this;
/**
* Calculates the difference of two particles, for sorting them by depth.
* @param a The first particle.
* @param b The second particle.
*/
depthSortCallback(a: object, b: object): number;
/**
* Puts the emitter in flow mode (frequency >= 0) and starts (or restarts) a particle flow.
*
* To resume a flow at the current frequency and quantity, use {@link Phaser.GameObjects.Particles.ParticleEmitter#start} instead.
* @param frequency The time interval (>= 0) of each flow cycle, in ms.
* @param count The number of particles to emit at each flow cycle. Default 1.
* @param stopAfter Stop this emitter from firing any more particles once this value is reached. Set to zero for unlimited. Setting this parameter will override any `stopAfter` value already set in the Emitter configuration object.
*/
flow(frequency: number, count?: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType, stopAfter?: number): this;
/**
* Puts the emitter in explode mode (frequency = -1), stopping any current particle flow, and emits several particles all at once.
* @param count The number of Particles to emit. Default this.quantity.
* @param x The x coordinate to emit the Particles from. Default this.x.
* @param y The y coordinate to emit the Particles from. Default this.x.
*/
explode(count?: number, x?: number, y?: number): Phaser.GameObjects.Particles.Particle | undefined;
/**
* Emits particles at the given position. If no position is given, it will
* emit from this Emitters current location.
* @param x The x coordinate to emit the Particles from. Default this.x.
* @param y The y coordinate to emit the Particles from. Default this.x.
* @param count The number of Particles to emit. Default this.quantity.
*/
emitParticleAt(x?: number, y?: number, count?: number): Phaser.GameObjects.Particles.Particle | undefined;
/**
* Emits particles at a given position (or the emitters current position).
* @param count The number of Particles to emit. Default this.quantity.
* @param x The x coordinate to emit the Particles from. Default this.x.
* @param y The y coordinate to emit the Particles from. Default this.x.
*/
emitParticle(count?: number, x?: number, y?: number): Phaser.GameObjects.Particles.Particle | undefined;
/**
* Fast forwards this Particle Emitter and all of its particles.
*
* Works by running the Emitter `preUpdate` handler in a loop until the `time`
* has been reached at `delta` steps per loop.
*
* All callbacks and emitter related events that would normally be fired
* will still be invoked.
*
* You can make an emitter 'fast forward' via the emitter config using the
* `advance` property. Set this value to the number of ms you wish the
* emitter to be fast-forwarded by. Or, call this method post-creation.
* @param time The number of ms to advance the Particle Emitter by.
* @param delta The amount of delta to use for each step. Defaults to 1000 / 60.
*/
fastForward(time: number, delta?: number): this;
/**
* Updates this emitter and its particles.
* @param time The current timestamp as generated by the Request Animation Frame or SetTimeout.
* @param delta The delta time, in ms, elapsed since the last frame.
*/
preUpdate(time: number, delta: number): void;
/**
* Takes either a Rectangle Geometry object or an Arcade Physics Body and tests
* to see if it intersects with any currently alive Particle in this Emitter.
*
* Overlapping particles are returned in an array, where you can perform further
* processing on them. If nothing overlaps then the array will be empty.
* @param target A Rectangle or Arcade Physics Body to check for intersection against all alive particles.
*/
overlap(target: Phaser.Geom.Rectangle | Phaser.Physics.Arcade.Body): Phaser.GameObjects.Particles.Particle[];
/**
* Returns a bounds Rectangle calculated from the bounds of all currently
* _active_ Particles in this Emitter. If this Emitter has only just been
* created and not yet rendered, then calling this method will return a Rectangle
* with a max safe integer for dimensions. Use the `advance` parameter to
* avoid this.
*
* Typically it takes a few seconds for a flow Emitter to 'warm up'. You can
* use the `advance` and `delta` parameters to force the Emitter to
* 'fast forward' in time to try and allow the bounds to be more accurate,
* as it will calculate the bounds based on the particle bounds across all
* timesteps, giving a better result.
*
* You can also use the `padding` parameter to increase the size of the
* bounds. Emitters with a lot of randomness in terms of direction or lifespan
* can often return a bounds smaller than their possible maximum. By using
* the `padding` (and `advance` if needed) you can help limit this.
* @param padding The amount of padding, in pixels, to add to the bounds Rectangle.
* @param advance The number of ms to advance the Particle Emitter by. Defaults to 0, i.e. not used.
* @param delta The amount of delta to use for each step. Defaults to 1000 / 60.
* @param output The Rectangle to store the results in. If not given a new one will be created.
*/
getBounds(padding?: number, advance?: number, delta?: number, output?: Phaser.Geom.Rectangle): Phaser.Geom.Rectangle;
/**
* Prints a warning to the console if you mistakenly call this function
* thinking it works the same way as Phaser v3.55.
*/
createEmitter(): void;
/**
* The x coordinate the particles are emitted from.
*
* This is relative to the Emitters x coordinate and that of any parent.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
particleX: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType;
/**
* The y coordinate the particles are emitted from.
*
* This is relative to the Emitters x coordinate and that of any parent.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
particleY: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType;
/**
* The horizontal acceleration applied to emitted particles, in pixels per second squared.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
accelerationX: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The vertical acceleration applied to emitted particles, in pixels per second squared.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
accelerationY: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The maximum horizontal velocity emitted particles can reach, in pixels per second squared.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
maxVelocityX: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The maximum vertical velocity emitted particles can reach, in pixels per second squared.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
maxVelocityY: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The initial speed of emitted particles, in pixels per second.
*
* If using this as a getter it will return the `speedX` value.
*
* If using it as a setter it will update both `speedX` and `speedY` to the
* given value.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
speed: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The initial horizontal speed of emitted particles, in pixels per second.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
speedX: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The initial vertical speed of emitted particles, in pixels per second.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
speedY: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The x coordinate emitted particles move toward, when {@link Phaser.GameObjects.Particles.ParticleEmitter#moveTo} is true.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
moveToX: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The y coordinate emitted particles move toward, when {@link Phaser.GameObjects.Particles.ParticleEmitter#moveTo} is true.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
moveToY: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The amount of velocity particles will use when rebounding off the
* emitter bounds, if set. A value of 0 means no bounce. A value of 1
* means a full rebound.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
bounce: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The horizontal scale of emitted particles.
*
* This is relative to the Emitters scale and that of any parent.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
particleScaleX: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The vertical scale of emitted particles.
*
* This is relative to the Emitters scale and that of any parent.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
particleScaleY: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* A color tint value that is applied to the texture of the emitted
* particle. The value should be given in hex format, i.e. 0xff0000
* for a red tint, and should not include the alpha channel.
*
* Tints are additive, meaning a tint value of white (0xffffff) will
* effectively reset the tint to nothing.
*
* Modify the `ParticleEmitter.tintFill` property to change between
* an additive and replacement tint mode.
*
* When you define the color via the Emitter config you should give
* it as an array of color values. The Particle will then interpolate
* through these colors over the course of its lifespan. Setting this
* will override any `tint` value that may also be given.
*
* This is a WebGL only feature.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
particleColor: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* Controls the easing function used when you have created an
* Emitter that uses the `color` property to interpolate the
* tint of Particles over their lifetime.
*
* Setting this has no effect if you haven't also applied a
* `particleColor` to this Emitter.
*/
colorEase: string;
/**
* A color tint value that is applied to the texture of the emitted
* particle. The value should be given in hex format, i.e. 0xff0000
* for a red tint, and should not include the alpha channel.
*
* Tints are additive, meaning a tint value of white (0xffffff) will
* effectively reset the tint to nothing.
*
* Modify the `ParticleEmitter.tintFill` property to change between
* an additive and replacement tint mode.
*
* The `tint` value will be overriden if a `color` array is provided.
*
* This is a WebGL only feature.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
particleTint: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The alpha value of the emitted particles. This is a value
* between 0 and 1. Particles with alpha zero are invisible
* and are therefore not rendered, but are still processed
* by the Emitter.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
particleAlpha: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The lifespan of the emitted particles. This value is given
* in milliseconds and defaults to 1000ms (1 second). When a
* particle reaches this amount it is killed.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
lifespan: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The angle at which the particles are emitted. The values are
* given in degrees. This allows you to control the direction
* of the emitter. If you wish instead to change the rotation
* of the particles themselves, see the `particleRotate` property.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
particleAngle: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The rotation (or angle) of each particle when it is emitted.
* The value is given in degrees and uses a right-handed
* coordinate system, where 0 degrees points to the right, 90 degrees
* points down and -90 degrees points up.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
particleRotate: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The number of particles that are emitted each time an emission
* occurs, i.e. from one 'explosion' or each frame in a 'flow' cycle.
*
* The default is 1.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
quantity: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The number of milliseconds to wait after emission before
* the particles start updating. This allows you to emit particles
* that appear 'static' or still on-screen and then, after this value,
* begin to move.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
delay: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The number of milliseconds to wait after a particle has finished
* its life before it will be removed. This allows you to 'hold' a
* particle on the screen once it has reached its final state
* before it then vanishes.
*
* Note that all particle updates will cease, including changing
* alpha, scale, movement or animation.
*
* Accessing this property should typically return a number.
* However, it can be set to any valid EmitterOp onEmit type.
*/
hold: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType;
/**
* The internal flow counter.
*
* Treat this property as read-only.
*/
flowCounter: number;
/**
* The internal frame counter.
*
* Treat this property as read-only.
*/
frameCounter: number;
/**
* The internal animation counter.
*
* Treat this property as read-only.
*/
animCounter: number;
/**
* The internal elasped counter.
*
* Treat this property as read-only.
*/
elapsed: number;
/**
* The internal stop counter.
*
* Treat this property as read-only.
*/
stopCounter: number;
/**
* The internal complete flag.
*
* Treat this property as read-only.
*/
completeFlag: boolean;
/**
* The internal zone index.
*
* Treat this property as read-only.
*/
zoneIndex: number;
/**
* The internal zone total.
*
* Treat this property as read-only.
*/
zoneTotal: number;
/**
* The current frame index.
*
* Treat this property as read-only.
*/
currentFrame: number;
/**
* The current animation index.
*
* Treat this property as read-only.
*/
currentAnim: number;
/**
* Destroys this Particle Emitter and all Particles it owns.
*/
preDestroy(): void;
/**
* 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 Mask this Game Object is using during render.
*/
mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask;
/**
* Sets the mask that this Game Object will use to render with.
*
* The mask must have been previously created and can be either a GeometryMask or a BitmapMask.
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* If a mask is already set on this Game Object it will be immediately replaced.
*
* Masks are positioned in global space and are not relative to the Game Object to which they
* are applied. The reason for this is that multiple Game Objects can all share the same mask.
*
* Masks have no impact on physics or input detection. They are purely a rendering component
* that allows you to limit what is visible during the render pass.
* @param mask The mask this Game Object will use when rendering.
*/
setMask(mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask): this;
/**
* Clears the mask that this Game Object was using.
* @param destroyMask Destroy the mask before clearing it? Default false.
*/
clearMask(destroyMask?: boolean): this;
/**
* Creates and returns a Bitmap Mask. This mask can be used by any Game Object,
* including this one, or a Dynamic Texture.
*
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* To create the mask you need to pass in a reference to a renderable Game Object.
* A renderable Game Object is one that uses a texture to render with, such as an
* Image, Sprite, Render Texture or BitmapText.
*
* If you do not provide a renderable object, and this Game Object has a texture,
* it will use itself as the object. This means you can call this method to create
* a Bitmap Mask from any renderable texture-based Game Object.
* @param maskObject The Game Object or Dynamic 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.
*/
createBitmapMask(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 and returns a Geometry Mask. This mask can be used by any Game Object,
* including this one.
*
* To create the mask you need to pass in a reference to a Graphics Game Object.
*
* If you do not provide a graphics object, and this Game Object is an instance
* of a Graphics object, then it will use itself to create the mask.
*
* This means you can call this method to create a Geometry Mask from any Graphics Game Object.
* @param graphics A Graphics Game Object, or any kind of Shape Game Object. The geometry within it will be used as the mask.
*/
createGeometryMask(graphics?: Phaser.GameObjects.Graphics | Phaser.GameObjects.Shape): Phaser.Display.Masks.GeometryMask;
/**
* The initial WebGL pipeline of this Game Object.
*
* If you call `resetPipeline` on this Game Object, the pipeline is reset to this default.
*/
defaultPipeline: Phaser.Renderer.WebGL.WebGLPipeline;
/**
* The current WebGL pipeline of this Game Object.
*/
pipeline: Phaser.Renderer.WebGL.WebGLPipeline;
/**
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
*/
pipelineData: object;
/**
* Sets the initial WebGL Pipeline of this Game Object.
*
* This should only be called during the instantiation of the Game Object. After that, use `setPipeline`.
* @param pipeline Either the string-based name of the pipeline, or a pipeline instance to set.
*/
initPipeline(pipeline?: string | Phaser.Renderer.WebGL.WebGLPipeline): boolean;
/**
* Sets the main WebGL Pipeline of this Game Object.
*
* Also sets the `pipelineData` property, if the parameter is given.
* @param pipeline Either the string-based name of the pipeline, or a pipeline instance to set.
* @param pipelineData Optional pipeline data object that is set in to the `pipelineData` property of this Game Object.
* @param copyData Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead. Default true.
*/
setPipeline(pipeline: string | Phaser.Renderer.WebGL.WebGLPipeline, pipelineData?: object, copyData?: boolean): this;
/**
* Adds an entry to the `pipelineData` object belonging to this Game Object.
*
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
*
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
* @param key The key of the pipeline data to set, update, or delete.
* @param value The value to be set with the key. If `undefined` then `key` will be deleted from the object.
*/
setPipelineData(key: string, value?: any): this;
/**
* Resets the WebGL Pipeline of this Game Object back to the default it was created with.
* @param resetData Reset the `pipelineData` object to being an empty object? Default false.
*/
resetPipeline(resetData?: boolean): boolean;
/**
* Gets the name of the WebGL Pipeline this Game Object is currently using.
*/
getPipelineName(): string;
/**
* Does this Game Object have any Post Pipelines set?
*/
hasPostPipeline: boolean;
/**
* The WebGL Post FX Pipelines this Game Object uses for post-render effects.
*
* The pipelines are processed in the order in which they appear in this array.
*
* If you modify this array directly, be sure to set the
* `hasPostPipeline` property accordingly.
*/
postPipelines: Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
*/
postPipelineData: object;
/**
* The Pre FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.preFX.addBloom();
* ```
*
* Only the following Game Objects support Pre FX:
*
* * Image
* * Sprite
* * TileSprite
* * Text
* * RenderTexture
* * Video
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*/
preFX: Phaser.GameObjects.Components.FX | null;
/**
* The Post FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.postFX.addBloom();
* ```
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*
* This property is always `null` until the `initPostPipeline` method is called.
*/
postFX: Phaser.GameObjects.Components.FX;
/**
* This should only be called during the instantiation of the Game Object.
*
* It is called by default by all core Game Objects and doesn't need
* calling again.
*
* After that, use `setPostPipeline`.
* @param preFX Does this Game Object support Pre FX? Default false.
*/
initPostPipeline(preFX?: boolean): void;
/**
* Sets one, or more, Post Pipelines on this Game Object.
*
* Post Pipelines are invoked after this Game Object has rendered to its target and
* are commonly used for post-fx.
*
* The post pipelines are appended to the `postPipelines` array belonging to this
* Game Object. When the renderer processes this Game Object, it iterates through the post
* pipelines in the order in which they appear in the array. If you are stacking together
* multiple effects, be aware that the order is important.
*
* If you call this method multiple times, the new pipelines will be appended to any existing
* post pipelines already set. Use the `resetPostPipeline` method to clear them first, if required.
*
* You can optionally also set the `postPipelineData` property, if the parameter is given.
* @param pipelines Either the string-based name of the pipeline, or a pipeline instance, or class, or an array of them.
* @param pipelineData Optional pipeline data object that is set in to the `postPipelineData` property of this Game Object.
* @param copyData Should the pipeline data object be _deep copied_ into the `postPipelineData` property of this Game Object? If `false` it will be set by reference instead. Default true.
*/
setPostPipeline(pipelines: string | string[] | Function | Function[] | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[], pipelineData?: object, copyData?: boolean): this;
/**
* Adds an entry to the `postPipelineData` object belonging to this Game Object.
*
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
*
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
* @param key The key of the pipeline data to set, update, or delete.
* @param value The value to be set with the key. If `undefined` then `key` will be deleted from the object.
*/
setPostPipelineData(key: string, value?: any): this;
/**
* Gets a Post Pipeline instance from this Game Object, based on the given name, and returns it.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
getPostPipeline(pipeline: string | Function | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* Resets the WebGL Post Pipelines of this Game Object. It does this by calling
* the `destroy` method on each post pipeline and then clearing the local array.
* @param resetData Reset the `postPipelineData` object to being an empty object? Default false.
*/
resetPostPipeline(resetData?: boolean): void;
/**
* Removes a type of Post Pipeline instances from this Game Object, based on the given name, and destroys them.
*
* If you wish to remove all Post Pipelines use the `resetPostPipeline` method instead.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
removePostPipeline(pipeline: string | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): this;
/**
* Removes all Pre and Post FX Controllers from this Game Object.
*
* If you wish to remove a single controller, use the `preFX.remove(fx)` or `postFX.remove(fx)` methods instead.
*
* If you wish to clear a single controller, use the `preFX.clear()` or `postFX.clear()` methods instead.
*/
clearFX(): 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 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.
*
* Calling this method 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 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.
* @param updateSize Should this call adjust the size of the Game Object? Default true.
* @param updateOrigin Should this call change the origin of the Game Object? Default true.
*/
setTexture(key: string | Phaser.Textures.Texture, frame?: string | number, updateSize?: boolean, updateOrigin?: boolean): 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;
/**
* 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;
}
/**
* This class provides the structured required for all Particle Processors.
*
* You should extend it and add the functionality required for your processor,
* including tidying up any resources this may create in the `destroy` method.
*
* See the GravityWell for an example of a processor.
*/
class ParticleProcessor {
/**
*
* @param x The x coordinate of the Particle Processor, in world space. Default 0.
* @param y The y coordinate of the Particle Processor, in world space. Default 0.
* @param active The active state of this Particle Processor. Default true.
*/
constructor(x?: number, y?: number, active?: boolean);
/**
* A reference to the Particle Emitter that owns this Processor.
* This is set automatically when the Processor is added to an Emitter
* and nulled when removed or destroyed.
*/
manager: Phaser.GameObjects.Particles.ParticleEmitter;
/**
* The x coordinate of the Particle Processor, in world space.
*/
x: number;
/**
* The y coordinate of the Particle Processor, in world space.
*/
y: number;
/**
* The active state of the Particle Processor.
*
* An inactive Particle Processor will be skipped for processing by
* its parent Emitter.
*/
active: boolean;
/**
* The Particle Processor update method should be overriden by your own
* method and handle the processing of the particles, typically modifying
* their velocityX/Y values based on the criteria of this processor.
* @param particle The Particle to update.
* @param delta The delta time in ms.
* @param step The delta value divided by 1000.
* @param t The current normalized lifetime of the particle, between 0 (birth) and 1 (death).
*/
update(particle: Phaser.GameObjects.Particles.Particle, delta: number, step: number, t: number): void;
/**
* Destroys this Particle Processor by removing all external references.
*
* This is called automatically when the owning Particle Emitter is destroyed.
*/
destroy(): void;
}
namespace Zones {
/**
* A Death Zone.
*
* A Death Zone is a special type of zone that will kill a Particle as soon as it either enters, or leaves, the zone.
*
* The zone consists of a `source` which could be a Geometric shape, such as a Rectangle or Ellipse, or your own
* object as long as it includes a `contains` method for which the Particles can be tested against.
*/
class DeathZone {
/**
*
* @param source An object instance that has a `contains` method that returns a boolean when given `x` and `y` arguments.
* @param killOnEnter Should the Particle be killed when it enters the zone? `true` or leaves it? `false`
*/
constructor(source: Phaser.Types.GameObjects.Particles.DeathZoneSource, killOnEnter: boolean);
/**
* An object instance that has a `contains` method that returns a boolean when given `x` and `y` arguments.
* This could be a Geometry shape, such as `Phaser.Geom.Circle`, or your own custom object.
*/
source: Phaser.Types.GameObjects.Particles.DeathZoneSource;
/**
* Set to `true` if the Particle should be killed if it enters this zone.
* Set to `false` to kill the Particle if it leaves this zone.
*/
killOnEnter: boolean;
/**
* Checks if the given Particle will be killed or not by this zone.
* @param particle The particle to test against this Death Zones.
*/
willKill(particle: Phaser.GameObjects.Particles.Particle): boolean;
}
/**
* A zone that places particles on a shape's edges.
*/
class EdgeZone {
/**
*
* @param source An object instance with a `getPoints(quantity, stepRate)` method returning an array of points.
* @param quantity The number of particles to place on the source edge. Set to 0 to use `stepRate` instead.
* @param stepRate The distance between each particle. When set, `quantity` is implied and should be set to 0.
* @param yoyo Whether particles are placed from start to end and then end to start. Default false.
* @param seamless Whether one endpoint will be removed if it's identical to the other. Default true.
* @param total The total number of particles this zone will emit before passing over to the next emission zone in the Emitter. -1 means it will never pass over and you must use `setEmitZone` to change it. Default -1.
*/
constructor(source: Phaser.Types.GameObjects.Particles.EdgeZoneSource, quantity: number, stepRate?: number, yoyo?: boolean, seamless?: boolean, total?: number);
/**
* An object instance with a `getPoints(quantity, stepRate)` method returning an array of points.
*/
source: Phaser.Types.GameObjects.Particles.EdgeZoneSource | Phaser.Types.GameObjects.Particles.RandomZoneSource;
/**
* The points placed on the source edge.
*/
points: Phaser.Geom.Point[];
/**
* The number of particles to place on the source edge. Set to 0 to use `stepRate` instead.
*/
quantity: number;
/**
* The distance between each particle. When set, `quantity` is implied and should be set to 0.
*/
stepRate: number;
/**
* Whether particles are placed from start to end and then end to start.
*/
yoyo: boolean;
/**
* The counter used for iterating the EdgeZone's points.
*/
counter: number;
/**
* Whether one endpoint will be removed if it's identical to the other.
*/
seamless: boolean;
/**
* The total number of particles this zone will emit before the Emitter
* transfers control over to the next zone in its emission zone list.
*
* By default this is -1, meaning it will never pass over from this
* zone to another one. You can call the `ParticleEmitter.setEmitZone`
* method to change it, or set this value to something else via the
* config, or directly at runtime.
*
* A value of 1 would mean the zones rotate in order, but it can
* be set to any integer value.
*/
total: number;
/**
* Update the {@link Phaser.GameObjects.Particles.Zones.EdgeZone#points} from the EdgeZone's
* {@link Phaser.GameObjects.Particles.Zones.EdgeZone#source}.
*
* Also updates internal properties.
*/
updateSource(): this;
/**
* Change the source of the EdgeZone.
* @param source An object instance with a `getPoints(quantity, stepRate)` method returning an array of points.
*/
changeSource(source: Phaser.Types.GameObjects.Particles.EdgeZoneSource): this;
/**
* Get the next point in the Zone and set its coordinates on the given Particle.
* @param particle The Particle.
*/
getPoint(particle: Phaser.GameObjects.Particles.Particle): void;
}
/**
* A zone that places particles randomly within a shapes area.
*/
class RandomZone {
/**
*
* @param source An object instance with a `getRandomPoint(point)` method.
*/
constructor(source: Phaser.Types.GameObjects.Particles.RandomZoneSource);
/**
* An object instance with a `getRandomPoint(point)` method.
*/
source: Phaser.Types.GameObjects.Particles.RandomZoneSource;
/**
* The total number of particles this zone will emit before the Emitter
* transfers control over to the next zone in its emission zone list.
*
* By default this is -1, meaning it will never pass over from this
* zone to another one. You can call the `ParticleEmitter.setEmitZone`
* method to change it, or set this value to something else via the
* config, or directly at runtime.
*
* A value of 1 would mean the zones rotate in order, but it can
* be set to any integer value.
*/
total: number;
/**
* Get the next point in the Zone and set its coordinates on the given Particle.
* @param particle The Particle.
*/
getPoint(particle: Phaser.GameObjects.Particles.Particle): void;
}
}
}
/**
* A PathFollower Game Object.
*
* A PathFollower is a Sprite Game Object with some extra helpers to allow it to follow a Path automatically.
*
* Anything you can do with a standard Sprite can be done with this PathFollower, such as animate it, tint it,
* scale it and so on.
*
* PathFollowers are bound to a single Path at any one time and can traverse the length of the Path, from start
* to finish, forwards or backwards, or from any given point on the Path to its end. They can optionally rotate
* to face the direction of the path, be offset from the path coordinates or rotate independently of the Path.
*/
class PathFollower extends Phaser.GameObjects.Sprite implements Phaser.GameObjects.Components.PathFollower {
/**
*
* @param scene The Scene to which this PathFollower belongs.
* @param path The Path this PathFollower is following. It can only follow one Path at a time.
* @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.
*/
constructor(scene: Phaser.Scene, path: Phaser.Curves.Path, x: number, y: number, texture: string | Phaser.Textures.Texture, frame?: string | number);
/**
* If the PathFollower is rotating to match the Path (@see Phaser.GameObjects.PathFollower#rotateToPath)
* this value is added to the rotation value. This allows you to rotate objects to a path but control
* the angle of the rotation as well.
*/
pathRotationOffset: number;
/**
* An additional vector to add to the PathFollowers position, allowing you to offset it from the
* Path coordinates.
*/
pathOffset: Phaser.Math.Vector2;
/**
* A Vector2 that stores the current point of the path the follower is on.
*/
pathVector: Phaser.Math.Vector2;
/**
* The distance the follower has traveled from the previous point to the current one, at the last update.
*/
pathDelta: Phaser.Math.Vector2;
/**
* The Tween used for following the Path.
*/
pathTween: Phaser.Tweens.Tween;
/**
* Settings for the PathFollower.
*/
pathConfig: Phaser.Types.GameObjects.PathFollower.PathConfig | null;
/**
* Internal update handler that advances this PathFollower along the path.
*
* Called automatically by the Scene step, should not typically be called directly.
* @param time The current timestamp as generated by the Request Animation Frame or SetTimeout.
* @param delta The delta time, in ms, elapsed since the last frame.
*/
protected preUpdate(time: number, delta: number): void;
/**
* 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;
/**
* Gets the center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the top-left corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getTopLeft(output?: O, includeParent?: boolean): O;
/**
* Gets the top-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getTopCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the top-right corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getTopRight(output?: O, includeParent?: boolean): O;
/**
* Gets the left-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getLeftCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the right-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getRightCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the bottom-left corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getBottomLeft(output?: O, includeParent?: boolean): O;
/**
* Gets the bottom-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getBottomCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the bottom-right corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getBottomRight(output?: O, includeParent?: boolean): O;
/**
* Gets the bounds of this Game Object, regardless of origin.
*
* The values are stored and returned in a Rectangle, or Rectangle-like, object.
* @param output An object to store the values in. If not provided a new Rectangle will be created.
*/
getBounds(output?: O): O;
/**
* The Mask this Game Object is using during render.
*/
mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask;
/**
* Sets the mask that this Game Object will use to render with.
*
* The mask must have been previously created and can be either a GeometryMask or a BitmapMask.
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* If a mask is already set on this Game Object it will be immediately replaced.
*
* Masks are positioned in global space and are not relative to the Game Object to which they
* are applied. The reason for this is that multiple Game Objects can all share the same mask.
*
* Masks have no impact on physics or input detection. They are purely a rendering component
* that allows you to limit what is visible during the render pass.
* @param mask The mask this Game Object will use when rendering.
*/
setMask(mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask): this;
/**
* Clears the mask that this Game Object was using.
* @param destroyMask Destroy the mask before clearing it? Default false.
*/
clearMask(destroyMask?: boolean): this;
/**
* Creates and returns a Bitmap Mask. This mask can be used by any Game Object,
* including this one, or a Dynamic Texture.
*
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* To create the mask you need to pass in a reference to a renderable Game Object.
* A renderable Game Object is one that uses a texture to render with, such as an
* Image, Sprite, Render Texture or BitmapText.
*
* If you do not provide a renderable object, and this Game Object has a texture,
* it will use itself as the object. This means you can call this method to create
* a Bitmap Mask from any renderable texture-based Game Object.
* @param maskObject The Game Object or Dynamic 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.
*/
createBitmapMask(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 and returns a Geometry Mask. This mask can be used by any Game Object,
* including this one.
*
* To create the mask you need to pass in a reference to a Graphics Game Object.
*
* If you do not provide a graphics object, and this Game Object is an instance
* of a Graphics object, then it will use itself to create the mask.
*
* This means you can call this method to create a Geometry Mask from any Graphics Game Object.
* @param graphics A Graphics Game Object, or any kind of Shape Game Object. The geometry within it will be used as the mask.
*/
createGeometryMask(graphics?: Phaser.GameObjects.Graphics | Phaser.GameObjects.Shape): Phaser.Display.Masks.GeometryMask;
/**
* 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 initial WebGL pipeline of this Game Object.
*
* If you call `resetPipeline` on this Game Object, the pipeline is reset to this default.
*/
defaultPipeline: Phaser.Renderer.WebGL.WebGLPipeline;
/**
* The current WebGL pipeline of this Game Object.
*/
pipeline: Phaser.Renderer.WebGL.WebGLPipeline;
/**
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
*/
pipelineData: object;
/**
* Sets the initial WebGL Pipeline of this Game Object.
*
* This should only be called during the instantiation of the Game Object. After that, use `setPipeline`.
* @param pipeline Either the string-based name of the pipeline, or a pipeline instance to set.
*/
initPipeline(pipeline?: string | Phaser.Renderer.WebGL.WebGLPipeline): boolean;
/**
* Sets the main WebGL Pipeline of this Game Object.
*
* Also sets the `pipelineData` property, if the parameter is given.
* @param pipeline Either the string-based name of the pipeline, or a pipeline instance to set.
* @param pipelineData Optional pipeline data object that is set in to the `pipelineData` property of this Game Object.
* @param copyData Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead. Default true.
*/
setPipeline(pipeline: string | Phaser.Renderer.WebGL.WebGLPipeline, pipelineData?: object, copyData?: boolean): this;
/**
* Adds an entry to the `pipelineData` object belonging to this Game Object.
*
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
*
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
* @param key The key of the pipeline data to set, update, or delete.
* @param value The value to be set with the key. If `undefined` then `key` will be deleted from the object.
*/
setPipelineData(key: string, value?: any): this;
/**
* Resets the WebGL Pipeline of this Game Object back to the default it was created with.
* @param resetData Reset the `pipelineData` object to being an empty object? Default false.
*/
resetPipeline(resetData?: boolean): boolean;
/**
* Gets the name of the WebGL Pipeline this Game Object is currently using.
*/
getPipelineName(): string;
/**
* Does this Game Object have any Post Pipelines set?
*/
hasPostPipeline: boolean;
/**
* The WebGL Post FX Pipelines this Game Object uses for post-render effects.
*
* The pipelines are processed in the order in which they appear in this array.
*
* If you modify this array directly, be sure to set the
* `hasPostPipeline` property accordingly.
*/
postPipelines: Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
*/
postPipelineData: object;
/**
* The Pre FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.preFX.addBloom();
* ```
*
* Only the following Game Objects support Pre FX:
*
* * Image
* * Sprite
* * TileSprite
* * Text
* * RenderTexture
* * Video
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*/
preFX: Phaser.GameObjects.Components.FX | null;
/**
* The Post FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.postFX.addBloom();
* ```
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*
* This property is always `null` until the `initPostPipeline` method is called.
*/
postFX: Phaser.GameObjects.Components.FX;
/**
* This should only be called during the instantiation of the Game Object.
*
* It is called by default by all core Game Objects and doesn't need
* calling again.
*
* After that, use `setPostPipeline`.
* @param preFX Does this Game Object support Pre FX? Default false.
*/
initPostPipeline(preFX?: boolean): void;
/**
* Sets one, or more, Post Pipelines on this Game Object.
*
* Post Pipelines are invoked after this Game Object has rendered to its target and
* are commonly used for post-fx.
*
* The post pipelines are appended to the `postPipelines` array belonging to this
* Game Object. When the renderer processes this Game Object, it iterates through the post
* pipelines in the order in which they appear in the array. If you are stacking together
* multiple effects, be aware that the order is important.
*
* If you call this method multiple times, the new pipelines will be appended to any existing
* post pipelines already set. Use the `resetPostPipeline` method to clear them first, if required.
*
* You can optionally also set the `postPipelineData` property, if the parameter is given.
* @param pipelines Either the string-based name of the pipeline, or a pipeline instance, or class, or an array of them.
* @param pipelineData Optional pipeline data object that is set in to the `postPipelineData` property of this Game Object.
* @param copyData Should the pipeline data object be _deep copied_ into the `postPipelineData` property of this Game Object? If `false` it will be set by reference instead. Default true.
*/
setPostPipeline(pipelines: string | string[] | Function | Function[] | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[], pipelineData?: object, copyData?: boolean): this;
/**
* Adds an entry to the `postPipelineData` object belonging to this Game Object.
*
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
*
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
* @param key The key of the pipeline data to set, update, or delete.
* @param value The value to be set with the key. If `undefined` then `key` will be deleted from the object.
*/
setPostPipelineData(key: string, value?: any): this;
/**
* Gets a Post Pipeline instance from this Game Object, based on the given name, and returns it.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
getPostPipeline(pipeline: string | Function | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* Resets the WebGL Post Pipelines of this Game Object. It does this by calling
* the `destroy` method on each post pipeline and then clearing the local array.
* @param resetData Reset the `postPipelineData` object to being an empty object? Default false.
*/
resetPostPipeline(resetData?: boolean): void;
/**
* Removes a type of Post Pipeline instances from this Game Object, based on the given name, and destroys them.
*
* If you wish to remove all Post Pipelines use the `resetPostPipeline` method instead.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
removePostPipeline(pipeline: string | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): this;
/**
* Removes all Pre and Post FX Controllers from this Game Object.
*
* If you wish to remove a single controller, use the `preFX.remove(fx)` or `postFX.remove(fx)` methods instead.
*
* If you wish to clear a single controller, use the `preFX.clear()` or `postFX.clear()` methods instead.
*/
clearFX(): 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;
/**
* A boolean flag indicating if this Game Object is being cropped or not.
* You can toggle this at any time after `setCrop` has been called, to turn cropping on or off.
* Equally, calling `setCrop` with no arguments will reset the crop and disable it.
*/
isCropped: boolean;
/**
* Applies a crop to a texture based Game Object, such as a Sprite or Image.
*
* The crop is a rectangle that limits the area of the texture frame that is visible during rendering.
*
* Cropping a Game Object does not change its size, dimensions, physics body or hit area, it just
* changes what is shown when rendered.
*
* The crop coordinates are relative to the texture frame, not the Game Object, meaning 0 x 0 is the top-left.
*
* Therefore, if you had a Game Object that had an 800x600 sized texture, and you wanted to show only the left
* half of it, you could call `setCrop(0, 0, 400, 600)`.
*
* It is also scaled to match the Game Object scale automatically. Therefore a crop rect of 100x50 would crop
* an area of 200x100 when applied to a Game Object that had a scale factor of 2.
*
* You can either pass in numeric values directly, or you can provide a single Rectangle object as the first argument.
*
* Call this method with no arguments at all to reset the crop, or toggle the property `isCropped` to `false`.
*
* You should do this if the crop rectangle becomes the same size as the frame itself, as it will allow
* the renderer to skip several internal calculations.
* @param x The x coordinate to start the crop from. Or a Phaser.Geom.Rectangle object, in which case the rest of the arguments are ignored.
* @param y The y coordinate to start the crop from.
* @param width The width of the crop rectangle in pixels.
* @param height The height of the crop rectangle in pixels.
*/
setCrop(x?: number | Phaser.Geom.Rectangle, y?: number, width?: number, height?: number): this;
/**
* 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.
* @param frame The name or index of the frame within the Texture.
*/
setTexture(key: string, 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.
* Return `tintTopLeft` when read this tint property.
*/
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 Path this PathFollower is following. It can only follow one Path at a time.
*/
path: Phaser.Curves.Path;
/**
* Should the PathFollower automatically rotate to point in the direction of the Path?
*/
rotateToPath: boolean;
/**
* Set the Path that this PathFollower should follow.
*
* Optionally accepts {@link Phaser.Types.GameObjects.PathFollower.PathConfig} settings.
* @param path The Path this PathFollower is following. It can only follow one Path at a time.
* @param config Settings for the PathFollower.
*/
setPath(path: Phaser.Curves.Path, config?: number | Phaser.Types.GameObjects.PathFollower.PathConfig | Phaser.Types.Tweens.NumberTweenBuilderConfig): this;
/**
* Set whether the PathFollower should automatically rotate to point in the direction of the Path.
* @param value Whether the PathFollower should automatically rotate to point in the direction of the Path.
* @param offset Rotation offset in degrees. Default 0.
*/
setRotateToPath(value: boolean, offset?: number): this;
/**
* Is this PathFollower actively following a Path or not?
*
* To be considered as `isFollowing` it must be currently moving on a Path, and not paused.
*/
isFollowing(): boolean;
/**
* Starts this PathFollower following its given Path.
* @param config The duration of the follow, or a PathFollower config object. Default {}.
* @param startAt Optional start position of the follow, between 0 and 1. Default 0.
*/
startFollow(config?: number | Phaser.Types.GameObjects.PathFollower.PathConfig | Phaser.Types.Tweens.NumberTweenBuilderConfig, startAt?: number): this;
/**
* Pauses this PathFollower. It will still continue to render, but it will remain motionless at the
* point on the Path at which you paused it.
*/
pauseFollow(): this;
/**
* Resumes a previously paused PathFollower.
*
* If the PathFollower was not paused this has no effect.
*/
resumeFollow(): this;
/**
* Stops this PathFollower from following the path any longer.
*
* This will invoke any 'stop' conditions that may exist on the Path, or for the follower.
*/
stopFollow(): this;
/**
* Internal update handler that advances this PathFollower along the path.
*
* Called automatically by the Scene step, should not typically be called directly.
*/
pathUpdate(): void;
}
/**
* A Plane Game Object.
*
* The Plane Game Object is a helper class that takes the Mesh Game Object and extends it,
* allowing for fast and easy creation of Planes. A Plane is a one-sided grid of cells,
* where you specify the number of cells in each dimension. The Plane can have a texture
* that is either repeated (tiled) across each cell, or applied to the full Plane.
*
* The Plane can then be manipulated in 3D space, with rotation across all 3 axis.
*
* This allows you to create effects not possible with regular Sprites, such as perspective
* distortion. You can also adjust the vertices on a per-vertex basis. Plane data becomes
* part of the WebGL batch, just like standard Sprites, so doesn't introduce any additional
* shader overhead. Because the Plane just generates vertices into the WebGL batch, like any
* other Sprite, you can use all of the common Game Object components on a Plane too,
* such as a custom pipeline, mask, blend mode or texture.
*
* You can use the `uvScroll` and `uvScale` methods to adjust the placement and scaling
* of the texture if this Plane is using a single texture, and not a frame from a texture
* atlas or sprite sheet.
*
* The Plane Game Object also has the Animation component, allowing you to play animations
* across the Plane just as you would with a Sprite.
*
* Note that the Plane object is WebGL only and does not have a Canvas counterpart.
*
* The Plane origin is always 0.5 x 0.5 and cannot be changed.
*/
class Plane extends Phaser.GameObjects.Mesh {
/**
*
* @param scene The Scene to which this Plane belongs. A Plane can only belong to one Scene at a time.
* @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.
*/
constructor(scene: Phaser.Scene, x?: number, y?: number, texture?: string | Phaser.Textures.Texture, frame?: string | number, width?: number, height?: number, tile?: boolean);
/**
* The Animation State component of this Sprite.
*
* This component provides features to apply animations to this Sprite.
* It is responsible for playing, loading, queuing animations for later playback,
* mixing between animations and setting the current animation frame to this Sprite.
*/
anims: Phaser.Animations.AnimationState;
/**
* The width of this Plane in cells, not pixels.
*
* This value is read-only. To adjust it, see the `setGridSize` method.
*/
readonly gridWidth: number;
/**
* The height of this Plane in cells, not pixels.
*
* This value is read-only. To adjust it, see the `setGridSize` method.
*/
readonly gridHeight: number;
/**
* Is the texture of this Plane tiled across all cells, or not?
*
* This value is read-only. To adjust it, see the `setGridSize` method.
*/
readonly isTiled: boolean;
/**
* Do not change this value. It has no effect other than to break things.
*/
readonly originX: number;
/**
* Do not change this value. It has no effect other than to break things.
*/
readonly originY: number;
/**
* Modifies the layout of this Plane by adjusting the grid dimensions to the
* given width and height. The values are given in cells, not pixels.
*
* The `tile` parameter allows you to control if the texture is tiled, or
* applied across the entire Plane? A tiled texture will repeat with one
* iteration per cell. A non-tiled texture will be applied across the whole
* Plane.
*
* Note that if this Plane is using a single texture, not from a texture atlas
* or sprite sheet, then you can use the `Plane.uvScale` method to have much
* more fine-grained control over the texture tiling.
* @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.
*/
preDestroy(width?: number, height?: number, tile?: boolean): void;
/**
* Sets the height of this Plane to match the given value, in pixels.
*
* This adjusts the `Plane.viewPosition.z` value to achieve this.
*
* If no `value` parameter is given, it will set the view height to match
* that of the current texture frame the Plane is using.
* @param value The height, in pixels, to set this Plane view height to.
*/
setViewHeight(value?: number): void;
/**
* Creates a checkerboard style texture, based on the given colors and alpha
* values and applies it to this Plane, replacing any current texture it may
* have.
*
* The colors are used in an alternating pattern, like a chess board.
*
* Calling this method generates a brand new 16x16 pixel WebGLTexture internally
* and applies it to this Plane. While quite fast to do, you should still be
* mindful of calling this method either extensively, or in tight parts of
* your game.
* @param color1 The odd cell color, specified as a hex value. Default 0xffffff.
* @param color2 The even cell color, specified as a hex value. Default 0x0000ff.
* @param alpha1 The odd cell alpha value, specified as a number between 0 and 255. Default 255.
* @param alpha2 The even cell alpha value, specified as a number between 0 and 255. Default 255.
* @param height The view height of the Plane after creation, in pixels. Default 128.
*/
createCheckerboard(color1?: number, color2?: number, alpha1?: number, alpha2?: number, height?: number): void;
/**
* If this Plane has a Checkerboard Texture, this method will destroy it
* and reset the internal flag for it.
*/
removeCheckerboard(): void;
/**
* Start playing the given animation on this Plane.
*
* Animations in Phaser can either belong to the global Animation Manager, or specifically to this Plane.
*
* The benefit of a global animation is that multiple Game Objects can all play the same animation, without
* having to duplicate the data. You can just create it once and then play it on any animating Game Object.
*
* The following code shows how to create a global repeating animation. The animation will be created
* from all of the frames within the sprite sheet that was loaded with the key 'muybridge':
*
* ```javascript
* var config = {
* key: 'run',
* frames: 'muybridge',
* frameRate: 15,
* repeat: -1
* };
*
* // This code should be run from within a Scene:
* this.anims.create(config);
* ```
*
* However, if you wish to create an animation that is unique to this Plane, and this Plane alone,
* you can call the `Animation.create` method instead. It accepts the exact same parameters as when
* creating a global animation, however the resulting data is kept locally in this Plane.
*
* With the animation created, either globally or locally, you can now play it on this Plane:
*
* ```javascript
* const plane = this.add.plane(...);
* plane.play('run');
* ```
*
* Alternatively, if you wish to run it at a different frame rate for example, you can pass a config
* object instead:
*
* ```javascript
* const plane = this.add.plane(...);
* plane.play({ key: 'run', frameRate: 24 });
* ```
*
* When playing an animation on a Plane it will first check to see if it can find a matching key
* locally within the Plane. If it can, it will play the local animation. If not, it will then
* search the global Animation Manager and look for it there.
*
* If you need a Plane to be able to play both local and global animations, make sure they don't
* have conflicting keys.
*
* See the documentation for the `PlayAnimationConfig` config object for more details about this.
*
* Also, see the documentation in the Animation Manager for further details on creating animations.
* @param key The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object.
* @param ignoreIfPlaying If an animation is already playing then ignore this call. Default false.
*/
play(key: string | Phaser.Animations.Animation | Phaser.Types.Animations.PlayAnimationConfig, ignoreIfPlaying?: boolean): this;
/**
* Start playing the given animation on this Plane, in reverse.
*
* Animations in Phaser can either belong to the global Animation Manager, or specifically to a Game Object.
*
* The benefit of a global animation is that multiple Game Objects can all play the same animation, without
* having to duplicate the data. You can just create it once and then play it on any animating Game Object.
*
* The following code shows how to create a global repeating animation. The animation will be created
* from all of the frames within the sprite sheet that was loaded with the key 'muybridge':
*
* ```javascript
* var config = {
* key: 'run',
* frames: 'muybridge',
* frameRate: 15,
* repeat: -1
* };
*
* // This code should be run from within a Scene:
* this.anims.create(config);
* ```
*
* However, if you wish to create an animation that is unique to this Game Object, and this Game Object alone,
* you can call the `Animation.create` method instead. It accepts the exact same parameters as when
* creating a global animation, however the resulting data is kept locally in this Game Object.
*
* With the animation created, either globally or locally, you can now play it on this Game Object:
*
* ```javascript
* const plane = this.add.plane(...);
* plane.playReverse('run');
* ```
*
* Alternatively, if you wish to run it at a different frame rate, for example, you can pass a config
* object instead:
*
* ```javascript
* const plane = this.add.plane(...);
* plane.playReverse({ key: 'run', frameRate: 24 });
* ```
*
* When playing an animation on a Game Object it will first check to see if it can find a matching key
* locally within the Game Object. If it can, it will play the local animation. If not, it will then
* search the global Animation Manager and look for it there.
*
* If you need a Game Object to be able to play both local and global animations, make sure they don't
* have conflicting keys.
*
* See the documentation for the `PlayAnimationConfig` config object for more details about this.
*
* Also, see the documentation in the Animation Manager for further details on creating animations.
* @param key The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object.
* @param ignoreIfPlaying If an animation is already playing then ignore this call. Default false.
*/
playReverse(key: string | Phaser.Animations.Animation | Phaser.Types.Animations.PlayAnimationConfig, ignoreIfPlaying?: boolean): this;
/**
* Waits for the specified delay, in milliseconds, then starts playback of the given animation.
*
* If the animation _also_ has a delay value set in its config, it will be **added** to the delay given here.
*
* If an animation is already running and a new animation is given to this method, it will wait for
* the given delay before starting the new animation.
*
* If no animation is currently running, the given one begins after the delay.
*
* When playing an animation on a Game Object it will first check to see if it can find a matching key
* locally within the Game Object. If it can, it will play the local animation. If not, it will then
* search the global Animation Manager and look for it there.
* @param key The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object.
* @param delay The delay, in milliseconds, to wait before starting the animation playing.
*/
playAfterDelay(key: string | Phaser.Animations.Animation | Phaser.Types.Animations.PlayAnimationConfig, delay: number): this;
/**
* Waits for the current animation to complete the `repeatCount` number of repeat cycles, then starts playback
* of the given animation.
*
* You can use this to ensure there are no harsh jumps between two sets of animations, i.e. going from an
* idle animation to a walking animation, by making them blend smoothly into each other.
*
* If no animation is currently running, the given one will start immediately.
*
* When playing an animation on a Game Object it will first check to see if it can find a matching key
* locally within the Game Object. If it can, it will play the local animation. If not, it will then
* search the global Animation Manager and look for it there.
* @param key The string-based key of the animation to play, or an Animation instance, or a `PlayAnimationConfig` object.
* @param repeatCount How many times should the animation repeat before the next one starts? Default 1.
*/
playAfterRepeat(key: string | Phaser.Animations.Animation | Phaser.Types.Animations.PlayAnimationConfig, repeatCount?: number): this;
/**
* Immediately stops the current animation from playing and dispatches the `ANIMATION_STOP` events.
*
* If no animation is playing, no event will be dispatched.
*
* If there is another animation queued (via the `chain` method) then it will start playing immediately.
*/
stop(): this;
/**
* Stops the current animation from playing after the specified time delay, given in milliseconds.
*
* It then dispatches the `ANIMATION_STOP` event.
*
* If no animation is running, no events will be dispatched.
*
* If there is another animation in the queue (set via the `chain` method) then it will start playing,
* when the current one stops.
* @param delay The number of milliseconds to wait before stopping this animation.
*/
stopAfterDelay(delay: number): this;
/**
* Stops the current animation from playing after the given number of repeats.
*
* It then dispatches the `ANIMATION_STOP` event.
*
* If no animation is running, no events will be dispatched.
*
* If there is another animation in the queue (set via the `chain` method) then it will start playing,
* when the current one stops.
* @param repeatCount How many times should the animation repeat before stopping? Default 1.
*/
stopAfterRepeat(repeatCount?: number): this;
/**
* Stops the current animation from playing when it next sets the given frame.
* If this frame doesn't exist within the animation it will not stop it from playing.
*
* It then dispatches the `ANIMATION_STOP` event.
*
* If no animation is running, no events will be dispatched.
*
* If there is another animation in the queue (set via the `chain` method) then it will start playing,
* when the current one stops.
* @param frame The frame to check before stopping this animation.
*/
stopOnFrame(frame: Phaser.Animations.AnimationFrame): this;
/**
* Runs the preUpdate for this Plane, which will check its Animation State,
* if one is playing, and refresh view / model matrices, if updated.
* @param time The current timestamp.
* @param delta The delta time, in ms, elapsed since the last frame.
*/
protected preUpdate(time: number, delta: number): void;
/**
* 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 Mask this Game Object is using during render.
*/
mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask;
/**
* Sets the mask that this Game Object will use to render with.
*
* The mask must have been previously created and can be either a GeometryMask or a BitmapMask.
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* If a mask is already set on this Game Object it will be immediately replaced.
*
* Masks are positioned in global space and are not relative to the Game Object to which they
* are applied. The reason for this is that multiple Game Objects can all share the same mask.
*
* Masks have no impact on physics or input detection. They are purely a rendering component
* that allows you to limit what is visible during the render pass.
* @param mask The mask this Game Object will use when rendering.
*/
setMask(mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask): this;
/**
* Clears the mask that this Game Object was using.
* @param destroyMask Destroy the mask before clearing it? Default false.
*/
clearMask(destroyMask?: boolean): this;
/**
* Creates and returns a Bitmap Mask. This mask can be used by any Game Object,
* including this one, or a Dynamic Texture.
*
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* To create the mask you need to pass in a reference to a renderable Game Object.
* A renderable Game Object is one that uses a texture to render with, such as an
* Image, Sprite, Render Texture or BitmapText.
*
* If you do not provide a renderable object, and this Game Object has a texture,
* it will use itself as the object. This means you can call this method to create
* a Bitmap Mask from any renderable texture-based Game Object.
* @param maskObject The Game Object or Dynamic 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.
*/
createBitmapMask(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 and returns a Geometry Mask. This mask can be used by any Game Object,
* including this one.
*
* To create the mask you need to pass in a reference to a Graphics Game Object.
*
* If you do not provide a graphics object, and this Game Object is an instance
* of a Graphics object, then it will use itself to create the mask.
*
* This means you can call this method to create a Geometry Mask from any Graphics Game Object.
* @param graphics A Graphics Game Object, or any kind of Shape Game Object. The geometry within it will be used as the mask.
*/
createGeometryMask(graphics?: Phaser.GameObjects.Graphics | Phaser.GameObjects.Shape): Phaser.Display.Masks.GeometryMask;
/**
* The initial WebGL pipeline of this Game Object.
*
* If you call `resetPipeline` on this Game Object, the pipeline is reset to this default.
*/
defaultPipeline: Phaser.Renderer.WebGL.WebGLPipeline;
/**
* The current WebGL pipeline of this Game Object.
*/
pipeline: Phaser.Renderer.WebGL.WebGLPipeline;
/**
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
*/
pipelineData: object;
/**
* Sets the initial WebGL Pipeline of this Game Object.
*
* This should only be called during the instantiation of the Game Object. After that, use `setPipeline`.
* @param pipeline Either the string-based name of the pipeline, or a pipeline instance to set.
*/
initPipeline(pipeline?: string | Phaser.Renderer.WebGL.WebGLPipeline): boolean;
/**
* Sets the main WebGL Pipeline of this Game Object.
*
* Also sets the `pipelineData` property, if the parameter is given.
* @param pipeline Either the string-based name of the pipeline, or a pipeline instance to set.
* @param pipelineData Optional pipeline data object that is set in to the `pipelineData` property of this Game Object.
* @param copyData Should the pipeline data object be _deep copied_ into the `pipelineData` property of this Game Object? If `false` it will be set by reference instead. Default true.
*/
setPipeline(pipeline: string | Phaser.Renderer.WebGL.WebGLPipeline, pipelineData?: object, copyData?: boolean): this;
/**
* Adds an entry to the `pipelineData` object belonging to this Game Object.
*
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
*
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
* @param key The key of the pipeline data to set, update, or delete.
* @param value The value to be set with the key. If `undefined` then `key` will be deleted from the object.
*/
setPipelineData(key: string, value?: any): this;
/**
* Resets the WebGL Pipeline of this Game Object back to the default it was created with.
* @param resetData Reset the `pipelineData` object to being an empty object? Default false.
*/
resetPipeline(resetData?: boolean): boolean;
/**
* Gets the name of the WebGL Pipeline this Game Object is currently using.
*/
getPipelineName(): string;
/**
* Does this Game Object have any Post Pipelines set?
*/
hasPostPipeline: boolean;
/**
* The WebGL Post FX Pipelines this Game Object uses for post-render effects.
*
* The pipelines are processed in the order in which they appear in this array.
*
* If you modify this array directly, be sure to set the
* `hasPostPipeline` property accordingly.
*/
postPipelines: Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* An object to store pipeline specific data in, to be read by the pipelines this Game Object uses.
*/
postPipelineData: object;
/**
* The Pre FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.preFX.addBloom();
* ```
*
* Only the following Game Objects support Pre FX:
*
* * Image
* * Sprite
* * TileSprite
* * Text
* * RenderTexture
* * Video
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*/
preFX: Phaser.GameObjects.Components.FX | null;
/**
* The Post FX component of this Game Object.
*
* This component allows you to apply a variety of built-in effects to this Game Object, such
* as glow, blur, bloom, displacements, vignettes and more. You access them via this property,
* for example:
*
* ```js
* const player = this.add.sprite();
* player.postFX.addBloom();
* ```
*
* All FX are WebGL only and do not have Canvas counterparts.
*
* Please see the FX Class for more details and available methods.
*
* This property is always `null` until the `initPostPipeline` method is called.
*/
postFX: Phaser.GameObjects.Components.FX;
/**
* This should only be called during the instantiation of the Game Object.
*
* It is called by default by all core Game Objects and doesn't need
* calling again.
*
* After that, use `setPostPipeline`.
* @param preFX Does this Game Object support Pre FX? Default false.
*/
initPostPipeline(preFX?: boolean): void;
/**
* Sets one, or more, Post Pipelines on this Game Object.
*
* Post Pipelines are invoked after this Game Object has rendered to its target and
* are commonly used for post-fx.
*
* The post pipelines are appended to the `postPipelines` array belonging to this
* Game Object. When the renderer processes this Game Object, it iterates through the post
* pipelines in the order in which they appear in the array. If you are stacking together
* multiple effects, be aware that the order is important.
*
* If you call this method multiple times, the new pipelines will be appended to any existing
* post pipelines already set. Use the `resetPostPipeline` method to clear them first, if required.
*
* You can optionally also set the `postPipelineData` property, if the parameter is given.
* @param pipelines Either the string-based name of the pipeline, or a pipeline instance, or class, or an array of them.
* @param pipelineData Optional pipeline data object that is set in to the `postPipelineData` property of this Game Object.
* @param copyData Should the pipeline data object be _deep copied_ into the `postPipelineData` property of this Game Object? If `false` it will be set by reference instead. Default true.
*/
setPostPipeline(pipelines: string | string[] | Function | Function[] | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[], pipelineData?: object, copyData?: boolean): this;
/**
* Adds an entry to the `postPipelineData` object belonging to this Game Object.
*
* If the 'key' already exists, its value is updated. If it doesn't exist, it is created.
*
* If `value` is undefined, and `key` exists, `key` is removed from the data object.
* @param key The key of the pipeline data to set, update, or delete.
* @param value The value to be set with the key. If `undefined` then `key` will be deleted from the object.
*/
setPostPipelineData(key: string, value?: any): this;
/**
* Gets a Post Pipeline instance from this Game Object, based on the given name, and returns it.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
getPostPipeline(pipeline: string | Function | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): Phaser.Renderer.WebGL.Pipelines.PostFXPipeline | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline[];
/**
* Resets the WebGL Post Pipelines of this Game Object. It does this by calling
* the `destroy` method on each post pipeline and then clearing the local array.
* @param resetData Reset the `postPipelineData` object to being an empty object? Default false.
*/
resetPostPipeline(resetData?: boolean): void;
/**
* Removes a type of Post Pipeline instances from this Game Object, based on the given name, and destroys them.
*
* If you wish to remove all Post Pipelines use the `resetPostPipeline` method instead.
* @param pipeline The string-based name of the pipeline, or a pipeline class.
*/
removePostPipeline(pipeline: string | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline): this;
/**
* Removes all Pre and Post FX Controllers from this Game Object.
*
* If you wish to remove a single controller, use the `preFX.remove(fx)` or `postFX.remove(fx)` methods instead.
*
* If you wish to clear a single controller, use the `preFX.clear()` or `postFX.clear()` methods instead.
*/
clearFX(): 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;
/**
* An internal method that resets the perspective projection for this Plane
* when it changes texture or frame, and also resets the cell UV coordinates,
* if required.
* @param resetUV Reset all of the cell UV coordinates? Default true.
*/
setSizeToFrame(resetUV?: 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.
*
* Calling this method 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 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.
* @param updateSize Should this call adjust the size of the Game Object? Default true.
* @param updateOrigin Should this call change the origin of the Game Object? Default true.
*/
setTexture(key: string | Phaser.Textures.Texture, frame?: string | number, updateSize?: boolean, updateOrigin?: boolean): 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;
/**
* 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 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.
*/
class PointLight extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.AlphaSingle, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.GetBounds, Phaser.GameObjects.Components.Mask, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.PostPipeline, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible {
/**
*
* @param scene The Scene to which this Point Light belongs. A Point Light can only belong to one Scene at a time.
* @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.
*/
constructor(scene: Phaser.Scene, x: number, y: number, color?: number, radius?: number, intensity?: number, attenuation?: number);
/**
* The color of this Point Light. This property is an instance of a
* Color object, so you can use the methods within it, such as `setTo(r, g, b)`
* to change the color value.
*/
color: Phaser.Display.Color;
/**
* The intensity of the Point Light.
*
* The colors of the light are multiplied by this value during rendering.
*/
intensity: number;
/**
* The attenuation of the Point Light.
*
* This value controls the force with which the light falls-off from the center of the light.
*
* Use small float-based values, i.e. 0.1.
*/
attenuation: number;
/**
* The radius of the Point Light.
*/
radius: number;
/**
* 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;
/**
* Gets the center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the top-left corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getTopLeft(output?: O, includeParent?: boolean): O;
/**
* Gets the top-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getTopCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the top-right corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getTopRight(output?: O, includeParent?: boolean): O;
/**
* Gets the left-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getLeftCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the right-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getRightCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the bottom-left corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getBottomLeft(output?: O, includeParent?: boolean): O;
/**
* Gets the bottom-center coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getBottomCenter(output?: O, includeParent?: boolean): O;
/**
* Gets the bottom-right corner coordinate of this Game Object, regardless of origin.
*
* The returned point is calculated in local space and does not factor in any parent Containers,
* unless the `includeParent` argument is set to `true`.
* @param output An object to store the values in. If not provided a new Vector2 will be created.
* @param includeParent If this Game Object has a parent Container, include it (and all other ancestors) in the resulting vector? Default false.
*/
getBottomRight(output?: O, includeParent?: boolean): O;
/**
* Gets the bounds of this Game Object, regardless of origin.
*
* The values are stored and returned in a Rectangle, or Rectangle-like, object.
* @param output An object to store the values in. If not provided a new Rectangle will be created.
*/
getBounds(output?: O): O;
/**
* The Mask this Game Object is using during render.
*/
mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask;
/**
* Sets the mask that this Game Object will use to render with.
*
* The mask must have been previously created and can be either a GeometryMask or a BitmapMask.
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* If a mask is already set on this Game Object it will be immediately replaced.
*
* Masks are positioned in global space and are not relative to the Game Object to which they
* are applied. The reason for this is that multiple Game Objects can all share the same mask.
*
* Masks have no impact on physics or input detection. They are purely a rendering component
* that allows you to limit what is visible during the render pass.
* @param mask The mask this Game Object will use when rendering.
*/
setMask(mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask): this;
/**
* Clears the mask that this Game Object was using.
* @param destroyMask Destroy the mask before clearing it? Default false.
*/
clearMask(destroyMask?: boolean): this;
/**
* Creates and returns a Bitmap Mask. This mask can be used by any Game Object,
* including this one, or a Dynamic Texture.
*
* Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.
*
* To create the mask you need to pass in a reference to a renderable Game Object.
* A renderable Game Object is one that uses a texture to render with, such as an
* Image, Sprite, Render Texture or BitmapText.
*
* If you do not provide a renderable object, and this Game Object has a texture,
* it will use itself as the object. This means you can call this method to create
* a Bitmap Mask from any renderable texture-based Game Object.
* @param maskObject The Game Object or Dynamic 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.
*/
createBitmapMask(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 and returns a Geometry Mask. This mask can be used by any Game Object,
* including this one.
*
* To create the mask you need to pass in a reference to a Graphics Game Object.
*
* If you do not provide a graphics object, and this Game Object is an instance
* of a Graphics object, then it will use itself to create the mask.
*
* This means you can call this method to create a Geometry Mask from any Graphics Game Object.
* @param graphics A Graphics Game Object, or any kind of Shape Game Object. The geometry within it will be used as the mask.
*/
createGeometryMask