`
* 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;
/**
* Sets this Game Object to be at the top of the display list, or the top of its parent container.
*
* Being at the top means it will render on-top of everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToTop(): this;
/**
* Sets this Game Object to the back of the display list, or the back of its parent container.
*
* Being at the back means it will render below everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToBack(): this;
/**
* Move this Game Object so that it appears above the given Game Object.
*
* This means it will render immediately after the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be above.
*/
setAbove(gameObject: Phaser.GameObjects.GameObject): this;
/**
* Move this Game Object so that it appears below the given Game Object.
*
* This means it will render immediately under the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be below.
*/
setBelow(gameObject: Phaser.GameObjects.GameObject): 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 Metadata Event.
*
* This event is dispatched when a Video has access to the metadata.
*
* Listen for it from a Video Game Object instance using `Video.on('metadata', listener)`.
*/
const VIDEO_METADATA: 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;
/**
* Sets this Game Object to be at the top of the display list, or the top of its parent container.
*
* Being at the top means it will render on-top of everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToTop(): this;
/**
* Sets this Game Object to the back of the display list, or the back of its parent container.
*
* Being at the back means it will render below everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToBack(): this;
/**
* Move this Game Object so that it appears above the given Game Object.
*
* This means it will render immediately after the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be above.
*/
setAbove(gameObject: Phaser.GameObjects.GameObject): this;
/**
* Move this Game Object so that it appears below the given Game Object.
*
* This means it will render immediately under the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be below.
*/
setBelow(gameObject: Phaser.GameObjects.GameObject): 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;
}
/**
* 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;
/**
* Sets this Game Object to be at the top of the display list, or the top of its parent container.
*
* Being at the top means it will render on-top of everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToTop(): this;
/**
* Sets this Game Object to the back of the display list, or the back of its parent container.
*
* Being at the back means it will render below everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToBack(): this;
/**
* Move this Game Object so that it appears above the given Game Object.
*
* This means it will render immediately after the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be above.
*/
setAbove(gameObject: Phaser.GameObjects.GameObject): this;
/**
* Move this Game Object so that it appears below the given Game Object.
*
* This means it will render immediately under the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be below.
*/
setBelow(gameObject: Phaser.GameObjects.GameObject): 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 | null;
/**
* 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;
/**
* Sets this Game Object to be at the top of the display list, or the top of its parent container.
*
* Being at the top means it will render on-top of everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToTop(): this;
/**
* Sets this Game Object to the back of the display list, or the back of its parent container.
*
* Being at the back means it will render below everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToBack(): this;
/**
* Move this Game Object so that it appears above the given Game Object.
*
* This means it will render immediately after the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be above.
*/
setAbove(gameObject: Phaser.GameObjects.GameObject): this;
/**
* Move this Game Object so that it appears below the given Game Object.
*
* This means it will render immediately under the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be below.
*/
setBelow(gameObject: Phaser.GameObjects.GameObject): 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 | null;
/**
* 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 size as well as coordinates can not exceed the the size of the texture frame.
*
* 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 rectangle 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. Cannot be negative or exceed the Frame width. 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. Cannot be negative or exceed the Frame height.
* @param width The width of the crop rectangle in pixels. Cannot exceed the Frame width.
* @param height The height of the crop rectangle in pixels. Cannot exceed the Frame height.
*/
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;
/**
* 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 a reference to the array which contains all Game Objects in this Layer.
*
* This is a reference, not a copy of it, so be very careful not to mutate 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;
/**
* Sets this Game Object to be at the top of the display list, or the top of its parent container.
*
* Being at the top means it will render on-top of everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToTop(): this;
/**
* Sets this Game Object to the back of the display list, or the back of its parent container.
*
* Being at the back means it will render below everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToBack(): this;
/**
* Move this Game Object so that it appears above the given Game Object.
*
* This means it will render immediately after the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be above.
*/
setAbove(gameObject: Phaser.GameObjects.GameObject): this;
/**
* Move this Game Object so that it appears below the given Game Object.
*
* This means it will render immediately under the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be below.
*/
setBelow(gameObject: Phaser.GameObjects.GameObject): 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 Light.
*
* These are created by the {@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.
*
* Lights cannot be added to Containers. They are designed to exist in the root of a Scene.
*/
class Light extends Phaser.Geom.Circle implements Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.ScrollFactor, 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;
/**
* 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.
* @param config An input configuration object but it will ignore hitArea, hitAreaCallback and pixelPerfect with associated alphaTolerance properties.
*/
setInteractive(config?: Phaser.Types.Input.InputConfiguration): 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;
/**
* Sets this Game Object to be at the top of the display list, or the top of its parent container.
*
* Being at the top means it will render on-top of everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToTop(): this;
/**
* Sets this Game Object to the back of the display list, or the back of its parent container.
*
* Being at the back means it will render below everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToBack(): this;
/**
* Move this Game Object so that it appears above the given Game Object.
*
* This means it will render immediately after the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be above.
*/
setAbove(gameObject: Phaser.GameObjects.GameObject): this;
/**
* Move this Game Object so that it appears below the given Game Object.
*
* This means it will render immediately under the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be below.
*/
setBelow(gameObject: Phaser.GameObjects.GameObject): 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 | null;
/**
* 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 3.70 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 horizontal row (C). Set to zero or undefined to create a 3 slice object. Default 0.
* @param bottomHeight The size of the bottom horizontal 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 horizontal row (C). Set to zero or undefined to create a 3 slice object. Default 0.
* @param bottomHeight The size of the bottom horizontal 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;
/**
* Sets this Game Object to be at the top of the display list, or the top of its parent container.
*
* Being at the top means it will render on-top of everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToTop(): this;
/**
* Sets this Game Object to the back of the display list, or the back of its parent container.
*
* Being at the back means it will render below everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToBack(): this;
/**
* Move this Game Object so that it appears above the given Game Object.
*
* This means it will render immediately after the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be above.
*/
setAbove(gameObject: Phaser.GameObjects.GameObject): this;
/**
* Move this Game Object so that it appears below the given Game Object.
*
* This means it will render immediately under the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be below.
*/
setBelow(gameObject: Phaser.GameObjects.GameObject): 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 | null;
/**
* 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;
}
/**
* 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 the configuration for the Emitter.
*
* These are populated as part of the Emitter configuration parsing.
*
* You typically do not access them directly, but instead use the
* `ParticleEmitter.setConfig` or `ParticleEmitter.updateConfig` methods.
*/
config: Phaser.Types.GameObjects.Particles.ParticleEmitterConfig;
/**
* 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;
/**
* Takes an existing Emitter Configuration file and updates this Emitter.
* Existing properties are overriden while new properties are added. The
* updated configuration is then passed to the `setConfig` method to reset
* the Emitter with the updated configuration.
* @param config Settings for this emitter.
*/
updateConfig(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;
/**
* Sets this Game Object to be at the top of the display list, or the top of its parent container.
*
* Being at the top means it will render on-top of everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToTop(): this;
/**
* Sets this Game Object to the back of the display list, or the back of its parent container.
*
* Being at the back means it will render below everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToBack(): this;
/**
* Move this Game Object so that it appears above the given Game Object.
*
* This means it will render immediately after the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be above.
*/
setAbove(gameObject: Phaser.GameObjects.GameObject): this;
/**
* Move this Game Object so that it appears below the given Game Object.
*
* This means it will render immediately under the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be below.
*/
setBelow(gameObject: Phaser.GameObjects.GameObject): 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 | null;
/**
* 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 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;
}
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;
/**
* Sets this Game Object to be at the top of the display list, or the top of its parent container.
*
* Being at the top means it will render on-top of everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToTop(): this;
/**
* Sets this Game Object to the back of the display list, or the back of its parent container.
*
* Being at the back means it will render below everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToBack(): this;
/**
* Move this Game Object so that it appears above the given Game Object.
*
* This means it will render immediately after the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be above.
*/
setAbove(gameObject: Phaser.GameObjects.GameObject): this;
/**
* Move this Game Object so that it appears below the given Game Object.
*
* This means it will render immediately under the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be below.
*/
setBelow(gameObject: Phaser.GameObjects.GameObject): 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 | null;
/**
* 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 size as well as coordinates can not exceed the the size of the texture frame.
*
* 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 rectangle 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. Cannot be negative or exceed the Frame width. 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. Cannot be negative or exceed the Frame height.
* @param width The width of the crop rectangle in pixels. Cannot exceed the Frame width.
* @param height The height of the crop rectangle in pixels. Cannot exceed the Frame height.
*/
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. The animation frame size must be fixed
* as the first frame will be the size of the entire animation, for example use a `SpriteSheet`.
*
* 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;
/**
* Sets this Game Object to be at the top of the display list, or the top of its parent container.
*
* Being at the top means it will render on-top of everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToTop(): this;
/**
* Sets this Game Object to the back of the display list, or the back of its parent container.
*
* Being at the back means it will render below everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToBack(): this;
/**
* Move this Game Object so that it appears above the given Game Object.
*
* This means it will render immediately after the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be above.
*/
setAbove(gameObject: Phaser.GameObjects.GameObject): this;
/**
* Move this Game Object so that it appears below the given Game Object.
*
* This means it will render immediately under the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be below.
*/
setBelow(gameObject: Phaser.GameObjects.GameObject): 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 | null;
/**
* 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;
/**
* Sets this Game Object to be at the top of the display list, or the top of its parent container.
*
* Being at the top means it will render on-top of everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToTop(): this;
/**
* Sets this Game Object to the back of the display list, or the back of its parent container.
*
* Being at the back means it will render below everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToBack(): this;
/**
* Move this Game Object so that it appears above the given Game Object.
*
* This means it will render immediately after the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be above.
*/
setAbove(gameObject: Phaser.GameObjects.GameObject): this;
/**
* Move this Game Object so that it appears below the given Game Object.
*
* This means it will render immediately under the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be below.
*/
setBelow(gameObject: Phaser.GameObjects.GameObject): 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 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 | null;
/**
* 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;
/**
* 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 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.
*
* In versions of Phaser before 3.60 a Render Texture was the only way you could create a texture
* like this, that had the ability to be drawn on. But in 3.60 we split the core functions out to
* the Dynamic Texture class as it made a lot more sense for them to reside in there. As a result,
* the Render Texture is now a light-weight shim that sits on-top of an Image Game Object and offers
* proxy methods to the features available from a Dynamic Texture.
*
* **When should you use a Render Texture vs. a Dynamic Texture?**
*
* You should use a Dynamic Texture if the texture is going to be used by multiple Game Objects,
* or you want to use it across multiple Scenes, because textures are globally stored.
*
* You should use a Dynamic Texture if the texture isn't going to be displayed in-game, but is
* instead going to be used for something like a mask or shader.
*
* You should use a Render Texture if you need to display the texture in-game on a single Game Object,
* as it provides the convenience of wrapping an Image and Dynamic Texture together for you.
*
* Under WebGL1, a FrameBuffer, which is what this Dynamic Texture uses internally, cannot be anti-aliased.
* This means that when drawing objects such as Shapes or Graphics instances to this texture, they may appear
* to be drawn with no aliasing around the edges. This is a technical limitation of WebGL1. To get around it,
* create your shape as a texture in an art package, then draw that to this texture.
*/
class RenderTexture extends Phaser.GameObjects.Image {
/**
*
* @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. Default 0.
* @param y The vertical position of this Game Object in the world. Default 0.
* @param width The width of the Render Texture. Default 32.
* @param height The height of the Render Texture. Default 32.
*/
constructor(scene: Phaser.Scene, x?: number, y?: number, width?: number, height?: number);
/**
* An internal Camera that can be used to move around this Render Texture.
*
* Control it just like you would any Scene Camera. The difference is that it only impacts
* the placement of Game Objects that you then draw to this texture.
*
* You can scroll, zoom and rotate this Camera.
*
* This property is a reference to `RenderTexture.texture.camera`.
*/
camera: Phaser.Cameras.Scene2D.BaseCamera;
/**
* Sets the internal size of this Render Texture, 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;
/**
* Resizes the Render Texture to the new dimensions given.
*
* In WebGL it will destroy and then re-create the frame buffer being used by the Render Texture.
* In Canvas it will resize the underlying canvas element.
*
* Both approaches will erase everything currently drawn to the Render Texture.
*
* If the dimensions given are the same as those already being used, calling this method will do nothing.
* @param width The new width of the Render Texture.
* @param height The new height of the Render Texture. If not specified, will be set the same as the `width`. Default width.
*/
resize(width: number, height?: number): this;
/**
* Stores a copy of this Render Texture in the Texture Manager using the given key.
*
* After doing this, any texture based Game Object, such as a Sprite, can use the contents of this
* Render Texture by using the texture key:
*
* ```javascript
* var rt = this.add.renderTexture(0, 0, 128, 128);
*
* // Draw something to the Render Texture
*
* rt.saveTexture('doodle');
*
* this.add.image(400, 300, 'doodle');
* ```
*
* Updating the contents of this Render Texture will automatically update _any_ Game Object
* that is using it as a texture. Calling `saveTexture` again will not save another copy
* of the same texture, it will just rename the key of the existing copy.
*
* By default it will create a single base texture. You can add frames to the texture
* by using the `Texture.add` method. After doing this, you can then allow Game Objects
* to use a specific frame from a Render Texture.
*
* If you destroy this Render Texture, any Game Object using it via the Texture Manager will
* stop rendering. Ensure you remove the texture from the Texture Manager and any Game Objects
* using it first, before destroying this Render Texture.
* @param key The unique key to store the texture as within the global Texture Manager.
*/
saveTexture(key: string): Phaser.Textures.DynamicTexture;
/**
* Fills this Render Texture with the given color.
*
* By default it will fill the entire texture, however you can set it to fill a specific
* rectangular area by using the x, y, width and height arguments.
*
* The color should be given in hex format, i.e. 0xff0000 for red, 0x00ff00 for green, etc.
* @param rgb The color to fill this Render Texture with, such as 0xff0000 for red.
* @param alpha The alpha value used by the fill. Default 1.
* @param x The left coordinate of the fill rectangle. Default 0.
* @param y The top coordinate of the fill rectangle. Default 0.
* @param width The width of the fill rectangle. Default this.width.
* @param height The height of the fill rectangle. Default this.height.
*/
fill(rgb: number, alpha?: number, x?: number, y?: number, width?: number, height?: number): this;
/**
* Fully clears this Render Texture, erasing everything from it and resetting it back to
* a blank, transparent, texture.
*/
clear(): this;
/**
* Takes the given texture key and frame and then stamps it at the given
* x and y coordinates. You can use the optional 'config' argument to provide
* lots more options about how the stamp is applied, including the alpha,
* tint, angle, scale and origin.
*
* By default, the frame will stamp on the x/y coordinates based on its center.
*
* If you wish to stamp from the top-left, set the config `originX` and
* `originY` properties both to zero.
* @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. Set to `null` to skip this argument if not required.
* @param x The x position to draw the frame at. Default 0.
* @param y The y position to draw the frame at. Default 0.
* @param config The stamp configuration object, allowing you to set the alpha, tint, angle, scale and origin of the stamp.
*/
stamp(key: string, frame?: string | number, x?: number, y?: number, config?: Phaser.Types.Textures.StampConfig): this;
/**
* Draws the given object, or an array of objects, to this Render Texture using a blend mode of ERASE.
* This has the effect of erasing any filled pixels present in the objects from this texture.
*
* It can accept any of the following:
*
* * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
* * Tilemap Layers.
* * A Group. The contents of which will be iterated and drawn in turn.
* * A Container. The contents of which will be iterated fully, and drawn in turn.
* * A Scene Display List. Pass in `Scene.children` to draw the whole list.
* * Another Dynamic Texture, or a Render Texture.
* * A Texture Frame instance.
* * A string. This is used to look-up the texture from the Texture Manager.
*
* Note: You cannot erase a Render Texture from itself.
*
* If passing in a Group or Container it will only draw children that return `true`
* when their `willRender()` method is called. I.e. a Container with 10 children,
* 5 of which have `visible=false` will only draw the 5 visible ones.
*
* If passing in an array of Game Objects it will draw them all, regardless if
* they pass a `willRender` check or not.
*
* You can pass in a string in which case it will look for a texture in the Texture
* Manager matching that string, and draw the base frame.
*
* You can pass in the `x` and `y` coordinates to draw the objects at. The use of
* the coordinates differ based on what objects are being drawn. If the object is
* a Group, Container or Display List, the coordinates are _added_ to the positions
* of the children. For all other types of object, the coordinates are exact.
*
* Calling this method causes the WebGL batch to flush, so it can write the texture
* data to the framebuffer being used internally. The batch is flushed at the end,
* after the entries have been iterated. So if you've a bunch of objects to draw,
* try and pass them in an array in one single call, rather than making lots of
* separate calls.
* @param entries Any renderable Game Object, or Group, Container, Display List, Render Texture, Texture Frame, or an array of any of these.
* @param x The x position to draw the Frame at, or the offset applied to the object. Default 0.
* @param y The y position to draw the Frame at, or the offset applied to the object. Default 0.
*/
erase(entries: any, x?: number, y?: number): this;
/**
* Draws the given object, or an array of objects, to this Render Texture.
*
* It can accept any of the following:
*
* * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
* * Tilemap Layers.
* * A Group. The contents of which will be iterated and drawn in turn.
* * A Container. The contents of which will be iterated fully, and drawn in turn.
* * A Scene Display List. Pass in `Scene.children` to draw the whole list.
* * Another Dynamic Texture, or a Render Texture.
* * A Texture Frame instance.
* * A string. This is used to look-up the texture from the Texture Manager.
*
* Note 1: You cannot draw a Render Texture to itself.
*
* Note 2: For Game Objects that have Post FX Pipelines, the pipeline _cannot_ be
* used when drawn to this texture.
*
* If passing in a Group or Container it will only draw children that return `true`
* when their `willRender()` method is called. I.e. a Container with 10 children,
* 5 of which have `visible=false` will only draw the 5 visible ones.
*
* If passing in an array of Game Objects it will draw them all, regardless if
* they pass a `willRender` check or not.
*
* You can pass in a string in which case it will look for a texture in the Texture
* Manager matching that string, and draw the base frame. If you need to specify
* exactly which frame to draw then use the method `drawFrame` instead.
*
* You can pass in the `x` and `y` coordinates to draw the objects at. The use of
* the coordinates differ based on what objects are being drawn. If the object is
* a Group, Container or Display List, the coordinates are _added_ to the positions
* of the children. For all other types of object, the coordinates are exact.
*
* The `alpha` and `tint` values are only used by Texture Frames.
* Game Objects use their own alpha and tint values when being drawn.
*
* Calling this method causes the WebGL batch to flush, so it can write the texture
* data to the framebuffer being used internally. The batch is flushed at the end,
* after the entries have been iterated. So if you've a bunch of objects to draw,
* try and pass them in an array in one single call, rather than making lots of
* separate calls.
* @param entries Any renderable Game Object, or Group, Container, Display List, other Render Texture, Texture Frame or an array of any of these.
* @param x The x position to draw the Frame at, or the offset applied to the object. Default 0.
* @param y The y position to draw the Frame at, or the offset applied to the object. Default 0.
* @param alpha The alpha value. Only used when drawing Texture Frames to this texture. Game Objects use their own alpha. Default 1.
* @param tint The tint color value. Only used when drawing Texture Frames to this texture. Game Objects use their own tint. WebGL only. Default 0xffffff.
*/
draw(entries: any, x?: number, y?: number, alpha?: number, tint?: number): this;
/**
* Draws the Texture Frame to the Render Texture at the given position.
*
* Textures are referenced by their string-based keys, as stored in the Texture Manager.
*
* ```javascript
* var rt = this.add.renderTexture(0, 0, 800, 600);
* rt.drawFrame(key, frame);
* ```
*
* You can optionally provide a position, alpha and tint value to apply to the frame
* before it is drawn.
*
* Calling this method will cause a batch flush, so if you've got a stack of things to draw
* in a tight loop, try using the `draw` method instead.
*
* If you need to draw a Sprite to this Render Texture, use the `draw` method instead.
* @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. Set to `null` to skip this argument if not required.
* @param x The x position to draw the frame at. Default 0.
* @param y The y position to draw the frame at. Default 0.
* @param alpha The alpha value. Only used when drawing Texture Frames to this texture. Default 1.
* @param tint The tint color value. Only used when drawing Texture Frames to this texture. WebGL only. Default 0xffffff.
*/
drawFrame(key: string, frame?: string | number, x?: number, y?: number, alpha?: number, tint?: number): this;
/**
* Takes the given Texture Frame and draws it to this Render Texture as a fill pattern,
* i.e. in a grid-layout based on the frame dimensions.
*
* Textures are referenced by their string-based keys, as stored in the Texture Manager.
*
* You can optionally provide a position, width, height, alpha and tint value to apply to
* the frames before they are drawn. The position controls the top-left where the repeating
* fill will start from. The width and height control the size of the filled area.
*
* The position can be negative if required, but the dimensions cannot.
*
* Calling this method will cause a batch flush by default. Use the `skipBatch` argument
* to disable this if this call is part of a larger batch draw.
* @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. Set to `null` to skip this argument if not required.
* @param x The x position to start drawing the frames from (can be negative to offset). Default 0.
* @param y The y position to start drawing the frames from (can be negative to offset). Default 0.
* @param width The width of the area to repeat the frame within. Defaults to the width of this Dynamic Texture. Default this.width.
* @param height The height of the area to repeat the frame within. Defaults to the height of this Dynamic Texture. Default this.height.
* @param alpha The alpha to use. Defaults to 1, no alpha. Default 1.
* @param tint WebGL only. The tint color to use. Leave as undefined, or 0xffffff to have no tint. Default 0xffffff.
* @param skipBatch Skip beginning and ending a batch with this call. Use if this is part of a bigger batched draw. Default false.
*/
repeat(key: string, frame?: string | number, x?: number, y?: number, width?: number, height?: number, alpha?: number, tint?: number, skipBatch?: boolean): this;
/**
* Use this method if you need to batch draw a large number of Game Objects to
* this Render Texture in a single pass, or on a frequent basis. This is especially
* useful under WebGL, however, if your game is using Canvas only, it will not make
* any speed difference in that situation.
*
* This method starts the beginning of a batched draw, unless one is already open.
*
* Batched drawing is faster than calling `draw` in loop, but you must be careful
* to manage the flow of code and remember to call `endDraw()` when you're finished.
*
* If you don't need to draw large numbers of objects it's much safer and easier
* to use the `draw` method instead.
*
* The flow should be:
*
* ```javascript
* // Call once:
* RenderTexture.beginDraw();
*
* // repeat n times:
* RenderTexture.batchDraw();
* // or
* RenderTexture.batchDrawFrame();
*
* // Call once:
* RenderTexture.endDraw();
* ```
*
* Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you
* have started a batch. Also, be very careful not to destroy this Render Texture while the
* batch is still open. Doing so will cause a run-time error in the WebGL Renderer.
*
* You can use the `RenderTexture.texture.isDrawing` boolean property to tell if a batch is
* currently open, or not.
*/
beginDraw(): this;
/**
* Use this method if you have already called `beginDraw` and need to batch
* draw a large number of objects to this Render Texture.
*
* This method batches the drawing of the given objects to this texture,
* without causing a WebGL bind or batch flush for each one.
*
* It is faster than calling `draw`, but you must be careful to manage the
* flow of code and remember to call `endDraw()`. If you don't need to draw large
* numbers of objects it's much safer and easier to use the `draw` method instead.
*
* The flow should be:
*
* ```javascript
* // Call once:
* RenderTexture.beginDraw();
*
* // repeat n times:
* RenderTexture.batchDraw();
* // or
* RenderTexture.batchDrawFrame();
*
* // Call once:
* RenderTexture.endDraw();
* ```
*
* Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you
* have started a batch. Also, be very careful not to destroy this Render Texture while the
* batch is still open. Doing so will cause a run-time error in the WebGL Renderer.
*
* You can use the `RenderTexture.texture.isDrawing` boolean property to tell if a batch is
* currently open, or not.
*
* This method can accept any of the following:
*
* * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
* * Tilemap Layers.
* * A Group. The contents of which will be iterated and drawn in turn.
* * A Container. The contents of which will be iterated fully, and drawn in turn.
* * A Scene's Display List. Pass in `Scene.children` to draw the whole list.
* * Another Dynamic Texture or Render Texture.
* * A Texture Frame instance.
* * A string. This is used to look-up a texture from the Texture Manager.
*
* Note: You cannot draw a Render Texture to itself.
*
* If passing in a Group or Container it will only draw children that return `true`
* when their `willRender()` method is called. I.e. a Container with 10 children,
* 5 of which have `visible=false` will only draw the 5 visible ones.
*
* If passing in an array of Game Objects it will draw them all, regardless if
* they pass a `willRender` check or not.
*
* You can pass in a string in which case it will look for a texture in the Texture
* Manager matching that string, and draw the base frame. If you need to specify
* exactly which frame to draw then use the method `drawFrame` instead.
*
* You can pass in the `x` and `y` coordinates to draw the objects at. The use of
* the coordinates differ based on what objects are being drawn. If the object is
* a Group, Container or Display List, the coordinates are _added_ to the positions
* of the children. For all other types of object, the coordinates are exact.
*
* The `alpha` and `tint` values are only used by Texture Frames.
* Game Objects use their own alpha and tint values when being drawn.
* @param entries Any renderable Game Object, or Group, Container, Display List, other Dynamic or Texture, Texture Frame or an array of any of these.
* @param x The x position to draw the Frame at, or the offset applied to the object. Default 0.
* @param y The y position to draw the Frame at, or the offset applied to the object. Default 0.
* @param alpha The alpha value. Only used when drawing Texture Frames to this texture. Game Objects use their own alpha. Default 1.
* @param tint The tint color value. Only used when drawing Texture Frames to this texture. Game Objects use their own tint. WebGL only. Default 0xffffff.
*/
batchDraw(entries: any, x?: number, y?: number, alpha?: number, tint?: number): this;
/**
* Use this method if you have already called `beginDraw` and need to batch
* draw a large number of texture frames to this Render Texture.
*
* This method batches the drawing of the given frames to this Render Texture,
* without causing a WebGL bind or batch flush for each one.
*
* It is faster than calling `drawFrame`, but you must be careful to manage the
* flow of code and remember to call `endDraw()`. If you don't need to draw large
* numbers of frames it's much safer and easier to use the `drawFrame` method instead.
*
* The flow should be:
*
* ```javascript
* // Call once:
* RenderTexture.beginDraw();
*
* // repeat n times:
* RenderTexture.batchDraw();
* // or
* RenderTexture.batchDrawFrame();
*
* // Call once:
* RenderTexture.endDraw();
* ```
*
* Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you
* have started a batch. Also, be very careful not to destroy this Render Texture while the
* batch is still open. Doing so will cause a run-time error in the WebGL Renderer.
*
* You can use the `RenderTexture.texture.isDrawing` boolean property to tell if a batch is
* currently open, or not.
*
* Textures are referenced by their string-based keys, as stored in the Texture Manager.
*
* You can optionally provide a position, alpha and tint value to apply to the frame
* before it is drawn.
* @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.
* @param x The x position to draw the frame at. Default 0.
* @param y The y position to draw the frame at. Default 0.
* @param alpha The alpha value. Only used when drawing Texture Frames to this texture. Game Objects use their own alpha. Default 1.
* @param tint The tint color value. Only used when drawing Texture Frames to this texture. Game Objects use their own tint. WebGL only. Default 0xffffff.
*/
batchDrawFrame(key: string, frame?: string | number, x?: number, y?: number, alpha?: number, tint?: number): this;
/**
* Use this method to finish batch drawing to this Render Texture.
*
* Doing so will stop the WebGL Renderer from capturing draws and then blit the
* framebuffer to the Render Target owned by this texture.
*
* Calling this method without first calling `beginDraw` will have no effect.
*
* Batch drawing is faster than calling `draw`, but you must be careful to manage the
* flow of code and remember to call `endDraw()` when you're finished.
*
* If you don't need to draw large numbers of objects it's much safer and easier
* to use the `draw` method instead.
*
* The flow should be:
*
* ```javascript
* // Call once:
* RenderTexture.beginDraw();
*
* // repeat n times:
* RenderTexture.batchDraw();
* // or
* RenderTexture.batchDrawFrame();
*
* // Call once:
* RenderTexture.endDraw();
* ```
*
* Do not call any methods other than `batchDraw`, `batchDrawFrame`, or `endDraw` once you
* have started a batch. Also, be very careful not to destroy this Render Texture while the
* batch is still open. Doing so will cause a run-time error in the WebGL Renderer.
*
* You can use the `RenderTexture.texture.isDrawing` boolean property to tell if a batch is
* currently open, or not.
* @param erase Draws all objects in this batch using a blend mode of ERASE. This has the effect of erasing any filled pixels in the objects being drawn. Default false.
*/
endDraw(erase?: boolean): this;
/**
* Takes a snapshot of the given area of this Render Texture.
*
* The snapshot is taken immediately, but the results are returned via the given callback.
*
* To capture the whole Render Texture see the `snapshot` method.
* To capture just a specific pixel, see the `snapshotPixel` method.
*
* Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer
* into an ArrayBufferView. It then parses this, copying the contents to a temporary Canvas and finally
* creating an Image object from it, which is the image returned to the callback provided.
*
* All in all, this is a computationally expensive and blocking process, which gets more expensive
* the larger the resolution this Render Texture has, so please be careful how you employ this in your game.
* @param x The x coordinate to grab from.
* @param y The y coordinate to grab from.
* @param width The width of the area to grab.
* @param height The height of the area to grab.
* @param callback The Function to invoke after the snapshot image is created.
* @param type The format of the image to create, usually `image/png` or `image/jpeg`. Default 'image/png'.
* @param encoderOptions The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. Default 0.92.
*/
snapshotArea(x: number, y: number, width: number, height: number, callback: Phaser.Types.Renderer.Snapshot.SnapshotCallback, type?: string, encoderOptions?: number): this;
/**
* Takes a snapshot of the whole of this Render Texture.
*
* The snapshot is taken immediately, but the results are returned via the given callback.
*
* To capture a portion of this Render Texture see the `snapshotArea` method.
* To capture just a specific pixel, see the `snapshotPixel` method.
*
* Snapshots work by using the WebGL `readPixels` feature to grab every pixel from the frame buffer
* into an ArrayBufferView. It then parses this, copying the contents to a temporary Canvas and finally
* creating an Image object from it, which is the image returned to the callback provided.
*
* All in all, this is a computationally expensive and blocking process, which gets more expensive
* the larger the resolution this Render Texture has, so please be careful how you employ this in your game.
* @param callback The Function to invoke after the snapshot image is created.
* @param type The format of the image to create, usually `image/png` or `image/jpeg`. Default 'image/png'.
* @param encoderOptions The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. Default 0.92.
*/
snapshot(callback: Phaser.Types.Renderer.Snapshot.SnapshotCallback, type?: string, encoderOptions?: number): this;
/**
* Takes a snapshot of the given pixel from this Render Texture.
*
* The snapshot is taken immediately, but the results are returned via the given callback.
*
* To capture the whole Render Texture see the `snapshot` method.
* To capture a portion of this Render Texture see the `snapshotArea` method.
*
* Unlike the two other snapshot methods, this one will send your callback a `Color` object
* containing the color data for the requested pixel. It doesn't need to create an internal
* Canvas or Image object, so is a lot faster to execute, using less memory than the other snapshot methods.
* @param x The x coordinate of the pixel to get.
* @param y The y coordinate of the pixel to get.
* @param callback The Function to invoke after the snapshot pixel data is extracted.
*/
snapshotPixel(x: number, y: number, callback: Phaser.Types.Renderer.Snapshot.SnapshotCallback): this;
/**
* Internal destroy handler, called as part of the destroy process.
*/
protected 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.
*
* 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;
/**
* Sets this Game Object to be at the top of the display list, or the top of its parent container.
*
* Being at the top means it will render on-top of everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToTop(): this;
/**
* Sets this Game Object to the back of the display list, or the back of its parent container.
*
* Being at the back means it will render below everything else.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
*/
setToBack(): this;
/**
* Move this Game Object so that it appears above the given Game Object.
*
* This means it will render immediately after the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be above.
*/
setAbove(gameObject: Phaser.GameObjects.GameObject): this;
/**
* Move this Game Object so that it appears below the given Game Object.
*
* This means it will render immediately under the other object in the display list.
*
* Both objects must belong to the same display list, or parent container.
*
* This method does not change this Game Objects `depth` value, it simply alters its list position.
* @param gameObject The Game Object that this Game Object will be moved to be below.
*/
setBelow(gameObject: Phaser.GameObjects.GameObject): 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