diff --git a/types/phaser.d.ts b/types/phaser.d.ts
index 39a845498..fbb0bafb7 100644
--- a/types/phaser.d.ts
+++ b/types/phaser.d.ts
@@ -1,3 +1,5 @@
+///
+
declare type DataEachCallback = (parent: any, key: string, value: any, ...args: any[])=>void;
declare type ContentLoadedCallback = ()=>void;
@@ -17,6 +19,17 @@ declare type CenterFunction = (triangle: Phaser.Geom.Triangle)=>void;
declare namespace Phaser {
namespace Actions {
+ /**
+ * Takes an array of Game Objects, or any objects that have public `x` and `y` properties, and aligns them next to each other.
+ *
+ * The first item isn't moved. The second item is aligned next to the first, then the third next to the second, and so on.
+ * @param items The array of items to be updated by this action.
+ * @param position The position to align the items with. This is an align constant, such as `Phaser.Display.Align.LEFT_CENTER`.
+ * @param offsetX Optional horizontal offset from the position. Default 0.
+ * @param offsetY Optional vertical offset from the position. Default 0.
+ */
+ function AlignTo(items: G, position: integer, offsetX?: number, offsetY?: number): G;
+
/**
* Takes an array of Game Objects, or any objects that have a public `angle` property,
* and then adds the given value to each of their `angle` properties.
@@ -614,18 +627,6 @@ declare namespace Phaser {
*/
function Shuffle(items: G): G;
- /**
- * Smoothstep is a sigmoid-like interpolation and clamping function.
- *
- * The function depends on three parameters, the input x, the "left edge" and the "right edge", with the left edge being assumed smaller than the right edge. The function receives a real number x as an argument and returns 0 if x is less than or equal to the left edge, 1 if x is greater than or equal to the right edge, and smoothly interpolates, using a Hermite polynomial, between 0 and 1 otherwise. The slope of the smoothstep function is zero at both edges. This is convenient for creating a sequence of transitions using smoothstep to interpolate each segment as an alternative to using more sophisticated or expensive interpolation techniques.
- * @param items An array of Game Objects. The contents of this array are updated by this Action.
- * @param property The property of the Game Object to interpolate.
- * @param min The minimum interpolation value.
- * @param max The maximum interpolation value.
- * @param inc Should the values be incremented? `true` or set (`false`) Default false.
- */
- function SmoothStep(items: G, property: string, min: number, max: number, inc?: boolean): G;
-
/**
* Smootherstep is a sigmoid-like interpolation and clamping function.
*
@@ -638,6 +639,18 @@ declare namespace Phaser {
*/
function SmootherStep(items: G, property: string, min: number, max: number, inc?: boolean): G;
+ /**
+ * Smoothstep is a sigmoid-like interpolation and clamping function.
+ *
+ * The function depends on three parameters, the input x, the "left edge" and the "right edge", with the left edge being assumed smaller than the right edge. The function receives a real number x as an argument and returns 0 if x is less than or equal to the left edge, 1 if x is greater than or equal to the right edge, and smoothly interpolates, using a Hermite polynomial, between 0 and 1 otherwise. The slope of the smoothstep function is zero at both edges. This is convenient for creating a sequence of transitions using smoothstep to interpolate each segment as an alternative to using more sophisticated or expensive interpolation techniques.
+ * @param items An array of Game Objects. The contents of this array are updated by this Action.
+ * @param property The property of the Game Object to interpolate.
+ * @param min The minimum interpolation value.
+ * @param max The maximum interpolation value.
+ * @param inc Should the values be incremented? `true` or set (`false`) Default false.
+ */
+ function SmoothStep(items: G, property: string, min: number, max: number, inc?: boolean): G;
+
/**
* Takes an array of Game Objects and then modifies their `property` so the value equals, or is incremented, by the
* calculated spread value.
@@ -1733,7 +1746,7 @@ declare namespace Phaser {
* the Camera there. The results are clamped based on the Camera bounds, if set.
* @param x The horizontal coordinate to center on.
* @param y The vertical coordinate to center on.
- * @param out A Vec2 to store the values in. If not given a new Vec2 is created.
+ * @param out A Vector2 to store the values in. If not given a new Vector2 is created.
*/
getScroll(x: number, y: number, out?: Phaser.Math.Vector2): Phaser.Math.Vector2;
@@ -4568,6 +4581,148 @@ declare namespace Phaser {
*/
function DebugHeader(game: Phaser.Game): void;
+ namespace Events {
+ /**
+ * The Game Blur Event.
+ *
+ * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded
+ * enters a blurred state. The blur event is raised when the window loses focus. This can happen if a user swaps
+ * tab, or if they simply remove focus from the browser to another app.
+ */
+ const BLUR: any;
+
+ /**
+ * The Game Boot Event.
+ *
+ * This event is dispatched when the Phaser Game instance has finished booting, but before it is ready to start running.
+ * The global systems use this event to know when to set themselves up, dispatching their own `ready` events as required.
+ */
+ const BOOT: any;
+
+ /**
+ * The Game Context Lost Event.
+ *
+ * This event is dispatched by the Game if the WebGL Renderer it is using encounters a WebGL Context Lost event from the browser.
+ *
+ * The partner event is `CONTEXT_RESTORED`.
+ */
+ const CONTEXT_LOST: any;
+
+ /**
+ * The Game Context Restored Event.
+ *
+ * This event is dispatched by the Game if the WebGL Renderer it is using encounters a WebGL Context Restored event from the browser.
+ *
+ * The partner event is `CONTEXT_LOST`.
+ */
+ const CONTEXT_RESTORED: any;
+
+ /**
+ * The Game Destroy Event.
+ *
+ * This event is dispatched when the game instance has been told to destroy itself.
+ * Lots of internal systems listen to this event in order to clear themselves out.
+ * Custom plugins and game code should also do the same.
+ */
+ const DESTROY: any;
+
+ /**
+ * The Game Focus Event.
+ *
+ * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded
+ * enters a focused state. The focus event is raised when the window re-gains focus, having previously lost it.
+ */
+ const FOCUS: any;
+
+ /**
+ * The Game Hidden Event.
+ *
+ * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded
+ * enters a hidden state. Only browsers that support the Visibility API will cause this event to be emitted.
+ *
+ * In most modern browsers, when the document enters a hidden state, the Request Animation Frame and setTimeout, which
+ * control the main game loop, will automatically pause. There is no way to stop this from happening. It is something
+ * your game should account for in its own code, should the pause be an issue (i.e. for multiplayer games)
+ */
+ const HIDDEN: any;
+
+ /**
+ * The Game Pause Event.
+ *
+ * This event is dispatched when the Game loop enters a paused state, usually as a result of the Visibility Handler.
+ */
+ const PAUSE: any;
+
+ /**
+ * The Game Post-Render Event.
+ *
+ * This event is dispatched right at the end of the render process.
+ *
+ * Every Scene will have rendered and been drawn to the canvas by the time this event is fired.
+ * Use it for any last minute post-processing before the next game step begins.
+ */
+ const POST_RENDER: any;
+
+ /**
+ * The Game Post-Step Event.
+ *
+ * This event is dispatched after the Scene Manager has updated.
+ * Hook into it from plugins or systems that need to do things before the render starts.
+ */
+ const POST_STEP: any;
+
+ /**
+ * The Game Pre-Render Event.
+ *
+ * This event is dispatched immediately before any of the Scenes have started to render.
+ *
+ * The renderer will already have been initialized this frame, clearing itself and preparing to receive the Scenes for rendering, but it won't have actually drawn anything yet.
+ */
+ const PRE_RENDER: any;
+
+ /**
+ * The Game Pre-Step Event.
+ *
+ * This event is dispatched before the main Game Step starts. By this point in the game cycle none of the Scene updates have yet happened.
+ * Hook into it from plugins or systems that need to update before the Scene Manager does.
+ */
+ const PRE_STEP: any;
+
+ /**
+ * The Game Ready Event.
+ *
+ * This event is dispatched when the Phaser Game instance has finished booting, the Texture Manager is fully ready,
+ * and all local systems are now able to start.
+ */
+ const READY: any;
+
+ /**
+ * The Game Resume Event.
+ *
+ * This event is dispatched when the game loop leaves a paused state and resumes running.
+ */
+ const RESUME: any;
+
+ /**
+ * The Game Step Event.
+ *
+ * This event is dispatched after the Game Pre-Step and before the Scene Manager steps.
+ * Hook into it from plugins or systems that need to update before the Scene Manager does, but after the core Systems have.
+ */
+ const STEP: any;
+
+ /**
+ * The Game Visible Event.
+ *
+ * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded
+ * enters a visible state, previously having been hidden.
+ *
+ * Only browsers that support the Visibility API will cause this event to be emitted.
+ */
+ const VISIBLE: any;
+
+ }
+
/**
* The core runner class that Phaser uses to handle the game loop. It can use either Request Animation Frame,
* or SetTimeout, based on browser support and config settings, to create a continuous loop within the browser.
@@ -4825,148 +4980,6 @@ declare namespace Phaser {
*/
function VisibilityHandler(game: Phaser.Game): void;
- namespace Events {
- /**
- * The Game Blur Event.
- *
- * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded
- * enters a blurred state. The blur event is raised when the window loses focus. This can happen if a user swaps
- * tab, or if they simply remove focus from the browser to another app.
- */
- const BLUR: any;
-
- /**
- * The Game Boot Event.
- *
- * This event is dispatched when the Phaser Game instance has finished booting, but before it is ready to start running.
- * The global systems use this event to know when to set themselves up, dispatching their own `ready` events as required.
- */
- const BOOT: any;
-
- /**
- * The Game Context Lost Event.
- *
- * This event is dispatched by the Game if the WebGL Renderer it is using encounters a WebGL Context Lost event from the browser.
- *
- * The partner event is `CONTEXT_RESTORED`.
- */
- const CONTEXT_LOST: any;
-
- /**
- * The Game Context Restored Event.
- *
- * This event is dispatched by the Game if the WebGL Renderer it is using encounters a WebGL Context Restored event from the browser.
- *
- * The partner event is `CONTEXT_LOST`.
- */
- const CONTEXT_RESTORED: any;
-
- /**
- * The Game Destroy Event.
- *
- * This event is dispatched when the game instance has been told to destroy itself.
- * Lots of internal systems listen to this event in order to clear themselves out.
- * Custom plugins and game code should also do the same.
- */
- const DESTROY: any;
-
- /**
- * The Game Focus Event.
- *
- * This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded
- * enters a focused state. The focus event is raised when the window re-gains focus, having previously lost it.
- */
- const FOCUS: any;
-
- /**
- * The Game Hidden Event.
- *
- * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded
- * enters a hidden state. Only browsers that support the Visibility API will cause this event to be emitted.
- *
- * In most modern browsers, when the document enters a hidden state, the Request Animation Frame and setTimeout, which
- * control the main game loop, will automatically pause. There is no way to stop this from happening. It is something
- * your game should account for in its own code, should the pause be an issue (i.e. for multiplayer games)
- */
- const HIDDEN: any;
-
- /**
- * The Game Pause Event.
- *
- * This event is dispatched when the Game loop enters a paused state, usually as a result of the Visibility Handler.
- */
- const PAUSE: any;
-
- /**
- * The Game Post-Render Event.
- *
- * This event is dispatched right at the end of the render process.
- *
- * Every Scene will have rendered and been drawn to the canvas by the time this event is fired.
- * Use it for any last minute post-processing before the next game step begins.
- */
- const POST_RENDER: any;
-
- /**
- * The Game Post-Step Event.
- *
- * This event is dispatched after the Scene Manager has updated.
- * Hook into it from plugins or systems that need to do things before the render starts.
- */
- const POST_STEP: any;
-
- /**
- * The Game Pre-Render Event.
- *
- * This event is dispatched immediately before any of the Scenes have started to render.
- *
- * The renderer will already have been initialized this frame, clearing itself and preparing to receive the Scenes for rendering, but it won't have actually drawn anything yet.
- */
- const PRE_RENDER: any;
-
- /**
- * The Game Pre-Step Event.
- *
- * This event is dispatched before the main Game Step starts. By this point in the game cycle none of the Scene updates have yet happened.
- * Hook into it from plugins or systems that need to update before the Scene Manager does.
- */
- const PRE_STEP: any;
-
- /**
- * The Game Ready Event.
- *
- * This event is dispatched when the Phaser Game instance has finished booting, the Texture Manager is fully ready,
- * and all local systems are now able to start.
- */
- const READY: any;
-
- /**
- * The Game Resume Event.
- *
- * This event is dispatched when the game loop leaves a paused state and resumes running.
- */
- const RESUME: any;
-
- /**
- * The Game Step Event.
- *
- * This event is dispatched after the Game Pre-Step and before the Scene Manager steps.
- * Hook into it from plugins or systems that need to update before the Scene Manager does, but after the core Systems have.
- */
- const STEP: any;
-
- /**
- * The Game Visible Event.
- *
- * This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded
- * enters a visible state, previously having been hidden.
- *
- * Only browsers that support the Visibility API will cause this event to be emitted.
- */
- const VISIBLE: any;
-
- }
-
}
namespace Create {
@@ -5087,7 +5100,7 @@ declare namespace Phaser {
class Curve {
/**
*
- * @param type [description]
+ * @param type The curve type.
*/
constructor(type: string);
@@ -5117,7 +5130,7 @@ declare namespace Phaser {
needsUpdate: boolean;
/**
- * [description]
+ * For a curve on a Path, `false` means the Path will ignore this curve.
*/
active: boolean;
@@ -5149,7 +5162,7 @@ declare namespace Phaser {
getDistancePoints(distance: integer): Phaser.Geom.Point[];
/**
- * [description]
+ * Get a point at the end of the curve.
* @param out Optional Vector object to store the result in.
*/
getEndPoint(out?: Phaser.Math.Vector2): Phaser.Math.Vector2;
@@ -5160,60 +5173,80 @@ declare namespace Phaser {
getLength(): number;
/**
- * Get list of cumulative segment lengths
- * @param divisions [description]
+ * Get a list of cumulative segment lengths.
+ *
+ * These lengths are
+ *
+ * - [0] 0
+ * - [1] The first segment
+ * - [2] The first and second segment
+ * - ...
+ * - [divisions] All segments
+ * @param divisions The number of divisions or segments.
*/
getLengths(divisions?: integer): number[];
/**
- * [description]
- * @param u [description]
- * @param out [description]
+ * Get a point at a relative position on the curve, by arc length.
+ * @param u The relative position, [0..1].
+ * @param out A point to store the result in.
*/
getPointAt(u: number, out?: O): O;
/**
- * [description]
- * @param divisions The number of evenly spaced points from the curve to return. If falsy, step param will be used to calculate the number of points.
- * @param step Step between points. Used to calculate the number of points to return when divisions is falsy. Ignored if divisions is positive.
+ * Get a sequence of evenly spaced points from the curve.
+ *
+ * You can pass `divisions`, `stepRate`, or neither.
+ *
+ * The number of divisions will be
+ *
+ * 1. `divisions`, if `divisions` > 0; or
+ * 2. `this.getLength / stepRate`, if `stepRate` > 0; or
+ * 3. `this.defaultDivisions`
+ *
+ * `1 + divisions` points will be returned.
+ * @param divisions The number of divisions to make.
+ * @param stepRate The curve distance between points, implying `divisions`.
* @param out An optional array to store the points in.
*/
- getPoints(divisions: integer, step: number, out?: O): O;
+ getPoints(divisions?: integer, stepRate?: number, out?: O): O;
/**
- * [description]
- * @param out [description]
+ * Get a random point from the curve.
+ * @param out A point object to store the result in.
*/
getRandomPoint(out?: O): O;
/**
- * [description]
- * @param divisions The number of evenly spaced points from the curve to return. If falsy, step param will be used to calculate the number of points.
- * @param step Step between points. Used to calculate the number of points to return when divisions is falsy. Ignored if divisions is positive.
+ * Get a sequence of equally spaced points (by arc distance) from the curve.
+ *
+ * `1 + divisions` points will be returned.
+ * @param divisions The number of divisions to make. Default this.defaultDivisions.
+ * @param stepRate Step between points. Used to calculate the number of points to return when divisions is falsy. Ignored if divisions is positive.
* @param out An optional array to store the points in.
*/
- getSpacedPoints(divisions?: integer, step?: number, out?: any[] | Phaser.Math.Vector2[]): Phaser.Math.Vector2[];
+ getSpacedPoints(divisions?: integer, stepRate?: number, out?: any[] | Phaser.Math.Vector2[]): Phaser.Math.Vector2[];
/**
- * [description]
- * @param out [description]
+ * Get a point at the start of the curve.
+ * @param out A point to store the result in.
*/
getStartPoint(out?: O): O;
/**
- * Returns a unit vector tangent at t
+ * Get a unit vector tangent at a relative position on the curve.
* In case any sub curve does not implement its tangent derivation,
* 2 points a small delta apart will be used to find its gradient
* which seems to give a reasonable approximation
- * @param t [description]
- * @param out [description]
+ * @param t The relative position on the curve, [0..1].
+ * @param out A vector to store the result in.
*/
getTangent(t: number, out?: O): O;
/**
- * [description]
- * @param u [description]
- * @param out [description]
+ * Get a unit vector tangent at a relative position on the curve, by arc length.
+ * @param u The relative position on the curve, [0..1].
+ * @param out A vector to store the result in.
*/
getTangentAt(u: number, out?: O): O;
@@ -5233,7 +5266,7 @@ declare namespace Phaser {
getUtoTmapping(u: number, distance: integer, divisions?: integer): number;
/**
- * [description]
+ * Calculate and cache the arc lengths.
*/
updateArcLengths(): void;
@@ -5481,132 +5514,6 @@ declare namespace Phaser {
}
- /**
- * [description]
- */
- class QuadraticBezier extends Phaser.Curves.Curve {
- /**
- *
- * @param p0 Start point, or an array of point pairs.
- * @param p1 Control Point 1.
- * @param p2 Control Point 2.
- */
- constructor(p0: Phaser.Math.Vector2 | number[], p1: Phaser.Math.Vector2, p2: Phaser.Math.Vector2);
-
- /**
- * [description]
- */
- p0: Phaser.Math.Vector2;
-
- /**
- * [description]
- */
- p1: Phaser.Math.Vector2;
-
- /**
- * [description]
- */
- p2: Phaser.Math.Vector2;
-
- /**
- * Gets the starting point on the curve.
- * @param out A Vector2 object to store the result in. If not given will be created.
- */
- getStartPoint(out?: O): O;
-
- /**
- * [description]
- * @param divisions [description]
- */
- getResolution(divisions: number): number;
-
- /**
- * Get point at relative position in curve according to length.
- * @param t The position along the curve to return. Where 0 is the start and 1 is the end.
- * @param out A Vector2 object to store the result in. If not given will be created.
- */
- getPoint(t: number, out?: O): O;
-
- /**
- * [description]
- * @param graphics `Graphics` object to draw onto.
- * @param pointsTotal Number of points to be used for drawing the curve. Higher numbers result in smoother curve but require more processing. Default 32.
- */
- draw(graphics: G, pointsTotal?: integer): G;
-
- /**
- * Converts the curve into a JSON compatible object.
- */
- toJSON(): Phaser.Types.Curves.JSONCurve;
-
- /**
- * Creates a curve from a JSON object, e. g. created by `toJSON`.
- * @param data The JSON object containing this curve data.
- */
- static fromJSON(data: Phaser.Types.Curves.JSONCurve): Phaser.Curves.QuadraticBezier;
-
- }
-
- /**
- * [description]
- */
- class Spline extends Phaser.Curves.Curve {
- /**
- *
- * @param points [description]
- */
- constructor(points?: Phaser.Math.Vector2[]);
-
- /**
- * [description]
- */
- points: Phaser.Math.Vector2[];
-
- /**
- * [description]
- * @param points [description]
- */
- addPoints(points: Phaser.Math.Vector2[] | number[] | number[][]): Phaser.Curves.Spline;
-
- /**
- * [description]
- * @param x [description]
- * @param y [description]
- */
- addPoint(x: number, y: number): Phaser.Math.Vector2;
-
- /**
- * Gets the starting point on the curve.
- * @param out A Vector2 object to store the result in. If not given will be created.
- */
- getStartPoint(out?: O): O;
-
- /**
- * [description]
- * @param divisions [description]
- */
- getResolution(divisions: number): number;
-
- /**
- * Get point at relative position in curve according to length.
- * @param t The position along the curve to return. Where 0 is the start and 1 is the end.
- * @param out A Vector2 object to store the result in. If not given will be created.
- */
- getPoint(t: number, out?: O): O;
-
- /**
- * [description]
- */
- toJSON(): Phaser.Types.Curves.JSONCurve;
-
- /**
- * [description]
- * @param data The JSON object containing this curve data.
- */
- static fromJSON(data: Phaser.Types.Curves.JSONCurve): Phaser.Curves.Spline;
-
- }
-
/**
* A MoveTo Curve is a very simple curve consisting of only a single point. Its intended use is to move the ending point in a Path.
*/
@@ -5731,12 +5638,12 @@ declare namespace Phaser {
/**
* Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points.
- * @param x The x coordinate of the end point. Or, if a Vec2, the p1 value.
- * @param y The y coordinate of the end point. Or, if a Vec2, the p2 value.
- * @param control1X The x coordinate of the first control point. Or, if a Vec2, the p3 value.
- * @param control1Y The y coordinate of the first control point. Not used if vec2s are provided as the first 3 arguments.
- * @param control2X The x coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments.
- * @param control2Y The y coordinate of the second control point. Not used if vec2s are provided as the first 3 arguments.
+ * @param x The x coordinate of the end point. Or, if a Vector2, the p1 value.
+ * @param y The y coordinate of the end point. Or, if a Vector2, the p2 value.
+ * @param control1X The x coordinate of the first control point. Or, if a Vector2, the p3 value.
+ * @param control1Y The y coordinate of the first control point. Not used if Vector2s are provided as the first 3 arguments.
+ * @param control2X The x coordinate of the second control point. Not used if Vector2s are provided as the first 3 arguments.
+ * @param control2Y The y coordinate of the second control point. Not used if Vector2s are provided as the first 3 arguments.
*/
cubicBezierTo(x: number | Phaser.Math.Vector2, y: number | Phaser.Math.Vector2, control1X: number | Phaser.Math.Vector2, control1Y?: number, control2X?: number, control2Y?: number): Phaser.Curves.Path;
@@ -5812,10 +5719,8 @@ declare namespace Phaser {
getPoint(t: number, out?: O): O;
/**
- * Returns the defined starting point of the Path.
- *
- * This is not necessarily equal to the starting point of the first Curve if it differs from {@link startPoint}.
- * @param divisions The number of points to divide the path in to. Default 12.
+ * Get a sequence of points on the path.
+ * @param divisions The number of divisions per resolution per curve. Default 12.
*/
getPoints(divisions?: integer): Phaser.Math.Vector2[];
@@ -5880,6 +5785,132 @@ declare namespace Phaser {
}
+ /**
+ * [description]
+ */
+ class QuadraticBezier extends Phaser.Curves.Curve {
+ /**
+ *
+ * @param p0 Start point, or an array of point pairs.
+ * @param p1 Control Point 1.
+ * @param p2 Control Point 2.
+ */
+ constructor(p0: Phaser.Math.Vector2 | number[], p1: Phaser.Math.Vector2, p2: Phaser.Math.Vector2);
+
+ /**
+ * [description]
+ */
+ p0: Phaser.Math.Vector2;
+
+ /**
+ * [description]
+ */
+ p1: Phaser.Math.Vector2;
+
+ /**
+ * [description]
+ */
+ p2: Phaser.Math.Vector2;
+
+ /**
+ * Gets the starting point on the curve.
+ * @param out A Vector2 object to store the result in. If not given will be created.
+ */
+ getStartPoint(out?: O): O;
+
+ /**
+ * [description]
+ * @param divisions [description]
+ */
+ getResolution(divisions: number): number;
+
+ /**
+ * Get point at relative position in curve according to length.
+ * @param t The position along the curve to return. Where 0 is the start and 1 is the end.
+ * @param out A Vector2 object to store the result in. If not given will be created.
+ */
+ getPoint(t: number, out?: O): O;
+
+ /**
+ * [description]
+ * @param graphics `Graphics` object to draw onto.
+ * @param pointsTotal Number of points to be used for drawing the curve. Higher numbers result in smoother curve but require more processing. Default 32.
+ */
+ draw(graphics: G, pointsTotal?: integer): G;
+
+ /**
+ * Converts the curve into a JSON compatible object.
+ */
+ toJSON(): Phaser.Types.Curves.JSONCurve;
+
+ /**
+ * Creates a curve from a JSON object, e. g. created by `toJSON`.
+ * @param data The JSON object containing this curve data.
+ */
+ static fromJSON(data: Phaser.Types.Curves.JSONCurve): Phaser.Curves.QuadraticBezier;
+
+ }
+
+ /**
+ * Create a smooth 2d spline curve from a series of points.
+ */
+ class Spline extends Phaser.Curves.Curve {
+ /**
+ *
+ * @param points The points that configure the curve.
+ */
+ constructor(points?: Phaser.Math.Vector2[] | number[] | number[][]);
+
+ /**
+ * The Vector2 points that configure the curve.
+ */
+ points: Phaser.Math.Vector2[];
+
+ /**
+ * Add a list of points to the current list of Vector2 points of the curve.
+ * @param points The points that configure the curve.
+ */
+ addPoints(points: Phaser.Math.Vector2[] | number[] | number[][]): Phaser.Curves.Spline;
+
+ /**
+ * Add a point to the current list of Vector2 points of the curve.
+ * @param x The x coordinate of this curve
+ * @param y The y coordinate of this curve
+ */
+ addPoint(x: number, y: number): Phaser.Math.Vector2;
+
+ /**
+ * Gets the starting point on the curve.
+ * @param out A Vector2 object to store the result in. If not given will be created.
+ */
+ getStartPoint(out?: O): O;
+
+ /**
+ * [description]
+ * @param divisions [description]
+ */
+ getResolution(divisions: number): number;
+
+ /**
+ * Get point at relative position in curve according to length.
+ * @param t The position along the curve to return. Where 0 is the start and 1 is the end.
+ * @param out A Vector2 object to store the result in. If not given will be created.
+ */
+ getPoint(t: number, out?: O): O;
+
+ /**
+ * Exports a JSON object containing this curve data.
+ */
+ toJSON(): Phaser.Types.Curves.JSONCurve;
+
+ /**
+ * Imports a JSON object containing this curve data.
+ * @param data The JSON object containing this curve data.
+ */
+ static fromJSON(data: Phaser.Types.Curves.JSONCurve): Phaser.Curves.Spline;
+
+ }
+
}
namespace Data {
@@ -6779,6 +6810,17 @@ declare namespace Phaser {
*/
function LeftTop(gameObject: G, alignTo: Phaser.GameObjects.GameObject, offsetX?: number, offsetY?: number): G;
+ /**
+ * Takes a Game Object and aligns it next to another, at the given position.
+ * The alignment used is based on the `position` argument, which is a `Phaser.Display.Align` property such as `LEFT_CENTER` or `TOP_RIGHT`.
+ * @param child The Game Object that will be positioned.
+ * @param alignTo The Game Object to base the alignment position on.
+ * @param position The position to align the Game Object with. This is an align constant, such as `Phaser.Display.Align.LEFT_CENTER`.
+ * @param offsetX Optional horizontal offset from the position. Default 0.
+ * @param offsetY Optional vertical offset from the position. Default 0.
+ */
+ function QuickSet(child: G, alignTo: Phaser.GameObjects.GameObject, position: integer, offsetX?: number, offsetY?: number): G;
+
/**
* Takes given Game Object and aligns it so that it is positioned next to the right bottom position of the other.
* @param gameObject The Game Object that will be positioned.
@@ -7334,6 +7376,16 @@ declare namespace Phaser {
*/
static GetColor32(red: integer, green: integer, blue: integer, alpha: integer): number;
+ /**
+ * Converts a hex string into a Phaser Color object.
+ *
+ * The hex string can supplied as `'#0033ff'` or the short-hand format of `'#03f'`; it can begin with an optional "#" or "0x", or be unprefixed.
+ *
+ * An alpha channel is _not_ supported.
+ * @param hex The hex color value to convert, such as `#0033ff` or the short-hand format: `#03f`.
+ */
+ static HexStringToColor(hex: string): Phaser.Display.Color;
+
/**
* Converts HSL (hue, saturation and lightness) values to a Phaser Color object.
* @param h The hue value in the range 0 to 1.
@@ -7361,16 +7413,6 @@ declare namespace Phaser {
*/
static HSVToRGB(h: number, s: number, v: number, out?: Phaser.Types.Display.ColorObject | Phaser.Display.Color): Phaser.Types.Display.ColorObject | Phaser.Display.Color;
- /**
- * Converts a hex string into a Phaser Color object.
- *
- * The hex string can supplied as `'#0033ff'` or the short-hand format of `'#03f'`; it can begin with an optional "#" or "0x", or be unprefixed.
- *
- * An alpha channel is _not_ supported.
- * @param hex The hex color value to convert, such as `#0033ff` or the short-hand format: `#03f`.
- */
- static HexStringToColor(hex: string): Phaser.Display.Color;
-
/**
* Converts a hue to an RGB color.
* Based on code by Michael Jackson (https://github.com/mjijackson)
@@ -7397,6 +7439,14 @@ declare namespace Phaser {
*/
static ObjectToColor(input: Phaser.Types.Display.InputColorObject): Phaser.Display.Color;
+ /**
+ * Creates a new Color object where the r, g, and b values have been set to random values
+ * based on the given min max values.
+ * @param min The minimum value to set the random range from (between 0 and 255) Default 0.
+ * @param max The maximum value to set the random range from (between 0 and 255) Default 255.
+ */
+ static RandomRGB(min?: integer, max?: integer): Phaser.Display.Color;
+
/**
* Converts a CSS 'web' string into a Phaser Color object.
*
@@ -7427,14 +7477,6 @@ declare namespace Phaser {
*/
static RGBToString(r: integer, g: integer, b: integer, a?: integer, prefix?: string): string;
- /**
- * Creates a new Color object where the r, g, and b values have been set to random values
- * based on the given min max values.
- * @param min The minimum value to set the random range from (between 0 and 255) Default 0.
- * @param max The maximum value to set the random range from (between 0 and 255) Default 255.
- */
- static RandomRGB(min?: integer, max?: integer): Phaser.Display.Color;
-
/**
* Converts the given source color value into an instance of a Color class.
* The value can be either a string, prefixed with `rgb` or a hex string, a number or an Object.
@@ -7956,1472 +7998,6 @@ declare namespace Phaser {
}
namespace GameObjects {
- /**
- * Builds a Game Object using the provided configuration object.
- * @param scene A reference to the Scene.
- * @param gameObject The initial GameObject.
- * @param config The config to build the GameObject with.
- */
- function BuildGameObject(scene: Phaser.Scene, gameObject: Phaser.GameObjects.GameObject, config: Phaser.Types.GameObjects.GameObjectConfig): Phaser.GameObjects.GameObject;
-
- /**
- * Adds an Animation component to a Sprite and populates it based on the given config.
- * @param sprite The sprite to add an Animation component to.
- * @param config The animation config.
- */
- function BuildGameObjectAnimation(sprite: Phaser.GameObjects.Sprite, config: object): Phaser.GameObjects.Sprite;
-
- /**
- * The Display List plugin.
- *
- * Display Lists belong to a Scene and maintain the list of Game Objects to render every frame.
- *
- * Some of these Game Objects may also be part of the Scene's [Update List]{@link Phaser.GameObjects.UpdateList}, for updating.
- */
- class DisplayList extends Phaser.Structs.List {
- /**
- *
- * @param scene The Scene that this Display List belongs to.
- */
- constructor(scene: Phaser.Scene);
-
- /**
- * The flag the determines whether Game Objects should be sorted when `depthSort()` is called.
- */
- sortChildrenFlag: boolean;
-
- /**
- * The Scene that this Display List belongs to.
- */
- scene: Phaser.Scene;
-
- /**
- * The Scene's Systems.
- */
- systems: Phaser.Scenes.Systems;
-
- /**
- * 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): integer;
-
- /**
- * Returns an array which contains all objects currently on the Display List.
- * This is a reference to the main list array, not a copy of it, so be careful not to modify it.
- */
- getChildren(): Phaser.GameObjects.GameObject[];
-
- }
-
- /**
- * The base class that all Game Objects extend.
- * You don't create GameObjects directly and they cannot be added to the display list.
- * Instead, use them as the base for your own custom classes.
- */
- class GameObject extends Phaser.Events.EventEmitter {
- /**
- *
- * @param scene The Scene to which this Game Object belongs.
- * @param type A textual representation of the type of Game Object, i.e. `sprite`.
- */
- constructor(scene: Phaser.Scene, type: string);
-
- /**
- * The Scene to which this Game Object belongs.
- * Game Objects can only belong to one Scene.
- */
- protected scene: Phaser.Scene;
-
- /**
- * 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: integer | string;
-
- /**
- * The parent Container of this Game Object, if it has one.
- */
- parentContainer: Phaser.GameObjects.Container;
-
- /**
- * The name of this Game Object.
- * Empty by default and never populated by Phaser, this is left for developers to use.
- */
- name: string;
-
- /**
- * The active state of this Game Object.
- * A Game Object with an active state of `true` is processed by the Scenes UpdateList, if added to it.
- * An active object is one which is having its logic and internal systems updated.
- */
- active: boolean;
-
- /**
- * The Tab Index of the Game Object.
- * Reserved for future use by plugins and the Input Manager.
- */
- tabIndex: integer;
-
- /**
- * 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: integer;
-
- /**
- * A bitmask that controls if this Game Object is drawn by a Camera or not.
- * Not usually set directly, instead call `Camera.ignore`, however you can
- * set this property directly using the Camera.id property:
- */
- cameraFilter: number;
-
- /**
- * If this Game Object is enabled for input then this property will contain an InteractiveObject instance.
- * Not usually set directly. Instead call `GameObject.setInteractive()`.
- */
- input: Phaser.Types.Input.InteractiveObject;
-
- /**
- * If this Game Object is enabled for physics then this property will contain a reference to a Physics Body.
- */
- body: object | Phaser.Physics.Arcade.Body | Phaser.Physics.Impact.Body;
-
- /**
- * This Game Object will ignore all calls made to its destroy method if this flag is set to `true`.
- * This includes calls that may come from a Group, Container or the Scene itself.
- * While it allows you to persist a Game Object across Scenes, please understand you are entirely
- * responsible for managing references to and from this Game Object.
- */
- ignoreDestroy: boolean;
-
- /**
- * Sets the `active` property of this Game Object and returns this Game Object for further chaining.
- * A Game Object with its `active` property set to `true` will be updated by the Scenes UpdateList.
- * @param value True if this Game Object should be set as active, false if not.
- */
- setActive(value: boolean): this;
-
- /**
- * Sets the `name` property of this Game Object and returns this Game Object for further chaining.
- * The `name` property is not populated by Phaser and is presented for your own use.
- * @param value The name to be given to this Game Object.
- */
- setName(value: string): this;
-
- /**
- * Sets the current state of this Game Object.
- *
- * Phaser itself will never modify the State of a Game Object, although plugins may do so.
- *
- * For example, a Game Object could change from a state of 'moving', to 'attacking', to 'dead'.
- * The state value should typically be an integer (ideally mapped to a constant
- * in your game code), but could also be a string. It is recommended to keep it light and simple.
- * If you need to store complex data about your Game Object, look at using the Data Component instead.
- * @param value The state of the Game Object.
- */
- setState(value: integer | 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;
-
- /**
- * Retrieves the value for the given key in this Game Objects Data Manager, or undefined if it doesn't exist.
- *
- * You can also access values via the `values` object. For example, if you had a key called `gold` you can do either:
- *
- * ```javascript
- * sprite.getData('gold');
- * ```
- *
- * Or access the value directly:
- *
- * ```javascript
- * sprite.data.values.gold;
- * ```
- *
- * You can also pass in an array of keys, in which case an array of values will be returned:
- *
- * ```javascript
- * sprite.getData([ 'gold', 'armor', 'health' ]);
- * ```
- *
- * This approach is useful for destructuring arrays in ES6.
- * @param key The key of the value to retrieve, or an array of keys.
- */
- getData(key: string | string[]): any;
-
- /**
- * Pass this Game Object to the Input Manager to enable it for Input.
- *
- * Input works by using hit areas, these are nearly always geometric shapes, such as rectangles or circles, that act as the hit area
- * for the Game Object. However, you can provide your own hit area shape and callback, should you wish to handle some more advanced
- * input detection.
- *
- * If no arguments are provided it will try and create a rectangle hit area based on the texture frame the Game Object is using. If
- * this isn't a texture-bound object, such as a Graphics or BitmapText object, this will fail, and you'll need to provide a specific
- * shape for it to use.
- *
- * You can also provide an Input Configuration Object as the only argument to this method.
- * @param shape 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 callback A callback to be invoked when the Game Object is interacted with. If you provide a shape you must also provide a callback.
- * @param dropZone Should this Game Object be treated as a drop zone target? Default false.
- */
- setInteractive(shape?: Phaser.Types.Input.InputConfiguration | any, callback?: Phaser.Types.Input.HitAreaCallback, dropZone?: boolean): this;
-
- /**
- * If this Game Object has previously been enabled for input, this will disable it.
- *
- * An object that is disabled for input stops processing or being considered for
- * input events, but can be turned back on again at any time by simply calling
- * `setInteractive()` with no arguments provided.
- *
- * If want to completely remove interaction from this Game Object then use `removeInteractive` instead.
- */
- disableInteractive(): this;
-
- /**
- * If this Game Object has previously been enabled for input, this will queue it
- * for removal, causing it to no longer be interactive. The removal happens on
- * the next game step, it is not immediate.
- *
- * The Interactive Object that was assigned to this Game Object will be destroyed,
- * removed from the Input Manager and cleared from this Game Object.
- *
- * If you wish to re-enable this Game Object at a later date you will need to
- * re-create its InteractiveObject by calling `setInteractive` again.
- *
- * If you wish to only temporarily stop an object from receiving input then use
- * `disableInteractive` instead, as that toggles the interactive state, where-as
- * this erases it completely.
- *
- * If you wish to resize a hit area, don't remove and then set it as being
- * interactive. Instead, access the hitarea object directly and resize the shape
- * being used. I.e.: `sprite.input.hitArea.setSize(width, height)` (assuming the
- * shape is a Rectangle, which it is by default.)
- */
- removeInteractive(): this;
-
- /**
- * 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(): integer[];
-
- /**
- * Destroys this Game Object removing it from the Display List and Update List and
- * severing all ties to parent resources.
- *
- * Also removes itself from the Input Manager and Physics Manager if previously enabled.
- *
- * Use this to remove a Game Object from your game if you don't ever plan to use it again.
- * As long as no reference to it exists within your own code it should become free for
- * garbage collection by the browser.
- *
- * If you just want to temporarily disable an object then look at using the
- * Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected.
- * @param fromScene Is this Game Object being destroyed as the result of a Scene shutdown? Default false.
- */
- destroy(fromScene?: boolean): void;
-
- /**
- * The bitmask that `GameObject.renderFlags` is compared against to determine if the Game Object will render or not.
- */
- static readonly RENDER_MASK: integer;
-
- }
-
- /**
- * The Game Object Creator is a Scene plugin that allows you to quickly create many common
- * types of Game Objects and return them. Unlike the Game Object Factory, they are not automatically
- * added to the Scene.
- *
- * Game Objects directly register themselves with the Creator and inject their own creation
- * methods into the class.
- */
- class GameObjectCreator {
- /**
- *
- * @param scene The Scene to which this Game Object Factory belongs.
- */
- constructor(scene: Phaser.Scene);
-
- /**
- * The Scene to which this Game Object Creator belongs.
- */
- protected scene: Phaser.Scene;
-
- /**
- * A reference to the Scene.Systems.
- */
- protected systems: Phaser.Scenes.Systems;
-
- /**
- * A reference to the Scene Display List.
- */
- protected displayList: Phaser.GameObjects.DisplayList;
-
- /**
- * A reference to the Scene Update List.
- */
- protected updateList: Phaser.GameObjects.UpdateList;
-
- /**
- * Creates a new Dynamic Bitmap Text Game Object and returns it.
- *
- * Note: This method will only be available if the Dynamic Bitmap Text Game Object has been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
- */
- dynamicBitmapText(config: Phaser.Types.GameObjects.BitmapText.BitmapTextConfig, addToScene?: boolean): Phaser.GameObjects.DynamicBitmapText;
-
- /**
- * Creates a new Bitmap Text Game Object and returns it.
- *
- * Note: This method will only be available if the Bitmap Text Game Object has been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
- */
- bitmapText(config: Phaser.Types.GameObjects.BitmapText.BitmapTextConfig, addToScene?: boolean): Phaser.GameObjects.BitmapText;
-
- /**
- * Creates a new Blitter Game Object and returns it.
- *
- * Note: This method will only be available if the Blitter Game Object has been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
- */
- blitter(config: object, addToScene?: boolean): Phaser.GameObjects.Blitter;
-
- /**
- * Creates a new Container Game Object and returns it.
- *
- * Note: This method will only be available if the Container Game Object has been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
- */
- container(config: object, addToScene?: boolean): Phaser.GameObjects.Container;
-
- /**
- * Creates a new Graphics Game Object and returns it.
- *
- * Note: This method will only be available if the Graphics Game Object has been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
- */
- graphics(config: object, addToScene?: boolean): Phaser.GameObjects.Graphics;
-
- /**
- * Creates a new Group Game Object and returns it.
- *
- * Note: This method will only be available if the Group Game Object has been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- */
- group(config: Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig): Phaser.GameObjects.Group;
-
- /**
- * Creates a new Image Game Object and returns it.
- *
- * Note: This method will only be available if the Image Game Object has been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
- */
- image(config: object, addToScene?: boolean): Phaser.GameObjects.Image;
-
- /**
- * Creates a new Mesh Game Object and returns it.
- *
- * Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
- */
- mesh(config: object, addToScene?: boolean): Phaser.GameObjects.Mesh;
-
- /**
- * Creates a new Particle Emitter Manager Game Object and returns it.
- *
- * Note: This method will only be available if the Particles Game Object has been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
- */
- particles(config: object, addToScene?: boolean): Phaser.GameObjects.Particles.ParticleEmitterManager;
-
- /**
- * Creates a new Quad Game Object and returns it.
- *
- * Note: This method will only be available if the Quad Game Object and WebGL support have been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
- */
- quad(config: object, addToScene?: boolean): Phaser.GameObjects.Quad;
-
- /**
- * Creates a new Render Texture Game Object and returns it.
- *
- * Note: This method will only be available if the Render Texture Game Object has been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
- */
- renderTexture(config: Phaser.Types.GameObjects.RenderTexture.RenderTextureConfig, addToScene?: boolean): Phaser.GameObjects.RenderTexture;
-
- /**
- * Creates a new Shader Game Object and returns it.
- *
- * Note: This method will only be available if the Shader Game Object and WebGL support have been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
- */
- shader(config: object, addToScene?: boolean): Phaser.GameObjects.Shader;
-
- /**
- * Creates a new Sprite Game Object and returns it.
- *
- * Note: This method will only be available if the Sprite Game Object has been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
- */
- sprite(config: Phaser.Types.GameObjects.Sprite.SpriteConfig, addToScene?: boolean): Phaser.GameObjects.Sprite;
-
- /**
- * Creates a new Text Game Object and returns it.
- *
- * Note: This method will only be available if the Text Game Object has been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
- */
- text(config: object, addToScene?: boolean): Phaser.GameObjects.Text;
-
- /**
- * Creates a new TileSprite Game Object and returns it.
- *
- * Note: This method will only be available if the TileSprite Game Object has been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
- */
- tileSprite(config: Phaser.Types.GameObjects.TileSprite.TileSpriteConfig, addToScene?: boolean): Phaser.GameObjects.TileSprite;
-
- /**
- * Creates a new Video Game Object and returns it.
- *
- * Note: This method will only be available if the Video Game Object has been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
- */
- video(config: object, addToScene?: boolean): Phaser.GameObjects.Video;
-
- /**
- * Creates a new Zone Game Object and returns it.
- *
- * Note: This method will only be available if the Zone Game Object has been built into Phaser.
- * @param config The configuration object this Game Object will use to create itself.
- */
- zone(config: object): Phaser.GameObjects.Zone;
-
- /**
- * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided.
- * When loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing
- * from a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map
- * data. For an empty map, you should specify tileWidth, tileHeight, width & height.
- * @param config The config options for the Tilemap.
- */
- tilemap(config?: Phaser.Types.Tilemaps.TilemapConfig): Phaser.Tilemaps.Tilemap;
-
- /**
- * Creates a new Tween object and returns it.
- *
- * Note: This method will only be available if Tweens have been built into Phaser.
- * @param config The Tween configuration.
- */
- tween(config: Phaser.Types.Tweens.TweenBuilderConfig | object): Phaser.Tweens.Tween;
-
- }
-
- /**
- * The Game Object Factory is a Scene plugin that allows you to quickly create many common
- * types of Game Objects and have them automatically registered with the Scene.
- *
- * Game Objects directly register themselves with the Factory and inject their own creation
- * methods into the class.
- */
- class GameObjectFactory {
- /**
- *
- * @param scene The Scene to which this Game Object Factory belongs.
- */
- constructor(scene: Phaser.Scene);
-
- /**
- * Creates a new Path Object.
- * @param x The horizontal position of this Path.
- * @param y The vertical position of this Path.
- */
- path(x: number, y: number): Phaser.Curves.Path;
-
- /**
- * The Scene to which this Game Object Factory belongs.
- */
- protected scene: Phaser.Scene;
-
- /**
- * A reference to the Scene.Systems.
- */
- protected systems: Phaser.Scenes.Systems;
-
- /**
- * A reference to the Scene Display List.
- */
- protected displayList: Phaser.GameObjects.DisplayList;
-
- /**
- * A reference to the Scene Update List.
- */
- protected updateList: Phaser.GameObjects.UpdateList;
-
- /**
- * Adds an existing Game Object to this Scene.
- *
- * If the Game Object renders, it will be added to the Display List.
- * If it has a `preUpdate` method, it will be added to the Update List.
- * @param child The child to be added to this Scene.
- */
- existing(child: Phaser.GameObjects.GameObject): Phaser.GameObjects.GameObject;
-
- /**
- * Static method called directly by the Game Object factory functions.
- * With this method you can register a custom GameObject factory in the GameObjectFactory,
- * providing a name (`factoryType`) and the constructor (`factoryFunction`) in order
- * to be called when you call to Phaser.Scene.add[ factoryType ] method.
- * @param factoryType The key of the factory that you will use to call to Phaser.Scene.add[ factoryType ] method.
- * @param factoryFunction The constructor function to be called when you invoke to the Phaser.Scene.add method.
- */
- static register(factoryType: string, factoryFunction: Function): void;
-
- /**
- * Static method called directly by the Game Object factory functions.
- * With this method you can remove a custom GameObject factory registered in the GameObjectFactory,
- * providing a its `factoryType`.
- * @param factoryType The key of the factory that you want to remove from the GameObjectFactory.
- */
- static remove(factoryType: string): void;
-
- /**
- * Creates a new Dynamic Bitmap Text Game Object and adds it to the Scene.
- *
- * BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure.
- *
- * During rendering for each letter of the text is rendered to the display, proportionally spaced out and aligned to
- * match the font structure.
- *
- * Dynamic Bitmap Text objects are different from Static Bitmap Text in that they invoke a callback for each
- * letter being rendered during the render pass. This callback allows you to manipulate the properties of
- * each letter being rendered, such as its position, scale or tint, allowing you to create interesting effects
- * like jiggling text, which can't be done with Static text. This means that Dynamic Text takes more processing
- * time, so only use them if you require the callback ability they have.
- *
- * BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability
- * to use Web Fonts, however you trade this flexibility for rendering speed. You can also create visually compelling BitmapTexts by
- * processing the font texture in an image editor, applying fills and any other effects required.
- *
- * To create multi-line text insert \r, \n or \r\n escape codes into the text string.
- *
- * To create a BitmapText data files you need a 3rd party app such as:
- *
- * BMFont (Windows, free): http://www.angelcode.com/products/bmfont/
- * Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner
- * Littera (Web-based, free): http://kvazars.com/littera/
- *
- * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of
- * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: http://codebeautify.org/xmltojson
- *
- * Note: This method will only be available if the Dynamic Bitmap Text Game Object has been built into Phaser.
- * @param x The x position of the Game Object.
- * @param y The y position of the Game Object.
- * @param font The key of the font to use from the BitmapFont cache.
- * @param text The string, or array of strings, to be set as the content of this Bitmap Text.
- * @param size The font size to set.
- */
- dynamicBitmapText(x: number, y: number, font: string, text?: string | string[], size?: number): Phaser.GameObjects.DynamicBitmapText;
-
- /**
- * Creates a new Bitmap Text Game Object and adds it to the Scene.
- *
- * BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure.
- *
- * During rendering for each letter of the text is rendered to the display, proportionally spaced out and aligned to
- * match the font structure.
- *
- * BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability
- * to use Web Fonts, however you trade this flexibility for rendering speed. You can also create visually compelling BitmapTexts by
- * processing the font texture in an image editor, applying fills and any other effects required.
- *
- * To create multi-line text insert \r, \n or \r\n escape codes into the text string.
- *
- * To create a BitmapText data files you need a 3rd party app such as:
- *
- * BMFont (Windows, free): http://www.angelcode.com/products/bmfont/
- * Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner
- * Littera (Web-based, free): http://kvazars.com/littera/
- *
- * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of
- * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: http://codebeautify.org/xmltojson
- *
- * Note: This method will only be available if the Bitmap Text Game Object has been built into Phaser.
- * @param x The x position of the Game Object.
- * @param y The y position of the Game Object.
- * @param font The key of the font to use from the BitmapFont cache.
- * @param text The string, or array of strings, to be set as the content of this Bitmap Text.
- * @param size The font size to set.
- * @param align The alignment of the text in a multi-line BitmapText object. Default 0.
- */
- bitmapText(x: number, y: number, font: string, text?: string | string[], size?: number, align?: integer): Phaser.GameObjects.BitmapText;
-
- /**
- * Creates a new Blitter Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Blitter Game Object has been built into Phaser.
- * @param x The x position of the Game Object.
- * @param y The y position of the Game Object.
- * @param key The key of the Texture the Blitter object will use.
- * @param frame The default Frame children of the Blitter will use.
- */
- blitter(x: number, y: number, key: string, frame?: string | integer): Phaser.GameObjects.Blitter;
-
- /**
- * Creates a new Container Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Container Game Object has been built into Phaser.
- * @param x The horizontal position of this Game Object in the world.
- * @param y The vertical position of this Game Object in the world.
- * @param children An optional array of Game Objects to add to this Container.
- */
- container(x: number, y: number, children?: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[]): Phaser.GameObjects.Container;
-
- /**
- * DOM Element Game Objects are a way to control and manipulate HTML Elements over the top of your game.
- *
- * In order for DOM Elements to display you have to enable them by adding the following to your game
- * configuration object:
- *
- * ```javascript
- * dom {
- * createContainer: true
- * }
- * ```
- *
- * When this is added, Phaser will automatically create a DOM Container div that is positioned over the top
- * of the game canvas. This div is sized to match the canvas, and if the canvas size changes, as a result of
- * settings within the Scale Manager, the dom container is resized accordingly.
- *
- * You can create a DOM Element by either passing in DOMStrings, or by passing in a reference to an existing
- * Element that you wish to be placed under the control of Phaser. For example:
- *
- * ```javascript
- * this.add.dom(x, y, 'div', 'background-color: lime; width: 220px; height: 100px; font: 48px Arial', 'Phaser');
- * ```
- *
- * The above code will insert a div element into the DOM Container at the given x/y coordinate. The DOMString in
- * the 4th argument sets the initial CSS style of the div and the final argument is the inner text. In this case,
- * it will create a lime colored div that is 220px by 100px in size with the text Phaser in it, in an Arial font.
- *
- * You should nearly always, without exception, use explicitly sized HTML Elements, in order to fully control
- * alignment and positioning of the elements next to regular game content.
- *
- * Rather than specify the CSS and HTML directly you can use the `load.html` File Loader to load it into the
- * cache and then use the `createFromCache` method instead. You can also use `createFromHTML` and various other
- * methods available in this class to help construct your elements.
- *
- * Once the element has been created you can then control it like you would any other Game Object. You can set its
- * position, scale, rotation, alpha and other properties. It will move as the main Scene Camera moves and be clipped
- * at the edge of the canvas. It's important to remember some limitations of DOM Elements: The obvious one is that
- * they appear above or below your game canvas. You cannot blend them into the display list, meaning you cannot have
- * a DOM Element, then a Sprite, then another DOM Element behind it.
- *
- * They also cannot be enabled for input. To do that, you have to use the `addListener` method to add native event
- * listeners directly. The final limitation is to do with cameras. The DOM Container is sized to match the game canvas
- * entirely and clipped accordingly. DOM Elements respect camera scrolling and scrollFactor settings, but if you
- * change the size of the camera so it no longer matches the size of the canvas, they won't be clipped accordingly.
- *
- * Also, all DOM Elements are inserted into the same DOM Container, regardless of which Scene they are created in.
- *
- * DOM Elements are a powerful way to align native HTML with your Phaser Game Objects. For example, you can insert
- * a login form for a multiplayer game directly into your title screen. Or a text input box for a highscore table.
- * Or a banner ad from a 3rd party service. Or perhaps you'd like to use them for high resolution text display and
- * UI. The choice is up to you, just remember that you're dealing with standard HTML and CSS floating over the top
- * of your game, and should treat it accordingly.
- *
- * Note: This method will only be available if the DOM Element Game Object has been built into Phaser.
- * @param x The horizontal position of this DOM Element in the world.
- * @param y The vertical position of this DOM Element in the world.
- * @param element An existing DOM element, or a string. If a string starting with a # it will do a `getElementById` look-up on the string (minus the hash). Without a hash, it represents the type of element to create, i.e. 'div'.
- * @param style If a string, will be set directly as the elements `style` property value. If a plain object, will be iterated and the values transferred. In both cases the values replacing whatever CSS styles may have been previously set.
- * @param innerText If given, will be set directly as the elements `innerText` property value, replacing whatever was there before.
- */
- dom(x: number, y: number, element?: HTMLElement | string, style?: string | any, innerText?: string): Phaser.GameObjects.DOMElement;
-
- /**
- * Creates a new Extern Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Extern Game Object has been built into Phaser.
- */
- extern(): Phaser.GameObjects.Extern;
-
- /**
- * Creates a new Graphics Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Graphics Game Object has been built into Phaser.
- * @param config The Graphics configuration.
- */
- graphics(config?: Phaser.Types.GameObjects.Graphics.Options): Phaser.GameObjects.Graphics;
-
- /**
- * Creates a new Group Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Group Game Object has been built into Phaser.
- * @param children Game Objects to add to this Group; or the `config` argument.
- * @param config A Group Configuration object.
- */
- group(children?: Phaser.GameObjects.GameObject[] | Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupConfig[], config?: Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig): Phaser.GameObjects.Group;
-
- /**
- * Creates a new Image Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Image Game Object has been built into Phaser.
- * @param x The horizontal position of this Game Object in the world.
- * @param y The vertical position of this Game Object in the world.
- * @param texture The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
- * @param frame An optional frame from the Texture this Game Object is rendering with.
- */
- image(x: number, y: number, texture: string, frame?: string | integer): Phaser.GameObjects.Image;
-
- /**
- * Creates a new Mesh Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser.
- * @param x The horizontal position of this Game Object in the world.
- * @param y The vertical position of this Game Object in the world.
- * @param vertices An array containing the vertices data for this Mesh.
- * @param uv An array containing the uv data for this Mesh.
- * @param colors An array containing the color data for this Mesh.
- * @param alphas An array containing the alpha data for this Mesh.
- * @param texture The key 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.
- */
- mesh(x: number, y: number, vertices: number[], uv: number[], colors: number[], alphas: number[], texture: string, frame?: string | integer): Phaser.GameObjects.Mesh;
-
- /**
- * Creates a new Particle Emitter Manager Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Particles Game Object has been built into Phaser.
- * @param texture The key 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 emitters Configuration settings for one or more emitters to create.
- */
- particles(texture: string, frame?: string | integer | object, emitters?: Phaser.Types.GameObjects.Particles.ParticleEmitterConfig | Phaser.Types.GameObjects.Particles.ParticleEmitterConfig[]): Phaser.GameObjects.Particles.ParticleEmitterManager;
-
- /**
- * Creates a new PathFollower Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the PathFollower Game Object has been built into Phaser.
- * @param path The Path this PathFollower is connected to.
- * @param x The horizontal position of this Game Object in the world.
- * @param y The vertical position of this Game Object in the world.
- * @param texture The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
- * @param frame An optional frame from the Texture this Game Object is rendering with.
- */
- follower(path: Phaser.Curves.Path, x: number, y: number, texture: string, frame?: string | integer): Phaser.GameObjects.PathFollower;
-
- /**
- * Creates a new Quad Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Quad Game Object and WebGL support have been built into Phaser.
- * @param x The horizontal position of this Game Object in the world.
- * @param y The vertical position of this Game Object in the world.
- * @param texture The key 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.
- */
- quad(x: number, y: number, texture: string, frame?: string | integer): Phaser.GameObjects.Quad;
-
- /**
- * Creates a new Render Texture Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Render Texture Game Object has been built into Phaser.
- *
- * A Render Texture is a special texture that allows any number of Game Objects to be drawn to it. You can take many complex objects and
- * draw them all to this one texture, which can they be used as the texture for other Game Object's. It's a way to generate dynamic
- * textures at run-time that are WebGL friendly and don't invoke expensive GPU uploads.
- * @param x The horizontal position of this Game Object in the world.
- * @param y The vertical position of this Game Object in the world.
- * @param width The width of the Render Texture. Default 32.
- * @param height The height of the Render Texture. Default 32.
- */
- renderTexture(x: number, y: number, width?: integer, height?: integer): Phaser.GameObjects.RenderTexture;
-
- /**
- * Creates a new Shader Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Shader Game Object and WebGL support have been built into Phaser.
- * @param key The key of the shader to use from the shader cache, or a BaseShader instance.
- * @param x The horizontal position of this Game Object in the world. Default 0.
- * @param y The vertical position of this Game Object in the world. Default 0.
- * @param width The width of the Game Object. Default 128.
- * @param height The height of the Game Object. Default 128.
- * @param textures Optional array of texture keys to bind to the iChannel0...3 uniforms. The textures must already exist in the Texture Manager.
- * @param textureData Optional additional texture data.
- */
- shader(key: string | Phaser.Display.BaseShader, x?: number, y?: number, width?: number, height?: number, textures?: string[], textureData?: object): Phaser.GameObjects.Shader;
-
- /**
- * Creates a new Arc Shape Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Arc Game Object has been built into Phaser.
- *
- * The Arc Shape is a Game Object that can be added to a Scene, Group or Container. You can
- * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
- * it for input or physics. It provides a quick and easy way for you to render this shape in your
- * game without using a texture, while still taking advantage of being fully batched in WebGL.
- *
- * This shape supports both fill and stroke colors.
- *
- * When it renders it displays an arc shape. You can control the start and end angles of the arc,
- * as well as if the angles are winding clockwise or anti-clockwise. With the default settings
- * it renders as a complete circle. By changing the angles you can create other arc shapes,
- * such as half-circles.
- * @param x The horizontal position of this Game Object in the world. Default 0.
- * @param y The vertical position of this Game Object in the world. Default 0.
- * @param radius The radius of the arc. Default 128.
- * @param startAngle The start angle of the arc, in degrees. Default 0.
- * @param endAngle The end angle of the arc, in degrees. Default 360.
- * @param anticlockwise The winding order of the start and end angles. Default false.
- * @param fillColor The color the arc will be filled with, i.e. 0xff0000 for red.
- * @param fillAlpha The alpha the arc will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
- */
- arc(x?: number, y?: number, radius?: number, startAngle?: integer, endAngle?: integer, anticlockwise?: boolean, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Arc;
-
- /**
- * Creates a new Circle Shape Game Object and adds it to the Scene.
- *
- * A Circle is an Arc with no defined start and end angle, making it render as a complete circle.
- *
- * Note: This method will only be available if the Arc Game Object has been built into Phaser.
- * @param x The horizontal position of this Game Object in the world. Default 0.
- * @param y The vertical position of this Game Object in the world. Default 0.
- * @param radius The radius of the circle. Default 128.
- * @param fillColor The color the circle will be filled with, i.e. 0xff0000 for red.
- * @param fillAlpha The alpha the circle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
- */
- circle(x?: number, y?: number, radius?: number, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Arc;
-
- /**
- * Creates a new Curve Shape Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Curve Game Object has been built into Phaser.
- *
- * The Curve Shape is a Game Object that can be added to a Scene, Group or Container. You can
- * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
- * it for input or physics. It provides a quick and easy way for you to render this shape in your
- * game without using a texture, while still taking advantage of being fully batched in WebGL.
- *
- * This shape supports both fill and stroke colors.
- *
- * To render a Curve Shape you must first create a `Phaser.Curves.Curve` object, then pass it to
- * the Curve Shape in the constructor.
- *
- * The Curve shape also has a `smoothness` property and corresponding `setSmoothness` method.
- * This allows you to control how smooth the shape renders in WebGL, by controlling the number of iterations
- * that take place during construction. Increase and decrease the default value for smoother, or more
- * jagged, shapes.
- * @param x The horizontal position of this Game Object in the world. Default 0.
- * @param y The vertical position of this Game Object in the world. Default 0.
- * @param curve The Curve object to use to create the Shape.
- * @param fillColor The color the curve will be filled with, i.e. 0xff0000 for red.
- * @param fillAlpha The alpha the curve will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
- */
- curve(x?: number, y?: number, curve?: Phaser.Curves.Curve, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Curve;
-
- /**
- * Creates a new Ellipse Shape Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Ellipse Game Object has been built into Phaser.
- *
- * The Ellipse Shape is a Game Object that can be added to a Scene, Group or Container. You can
- * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
- * it for input or physics. It provides a quick and easy way for you to render this shape in your
- * game without using a texture, while still taking advantage of being fully batched in WebGL.
- *
- * This shape supports both fill and stroke colors.
- *
- * When it renders it displays an ellipse shape. You can control the width and height of the ellipse.
- * If the width and height match it will render as a circle. If the width is less than the height,
- * it will look more like an egg shape.
- *
- * The Ellipse shape also has a `smoothness` property and corresponding `setSmoothness` method.
- * This allows you to control how smooth the shape renders in WebGL, by controlling the number of iterations
- * that take place during construction. Increase and decrease the default value for smoother, or more
- * jagged, shapes.
- * @param x The horizontal position of this Game Object in the world. Default 0.
- * @param y The vertical position of this Game Object in the world. Default 0.
- * @param width The width of the ellipse. An ellipse with equal width and height renders as a circle. Default 128.
- * @param height The height of the ellipse. An ellipse with equal width and height renders as a circle. Default 128.
- * @param fillColor The color the ellipse will be filled with, i.e. 0xff0000 for red.
- * @param fillAlpha The alpha the ellipse will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
- */
- ellipse(x?: number, y?: number, width?: number, height?: number, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Ellipse;
-
- /**
- * Creates a new Grid Shape Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Grid Game Object has been built into Phaser.
- *
- * The Grid Shape is a Game Object that can be added to a Scene, Group or Container. You can
- * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
- * it for input or physics. It provides a quick and easy way for you to render this shape in your
- * game without using a texture, while still taking advantage of being fully batched in WebGL.
- *
- * This shape supports only fill colors and cannot be stroked.
- *
- * A Grid Shape allows you to display a grid in your game, where you can control the size of the
- * grid as well as the width and height of the grid cells. You can set a fill color for each grid
- * cell as well as an alternate fill color. When the alternate fill color is set then the grid
- * cells will alternate the fill colors as they render, creating a chess-board effect. You can
- * also optionally have an outline fill color. If set, this draws lines between the grid cells
- * in the given color. If you specify an outline color with an alpha of zero, then it will draw
- * the cells spaced out, but without the lines between them.
- * @param x The horizontal position of this Game Object in the world. Default 0.
- * @param y The vertical position of this Game Object in the world. Default 0.
- * @param width The width of the grid. Default 128.
- * @param height The height of the grid. Default 128.
- * @param cellWidth The width of one cell in the grid. Default 32.
- * @param cellHeight The height of one cell in the grid. Default 32.
- * @param fillColor The color the grid cells will be filled with, i.e. 0xff0000 for red.
- * @param fillAlpha The alpha the grid cells will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
- * @param outlineFillColor The color of the lines between the grid cells.
- * @param outlineFillAlpha The alpha of the lines between the grid cells.
- */
- grid(x?: number, y?: number, width?: number, height?: number, cellWidth?: number, cellHeight?: number, fillColor?: number, fillAlpha?: number, outlineFillColor?: number, outlineFillAlpha?: number): Phaser.GameObjects.Grid;
-
- /**
- * Creates a new IsoBox Shape Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the IsoBox Game Object has been built into Phaser.
- *
- * The IsoBox Shape is a Game Object that can be added to a Scene, Group or Container. You can
- * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
- * it for input or physics. It provides a quick and easy way for you to render this shape in your
- * game without using a texture, while still taking advantage of being fully batched in WebGL.
- *
- * This shape supports only fill colors and cannot be stroked.
- *
- * An IsoBox is an 'isometric' rectangle. Each face of it has a different fill color. You can set
- * the color of the top, left and right faces of the rectangle respectively. You can also choose
- * which of the faces are rendered via the `showTop`, `showLeft` and `showRight` properties.
- *
- * You cannot view an IsoBox from under-neath, however you can change the 'angle' by setting
- * the `projection` property.
- * @param x The horizontal position of this Game Object in the world. Default 0.
- * @param y The vertical position of this Game Object in the world. Default 0.
- * @param size The width of the iso box in pixels. The left and right faces will be exactly half this value. Default 48.
- * @param height The height of the iso box. The left and right faces will be this tall. The overall height of the isobox will be this value plus half the `size` value. Default 32.
- * @param fillTop The fill color of the top face of the iso box. Default 0xeeeeee.
- * @param fillLeft The fill color of the left face of the iso box. Default 0x999999.
- * @param fillRight The fill color of the right face of the iso box. Default 0xcccccc.
- */
- isobox(x?: number, y?: number, size?: number, height?: number, fillTop?: number, fillLeft?: number, fillRight?: number): Phaser.GameObjects.IsoBox;
-
- /**
- * Creates a new IsoTriangle Shape Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the IsoTriangle Game Object has been built into Phaser.
- *
- * The IsoTriangle Shape is a Game Object that can be added to a Scene, Group or Container. You can
- * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
- * it for input or physics. It provides a quick and easy way for you to render this shape in your
- * game without using a texture, while still taking advantage of being fully batched in WebGL.
- *
- * This shape supports only fill colors and cannot be stroked.
- *
- * An IsoTriangle is an 'isometric' triangle. Think of it like a pyramid. Each face has a different
- * fill color. You can set the color of the top, left and right faces of the triangle respectively
- * You can also choose which of the faces are rendered via the `showTop`, `showLeft` and `showRight` properties.
- *
- * You cannot view an IsoTriangle from under-neath, however you can change the 'angle' by setting
- * the `projection` property. The `reversed` property controls if the IsoTriangle is rendered upside
- * down or not.
- * @param x The horizontal position of this Game Object in the world. Default 0.
- * @param y The vertical position of this Game Object in the world. Default 0.
- * @param size The width of the iso triangle in pixels. The left and right faces will be exactly half this value. Default 48.
- * @param height The height of the iso triangle. The left and right faces will be this tall. The overall height of the iso triangle will be this value plus half the `size` value. Default 32.
- * @param reversed Is the iso triangle upside down? Default false.
- * @param fillTop The fill color of the top face of the iso triangle. Default 0xeeeeee.
- * @param fillLeft The fill color of the left face of the iso triangle. Default 0x999999.
- * @param fillRight The fill color of the right face of the iso triangle. Default 0xcccccc.
- */
- isotriangle(x?: number, y?: number, size?: number, height?: number, reversed?: boolean, fillTop?: number, fillLeft?: number, fillRight?: number): Phaser.GameObjects.IsoTriangle;
-
- /**
- * Creates a new Line Shape Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Line Game Object has been built into Phaser.
- *
- * The Line Shape is a Game Object that can be added to a Scene, Group or Container. You can
- * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
- * it for input or physics. It provides a quick and easy way for you to render this shape in your
- * game without using a texture, while still taking advantage of being fully batched in WebGL.
- *
- * This shape supports only stroke colors and cannot be filled.
- *
- * A Line Shape allows you to draw a line between two points in your game. You can control the
- * stroke color and thickness of the line. In WebGL only you can also specify a different
- * thickness for the start and end of the line, allowing you to render lines that taper-off.
- *
- * If you need to draw multiple lines in a sequence you may wish to use the Polygon Shape instead.
- * @param x The horizontal position of this Game Object in the world. Default 0.
- * @param y The vertical position of this Game Object in the world. Default 0.
- * @param x1 The horizontal position of the start of the line. Default 0.
- * @param y1 The vertical position of the start of the line. Default 0.
- * @param x2 The horizontal position of the end of the line. Default 128.
- * @param y2 The vertical position of the end of the line. Default 0.
- * @param strokeColor The color the line will be drawn in, i.e. 0xff0000 for red.
- * @param strokeAlpha The alpha the line will be drawn in. You can also set the alpha of the overall Shape using its `alpha` property.
- */
- line(x?: number, y?: number, x1?: number, y1?: number, x2?: number, y2?: number, strokeColor?: number, strokeAlpha?: number): Phaser.GameObjects.Line;
-
- /**
- * Creates a new Polygon Shape Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Polygon Game Object has been built into Phaser.
- *
- * The Polygon Shape is a Game Object that can be added to a Scene, Group or Container. You can
- * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
- * it for input or physics. It provides a quick and easy way for you to render this shape in your
- * game without using a texture, while still taking advantage of being fully batched in WebGL.
- *
- * This shape supports both fill and stroke colors.
- *
- * The Polygon Shape is created by providing a list of points, which are then used to create an
- * internal Polygon geometry object. The points can be set from a variety of formats:
- *
- * - An array of Point or Vector2 objects: `[new Phaser.Math.Vec2(x1, y1), ...]`
- * - An array of objects with public x/y properties: `[obj1, obj2, ...]`
- * - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]`
- * - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]`
- *
- * By default the `x` and `y` coordinates of this Shape refer to the center of it. However, depending
- * on the coordinates of the points provided, the final shape may be rendered offset from its origin.
- * @param x The horizontal position of this Game Object in the world. Default 0.
- * @param y The vertical position of this Game Object in the world. Default 0.
- * @param points The points that make up the polygon.
- * @param fillColor The color the polygon will be filled with, i.e. 0xff0000 for red.
- * @param fillAlpha The alpha the polygon will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
- */
- polygon(x?: number, y?: number, points?: any, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Polygon;
-
- /**
- * Creates a new Rectangle Shape Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Rectangle Game Object has been built into Phaser.
- *
- * The Rectangle Shape is a Game Object that can be added to a Scene, Group or Container. You can
- * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
- * it for input or physics. It provides a quick and easy way for you to render this shape in your
- * game without using a texture, while still taking advantage of being fully batched in WebGL.
- *
- * This shape supports both fill and stroke colors.
- *
- * You can change the size of the rectangle by changing the `width` and `height` properties.
- * @param x The horizontal position of this Game Object in the world. Default 0.
- * @param y The vertical position of this Game Object in the world. Default 0.
- * @param width The width of the rectangle. Default 128.
- * @param height The height of the rectangle. Default 128.
- * @param fillColor The color the rectangle will be filled with, i.e. 0xff0000 for red.
- * @param fillAlpha The alpha the rectangle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
- */
- rectangle(x?: number, y?: number, width?: number, height?: number, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Rectangle;
-
- /**
- * Creates a new Star Shape Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Star Game Object has been built into Phaser.
- *
- * The Star Shape is a Game Object that can be added to a Scene, Group or Container. You can
- * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
- * it for input or physics. It provides a quick and easy way for you to render this shape in your
- * game without using a texture, while still taking advantage of being fully batched in WebGL.
- *
- * This shape supports both fill and stroke colors.
- *
- * As the name implies, the Star shape will display a star in your game. You can control several
- * aspects of it including the number of points that constitute the star. The default is 5. If
- * you change it to 4 it will render as a diamond. If you increase them, you'll get a more spiky
- * star shape.
- *
- * You can also control the inner and outer radius, which is how 'long' each point of the star is.
- * Modify these values to create more interesting shapes.
- * @param x The horizontal position of this Game Object in the world. Default 0.
- * @param y The vertical position of this Game Object in the world. Default 0.
- * @param points The number of points on the star. Default 5.
- * @param innerRadius The inner radius of the star. Default 32.
- * @param outerRadius The outer radius of the star. Default 64.
- * @param fillColor The color the star will be filled with, i.e. 0xff0000 for red.
- * @param fillAlpha The alpha the star will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
- */
- star(x?: number, y?: number, points?: number, innerRadius?: number, outerRadius?: number, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Star;
-
- /**
- * Creates a new Triangle Shape Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Triangle Game Object has been built into Phaser.
- *
- * The Triangle Shape is a Game Object that can be added to a Scene, Group or Container. You can
- * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
- * it for input or physics. It provides a quick and easy way for you to render this shape in your
- * game without using a texture, while still taking advantage of being fully batched in WebGL.
- *
- * This shape supports both fill and stroke colors.
- *
- * The Triangle consists of 3 lines, joining up to form a triangular shape. You can control the
- * position of each point of these lines. The triangle is always closed and cannot have an open
- * face. If you require that, consider using a Polygon instead.
- * @param x The horizontal position of this Game Object in the world. Default 0.
- * @param y The vertical position of this Game Object in the world. Default 0.
- * @param x1 The horizontal position of the first point in the triangle. Default 0.
- * @param y1 The vertical position of the first point in the triangle. Default 128.
- * @param x2 The horizontal position of the second point in the triangle. Default 64.
- * @param y2 The vertical position of the second point in the triangle. Default 0.
- * @param x3 The horizontal position of the third point in the triangle. Default 128.
- * @param y3 The vertical position of the third point in the triangle. Default 128.
- * @param fillColor The color the triangle will be filled with, i.e. 0xff0000 for red.
- * @param fillAlpha The alpha the triangle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
- */
- triangle(x?: number, y?: number, x1?: number, y1?: number, x2?: number, y2?: number, x3?: number, y3?: number, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Triangle;
-
- /**
- * Creates a new Sprite Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Sprite Game Object has been built into Phaser.
- * @param x The horizontal position of this Game Object in the world.
- * @param y The vertical position of this Game Object in the world.
- * @param texture The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
- * @param frame An optional frame from the Texture this Game Object is rendering with.
- */
- sprite(x: number, y: number, texture: string, frame?: string | integer): Phaser.GameObjects.Sprite;
-
- /**
- * Creates a new Text Game Object and adds it to the Scene.
- *
- * A Text Game Object.
- *
- * Text objects work by creating their own internal hidden Canvas and then renders text to it using
- * the standard Canvas `fillText` API. It then creates a texture from this canvas which is rendered
- * to your game during the render pass.
- *
- * Because it uses the Canvas API you can take advantage of all the features this offers, such as
- * applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts
- * loaded externally, such as Google or TypeKit Web fonts.
- *
- * You can only display fonts that are currently loaded and available to the browser: therefore fonts must
- * be pre-loaded. Phaser does not do ths for you, so you will require the use of a 3rd party font loader,
- * or have the fonts ready available in the CSS on the page in which your Phaser game resides.
- *
- * See {@link http://www.jordanm.co.uk/tinytype this compatibility table} for the available default fonts
- * across mobile browsers.
- *
- * A note on performance: Every time the contents of a Text object changes, i.e. changing the text being
- * displayed, or the style of the text, it needs to remake the Text canvas, and if on WebGL, re-upload the
- * new texture to the GPU. This can be an expensive operation if used often, or with large quantities of
- * Text objects in your game. If you run into performance issues you would be better off using Bitmap Text
- * instead, as it benefits from batching and avoids expensive Canvas API calls.
- *
- * Note: This method will only be available if the Text Game Object has been built into Phaser.
- * @param x The horizontal position of this Game Object in the world.
- * @param y The vertical position of this Game Object in the world.
- * @param text The text this Text object will display.
- * @param style The Text style configuration object.
- */
- text(x: number, y: number, text: string | string[], style?: object): Phaser.GameObjects.Text;
-
- /**
- * Creates a new TileSprite Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the TileSprite Game Object has been built into Phaser.
- * @param x The horizontal position of this Game Object in the world.
- * @param y The vertical position of this Game Object in the world.
- * @param width The width of the Game Object. If zero it will use the size of the texture frame.
- * @param height The height of the Game Object. If zero it will use the size of the texture frame.
- * @param texture The key 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.
- */
- tileSprite(x: number, y: number, width: integer, height: integer, texture: string, frame?: string | integer): Phaser.GameObjects.TileSprite;
-
- /**
- * Creates a new Image Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Image Game Object has been built into Phaser.
- * @param x The horizontal position of this Game Object in the world.
- * @param y The vertical position of this Game Object in the world.
- * @param texture The key 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.
- */
- video(x: number, y: number, texture: string, frame?: string | integer): Phaser.GameObjects.Image;
-
- /**
- * Creates a new Zone Game Object and adds it to the Scene.
- *
- * Note: This method will only be available if the Zone Game Object has been built into Phaser.
- * @param x The horizontal position of this Game Object in the world.
- * @param y The vertical position of this Game Object in the world.
- * @param width The width of the Game Object.
- * @param height The height of the Game Object.
- */
- zone(x: number, y: number, width: number, height: number): Phaser.GameObjects.Zone;
-
- /**
- * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided.
- * When loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing
- * from a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map
- * data. For an empty map, you should specify tileWidth, tileHeight, width & height.
- * @param key The key in the Phaser cache that corresponds to the loaded tilemap data.
- * @param tileWidth The width of a tile in pixels. Pass in `null` to leave as the
- * default. Default 32.
- * @param tileHeight The height of a tile in pixels. Pass in `null` to leave as the
- * default. Default 32.
- * @param width The width of the map in tiles. Pass in `null` to leave as the
- * default. Default 10.
- * @param height The height of the map in tiles. Pass in `null` to leave as the
- * default. Default 10.
- * @param data Instead of loading from the cache, you can also load directly from
- * a 2D array of tile indexes. Pass in `null` for no data.
- * @param insertNull Controls how empty tiles, tiles with an index of -1, in the
- * map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty
- * location will get a Tile object with an index of -1. If you've a large sparsely populated map and
- * the tile data doesn't need to change then setting this value to `true` will help with memory
- * consumption. However if your map is small or you need to update the tiles dynamically, then leave
- * the default value set. Default false.
- */
- tilemap(key?: string, tileWidth?: integer, tileHeight?: integer, width?: integer, height?: integer, data?: integer[][], insertNull?: boolean): Phaser.Tilemaps.Tilemap;
-
- /**
- * Creates a new Tween object.
- *
- * Note: This method will only be available if Tweens have been built into Phaser.
- * @param config The Tween configuration.
- */
- tween(config: Phaser.Types.Tweens.TweenBuilderConfig | object): Phaser.Tweens.Tween;
-
- }
-
- /**
- * The Update List plugin.
- *
- * Update Lists belong to a Scene and maintain the list Game Objects to be updated every frame.
- *
- * Some or all of these Game Objects may also be part of the Scene's [Display List]{@link Phaser.GameObjects.DisplayList}, for Rendering.
- */
- class UpdateList extends Phaser.Structs.ProcessQueue {
- /**
- *
- * @param scene The Scene that the Update List belongs to.
- */
- constructor(scene: Phaser.Scene);
-
- /**
- * The Scene that the Update List belongs to.
- */
- scene: Phaser.Scene;
-
- /**
- * The Scene's Systems.
- */
- systems: Phaser.Scenes.Systems;
-
- /**
- * The update step.
- *
- * Pre-updates every active Game Object in the list.
- * @param time The current timestamp.
- * @param delta The delta time elapsed since the last frame.
- */
- sceneUpdate(time: number, delta: number): void;
-
- /**
- * The Scene that owns this plugin is shutting down.
- *
- * We need to kill and reset all internal properties as well as stop listening to Scene events.
- */
- shutdown(): void;
-
- /**
- * The Scene that owns this plugin is being destroyed.
- *
- * We need to shutdown and then kill off all external references.
- */
- destroy(): void;
-
- }
-
- namespace RetroFont {
- /**
- * Parses a Retro Font configuration object so you can pass it to the BitmapText constructor
- * and create a BitmapText object using a fixed-width retro font.
- * @param scene A reference to the Phaser Scene.
- * @param config The font configuration object.
- */
- function Parse(scene: Phaser.Scene, config: Phaser.Types.GameObjects.BitmapText.RetroFontConfig): object;
-
- /**
- * Text Set 1 = !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
- */
- var TEXT_SET1: string;
-
- /**
- * Text Set 2 = !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ
- */
- var TEXT_SET2: string;
-
- /**
- * Text Set 3 = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
- */
- var TEXT_SET3: string;
-
- /**
- * Text Set 4 = ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789
- */
- var TEXT_SET4: string;
-
- /**
- * Text Set 5 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789
- */
- var TEXT_SET5: string;
-
- /**
- * Text Set 6 = ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789"(),-.'
- */
- var TEXT_SET6: string;
-
- /**
- * Text Set 7 = AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW")28FLRX-'39
- */
- var TEXT_SET7: string;
-
- /**
- * Text Set 8 = 0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ
- */
- var TEXT_SET8: string;
-
- /**
- * Text Set 9 = ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'"?!
- */
- var TEXT_SET9: string;
-
- /**
- * Text Set 10 = ABCDEFGHIJKLMNOPQRSTUVWXYZ
- */
- var TEXT_SET10: string;
-
- /**
- * Text Set 11 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,"-+!?()':;0123456789
- */
- var TEXT_SET11: string;
-
- }
-
/**
* BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure.
*
@@ -10156,6 +8732,72 @@ declare namespace Phaser {
}
+ namespace RetroFont {
+ /**
+ * Text Set 1 = !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
+ */
+ var TEXT_SET1: string;
+
+ /**
+ * Text Set 2 = !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ
+ */
+ var TEXT_SET2: string;
+
+ /**
+ * Text Set 3 = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
+ */
+ var TEXT_SET3: string;
+
+ /**
+ * Text Set 4 = ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789
+ */
+ var TEXT_SET4: string;
+
+ /**
+ * Text Set 5 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789
+ */
+ var TEXT_SET5: string;
+
+ /**
+ * Text Set 6 = ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789"(),-.'
+ */
+ var TEXT_SET6: string;
+
+ /**
+ * Text Set 7 = AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW")28FLRX-'39
+ */
+ var TEXT_SET7: string;
+
+ /**
+ * Text Set 8 = 0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ
+ */
+ var TEXT_SET8: string;
+
+ /**
+ * Text Set 9 = ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'"?!
+ */
+ var TEXT_SET9: string;
+
+ /**
+ * Text Set 10 = ABCDEFGHIJKLMNOPQRSTUVWXYZ
+ */
+ var TEXT_SET10: string;
+
+ /**
+ * Text Set 11 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,"-+!?()':;0123456789
+ */
+ var TEXT_SET11: string;
+
+ /**
+ * Parses a Retro Font configuration object so you can pass it to the BitmapText constructor
+ * and create a BitmapText object using a fixed-width retro font.
+ * @param scene A reference to the Phaser Scene.
+ * @param config The font configuration object.
+ */
+ function Parse(scene: Phaser.Scene, config: Phaser.Types.GameObjects.BitmapText.RetroFontConfig): object;
+
+ }
+
/**
* BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure.
*
@@ -11834,6 +10476,21 @@ declare namespace Phaser {
}
+ /**
+ * Builds a Game Object using the provided configuration object.
+ * @param scene A reference to the Scene.
+ * @param gameObject The initial GameObject.
+ * @param config The config to build the GameObject with.
+ */
+ function BuildGameObject(scene: Phaser.Scene, gameObject: Phaser.GameObjects.GameObject, config: Phaser.Types.GameObjects.GameObjectConfig): Phaser.GameObjects.GameObject;
+
+ /**
+ * Adds an Animation component to a Sprite and populates it based on the given config.
+ * @param sprite The sprite to add an Animation component to.
+ * @param config The animation config.
+ */
+ function BuildGameObjectAnimation(sprite: Phaser.GameObjects.Sprite, config: object): Phaser.GameObjects.Sprite;
+
namespace Components {
/**
* Provides methods used for setting the alpha properties of a Game Object.
@@ -11890,7 +10547,25 @@ declare namespace Phaser {
* Provides methods used for setting the alpha property of a Game Object.
* Should be applied as a mixin and not used directly.
*/
- namespace AlphaSingle {
+ interface AlphaSingle {
+ /**
+ * 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;
}
interface Animation {
@@ -13520,7 +12195,7 @@ declare namespace Phaser {
* flexible manner as those not within them. In short, don't use them for the sake of it. You pay a small cost
* every time you create one, try to structure your game around avoiding that where possible.
*/
- class Container extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.ComputedSize, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Mask, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible {
+ class Container extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.AlphaSingle, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.ComputedSize, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Mask, 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.
@@ -13995,6 +12670,27 @@ declare namespace Phaser {
*/
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.
+ * @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.
*
@@ -14355,6 +13051,60 @@ declare namespace Phaser {
}
+ /**
+ * The Display List plugin.
+ *
+ * Display Lists belong to a Scene and maintain the list of Game Objects to render every frame.
+ *
+ * Some of these Game Objects may also be part of the Scene's [Update List]{@link Phaser.GameObjects.UpdateList}, for updating.
+ */
+ class DisplayList extends Phaser.Structs.List {
+ /**
+ *
+ * @param scene The Scene that this Display List belongs to.
+ */
+ constructor(scene: Phaser.Scene);
+
+ /**
+ * The flag the determines whether Game Objects should be sorted when `depthSort()` is called.
+ */
+ sortChildrenFlag: boolean;
+
+ /**
+ * The Scene that this Display List belongs to.
+ */
+ scene: Phaser.Scene;
+
+ /**
+ * The Scene's Systems.
+ */
+ systems: Phaser.Scenes.Systems;
+
+ /**
+ * 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): integer;
+
+ /**
+ * Returns an array which contains all objects currently on the Display List.
+ * This is a reference to the main list array, not a copy of it, so be careful not to modify it.
+ */
+ getChildren(): Phaser.GameObjects.GameObject[];
+
+ }
+
/**
* DOM Element Game Objects are a way to control and manipulate HTML Elements over the top of your game.
*
@@ -14408,7 +13158,7 @@ declare namespace Phaser {
* UI. The choice is up to you, just remember that you're dealing with standard HTML and CSS floating over the top
* of your game, and should treat it accordingly.
*/
- class DOMElement extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible {
+ class DOMElement extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.AlphaSingle, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.ScrollFactor, 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.
@@ -14784,6 +13534,27 @@ declare namespace Phaser {
*/
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.
*
@@ -15969,6 +14740,1288 @@ declare namespace Phaser {
}
+ /**
+ * The base class that all Game Objects extend.
+ * You don't create GameObjects directly and they cannot be added to the display list.
+ * Instead, use them as the base for your own custom classes.
+ */
+ class GameObject extends Phaser.Events.EventEmitter {
+ /**
+ *
+ * @param scene The Scene to which this Game Object belongs.
+ * @param type A textual representation of the type of Game Object, i.e. `sprite`.
+ */
+ constructor(scene: Phaser.Scene, type: string);
+
+ /**
+ * The Scene to which this Game Object belongs.
+ * Game Objects can only belong to one Scene.
+ */
+ protected scene: Phaser.Scene;
+
+ /**
+ * 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: integer | string;
+
+ /**
+ * The parent Container of this Game Object, if it has one.
+ */
+ parentContainer: Phaser.GameObjects.Container;
+
+ /**
+ * The name of this Game Object.
+ * Empty by default and never populated by Phaser, this is left for developers to use.
+ */
+ name: string;
+
+ /**
+ * The active state of this Game Object.
+ * A Game Object with an active state of `true` is processed by the Scenes UpdateList, if added to it.
+ * An active object is one which is having its logic and internal systems updated.
+ */
+ active: boolean;
+
+ /**
+ * The Tab Index of the Game Object.
+ * Reserved for future use by plugins and the Input Manager.
+ */
+ tabIndex: integer;
+
+ /**
+ * 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: integer;
+
+ /**
+ * A bitmask that controls if this Game Object is drawn by a Camera or not.
+ * Not usually set directly, instead call `Camera.ignore`, however you can
+ * set this property directly using the Camera.id property:
+ */
+ cameraFilter: number;
+
+ /**
+ * If this Game Object is enabled for input then this property will contain an InteractiveObject instance.
+ * Not usually set directly. Instead call `GameObject.setInteractive()`.
+ */
+ input: Phaser.Types.Input.InteractiveObject;
+
+ /**
+ * If this Game Object is enabled for physics then this property will contain a reference to a Physics Body.
+ */
+ body: object | Phaser.Physics.Arcade.Body | Phaser.Physics.Impact.Body;
+
+ /**
+ * This Game Object will ignore all calls made to its destroy method if this flag is set to `true`.
+ * This includes calls that may come from a Group, Container or the Scene itself.
+ * While it allows you to persist a Game Object across Scenes, please understand you are entirely
+ * responsible for managing references to and from this Game Object.
+ */
+ ignoreDestroy: boolean;
+
+ /**
+ * Sets the `active` property of this Game Object and returns this Game Object for further chaining.
+ * A Game Object with its `active` property set to `true` will be updated by the Scenes UpdateList.
+ * @param value True if this Game Object should be set as active, false if not.
+ */
+ setActive(value: boolean): this;
+
+ /**
+ * Sets the `name` property of this Game Object and returns this Game Object for further chaining.
+ * The `name` property is not populated by Phaser and is presented for your own use.
+ * @param value The name to be given to this Game Object.
+ */
+ setName(value: string): this;
+
+ /**
+ * Sets the current state of this Game Object.
+ *
+ * Phaser itself will never modify the State of a Game Object, although plugins may do so.
+ *
+ * For example, a Game Object could change from a state of 'moving', to 'attacking', to 'dead'.
+ * The state value should typically be an integer (ideally mapped to a constant
+ * in your game code), but could also be a string. It is recommended to keep it light and simple.
+ * If you need to store complex data about your Game Object, look at using the Data Component instead.
+ * @param value The state of the Game Object.
+ */
+ setState(value: integer | 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;
+
+ /**
+ * Retrieves the value for the given key in this Game Objects Data Manager, or undefined if it doesn't exist.
+ *
+ * You can also access values via the `values` object. For example, if you had a key called `gold` you can do either:
+ *
+ * ```javascript
+ * sprite.getData('gold');
+ * ```
+ *
+ * Or access the value directly:
+ *
+ * ```javascript
+ * sprite.data.values.gold;
+ * ```
+ *
+ * You can also pass in an array of keys, in which case an array of values will be returned:
+ *
+ * ```javascript
+ * sprite.getData([ 'gold', 'armor', 'health' ]);
+ * ```
+ *
+ * This approach is useful for destructuring arrays in ES6.
+ * @param key The key of the value to retrieve, or an array of keys.
+ */
+ getData(key: string | string[]): any;
+
+ /**
+ * Pass this Game Object to the Input Manager to enable it for Input.
+ *
+ * Input works by using hit areas, these are nearly always geometric shapes, such as rectangles or circles, that act as the hit area
+ * for the Game Object. However, you can provide your own hit area shape and callback, should you wish to handle some more advanced
+ * input detection.
+ *
+ * If no arguments are provided it will try and create a rectangle hit area based on the texture frame the Game Object is using. If
+ * this isn't a texture-bound object, such as a Graphics or BitmapText object, this will fail, and you'll need to provide a specific
+ * shape for it to use.
+ *
+ * You can also provide an Input Configuration Object as the only argument to this method.
+ * @param shape 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 callback A callback to be invoked when the Game Object is interacted with. If you provide a shape you must also provide a callback.
+ * @param dropZone Should this Game Object be treated as a drop zone target? Default false.
+ */
+ setInteractive(shape?: Phaser.Types.Input.InputConfiguration | any, callback?: Phaser.Types.Input.HitAreaCallback, dropZone?: boolean): this;
+
+ /**
+ * If this Game Object has previously been enabled for input, this will disable it.
+ *
+ * An object that is disabled for input stops processing or being considered for
+ * input events, but can be turned back on again at any time by simply calling
+ * `setInteractive()` with no arguments provided.
+ *
+ * If want to completely remove interaction from this Game Object then use `removeInteractive` instead.
+ */
+ disableInteractive(): this;
+
+ /**
+ * If this Game Object has previously been enabled for input, this will queue it
+ * for removal, causing it to no longer be interactive. The removal happens on
+ * the next game step, it is not immediate.
+ *
+ * The Interactive Object that was assigned to this Game Object will be destroyed,
+ * removed from the Input Manager and cleared from this Game Object.
+ *
+ * If you wish to re-enable this Game Object at a later date you will need to
+ * re-create its InteractiveObject by calling `setInteractive` again.
+ *
+ * If you wish to only temporarily stop an object from receiving input then use
+ * `disableInteractive` instead, as that toggles the interactive state, where-as
+ * this erases it completely.
+ *
+ * If you wish to resize a hit area, don't remove and then set it as being
+ * interactive. Instead, access the hitarea object directly and resize the shape
+ * being used. I.e.: `sprite.input.hitArea.setSize(width, height)` (assuming the
+ * shape is a Rectangle, which it is by default.)
+ */
+ removeInteractive(): this;
+
+ /**
+ * 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(): integer[];
+
+ /**
+ * Destroys this Game Object removing it from the Display List and Update List and
+ * severing all ties to parent resources.
+ *
+ * Also removes itself from the Input Manager and Physics Manager if previously enabled.
+ *
+ * Use this to remove a Game Object from your game if you don't ever plan to use it again.
+ * As long as no reference to it exists within your own code it should become free for
+ * garbage collection by the browser.
+ *
+ * If you just want to temporarily disable an object then look at using the
+ * Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected.
+ * @param fromScene Is this Game Object being destroyed as the result of a Scene shutdown? Default false.
+ */
+ destroy(fromScene?: boolean): void;
+
+ /**
+ * The bitmask that `GameObject.renderFlags` is compared against to determine if the Game Object will render or not.
+ */
+ static readonly RENDER_MASK: integer;
+
+ }
+
+ /**
+ * The Game Object Creator is a Scene plugin that allows you to quickly create many common
+ * types of Game Objects and return them. Unlike the Game Object Factory, they are not automatically
+ * added to the Scene.
+ *
+ * Game Objects directly register themselves with the Creator and inject their own creation
+ * methods into the class.
+ */
+ class GameObjectCreator {
+ /**
+ *
+ * @param scene The Scene to which this Game Object Factory belongs.
+ */
+ constructor(scene: Phaser.Scene);
+
+ /**
+ * Creates a new Dynamic Bitmap Text Game Object and returns it.
+ *
+ * Note: This method will only be available if the Dynamic Bitmap Text Game Object has been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
+ */
+ dynamicBitmapText(config: Phaser.Types.GameObjects.BitmapText.BitmapTextConfig, addToScene?: boolean): Phaser.GameObjects.DynamicBitmapText;
+
+ /**
+ * Creates a new Bitmap Text Game Object and returns it.
+ *
+ * Note: This method will only be available if the Bitmap Text Game Object has been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
+ */
+ bitmapText(config: Phaser.Types.GameObjects.BitmapText.BitmapTextConfig, addToScene?: boolean): Phaser.GameObjects.BitmapText;
+
+ /**
+ * Creates a new Blitter Game Object and returns it.
+ *
+ * Note: This method will only be available if the Blitter Game Object has been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
+ */
+ blitter(config: object, addToScene?: boolean): Phaser.GameObjects.Blitter;
+
+ /**
+ * Creates a new Container Game Object and returns it.
+ *
+ * Note: This method will only be available if the Container Game Object has been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
+ */
+ container(config: object, addToScene?: boolean): Phaser.GameObjects.Container;
+
+ /**
+ * The Scene to which this Game Object Creator belongs.
+ */
+ protected scene: Phaser.Scene;
+
+ /**
+ * A reference to the Scene.Systems.
+ */
+ protected systems: Phaser.Scenes.Systems;
+
+ /**
+ * A reference to the Scene Display List.
+ */
+ protected displayList: Phaser.GameObjects.DisplayList;
+
+ /**
+ * A reference to the Scene Update List.
+ */
+ protected updateList: Phaser.GameObjects.UpdateList;
+
+ /**
+ * Creates a new Graphics Game Object and returns it.
+ *
+ * Note: This method will only be available if the Graphics Game Object has been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
+ */
+ graphics(config: object, addToScene?: boolean): Phaser.GameObjects.Graphics;
+
+ /**
+ * Creates a new Group Game Object and returns it.
+ *
+ * Note: This method will only be available if the Group Game Object has been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ */
+ group(config: Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig): Phaser.GameObjects.Group;
+
+ /**
+ * Creates a new Image Game Object and returns it.
+ *
+ * Note: This method will only be available if the Image Game Object has been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
+ */
+ image(config: object, addToScene?: boolean): Phaser.GameObjects.Image;
+
+ /**
+ * Creates a new Mesh Game Object and returns it.
+ *
+ * Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
+ */
+ mesh(config: object, addToScene?: boolean): Phaser.GameObjects.Mesh;
+
+ /**
+ * Creates a new Particle Emitter Manager Game Object and returns it.
+ *
+ * Note: This method will only be available if the Particles Game Object has been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
+ */
+ particles(config: object, addToScene?: boolean): Phaser.GameObjects.Particles.ParticleEmitterManager;
+
+ /**
+ * Creates a new Quad Game Object and returns it.
+ *
+ * Note: This method will only be available if the Quad Game Object and WebGL support have been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
+ */
+ quad(config: object, addToScene?: boolean): Phaser.GameObjects.Quad;
+
+ /**
+ * Creates a new Render Texture Game Object and returns it.
+ *
+ * Note: This method will only be available if the Render Texture Game Object has been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
+ */
+ renderTexture(config: Phaser.Types.GameObjects.RenderTexture.RenderTextureConfig, addToScene?: boolean): Phaser.GameObjects.RenderTexture;
+
+ /**
+ * Creates a new Shader Game Object and returns it.
+ *
+ * Note: This method will only be available if the Shader Game Object and WebGL support have been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
+ */
+ shader(config: object, addToScene?: boolean): Phaser.GameObjects.Shader;
+
+ /**
+ * Creates a new Sprite Game Object and returns it.
+ *
+ * Note: This method will only be available if the Sprite Game Object has been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
+ */
+ sprite(config: Phaser.Types.GameObjects.Sprite.SpriteConfig, addToScene?: boolean): Phaser.GameObjects.Sprite;
+
+ /**
+ * Creates a new Text Game Object and returns it.
+ *
+ * Note: This method will only be available if the Text Game Object has been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
+ */
+ text(config: object, addToScene?: boolean): Phaser.GameObjects.Text;
+
+ /**
+ * Creates a new TileSprite Game Object and returns it.
+ *
+ * Note: This method will only be available if the TileSprite Game Object has been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
+ */
+ tileSprite(config: Phaser.Types.GameObjects.TileSprite.TileSpriteConfig, addToScene?: boolean): Phaser.GameObjects.TileSprite;
+
+ /**
+ * Creates a new Video Game Object and returns it.
+ *
+ * Note: This method will only be available if the Video Game Object has been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ * @param addToScene Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object.
+ */
+ video(config: object, addToScene?: boolean): Phaser.GameObjects.Video;
+
+ /**
+ * Creates a new Zone Game Object and returns it.
+ *
+ * Note: This method will only be available if the Zone Game Object has been built into Phaser.
+ * @param config The configuration object this Game Object will use to create itself.
+ */
+ zone(config: object): Phaser.GameObjects.Zone;
+
+ /**
+ * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided.
+ * When loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing
+ * from a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map
+ * data. For an empty map, you should specify tileWidth, tileHeight, width & height.
+ * @param config The config options for the Tilemap.
+ */
+ tilemap(config?: Phaser.Types.Tilemaps.TilemapConfig): Phaser.Tilemaps.Tilemap;
+
+ /**
+ * Creates a new Tween object and returns it.
+ *
+ * Note: This method will only be available if Tweens have been built into Phaser.
+ * @param config The Tween configuration.
+ */
+ tween(config: Phaser.Types.Tweens.TweenBuilderConfig | object): Phaser.Tweens.Tween;
+
+ }
+
+ /**
+ * The Game Object Factory is a Scene plugin that allows you to quickly create many common
+ * types of Game Objects and have them automatically registered with the Scene.
+ *
+ * Game Objects directly register themselves with the Factory and inject their own creation
+ * methods into the class.
+ */
+ class GameObjectFactory {
+ /**
+ *
+ * @param scene The Scene to which this Game Object Factory belongs.
+ */
+ constructor(scene: Phaser.Scene);
+
+ /**
+ * Creates a new Path Object.
+ * @param x The horizontal position of this Path.
+ * @param y The vertical position of this Path.
+ */
+ path(x: number, y: number): Phaser.Curves.Path;
+
+ /**
+ * Creates a new Dynamic Bitmap Text Game Object and adds it to the Scene.
+ *
+ * BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure.
+ *
+ * During rendering for each letter of the text is rendered to the display, proportionally spaced out and aligned to
+ * match the font structure.
+ *
+ * Dynamic Bitmap Text objects are different from Static Bitmap Text in that they invoke a callback for each
+ * letter being rendered during the render pass. This callback allows you to manipulate the properties of
+ * each letter being rendered, such as its position, scale or tint, allowing you to create interesting effects
+ * like jiggling text, which can't be done with Static text. This means that Dynamic Text takes more processing
+ * time, so only use them if you require the callback ability they have.
+ *
+ * BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability
+ * to use Web Fonts, however you trade this flexibility for rendering speed. You can also create visually compelling BitmapTexts by
+ * processing the font texture in an image editor, applying fills and any other effects required.
+ *
+ * To create multi-line text insert \r, \n or \r\n escape codes into the text string.
+ *
+ * To create a BitmapText data files you need a 3rd party app such as:
+ *
+ * BMFont (Windows, free): http://www.angelcode.com/products/bmfont/
+ * Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner
+ * Littera (Web-based, free): http://kvazars.com/littera/
+ *
+ * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of
+ * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: http://codebeautify.org/xmltojson
+ *
+ * Note: This method will only be available if the Dynamic Bitmap Text Game Object has been built into Phaser.
+ * @param x The x position of the Game Object.
+ * @param y The y position of the Game Object.
+ * @param font The key of the font to use from the BitmapFont cache.
+ * @param text The string, or array of strings, to be set as the content of this Bitmap Text.
+ * @param size The font size to set.
+ */
+ dynamicBitmapText(x: number, y: number, font: string, text?: string | string[], size?: number): Phaser.GameObjects.DynamicBitmapText;
+
+ /**
+ * Creates a new Bitmap Text Game Object and adds it to the Scene.
+ *
+ * BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure.
+ *
+ * During rendering for each letter of the text is rendered to the display, proportionally spaced out and aligned to
+ * match the font structure.
+ *
+ * BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability
+ * to use Web Fonts, however you trade this flexibility for rendering speed. You can also create visually compelling BitmapTexts by
+ * processing the font texture in an image editor, applying fills and any other effects required.
+ *
+ * To create multi-line text insert \r, \n or \r\n escape codes into the text string.
+ *
+ * To create a BitmapText data files you need a 3rd party app such as:
+ *
+ * BMFont (Windows, free): http://www.angelcode.com/products/bmfont/
+ * Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner
+ * Littera (Web-based, free): http://kvazars.com/littera/
+ *
+ * For most use cases it is recommended to use XML. If you wish to use JSON, the formatting should be equal to the result of
+ * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: http://codebeautify.org/xmltojson
+ *
+ * Note: This method will only be available if the Bitmap Text Game Object has been built into Phaser.
+ * @param x The x position of the Game Object.
+ * @param y The y position of the Game Object.
+ * @param font The key of the font to use from the BitmapFont cache.
+ * @param text The string, or array of strings, to be set as the content of this Bitmap Text.
+ * @param size The font size to set.
+ * @param align The alignment of the text in a multi-line BitmapText object. Default 0.
+ */
+ bitmapText(x: number, y: number, font: string, text?: string | string[], size?: number, align?: integer): Phaser.GameObjects.BitmapText;
+
+ /**
+ * Creates a new Blitter Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Blitter Game Object has been built into Phaser.
+ * @param x The x position of the Game Object.
+ * @param y The y position of the Game Object.
+ * @param key The key of the Texture the Blitter object will use.
+ * @param frame The default Frame children of the Blitter will use.
+ */
+ blitter(x: number, y: number, key: string, frame?: string | integer): Phaser.GameObjects.Blitter;
+
+ /**
+ * Creates a new Container Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Container Game Object has been built into Phaser.
+ * @param x The horizontal position of this Game Object in the world.
+ * @param y The vertical position of this Game Object in the world.
+ * @param children An optional array of Game Objects to add to this Container.
+ */
+ container(x: number, y: number, children?: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[]): Phaser.GameObjects.Container;
+
+ /**
+ * DOM Element Game Objects are a way to control and manipulate HTML Elements over the top of your game.
+ *
+ * In order for DOM Elements to display you have to enable them by adding the following to your game
+ * configuration object:
+ *
+ * ```javascript
+ * dom {
+ * createContainer: true
+ * }
+ * ```
+ *
+ * When this is added, Phaser will automatically create a DOM Container div that is positioned over the top
+ * of the game canvas. This div is sized to match the canvas, and if the canvas size changes, as a result of
+ * settings within the Scale Manager, the dom container is resized accordingly.
+ *
+ * You can create a DOM Element by either passing in DOMStrings, or by passing in a reference to an existing
+ * Element that you wish to be placed under the control of Phaser. For example:
+ *
+ * ```javascript
+ * this.add.dom(x, y, 'div', 'background-color: lime; width: 220px; height: 100px; font: 48px Arial', 'Phaser');
+ * ```
+ *
+ * The above code will insert a div element into the DOM Container at the given x/y coordinate. The DOMString in
+ * the 4th argument sets the initial CSS style of the div and the final argument is the inner text. In this case,
+ * it will create a lime colored div that is 220px by 100px in size with the text Phaser in it, in an Arial font.
+ *
+ * You should nearly always, without exception, use explicitly sized HTML Elements, in order to fully control
+ * alignment and positioning of the elements next to regular game content.
+ *
+ * Rather than specify the CSS and HTML directly you can use the `load.html` File Loader to load it into the
+ * cache and then use the `createFromCache` method instead. You can also use `createFromHTML` and various other
+ * methods available in this class to help construct your elements.
+ *
+ * Once the element has been created you can then control it like you would any other Game Object. You can set its
+ * position, scale, rotation, alpha and other properties. It will move as the main Scene Camera moves and be clipped
+ * at the edge of the canvas. It's important to remember some limitations of DOM Elements: The obvious one is that
+ * they appear above or below your game canvas. You cannot blend them into the display list, meaning you cannot have
+ * a DOM Element, then a Sprite, then another DOM Element behind it.
+ *
+ * They also cannot be enabled for input. To do that, you have to use the `addListener` method to add native event
+ * listeners directly. The final limitation is to do with cameras. The DOM Container is sized to match the game canvas
+ * entirely and clipped accordingly. DOM Elements respect camera scrolling and scrollFactor settings, but if you
+ * change the size of the camera so it no longer matches the size of the canvas, they won't be clipped accordingly.
+ *
+ * Also, all DOM Elements are inserted into the same DOM Container, regardless of which Scene they are created in.
+ *
+ * DOM Elements are a powerful way to align native HTML with your Phaser Game Objects. For example, you can insert
+ * a login form for a multiplayer game directly into your title screen. Or a text input box for a highscore table.
+ * Or a banner ad from a 3rd party service. Or perhaps you'd like to use them for high resolution text display and
+ * UI. The choice is up to you, just remember that you're dealing with standard HTML and CSS floating over the top
+ * of your game, and should treat it accordingly.
+ *
+ * Note: This method will only be available if the DOM Element Game Object has been built into Phaser.
+ * @param x The horizontal position of this DOM Element in the world.
+ * @param y The vertical position of this DOM Element in the world.
+ * @param element An existing DOM element, or a string. If a string starting with a # it will do a `getElementById` look-up on the string (minus the hash). Without a hash, it represents the type of element to create, i.e. 'div'.
+ * @param style If a string, will be set directly as the elements `style` property value. If a plain object, will be iterated and the values transferred. In both cases the values replacing whatever CSS styles may have been previously set.
+ * @param innerText If given, will be set directly as the elements `innerText` property value, replacing whatever was there before.
+ */
+ dom(x: number, y: number, element?: HTMLElement | string, style?: string | any, innerText?: string): Phaser.GameObjects.DOMElement;
+
+ /**
+ * Creates a new Extern Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Extern Game Object has been built into Phaser.
+ */
+ extern(): Phaser.GameObjects.Extern;
+
+ /**
+ * The Scene to which this Game Object Factory belongs.
+ */
+ protected scene: Phaser.Scene;
+
+ /**
+ * A reference to the Scene.Systems.
+ */
+ protected systems: Phaser.Scenes.Systems;
+
+ /**
+ * A reference to the Scene Display List.
+ */
+ protected displayList: Phaser.GameObjects.DisplayList;
+
+ /**
+ * A reference to the Scene Update List.
+ */
+ protected updateList: Phaser.GameObjects.UpdateList;
+
+ /**
+ * Adds an existing Game Object to this Scene.
+ *
+ * If the Game Object renders, it will be added to the Display List.
+ * If it has a `preUpdate` method, it will be added to the Update List.
+ * @param child The child to be added to this Scene.
+ */
+ existing(child: Phaser.GameObjects.GameObject | Phaser.GameObjects.Group): Phaser.GameObjects.GameObject;
+
+ /**
+ * Static method called directly by the Game Object factory functions.
+ * With this method you can register a custom GameObject factory in the GameObjectFactory,
+ * providing a name (`factoryType`) and the constructor (`factoryFunction`) in order
+ * to be called when you call to Phaser.Scene.add[ factoryType ] method.
+ * @param factoryType The key of the factory that you will use to call to Phaser.Scene.add[ factoryType ] method.
+ * @param factoryFunction The constructor function to be called when you invoke to the Phaser.Scene.add method.
+ */
+ static register(factoryType: string, factoryFunction: Function): void;
+
+ /**
+ * Static method called directly by the Game Object factory functions.
+ * With this method you can remove a custom GameObject factory registered in the GameObjectFactory,
+ * providing a its `factoryType`.
+ * @param factoryType The key of the factory that you want to remove from the GameObjectFactory.
+ */
+ static remove(factoryType: string): void;
+
+ /**
+ * Creates a new Graphics Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Graphics Game Object has been built into Phaser.
+ * @param config The Graphics configuration.
+ */
+ graphics(config?: Phaser.Types.GameObjects.Graphics.Options): Phaser.GameObjects.Graphics;
+
+ /**
+ * Creates a new Group Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Group Game Object has been built into Phaser.
+ * @param children Game Objects to add to this Group; or the `config` argument.
+ * @param config A Group Configuration object.
+ */
+ group(children?: Phaser.GameObjects.GameObject[] | Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupConfig[], config?: Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig): Phaser.GameObjects.Group;
+
+ /**
+ * Creates a new Image Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Image Game Object has been built into Phaser.
+ * @param x The horizontal position of this Game Object in the world.
+ * @param y The vertical position of this Game Object in the world.
+ * @param texture The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
+ * @param frame An optional frame from the Texture this Game Object is rendering with.
+ */
+ image(x: number, y: number, texture: string, frame?: string | integer): Phaser.GameObjects.Image;
+
+ /**
+ * Creates a new Mesh Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Mesh Game Object and WebGL support have been built into Phaser.
+ * @param x The horizontal position of this Game Object in the world.
+ * @param y The vertical position of this Game Object in the world.
+ * @param vertices An array containing the vertices data for this Mesh.
+ * @param uv An array containing the uv data for this Mesh.
+ * @param colors An array containing the color data for this Mesh.
+ * @param alphas An array containing the alpha data for this Mesh.
+ * @param texture The key 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.
+ */
+ mesh(x: number, y: number, vertices: number[], uv: number[], colors: number[], alphas: number[], texture: string, frame?: string | integer): Phaser.GameObjects.Mesh;
+
+ /**
+ * Creates a new Particle Emitter Manager Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Particles Game Object has been built into Phaser.
+ * @param texture The key 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 emitters Configuration settings for one or more emitters to create.
+ */
+ particles(texture: string, frame?: string | integer | object, emitters?: Phaser.Types.GameObjects.Particles.ParticleEmitterConfig | Phaser.Types.GameObjects.Particles.ParticleEmitterConfig[]): Phaser.GameObjects.Particles.ParticleEmitterManager;
+
+ /**
+ * Creates a new PathFollower Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the PathFollower Game Object has been built into Phaser.
+ * @param path The Path this PathFollower is connected to.
+ * @param x The horizontal position of this Game Object in the world.
+ * @param y The vertical position of this Game Object in the world.
+ * @param texture The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
+ * @param frame An optional frame from the Texture this Game Object is rendering with.
+ */
+ follower(path: Phaser.Curves.Path, x: number, y: number, texture: string, frame?: string | integer): Phaser.GameObjects.PathFollower;
+
+ /**
+ * Creates a new Quad Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Quad Game Object and WebGL support have been built into Phaser.
+ * @param x The horizontal position of this Game Object in the world.
+ * @param y The vertical position of this Game Object in the world.
+ * @param texture The key 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.
+ */
+ quad(x: number, y: number, texture: string, frame?: string | integer): Phaser.GameObjects.Quad;
+
+ /**
+ * Creates a new Render Texture Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Render Texture Game Object has been built into Phaser.
+ *
+ * A Render Texture is a special texture that allows any number of Game Objects to be drawn to it. You can take many complex objects and
+ * draw them all to this one texture, which can they be used as the texture for other Game Object's. It's a way to generate dynamic
+ * textures at run-time that are WebGL friendly and don't invoke expensive GPU uploads.
+ * @param x The horizontal position of this Game Object in the world.
+ * @param y The vertical position of this Game Object in the world.
+ * @param width The width of the Render Texture. Default 32.
+ * @param height The height of the Render Texture. Default 32.
+ */
+ renderTexture(x: number, y: number, width?: integer, height?: integer): Phaser.GameObjects.RenderTexture;
+
+ /**
+ * Creates a new Shader Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Shader Game Object and WebGL support have been built into Phaser.
+ * @param key The key of the shader to use from the shader cache, or a BaseShader instance.
+ * @param x The horizontal position of this Game Object in the world. Default 0.
+ * @param y The vertical position of this Game Object in the world. Default 0.
+ * @param width The width of the Game Object. Default 128.
+ * @param height The height of the Game Object. Default 128.
+ * @param textures Optional array of texture keys to bind to the iChannel0...3 uniforms. The textures must already exist in the Texture Manager.
+ * @param textureData Optional additional texture data.
+ */
+ shader(key: string | Phaser.Display.BaseShader, x?: number, y?: number, width?: number, height?: number, textures?: string[], textureData?: object): Phaser.GameObjects.Shader;
+
+ /**
+ * Creates a new Arc Shape Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Arc Game Object has been built into Phaser.
+ *
+ * The Arc Shape is a Game Object that can be added to a Scene, Group or Container. You can
+ * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
+ * it for input or physics. It provides a quick and easy way for you to render this shape in your
+ * game without using a texture, while still taking advantage of being fully batched in WebGL.
+ *
+ * This shape supports both fill and stroke colors.
+ *
+ * When it renders it displays an arc shape. You can control the start and end angles of the arc,
+ * as well as if the angles are winding clockwise or anti-clockwise. With the default settings
+ * it renders as a complete circle. By changing the angles you can create other arc shapes,
+ * such as half-circles.
+ * @param x The horizontal position of this Game Object in the world. Default 0.
+ * @param y The vertical position of this Game Object in the world. Default 0.
+ * @param radius The radius of the arc. Default 128.
+ * @param startAngle The start angle of the arc, in degrees. Default 0.
+ * @param endAngle The end angle of the arc, in degrees. Default 360.
+ * @param anticlockwise The winding order of the start and end angles. Default false.
+ * @param fillColor The color the arc will be filled with, i.e. 0xff0000 for red.
+ * @param fillAlpha The alpha the arc will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
+ */
+ arc(x?: number, y?: number, radius?: number, startAngle?: integer, endAngle?: integer, anticlockwise?: boolean, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Arc;
+
+ /**
+ * Creates a new Circle Shape Game Object and adds it to the Scene.
+ *
+ * A Circle is an Arc with no defined start and end angle, making it render as a complete circle.
+ *
+ * Note: This method will only be available if the Arc Game Object has been built into Phaser.
+ * @param x The horizontal position of this Game Object in the world. Default 0.
+ * @param y The vertical position of this Game Object in the world. Default 0.
+ * @param radius The radius of the circle. Default 128.
+ * @param fillColor The color the circle will be filled with, i.e. 0xff0000 for red.
+ * @param fillAlpha The alpha the circle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
+ */
+ circle(x?: number, y?: number, radius?: number, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Arc;
+
+ /**
+ * Creates a new Curve Shape Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Curve Game Object has been built into Phaser.
+ *
+ * The Curve Shape is a Game Object that can be added to a Scene, Group or Container. You can
+ * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
+ * it for input or physics. It provides a quick and easy way for you to render this shape in your
+ * game without using a texture, while still taking advantage of being fully batched in WebGL.
+ *
+ * This shape supports both fill and stroke colors.
+ *
+ * To render a Curve Shape you must first create a `Phaser.Curves.Curve` object, then pass it to
+ * the Curve Shape in the constructor.
+ *
+ * The Curve shape also has a `smoothness` property and corresponding `setSmoothness` method.
+ * This allows you to control how smooth the shape renders in WebGL, by controlling the number of iterations
+ * that take place during construction. Increase and decrease the default value for smoother, or more
+ * jagged, shapes.
+ * @param x The horizontal position of this Game Object in the world. Default 0.
+ * @param y The vertical position of this Game Object in the world. Default 0.
+ * @param curve The Curve object to use to create the Shape.
+ * @param fillColor The color the curve will be filled with, i.e. 0xff0000 for red.
+ * @param fillAlpha The alpha the curve will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
+ */
+ curve(x?: number, y?: number, curve?: Phaser.Curves.Curve, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Curve;
+
+ /**
+ * Creates a new Ellipse Shape Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Ellipse Game Object has been built into Phaser.
+ *
+ * The Ellipse Shape is a Game Object that can be added to a Scene, Group or Container. You can
+ * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
+ * it for input or physics. It provides a quick and easy way for you to render this shape in your
+ * game without using a texture, while still taking advantage of being fully batched in WebGL.
+ *
+ * This shape supports both fill and stroke colors.
+ *
+ * When it renders it displays an ellipse shape. You can control the width and height of the ellipse.
+ * If the width and height match it will render as a circle. If the width is less than the height,
+ * it will look more like an egg shape.
+ *
+ * The Ellipse shape also has a `smoothness` property and corresponding `setSmoothness` method.
+ * This allows you to control how smooth the shape renders in WebGL, by controlling the number of iterations
+ * that take place during construction. Increase and decrease the default value for smoother, or more
+ * jagged, shapes.
+ * @param x The horizontal position of this Game Object in the world. Default 0.
+ * @param y The vertical position of this Game Object in the world. Default 0.
+ * @param width The width of the ellipse. An ellipse with equal width and height renders as a circle. Default 128.
+ * @param height The height of the ellipse. An ellipse with equal width and height renders as a circle. Default 128.
+ * @param fillColor The color the ellipse will be filled with, i.e. 0xff0000 for red.
+ * @param fillAlpha The alpha the ellipse will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
+ */
+ ellipse(x?: number, y?: number, width?: number, height?: number, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Ellipse;
+
+ /**
+ * Creates a new Grid Shape Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Grid Game Object has been built into Phaser.
+ *
+ * The Grid Shape is a Game Object that can be added to a Scene, Group or Container. You can
+ * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
+ * it for input or physics. It provides a quick and easy way for you to render this shape in your
+ * game without using a texture, while still taking advantage of being fully batched in WebGL.
+ *
+ * This shape supports only fill colors and cannot be stroked.
+ *
+ * A Grid Shape allows you to display a grid in your game, where you can control the size of the
+ * grid as well as the width and height of the grid cells. You can set a fill color for each grid
+ * cell as well as an alternate fill color. When the alternate fill color is set then the grid
+ * cells will alternate the fill colors as they render, creating a chess-board effect. You can
+ * also optionally have an outline fill color. If set, this draws lines between the grid cells
+ * in the given color. If you specify an outline color with an alpha of zero, then it will draw
+ * the cells spaced out, but without the lines between them.
+ * @param x The horizontal position of this Game Object in the world. Default 0.
+ * @param y The vertical position of this Game Object in the world. Default 0.
+ * @param width The width of the grid. Default 128.
+ * @param height The height of the grid. Default 128.
+ * @param cellWidth The width of one cell in the grid. Default 32.
+ * @param cellHeight The height of one cell in the grid. Default 32.
+ * @param fillColor The color the grid cells will be filled with, i.e. 0xff0000 for red.
+ * @param fillAlpha The alpha the grid cells will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
+ * @param outlineFillColor The color of the lines between the grid cells.
+ * @param outlineFillAlpha The alpha of the lines between the grid cells.
+ */
+ grid(x?: number, y?: number, width?: number, height?: number, cellWidth?: number, cellHeight?: number, fillColor?: number, fillAlpha?: number, outlineFillColor?: number, outlineFillAlpha?: number): Phaser.GameObjects.Grid;
+
+ /**
+ * Creates a new IsoBox Shape Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the IsoBox Game Object has been built into Phaser.
+ *
+ * The IsoBox Shape is a Game Object that can be added to a Scene, Group or Container. You can
+ * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
+ * it for input or physics. It provides a quick and easy way for you to render this shape in your
+ * game without using a texture, while still taking advantage of being fully batched in WebGL.
+ *
+ * This shape supports only fill colors and cannot be stroked.
+ *
+ * An IsoBox is an 'isometric' rectangle. Each face of it has a different fill color. You can set
+ * the color of the top, left and right faces of the rectangle respectively. You can also choose
+ * which of the faces are rendered via the `showTop`, `showLeft` and `showRight` properties.
+ *
+ * You cannot view an IsoBox from under-neath, however you can change the 'angle' by setting
+ * the `projection` property.
+ * @param x The horizontal position of this Game Object in the world. Default 0.
+ * @param y The vertical position of this Game Object in the world. Default 0.
+ * @param size The width of the iso box in pixels. The left and right faces will be exactly half this value. Default 48.
+ * @param height The height of the iso box. The left and right faces will be this tall. The overall height of the isobox will be this value plus half the `size` value. Default 32.
+ * @param fillTop The fill color of the top face of the iso box. Default 0xeeeeee.
+ * @param fillLeft The fill color of the left face of the iso box. Default 0x999999.
+ * @param fillRight The fill color of the right face of the iso box. Default 0xcccccc.
+ */
+ isobox(x?: number, y?: number, size?: number, height?: number, fillTop?: number, fillLeft?: number, fillRight?: number): Phaser.GameObjects.IsoBox;
+
+ /**
+ * Creates a new IsoTriangle Shape Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the IsoTriangle Game Object has been built into Phaser.
+ *
+ * The IsoTriangle Shape is a Game Object that can be added to a Scene, Group or Container. You can
+ * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
+ * it for input or physics. It provides a quick and easy way for you to render this shape in your
+ * game without using a texture, while still taking advantage of being fully batched in WebGL.
+ *
+ * This shape supports only fill colors and cannot be stroked.
+ *
+ * An IsoTriangle is an 'isometric' triangle. Think of it like a pyramid. Each face has a different
+ * fill color. You can set the color of the top, left and right faces of the triangle respectively
+ * You can also choose which of the faces are rendered via the `showTop`, `showLeft` and `showRight` properties.
+ *
+ * You cannot view an IsoTriangle from under-neath, however you can change the 'angle' by setting
+ * the `projection` property. The `reversed` property controls if the IsoTriangle is rendered upside
+ * down or not.
+ * @param x The horizontal position of this Game Object in the world. Default 0.
+ * @param y The vertical position of this Game Object in the world. Default 0.
+ * @param size The width of the iso triangle in pixels. The left and right faces will be exactly half this value. Default 48.
+ * @param height The height of the iso triangle. The left and right faces will be this tall. The overall height of the iso triangle will be this value plus half the `size` value. Default 32.
+ * @param reversed Is the iso triangle upside down? Default false.
+ * @param fillTop The fill color of the top face of the iso triangle. Default 0xeeeeee.
+ * @param fillLeft The fill color of the left face of the iso triangle. Default 0x999999.
+ * @param fillRight The fill color of the right face of the iso triangle. Default 0xcccccc.
+ */
+ isotriangle(x?: number, y?: number, size?: number, height?: number, reversed?: boolean, fillTop?: number, fillLeft?: number, fillRight?: number): Phaser.GameObjects.IsoTriangle;
+
+ /**
+ * Creates a new Line Shape Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Line Game Object has been built into Phaser.
+ *
+ * The Line Shape is a Game Object that can be added to a Scene, Group or Container. You can
+ * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
+ * it for input or physics. It provides a quick and easy way for you to render this shape in your
+ * game without using a texture, while still taking advantage of being fully batched in WebGL.
+ *
+ * This shape supports only stroke colors and cannot be filled.
+ *
+ * A Line Shape allows you to draw a line between two points in your game. You can control the
+ * stroke color and thickness of the line. In WebGL only you can also specify a different
+ * thickness for the start and end of the line, allowing you to render lines that taper-off.
+ *
+ * If you need to draw multiple lines in a sequence you may wish to use the Polygon Shape instead.
+ * @param x The horizontal position of this Game Object in the world. Default 0.
+ * @param y The vertical position of this Game Object in the world. Default 0.
+ * @param x1 The horizontal position of the start of the line. Default 0.
+ * @param y1 The vertical position of the start of the line. Default 0.
+ * @param x2 The horizontal position of the end of the line. Default 128.
+ * @param y2 The vertical position of the end of the line. Default 0.
+ * @param strokeColor The color the line will be drawn in, i.e. 0xff0000 for red.
+ * @param strokeAlpha The alpha the line will be drawn in. You can also set the alpha of the overall Shape using its `alpha` property.
+ */
+ line(x?: number, y?: number, x1?: number, y1?: number, x2?: number, y2?: number, strokeColor?: number, strokeAlpha?: number): Phaser.GameObjects.Line;
+
+ /**
+ * Creates a new Polygon Shape Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Polygon Game Object has been built into Phaser.
+ *
+ * The Polygon Shape is a Game Object that can be added to a Scene, Group or Container. You can
+ * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
+ * it for input or physics. It provides a quick and easy way for you to render this shape in your
+ * game without using a texture, while still taking advantage of being fully batched in WebGL.
+ *
+ * This shape supports both fill and stroke colors.
+ *
+ * The Polygon Shape is created by providing a list of points, which are then used to create an
+ * internal Polygon geometry object. The points can be set from a variety of formats:
+ *
+ * - An array of Point or Vector2 objects: `[new Phaser.Math.Vector2(x1, y1), ...]`
+ * - An array of objects with public x/y properties: `[obj1, obj2, ...]`
+ * - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]`
+ * - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]`
+ *
+ * By default the `x` and `y` coordinates of this Shape refer to the center of it. However, depending
+ * on the coordinates of the points provided, the final shape may be rendered offset from its origin.
+ * @param x The horizontal position of this Game Object in the world. Default 0.
+ * @param y The vertical position of this Game Object in the world. Default 0.
+ * @param points The points that make up the polygon.
+ * @param fillColor The color the polygon will be filled with, i.e. 0xff0000 for red.
+ * @param fillAlpha The alpha the polygon will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
+ */
+ polygon(x?: number, y?: number, points?: any, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Polygon;
+
+ /**
+ * Creates a new Rectangle Shape Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Rectangle Game Object has been built into Phaser.
+ *
+ * The Rectangle Shape is a Game Object that can be added to a Scene, Group or Container. You can
+ * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
+ * it for input or physics. It provides a quick and easy way for you to render this shape in your
+ * game without using a texture, while still taking advantage of being fully batched in WebGL.
+ *
+ * This shape supports both fill and stroke colors.
+ *
+ * You can change the size of the rectangle by changing the `width` and `height` properties.
+ * @param x The horizontal position of this Game Object in the world. Default 0.
+ * @param y The vertical position of this Game Object in the world. Default 0.
+ * @param width The width of the rectangle. Default 128.
+ * @param height The height of the rectangle. Default 128.
+ * @param fillColor The color the rectangle will be filled with, i.e. 0xff0000 for red.
+ * @param fillAlpha The alpha the rectangle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
+ */
+ rectangle(x?: number, y?: number, width?: number, height?: number, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Rectangle;
+
+ /**
+ * Creates a new Star Shape Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Star Game Object has been built into Phaser.
+ *
+ * The Star Shape is a Game Object that can be added to a Scene, Group or Container. You can
+ * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
+ * it for input or physics. It provides a quick and easy way for you to render this shape in your
+ * game without using a texture, while still taking advantage of being fully batched in WebGL.
+ *
+ * This shape supports both fill and stroke colors.
+ *
+ * As the name implies, the Star shape will display a star in your game. You can control several
+ * aspects of it including the number of points that constitute the star. The default is 5. If
+ * you change it to 4 it will render as a diamond. If you increase them, you'll get a more spiky
+ * star shape.
+ *
+ * You can also control the inner and outer radius, which is how 'long' each point of the star is.
+ * Modify these values to create more interesting shapes.
+ * @param x The horizontal position of this Game Object in the world. Default 0.
+ * @param y The vertical position of this Game Object in the world. Default 0.
+ * @param points The number of points on the star. Default 5.
+ * @param innerRadius The inner radius of the star. Default 32.
+ * @param outerRadius The outer radius of the star. Default 64.
+ * @param fillColor The color the star will be filled with, i.e. 0xff0000 for red.
+ * @param fillAlpha The alpha the star will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
+ */
+ star(x?: number, y?: number, points?: number, innerRadius?: number, outerRadius?: number, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Star;
+
+ /**
+ * Creates a new Triangle Shape Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Triangle Game Object has been built into Phaser.
+ *
+ * The Triangle Shape is a Game Object that can be added to a Scene, Group or Container. You can
+ * treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
+ * it for input or physics. It provides a quick and easy way for you to render this shape in your
+ * game without using a texture, while still taking advantage of being fully batched in WebGL.
+ *
+ * This shape supports both fill and stroke colors.
+ *
+ * The Triangle consists of 3 lines, joining up to form a triangular shape. You can control the
+ * position of each point of these lines. The triangle is always closed and cannot have an open
+ * face. If you require that, consider using a Polygon instead.
+ * @param x The horizontal position of this Game Object in the world. Default 0.
+ * @param y The vertical position of this Game Object in the world. Default 0.
+ * @param x1 The horizontal position of the first point in the triangle. Default 0.
+ * @param y1 The vertical position of the first point in the triangle. Default 128.
+ * @param x2 The horizontal position of the second point in the triangle. Default 64.
+ * @param y2 The vertical position of the second point in the triangle. Default 0.
+ * @param x3 The horizontal position of the third point in the triangle. Default 128.
+ * @param y3 The vertical position of the third point in the triangle. Default 128.
+ * @param fillColor The color the triangle will be filled with, i.e. 0xff0000 for red.
+ * @param fillAlpha The alpha the triangle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
+ */
+ triangle(x?: number, y?: number, x1?: number, y1?: number, x2?: number, y2?: number, x3?: number, y3?: number, fillColor?: number, fillAlpha?: number): Phaser.GameObjects.Triangle;
+
+ /**
+ * Creates a new Sprite Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Sprite Game Object has been built into Phaser.
+ * @param x The horizontal position of this Game Object in the world.
+ * @param y The vertical position of this Game Object in the world.
+ * @param texture The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
+ * @param frame An optional frame from the Texture this Game Object is rendering with.
+ */
+ sprite(x: number, y: number, texture: string, frame?: string | integer): Phaser.GameObjects.Sprite;
+
+ /**
+ * Creates a new Text Game Object and adds it to the Scene.
+ *
+ * A Text Game Object.
+ *
+ * Text objects work by creating their own internal hidden Canvas and then renders text to it using
+ * the standard Canvas `fillText` API. It then creates a texture from this canvas which is rendered
+ * to your game during the render pass.
+ *
+ * Because it uses the Canvas API you can take advantage of all the features this offers, such as
+ * applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts
+ * loaded externally, such as Google or TypeKit Web fonts.
+ *
+ * You can only display fonts that are currently loaded and available to the browser: therefore fonts must
+ * be pre-loaded. Phaser does not do ths for you, so you will require the use of a 3rd party font loader,
+ * or have the fonts ready available in the CSS on the page in which your Phaser game resides.
+ *
+ * See {@link http://www.jordanm.co.uk/tinytype this compatibility table} for the available default fonts
+ * across mobile browsers.
+ *
+ * A note on performance: Every time the contents of a Text object changes, i.e. changing the text being
+ * displayed, or the style of the text, it needs to remake the Text canvas, and if on WebGL, re-upload the
+ * new texture to the GPU. This can be an expensive operation if used often, or with large quantities of
+ * Text objects in your game. If you run into performance issues you would be better off using Bitmap Text
+ * instead, as it benefits from batching and avoids expensive Canvas API calls.
+ *
+ * Note: This method will only be available if the Text Game Object has been built into Phaser.
+ * @param x The horizontal position of this Game Object in the world.
+ * @param y The vertical position of this Game Object in the world.
+ * @param text The text this Text object will display.
+ * @param style The Text style configuration object.
+ */
+ text(x: number, y: number, text: string | string[], style?: object): Phaser.GameObjects.Text;
+
+ /**
+ * Creates a new TileSprite Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the TileSprite Game Object has been built into Phaser.
+ * @param x The horizontal position of this Game Object in the world.
+ * @param y The vertical position of this Game Object in the world.
+ * @param width The width of the Game Object. If zero it will use the size of the texture frame.
+ * @param height The height of the Game Object. If zero it will use the size of the texture frame.
+ * @param texture The key 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.
+ */
+ tileSprite(x: number, y: number, width: integer, height: integer, texture: string, frame?: string | integer): Phaser.GameObjects.TileSprite;
+
+ /**
+ * Creates a new Image Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Image Game Object has been built into Phaser.
+ * @param x The horizontal position of this Game Object in the world.
+ * @param y The vertical position of this Game Object in the world.
+ * @param texture The key 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.
+ */
+ video(x: number, y: number, texture: string, frame?: string | integer): Phaser.GameObjects.Image;
+
+ /**
+ * Creates a new Zone Game Object and adds it to the Scene.
+ *
+ * Note: This method will only be available if the Zone Game Object has been built into Phaser.
+ * @param x The horizontal position of this Game Object in the world.
+ * @param y The vertical position of this Game Object in the world.
+ * @param width The width of the Game Object.
+ * @param height The height of the Game Object.
+ */
+ zone(x: number, y: number, width: number, height: number): Phaser.GameObjects.Zone;
+
+ /**
+ * Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided.
+ * When loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing
+ * from a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map
+ * data. For an empty map, you should specify tileWidth, tileHeight, width & height.
+ * @param key The key in the Phaser cache that corresponds to the loaded tilemap data.
+ * @param tileWidth The width of a tile in pixels. Pass in `null` to leave as the
+ * default. Default 32.
+ * @param tileHeight The height of a tile in pixels. Pass in `null` to leave as the
+ * default. Default 32.
+ * @param width The width of the map in tiles. Pass in `null` to leave as the
+ * default. Default 10.
+ * @param height The height of the map in tiles. Pass in `null` to leave as the
+ * default. Default 10.
+ * @param data Instead of loading from the cache, you can also load directly from
+ * a 2D array of tile indexes. Pass in `null` for no data.
+ * @param insertNull Controls how empty tiles, tiles with an index of -1, in the
+ * map data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty
+ * location will get a Tile object with an index of -1. If you've a large sparsely populated map and
+ * the tile data doesn't need to change then setting this value to `true` will help with memory
+ * consumption. However if your map is small or you need to update the tiles dynamically, then leave
+ * the default value set. Default false.
+ */
+ tilemap(key?: string, tileWidth?: integer, tileHeight?: integer, width?: integer, height?: integer, data?: integer[][], insertNull?: boolean): Phaser.Tilemaps.Tilemap;
+
+ /**
+ * Creates a new Tween object.
+ *
+ * Note: This method will only be available if Tweens have been built into Phaser.
+ * @param config The Tween configuration.
+ */
+ tween(config: Phaser.Types.Tweens.TweenBuilderConfig | object): Phaser.Tweens.Tween;
+
+ }
+
/**
* 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
@@ -16009,7 +16062,7 @@ declare namespace Phaser {
* 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.BlendMode, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Mask, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible, Phaser.GameObjects.Components.ScrollFactor {
+ 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.Transform, Phaser.GameObjects.Components.Visible, Phaser.GameObjects.Components.ScrollFactor {
/**
*
* @param scene The Scene to which this Graphics object belongs.
@@ -16524,6 +16577,27 @@ declare namespace Phaser {
*/
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.
*
@@ -24637,707 +24711,6 @@ declare namespace Phaser {
}
- /**
- * The Shape Game Object is a base class for the various different shapes, such as the Arc, Star or Polygon.
- * You cannot add a Shape directly to your Scene, it is meant as a base for your own custom Shape classes.
- */
- class Shape extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.ComputedSize, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.GetBounds, Phaser.GameObjects.Components.Mask, Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.ScrollFactor, 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 type The internal type of the Shape.
- * @param data The data of the source shape geometry, if any.
- */
- constructor(scene: Phaser.Scene, type?: string, data?: any);
-
- /**
- * The source Shape data. Typically a geometry object.
- * You should not manipulate this directly.
- */
- readonly data: any;
-
- /**
- * Holds the polygon path data for filled rendering.
- */
- readonly pathData: number[];
-
- /**
- * Holds the earcut polygon path index data for filled rendering.
- */
- readonly pathIndexes: integer[];
-
- /**
- * The fill color used by this Shape.
- */
- fillColor: number;
-
- /**
- * The fill alpha value used by this Shape.
- */
- fillAlpha: number;
-
- /**
- * The stroke color used by this Shape.
- */
- strokeColor: number;
-
- /**
- * The stroke alpha value used by this Shape.
- */
- strokeAlpha: number;
-
- /**
- * The stroke line width used by this Shape.
- */
- lineWidth: number;
-
- /**
- * Controls if this Shape is filled or not.
- * Note that some Shapes do not support being filled (such as Line shapes)
- */
- isFilled: boolean;
-
- /**
- * Controls if this Shape is stroked or not.
- * Note that some Shapes do not support being stroked (such as Iso Box shapes)
- */
- isStroked: boolean;
-
- /**
- * Controls if this Shape path is closed during rendering when stroked.
- * Note that some Shapes are always closed when stroked (such as Ellipse shapes)
- */
- closePath: boolean;
-
- /**
- * Sets the fill color and alpha for this Shape.
- *
- * If you wish for the Shape to not be filled then call this method with no arguments, or just set `isFilled` to `false`.
- *
- * Note that some Shapes do not support fill colors, such as the Line shape.
- *
- * This call can be chained.
- * @param color The color used to fill this shape. If not provided the Shape will not be filled.
- * @param alpha The alpha value used when filling this shape, if a fill color is given. Default 1.
- */
- setFillStyle(color?: number, alpha?: number): this;
-
- /**
- * Sets the stroke color and alpha for this Shape.
- *
- * If you wish for the Shape to not be stroked then call this method with no arguments, or just set `isStroked` to `false`.
- *
- * Note that some Shapes do not support being stroked, such as the Iso Box shape.
- *
- * This call can be chained.
- * @param lineWidth The width of line to stroke with. If not provided or undefined the Shape will not be stroked.
- * @param color The color used to stroke this shape. If not provided the Shape will not be stroked.
- * @param alpha The alpha value used when stroking this shape, if a stroke color is given. Default 1.
- */
- setStrokeStyle(lineWidth?: number, color?: number, alpha?: number): this;
-
- /**
- * Sets if this Shape path is closed during rendering when stroked.
- * Note that some Shapes are always closed when stroked (such as Ellipse shapes)
- *
- * This call can be chained.
- * @param value Set to `true` if the Shape should be closed when stroked, otherwise `false`.
- */
- setClosePath(value: boolean): this;
-
- /**
- * Internal destroy handler, called as part of the destroy process.
- */
- protected preDestroy(): void;
-
- /**
- * 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:
- *
- * * 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;
-
- /**
- * 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:
- *
- * * 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 or a CONST.
- */
- setBlendMode(value: string | Phaser.BlendModes): 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 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 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 depth starts from zero (the default value) and increases from that point. 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 depth starts from zero (the default value) and increases from that point. 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.
- */
- setDepth(value: integer): 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
- * @param output An object to store the values in. If not provided a new Vector2 will be created.
- */
- getCenter(output?: O): 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
- * @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
- * @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
- * @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
- * @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
- * @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
- * @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
- * @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
- * @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.
- *
- * 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 Game Object.
- * @param renderable A renderable Game Object that uses a texture, such as a Sprite.
- */
- createBitmapMask(renderable?: Phaser.GameObjects.GameObject): 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. The geometry within it will be used as the mask.
- */
- createGeometryMask(graphics?: Phaser.GameObjects.Graphics): 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.
- */
- 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;
-
- /**
- * 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.
- */
- defaultPipeline: Phaser.Renderer.WebGL.WebGLPipeline;
-
- /**
- * The current WebGL pipeline of this Game Object.
- */
- pipeline: Phaser.Renderer.WebGL.WebGLPipeline;
-
- /**
- * Sets the initial WebGL Pipeline of this Game Object.
- * This should only be called during the instantiation of the Game Object.
- * @param pipelineName The name of the pipeline to set on this Game Object. Defaults to the Texture Tint Pipeline. Default TextureTintPipeline.
- */
- initPipeline(pipelineName?: string): boolean;
-
- /**
- * Sets the active WebGL Pipeline of this Game Object.
- * @param pipelineName The name of the pipeline to set on this Game Object.
- */
- setPipeline(pipelineName: string): this;
-
- /**
- * Resets the WebGL Pipeline of this Game Object back to the default it was created with.
- */
- resetPipeline(): boolean;
-
- /**
- * Gets the name of the WebGL Pipeline this Game Object is currently using.
- */
- getPipelineName(): string;
-
- /**
- * 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 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: integer;
-
- /**
- * The angle of this Game Object in radians.
- *
- * 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 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;
-
- /**
- * 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.
- * @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;
-
- /**
- * 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 Arc Shape is a Game Object that can be added to a Scene, Group or Container. You can
* treat it like any other Game Object in your game, such as tweening it, scaling it, or enabling
@@ -25427,6 +24800,27 @@ declare namespace Phaser {
*/
setEndAngle(value: integer): 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.
*
@@ -26057,6 +25451,27 @@ declare namespace Phaser {
*/
setSmoothness(value: integer): 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.
*
@@ -26697,6 +26112,27 @@ declare namespace Phaser {
*/
setSmoothness(value: integer): 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.
*
@@ -27392,6 +26828,27 @@ declare namespace Phaser {
*/
setOutlineStyle(fillColor?: number, fillAlpha?: number): 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.
*
@@ -28069,6 +27526,27 @@ declare namespace Phaser {
*/
setFillStyle(fillTop?: number, fillLeft?: number, fillRight?: number): 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.
*
@@ -28760,6 +28238,27 @@ declare namespace Phaser {
*/
setFillStyle(fillTop?: number, fillLeft?: number, fillRight?: number): 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.
*
@@ -29407,6 +28906,27 @@ declare namespace Phaser {
*/
setTo(x1?: number, y1?: number, x2?: number, y2?: number): 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.
*
@@ -30007,7 +29527,7 @@ declare namespace Phaser {
* internal Polygon geometry object. The points can be set from a variety of formats:
*
* - A string containing paired values separated by a single space: `'40 0 40 20 100 20 100 80 40 80 40 100 0 50'`
- * - An array of Point or Vector2 objects: `[new Phaser.Math.Vec2(x1, y1), ...]`
+ * - An array of Point or Vector2 objects: `[new Phaser.Math.Vector2(x1, y1), ...]`
* - An array of objects with public x/y properties: `[obj1, obj2, ...]`
* - An array of paired numbers that represent point coordinates: `[x1,y1, x2,y2, ...]`
* - An array of arrays with two elements representing x/y coordinates: `[[x1, y1], [x2, y2], ...]`
@@ -30035,6 +29555,27 @@ declare namespace Phaser {
*/
smooth(iterations?: integer): 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.
*
@@ -30646,6 +30187,749 @@ declare namespace Phaser {
*/
constructor(scene: Phaser.Scene, x: number, y: number, width?: number, height?: number, fillColor?: number, fillAlpha?: 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:
+ *
+ * * 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;
+
+ /**
+ * 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:
+ *
+ * * 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 or a CONST.
+ */
+ setBlendMode(value: string | Phaser.BlendModes): 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 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 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 depth starts from zero (the default value) and increases from that point. 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 depth starts from zero (the default value) and increases from that point. 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.
+ */
+ setDepth(value: integer): 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
+ * @param output An object to store the values in. If not provided a new Vector2 will be created.
+ */
+ getCenter(output?: O): 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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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.
+ *
+ * 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 Game Object.
+ * @param renderable A renderable Game Object that uses a texture, such as a Sprite.
+ */
+ createBitmapMask(renderable?: Phaser.GameObjects.GameObject): 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. The geometry within it will be used as the mask.
+ */
+ createGeometryMask(graphics?: Phaser.GameObjects.Graphics): 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.
+ */
+ 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;
+
+ /**
+ * 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.
+ */
+ defaultPipeline: Phaser.Renderer.WebGL.WebGLPipeline;
+
+ /**
+ * The current WebGL pipeline of this Game Object.
+ */
+ pipeline: Phaser.Renderer.WebGL.WebGLPipeline;
+
+ /**
+ * Sets the initial WebGL Pipeline of this Game Object.
+ * This should only be called during the instantiation of the Game Object.
+ * @param pipelineName The name of the pipeline to set on this Game Object. Defaults to the Texture Tint Pipeline. Default TextureTintPipeline.
+ */
+ initPipeline(pipelineName?: string): boolean;
+
+ /**
+ * Sets the active WebGL Pipeline of this Game Object.
+ * @param pipelineName The name of the pipeline to set on this Game Object.
+ */
+ setPipeline(pipelineName: string): this;
+
+ /**
+ * Resets the WebGL Pipeline of this Game Object back to the default it was created with.
+ */
+ resetPipeline(): boolean;
+
+ /**
+ * Gets the name of the WebGL Pipeline this Game Object is currently using.
+ */
+ getPipelineName(): string;
+
+ /**
+ * 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 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: integer;
+
+ /**
+ * The angle of this Game Object in radians.
+ *
+ * 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 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;
+
+ /**
+ * 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.
+ * @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;
+
+ /**
+ * 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 Shape Game Object is a base class for the various different shapes, such as the Arc, Star or Polygon.
+ * You cannot add a Shape directly to your Scene, it is meant as a base for your own custom Shape classes.
+ */
+ class Shape extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.AlphaSingle, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.ComputedSize, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.GetBounds, Phaser.GameObjects.Components.Mask, Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.ScrollFactor, 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 type The internal type of the Shape.
+ * @param data The data of the source shape geometry, if any.
+ */
+ constructor(scene: Phaser.Scene, type?: string, data?: any);
+
+ /**
+ * The source Shape data. Typically a geometry object.
+ * You should not manipulate this directly.
+ */
+ readonly data: any;
+
+ /**
+ * Holds the polygon path data for filled rendering.
+ */
+ readonly pathData: number[];
+
+ /**
+ * Holds the earcut polygon path index data for filled rendering.
+ */
+ readonly pathIndexes: integer[];
+
+ /**
+ * The fill color used by this Shape.
+ */
+ fillColor: number;
+
+ /**
+ * The fill alpha value used by this Shape.
+ */
+ fillAlpha: number;
+
+ /**
+ * The stroke color used by this Shape.
+ */
+ strokeColor: number;
+
+ /**
+ * The stroke alpha value used by this Shape.
+ */
+ strokeAlpha: number;
+
+ /**
+ * The stroke line width used by this Shape.
+ */
+ lineWidth: number;
+
+ /**
+ * Controls if this Shape is filled or not.
+ * Note that some Shapes do not support being filled (such as Line shapes)
+ */
+ isFilled: boolean;
+
+ /**
+ * Controls if this Shape is stroked or not.
+ * Note that some Shapes do not support being stroked (such as Iso Box shapes)
+ */
+ isStroked: boolean;
+
+ /**
+ * Controls if this Shape path is closed during rendering when stroked.
+ * Note that some Shapes are always closed when stroked (such as Ellipse shapes)
+ */
+ closePath: boolean;
+
+ /**
+ * Sets the fill color and alpha for this Shape.
+ *
+ * If you wish for the Shape to not be filled then call this method with no arguments, or just set `isFilled` to `false`.
+ *
+ * Note that some Shapes do not support fill colors, such as the Line shape.
+ *
+ * This call can be chained.
+ * @param color The color used to fill this shape. If not provided the Shape will not be filled.
+ * @param alpha The alpha value used when filling this shape, if a fill color is given. Default 1.
+ */
+ setFillStyle(color?: number, alpha?: number): this;
+
+ /**
+ * Sets the stroke color and alpha for this Shape.
+ *
+ * If you wish for the Shape to not be stroked then call this method with no arguments, or just set `isStroked` to `false`.
+ *
+ * Note that some Shapes do not support being stroked, such as the Iso Box shape.
+ *
+ * This call can be chained.
+ * @param lineWidth The width of line to stroke with. If not provided or undefined the Shape will not be stroked.
+ * @param color The color used to stroke this shape. If not provided the Shape will not be stroked.
+ * @param alpha The alpha value used when stroking this shape, if a stroke color is given. Default 1.
+ */
+ setStrokeStyle(lineWidth?: number, color?: number, alpha?: number): this;
+
+ /**
+ * Sets if this Shape path is closed during rendering when stroked.
+ * Note that some Shapes are always closed when stroked (such as Ellipse shapes)
+ *
+ * This call can be chained.
+ * @param value Set to `true` if the Shape should be closed when stroked, otherwise `false`.
+ */
+ setClosePath(value: boolean): 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.
+ * @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.
*
@@ -31300,6 +31584,27 @@ declare namespace Phaser {
*/
outerRadius: 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.
*
@@ -31928,6 +32233,27 @@ declare namespace Phaser {
*/
setTo(x1?: number, y1?: number, x2?: number, y2?: number, x3?: number, y3?: number): 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.
*
@@ -33443,359 +33769,6 @@ declare namespace Phaser {
}
- /**
- * A TextStyle class manages all of the style settings for a Text object.
- *
- * Text Game Objects create a TextStyle instance automatically, which is
- * accessed via the `Text.style` property. You do not normally need to
- * instantiate one yourself.
- */
- class TextStyle {
- /**
- *
- * @param text The Text object that this TextStyle is styling.
- * @param style The style settings to set.
- */
- constructor(text: Phaser.GameObjects.Text, style: Phaser.Types.GameObjects.Text.TextStyle);
-
- /**
- * The Text object that this TextStyle is styling.
- */
- parent: Phaser.GameObjects.Text;
-
- /**
- * The font family.
- */
- fontFamily: string;
-
- /**
- * The font size.
- */
- fontSize: string;
-
- /**
- * The font style.
- */
- fontStyle: string;
-
- /**
- * The background color.
- */
- backgroundColor: string;
-
- /**
- * The text fill color.
- */
- color: string;
-
- /**
- * The text stroke color.
- */
- stroke: string;
-
- /**
- * The text stroke thickness.
- */
- strokeThickness: number;
-
- /**
- * The horizontal shadow offset.
- */
- shadowOffsetX: number;
-
- /**
- * The vertical shadow offset.
- */
- shadowOffsetY: number;
-
- /**
- * The shadow color.
- */
- shadowColor: string;
-
- /**
- * The shadow blur radius.
- */
- shadowBlur: number;
-
- /**
- * Whether shadow stroke is enabled or not.
- */
- shadowStroke: boolean;
-
- /**
- * Whether shadow fill is enabled or not.
- */
- shadowFill: boolean;
-
- /**
- * The text alignment.
- */
- align: string;
-
- /**
- * The maximum number of lines to draw.
- */
- maxLines: integer;
-
- /**
- * The fixed width of the text.
- *
- * `0` means no fixed with.
- */
- fixedWidth: number;
-
- /**
- * The fixed height of the text.
- *
- * `0` means no fixed height.
- */
- fixedHeight: number;
-
- /**
- * The resolution the text is rendered to its internal canvas at.
- * The default is 0, which means it will use the resolution set in the Game Config.
- */
- resolution: number;
-
- /**
- * Whether the text should render right to left.
- */
- rtl: boolean;
-
- /**
- * The test string to use when measuring the font.
- */
- testString: string;
-
- /**
- * The amount of horizontal padding added to the width of the text when calculating the font metrics.
- */
- baselineX: number;
-
- /**
- * The amount of vertical padding added to the height of the text when calculating the font metrics.
- */
- baselineY: number;
-
- /**
- * Set the text style.
- * @param style The style settings to set.
- * @param updateText Whether to update the text immediately. Default true.
- * @param setDefaults Use the default values is not set, or the local values. Default false.
- */
- setStyle(style: Phaser.Types.GameObjects.Text.TextStyle, updateText?: boolean, setDefaults?: boolean): Phaser.GameObjects.Text;
-
- /**
- * Synchronize the font settings to the given Canvas Rendering Context.
- * @param canvas The Canvas Element.
- * @param context The Canvas Rendering Context.
- */
- syncFont(canvas: HTMLCanvasElement, context: CanvasRenderingContext2D): void;
-
- /**
- * Synchronize the text style settings to the given Canvas Rendering Context.
- * @param canvas The Canvas Element.
- * @param context The Canvas Rendering Context.
- */
- syncStyle(canvas: HTMLCanvasElement, context: CanvasRenderingContext2D): void;
-
- /**
- * Synchronize the shadow settings to the given Canvas Rendering Context.
- * @param context The Canvas Rendering Context.
- * @param enabled Whether shadows are enabled or not.
- */
- syncShadow(context: CanvasRenderingContext2D, enabled: boolean): void;
-
- /**
- * Update the style settings for the parent Text object.
- * @param recalculateMetrics Whether to recalculate font and text metrics.
- */
- update(recalculateMetrics: boolean): Phaser.GameObjects.Text;
-
- /**
- * Set the font.
- *
- * If a string is given, the font family is set.
- *
- * If an object is given, the `fontFamily`, `fontSize` and `fontStyle`
- * properties of that object are set.
- * @param font The font family or font settings to set.
- * @param updateText Whether to update the text immediately. Default true.
- */
- setFont(font: string | object, updateText?: boolean): Phaser.GameObjects.Text;
-
- /**
- * Set the font family.
- * @param family The font family.
- */
- setFontFamily(family: string): Phaser.GameObjects.Text;
-
- /**
- * Set the font style.
- * @param style The font style.
- */
- setFontStyle(style: string): Phaser.GameObjects.Text;
-
- /**
- * Set the font size.
- * @param size The font size.
- */
- setFontSize(size: number | string): Phaser.GameObjects.Text;
-
- /**
- * Set the test string to use when measuring the font.
- * @param string The test string to use when measuring the font.
- */
- setTestString(string: string): Phaser.GameObjects.Text;
-
- /**
- * Set a fixed width and height for the text.
- *
- * Pass in `0` for either of these parameters to disable fixed width or height respectively.
- * @param width The fixed width to set.
- * @param height The fixed height to set.
- */
- setFixedSize(width: number, height: number): Phaser.GameObjects.Text;
-
- /**
- * Set the background color.
- * @param color The background color.
- */
- setBackgroundColor(color: string): Phaser.GameObjects.Text;
-
- /**
- * Set the text fill color.
- * @param color The text fill color.
- */
- setFill(color: string): Phaser.GameObjects.Text;
-
- /**
- * Set the text fill color.
- * @param color The text fill color.
- */
- setColor(color: string): Phaser.GameObjects.Text;
-
- /**
- * Set the resolution used by the Text object.
- *
- * By default it will be set to match the resolution set in the Game Config,
- * but you can override it via this method. It allows for much clearer text on High DPI devices,
- * at the cost of memory because it uses larger internal Canvas textures for the Text.
- *
- * Please use with caution, as the more high res Text you have, the more memory it uses up.
- * @param value The resolution for this Text object to use.
- */
- setResolution(value: number): Phaser.GameObjects.Text;
-
- /**
- * Set the stroke settings.
- * @param color The stroke color.
- * @param thickness The stroke thickness.
- */
- setStroke(color: string, thickness: number): Phaser.GameObjects.Text;
-
- /**
- * Set the shadow settings.
- *
- * Calling this method always re-measures the parent Text object,
- * so only call it when you actually change the shadow settings.
- * @param x The horizontal shadow offset. Default 0.
- * @param y The vertical shadow offset. Default 0.
- * @param color The shadow color. Default '#000'.
- * @param blur The shadow blur radius. Default 0.
- * @param shadowStroke Whether to stroke the shadow. Default false.
- * @param shadowFill Whether to fill the shadow. Default true.
- */
- setShadow(x?: number, y?: number, color?: string, blur?: number, shadowStroke?: boolean, shadowFill?: boolean): Phaser.GameObjects.Text;
-
- /**
- * Set the shadow offset.
- * @param x The horizontal shadow offset. Default 0.
- * @param y The vertical shadow offset. Default 0.
- */
- setShadowOffset(x?: number, y?: number): Phaser.GameObjects.Text;
-
- /**
- * Set the shadow color.
- * @param color The shadow color. Default '#000'.
- */
- setShadowColor(color?: string): Phaser.GameObjects.Text;
-
- /**
- * Set the shadow blur radius.
- * @param blur The shadow blur radius. Default 0.
- */
- setShadowBlur(blur?: number): Phaser.GameObjects.Text;
-
- /**
- * Enable or disable shadow stroke.
- * @param enabled Whether shadow stroke is enabled or not.
- */
- setShadowStroke(enabled: boolean): Phaser.GameObjects.Text;
-
- /**
- * Enable or disable shadow fill.
- * @param enabled Whether shadow fill is enabled or not.
- */
- setShadowFill(enabled: boolean): Phaser.GameObjects.Text;
-
- /**
- * Set the width (in pixels) to use for wrapping lines.
- *
- * Pass in null to remove wrapping by width.
- * @param width The maximum width of a line in pixels. Set to null to remove wrapping.
- * @param useAdvancedWrap Whether or not to use the advanced wrapping
- * algorithm. If true, spaces are collapsed and whitespace is trimmed from lines. If false,
- * spaces and whitespace are left as is. Default false.
- */
- setWordWrapWidth(width: number, useAdvancedWrap?: boolean): Phaser.GameObjects.Text;
-
- /**
- * Set a custom callback for wrapping lines.
- *
- * Pass in null to remove wrapping by callback.
- * @param callback A custom function that will be responsible for wrapping the
- * text. It will receive two arguments: text (the string to wrap), textObject (this Text
- * instance). It should return the wrapped lines either as an array of lines or as a string with
- * newline characters in place to indicate where breaks should happen.
- * @param scope The scope that will be applied when the callback is invoked. Default null.
- */
- setWordWrapCallback(callback: TextStyleWordWrapCallback, scope?: object): Phaser.GameObjects.Text;
-
- /**
- * Set the alignment of the text in this Text object.
- *
- * The argument can be one of: `left`, `right`, `center` or `justify`.
- *
- * Alignment only works if the Text object has more than one line of text.
- * @param align The text alignment for multi-line text. Default 'left'.
- */
- setAlign(align?: string): Phaser.GameObjects.Text;
-
- /**
- * Set the maximum number of lines to draw.
- * @param max The maximum number of lines to draw. Default 0.
- */
- setMaxLines(max?: integer): Phaser.GameObjects.Text;
-
- /**
- * Get the current text metrics.
- */
- getTextMetrics(): Phaser.Types.GameObjects.Text.TextMetrics;
-
- /**
- * Build a JSON representation of this Text Style.
- */
- toJSON(): object;
-
- /**
- * Destroy this Text Style.
- */
- destroy(): void;
-
- }
-
/**
* A Text Game Object.
*
@@ -35036,6 +35009,359 @@ declare namespace Phaser {
}
+ /**
+ * A TextStyle class manages all of the style settings for a Text object.
+ *
+ * Text Game Objects create a TextStyle instance automatically, which is
+ * accessed via the `Text.style` property. You do not normally need to
+ * instantiate one yourself.
+ */
+ class TextStyle {
+ /**
+ *
+ * @param text The Text object that this TextStyle is styling.
+ * @param style The style settings to set.
+ */
+ constructor(text: Phaser.GameObjects.Text, style: Phaser.Types.GameObjects.Text.TextStyle);
+
+ /**
+ * The Text object that this TextStyle is styling.
+ */
+ parent: Phaser.GameObjects.Text;
+
+ /**
+ * The font family.
+ */
+ fontFamily: string;
+
+ /**
+ * The font size.
+ */
+ fontSize: string;
+
+ /**
+ * The font style.
+ */
+ fontStyle: string;
+
+ /**
+ * The background color.
+ */
+ backgroundColor: string;
+
+ /**
+ * The text fill color.
+ */
+ color: string;
+
+ /**
+ * The text stroke color.
+ */
+ stroke: string;
+
+ /**
+ * The text stroke thickness.
+ */
+ strokeThickness: number;
+
+ /**
+ * The horizontal shadow offset.
+ */
+ shadowOffsetX: number;
+
+ /**
+ * The vertical shadow offset.
+ */
+ shadowOffsetY: number;
+
+ /**
+ * The shadow color.
+ */
+ shadowColor: string;
+
+ /**
+ * The shadow blur radius.
+ */
+ shadowBlur: number;
+
+ /**
+ * Whether shadow stroke is enabled or not.
+ */
+ shadowStroke: boolean;
+
+ /**
+ * Whether shadow fill is enabled or not.
+ */
+ shadowFill: boolean;
+
+ /**
+ * The text alignment.
+ */
+ align: string;
+
+ /**
+ * The maximum number of lines to draw.
+ */
+ maxLines: integer;
+
+ /**
+ * The fixed width of the text.
+ *
+ * `0` means no fixed with.
+ */
+ fixedWidth: number;
+
+ /**
+ * The fixed height of the text.
+ *
+ * `0` means no fixed height.
+ */
+ fixedHeight: number;
+
+ /**
+ * The resolution the text is rendered to its internal canvas at.
+ * The default is 0, which means it will use the resolution set in the Game Config.
+ */
+ resolution: number;
+
+ /**
+ * Whether the text should render right to left.
+ */
+ rtl: boolean;
+
+ /**
+ * The test string to use when measuring the font.
+ */
+ testString: string;
+
+ /**
+ * The amount of horizontal padding added to the width of the text when calculating the font metrics.
+ */
+ baselineX: number;
+
+ /**
+ * The amount of vertical padding added to the height of the text when calculating the font metrics.
+ */
+ baselineY: number;
+
+ /**
+ * Set the text style.
+ * @param style The style settings to set.
+ * @param updateText Whether to update the text immediately. Default true.
+ * @param setDefaults Use the default values is not set, or the local values. Default false.
+ */
+ setStyle(style: Phaser.Types.GameObjects.Text.TextStyle, updateText?: boolean, setDefaults?: boolean): Phaser.GameObjects.Text;
+
+ /**
+ * Synchronize the font settings to the given Canvas Rendering Context.
+ * @param canvas The Canvas Element.
+ * @param context The Canvas Rendering Context.
+ */
+ syncFont(canvas: HTMLCanvasElement, context: CanvasRenderingContext2D): void;
+
+ /**
+ * Synchronize the text style settings to the given Canvas Rendering Context.
+ * @param canvas The Canvas Element.
+ * @param context The Canvas Rendering Context.
+ */
+ syncStyle(canvas: HTMLCanvasElement, context: CanvasRenderingContext2D): void;
+
+ /**
+ * Synchronize the shadow settings to the given Canvas Rendering Context.
+ * @param context The Canvas Rendering Context.
+ * @param enabled Whether shadows are enabled or not.
+ */
+ syncShadow(context: CanvasRenderingContext2D, enabled: boolean): void;
+
+ /**
+ * Update the style settings for the parent Text object.
+ * @param recalculateMetrics Whether to recalculate font and text metrics.
+ */
+ update(recalculateMetrics: boolean): Phaser.GameObjects.Text;
+
+ /**
+ * Set the font.
+ *
+ * If a string is given, the font family is set.
+ *
+ * If an object is given, the `fontFamily`, `fontSize` and `fontStyle`
+ * properties of that object are set.
+ * @param font The font family or font settings to set.
+ * @param updateText Whether to update the text immediately. Default true.
+ */
+ setFont(font: string | object, updateText?: boolean): Phaser.GameObjects.Text;
+
+ /**
+ * Set the font family.
+ * @param family The font family.
+ */
+ setFontFamily(family: string): Phaser.GameObjects.Text;
+
+ /**
+ * Set the font style.
+ * @param style The font style.
+ */
+ setFontStyle(style: string): Phaser.GameObjects.Text;
+
+ /**
+ * Set the font size.
+ * @param size The font size.
+ */
+ setFontSize(size: number | string): Phaser.GameObjects.Text;
+
+ /**
+ * Set the test string to use when measuring the font.
+ * @param string The test string to use when measuring the font.
+ */
+ setTestString(string: string): Phaser.GameObjects.Text;
+
+ /**
+ * Set a fixed width and height for the text.
+ *
+ * Pass in `0` for either of these parameters to disable fixed width or height respectively.
+ * @param width The fixed width to set.
+ * @param height The fixed height to set.
+ */
+ setFixedSize(width: number, height: number): Phaser.GameObjects.Text;
+
+ /**
+ * Set the background color.
+ * @param color The background color.
+ */
+ setBackgroundColor(color: string): Phaser.GameObjects.Text;
+
+ /**
+ * Set the text fill color.
+ * @param color The text fill color.
+ */
+ setFill(color: string): Phaser.GameObjects.Text;
+
+ /**
+ * Set the text fill color.
+ * @param color The text fill color.
+ */
+ setColor(color: string): Phaser.GameObjects.Text;
+
+ /**
+ * Set the resolution used by the Text object.
+ *
+ * By default it will be set to match the resolution set in the Game Config,
+ * but you can override it via this method. It allows for much clearer text on High DPI devices,
+ * at the cost of memory because it uses larger internal Canvas textures for the Text.
+ *
+ * Please use with caution, as the more high res Text you have, the more memory it uses up.
+ * @param value The resolution for this Text object to use.
+ */
+ setResolution(value: number): Phaser.GameObjects.Text;
+
+ /**
+ * Set the stroke settings.
+ * @param color The stroke color.
+ * @param thickness The stroke thickness.
+ */
+ setStroke(color: string, thickness: number): Phaser.GameObjects.Text;
+
+ /**
+ * Set the shadow settings.
+ *
+ * Calling this method always re-measures the parent Text object,
+ * so only call it when you actually change the shadow settings.
+ * @param x The horizontal shadow offset. Default 0.
+ * @param y The vertical shadow offset. Default 0.
+ * @param color The shadow color. Default '#000'.
+ * @param blur The shadow blur radius. Default 0.
+ * @param shadowStroke Whether to stroke the shadow. Default false.
+ * @param shadowFill Whether to fill the shadow. Default true.
+ */
+ setShadow(x?: number, y?: number, color?: string, blur?: number, shadowStroke?: boolean, shadowFill?: boolean): Phaser.GameObjects.Text;
+
+ /**
+ * Set the shadow offset.
+ * @param x The horizontal shadow offset. Default 0.
+ * @param y The vertical shadow offset. Default 0.
+ */
+ setShadowOffset(x?: number, y?: number): Phaser.GameObjects.Text;
+
+ /**
+ * Set the shadow color.
+ * @param color The shadow color. Default '#000'.
+ */
+ setShadowColor(color?: string): Phaser.GameObjects.Text;
+
+ /**
+ * Set the shadow blur radius.
+ * @param blur The shadow blur radius. Default 0.
+ */
+ setShadowBlur(blur?: number): Phaser.GameObjects.Text;
+
+ /**
+ * Enable or disable shadow stroke.
+ * @param enabled Whether shadow stroke is enabled or not.
+ */
+ setShadowStroke(enabled: boolean): Phaser.GameObjects.Text;
+
+ /**
+ * Enable or disable shadow fill.
+ * @param enabled Whether shadow fill is enabled or not.
+ */
+ setShadowFill(enabled: boolean): Phaser.GameObjects.Text;
+
+ /**
+ * Set the width (in pixels) to use for wrapping lines.
+ *
+ * Pass in null to remove wrapping by width.
+ * @param width The maximum width of a line in pixels. Set to null to remove wrapping.
+ * @param useAdvancedWrap Whether or not to use the advanced wrapping
+ * algorithm. If true, spaces are collapsed and whitespace is trimmed from lines. If false,
+ * spaces and whitespace are left as is. Default false.
+ */
+ setWordWrapWidth(width: number, useAdvancedWrap?: boolean): Phaser.GameObjects.Text;
+
+ /**
+ * Set a custom callback for wrapping lines.
+ *
+ * Pass in null to remove wrapping by callback.
+ * @param callback A custom function that will be responsible for wrapping the
+ * text. It will receive two arguments: text (the string to wrap), textObject (this Text
+ * instance). It should return the wrapped lines either as an array of lines or as a string with
+ * newline characters in place to indicate where breaks should happen.
+ * @param scope The scope that will be applied when the callback is invoked. Default null.
+ */
+ setWordWrapCallback(callback: TextStyleWordWrapCallback, scope?: object): Phaser.GameObjects.Text;
+
+ /**
+ * Set the alignment of the text in this Text object.
+ *
+ * The argument can be one of: `left`, `right`, `center` or `justify`.
+ *
+ * Alignment only works if the Text object has more than one line of text.
+ * @param align The text alignment for multi-line text. Default 'left'.
+ */
+ setAlign(align?: string): Phaser.GameObjects.Text;
+
+ /**
+ * Set the maximum number of lines to draw.
+ * @param max The maximum number of lines to draw. Default 0.
+ */
+ setMaxLines(max?: integer): Phaser.GameObjects.Text;
+
+ /**
+ * Get the current text metrics.
+ */
+ getTextMetrics(): Phaser.Types.GameObjects.Text.TextMetrics;
+
+ /**
+ * Build a JSON representation of this Text Style.
+ */
+ toJSON(): object;
+
+ /**
+ * Destroy this Text Style.
+ */
+ destroy(): void;
+
+ }
+
/**
* A TileSprite is a Sprite that has a repeating texture.
*
@@ -36022,6 +36348,55 @@ declare namespace Phaser {
}
+ /**
+ * The Update List plugin.
+ *
+ * Update Lists belong to a Scene and maintain the list Game Objects to be updated every frame.
+ *
+ * Some or all of these Game Objects may also be part of the Scene's [Display List]{@link Phaser.GameObjects.DisplayList}, for Rendering.
+ */
+ class UpdateList extends Phaser.Structs.ProcessQueue {
+ /**
+ *
+ * @param scene The Scene that the Update List belongs to.
+ */
+ constructor(scene: Phaser.Scene);
+
+ /**
+ * The Scene that the Update List belongs to.
+ */
+ scene: Phaser.Scene;
+
+ /**
+ * The Scene's Systems.
+ */
+ systems: Phaser.Scenes.Systems;
+
+ /**
+ * The update step.
+ *
+ * Pre-updates every active Game Object in the list.
+ * @param time The current timestamp.
+ * @param delta The delta time elapsed since the last frame.
+ */
+ sceneUpdate(time: number, delta: number): void;
+
+ /**
+ * The Scene that owns this plugin is shutting down.
+ *
+ * We need to kill and reset all internal properties as well as stop listening to Scene events.
+ */
+ shutdown(): void;
+
+ /**
+ * The Scene that owns this plugin is being destroyed.
+ *
+ * We need to shutdown and then kill off all external references.
+ */
+ destroy(): void;
+
+ }
+
/**
* A Video Game Object.
*
@@ -40007,1328 +40382,6 @@ declare namespace Phaser {
}
namespace Input {
- /**
- * Creates a new Interactive Object.
- *
- * This is called automatically by the Input Manager when you enable a Game Object for input.
- *
- * The resulting Interactive Object is mapped to the Game Object's `input` property.
- * @param gameObject The Game Object to which this Interactive Object is bound.
- * @param hitArea The hit area for this Interactive Object. Typically a geometry shape, like a Rectangle or Circle.
- * @param hitAreaCallback The 'contains' check callback that the hit area shape will use for all hit tests.
- */
- function CreateInteractiveObject(gameObject: Phaser.GameObjects.GameObject, hitArea: any, hitAreaCallback: Phaser.Types.Input.HitAreaCallback): Phaser.Types.Input.InteractiveObject;
-
- /**
- * Creates a new Pixel Perfect Handler function.
- *
- * Access via `InputPlugin.makePixelPerfect` rather than calling it directly.
- * @param textureManager A reference to the Texture Manager.
- * @param alphaTolerance The alpha level that the pixel should be above to be included as a successful interaction.
- */
- function CreatePixelPerfectHandler(textureManager: Phaser.Textures.TextureManager, alphaTolerance: integer): Function;
-
- /**
- * The Input Manager is responsible for handling the pointer related systems in a single Phaser Game instance.
- *
- * Based on the Game Config it will create handlers for mouse and touch support.
- *
- * Keyboard and Gamepad are plugins, handled directly by the InputPlugin class.
- *
- * It then manages the events, pointer creation and general hit test related operations.
- *
- * You rarely need to interact with the Input Manager directly, and as such, all of its properties and methods
- * should be considered private. Instead, you should use the Input Plugin, which is a Scene level system, responsible
- * for dealing with all input events for a Scene.
- */
- class InputManager {
- /**
- *
- * @param game The Game instance that owns the Input Manager.
- * @param config The Input Configuration object, as set in the Game Config.
- */
- constructor(game: Phaser.Game, config: object);
-
- /**
- * The Game instance that owns the Input Manager.
- * A Game only maintains on instance of the Input Manager at any time.
- */
- readonly game: Phaser.Game;
-
- /**
- * A reference to the global Game Scale Manager.
- * Used for all bounds checks and pointer scaling.
- */
- scaleManager: Phaser.Scale.ScaleManager;
-
- /**
- * The Canvas that is used for all DOM event input listeners.
- */
- canvas: HTMLCanvasElement;
-
- /**
- * The Game Configuration object, as set during the game boot.
- */
- config: Phaser.Core.Config;
-
- /**
- * If set, the Input Manager will run its update loop every frame.
- */
- enabled: boolean;
-
- /**
- * The Event Emitter instance that the Input Manager uses to emit events from.
- */
- events: Phaser.Events.EventEmitter;
-
- /**
- * Are any mouse or touch pointers currently over the game canvas?
- * This is updated automatically by the canvas over and out handlers.
- */
- readonly isOver: boolean;
-
- /**
- * The default CSS cursor to be used when interacting with your game.
- *
- * See the `setDefaultCursor` method for more details.
- */
- defaultCursor: string;
-
- /**
- * A reference to the Keyboard Manager class, if enabled via the `input.keyboard` Game Config property.
- */
- keyboard: Phaser.Input.Keyboard.KeyboardManager;
-
- /**
- * A reference to the Mouse Manager class, if enabled via the `input.mouse` Game Config property.
- */
- mouse: Phaser.Input.Mouse.MouseManager;
-
- /**
- * A reference to the Touch Manager class, if enabled via the `input.touch` Game Config property.
- */
- touch: Phaser.Input.Touch.TouchManager;
-
- /**
- * An array of Pointers that have been added to the game.
- * The first entry is reserved for the Mouse Pointer, the rest are Touch Pointers.
- *
- * By default there is 1 touch pointer enabled. If you need more use the `addPointer` method to start them,
- * or set the `input.activePointers` property in the Game Config.
- */
- pointers: Phaser.Input.Pointer[];
-
- /**
- * The number of touch objects activated and being processed each update.
- *
- * You can change this by either calling `addPointer` at run-time, or by
- * setting the `input.activePointers` property in the Game Config.
- */
- readonly pointersTotal: integer;
-
- /**
- * The mouse has its own unique Pointer object, which you can reference directly if making a _desktop specific game_.
- * If you are supporting both desktop and touch devices then do not use this property, instead use `activePointer`
- * which will always map to the most recently interacted pointer.
- */
- mousePointer: Phaser.Input.Pointer;
-
- /**
- * The most recently active Pointer object.
- *
- * If you've only 1 Pointer in your game then this will accurately be either the first finger touched, or the mouse.
- *
- * If your game doesn't need to support multi-touch then you can safely use this property in all of your game
- * code and it will adapt to be either the mouse or the touch, based on device.
- */
- activePointer: Phaser.Input.Pointer;
-
- /**
- * If the top-most Scene in the Scene List receives an input it will stop input from
- * propagating any lower down the scene list, i.e. if you have a UI Scene at the top
- * and click something on it, that click will not then be passed down to any other
- * Scene below. Disable this to have input events passed through all Scenes, all the time.
- */
- globalTopOnly: boolean;
-
- /**
- * The time this Input Manager was last updated.
- * This value is populated by the Game Step each frame.
- */
- readonly time: number;
-
- /**
- * The Boot handler is called by Phaser.Game when it first starts up.
- * The renderer is available by now.
- */
- protected boot(): void;
-
- /**
- * Tells the Input system to set a custom cursor.
- *
- * This cursor will be the default cursor used when interacting with the game canvas.
- *
- * If an Interactive Object also sets a custom cursor, this is the cursor that is reset after its use.
- *
- * Any valid CSS cursor value is allowed, including paths to image files, i.e.:
- *
- * ```javascript
- * this.input.setDefaultCursor('url(assets/cursors/sword.cur), pointer');
- * ```
- *
- * Please read about the differences between browsers when it comes to the file formats and sizes they support:
- *
- * https://developer.mozilla.org/en-US/docs/Web/CSS/cursor
- * https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_User_Interface/Using_URL_values_for_the_cursor_property
- *
- * It's up to you to pick a suitable cursor format that works across the range of browsers you need to support.
- * @param cursor The CSS to be used when setting the default cursor.
- */
- setDefaultCursor(cursor: string): void;
-
- /**
- * Adds new Pointer objects to the Input Manager.
- *
- * By default Phaser creates 2 pointer objects: `mousePointer` and `pointer1`.
- *
- * You can create more either by calling this method, or by setting the `input.activePointers` property
- * in the Game Config, up to a maximum of 10 pointers.
- *
- * The first 10 pointers are available via the `InputPlugin.pointerX` properties, once they have been added
- * via this method.
- * @param quantity The number of new Pointers to create. A maximum of 10 is allowed in total. Default 1.
- */
- addPointer(quantity?: integer): Phaser.Input.Pointer[];
-
- /**
- * Internal method that gets a list of all the active Input Plugins in the game
- * and updates each of them in turn, in reverse order (top to bottom), to allow
- * for DOM top-level event handling simulation.
- * @param type The type of event to process.
- * @param pointers An array of Pointers on which the event occurred.
- */
- updateInputPlugins(type: integer, pointers: Phaser.Input.Pointer[]): void;
-
- /**
- * Performs a hit test using the given Pointer and camera, against an array of interactive Game Objects.
- *
- * The Game Objects are culled against the camera, and then the coordinates are translated into the local camera space
- * and used to determine if they fall within the remaining Game Objects hit areas or not.
- *
- * If nothing is matched an empty array is returned.
- *
- * This method is called automatically by InputPlugin.hitTestPointer and doesn't usually need to be invoked directly.
- * @param pointer The Pointer to test against.
- * @param gameObjects An array of interactive Game Objects to check.
- * @param camera The Camera which is being tested against.
- * @param output An array to store the results in. If not given, a new empty array is created.
- */
- hitTest(pointer: Phaser.Input.Pointer, gameObjects: any[], camera: Phaser.Cameras.Scene2D.Camera, output?: any[]): any[];
-
- /**
- * Checks if the given x and y coordinate are within the hit area of the Game Object.
- *
- * This method assumes that the coordinate values have already been translated into the space of the Game Object.
- *
- * If the coordinates are within the hit area they are set into the Game Objects Input `localX` and `localY` properties.
- * @param gameObject The interactive Game Object to check against.
- * @param x The translated x coordinate for the hit test.
- * @param y The translated y coordinate for the hit test.
- */
- pointWithinHitArea(gameObject: Phaser.GameObjects.GameObject, x: number, y: number): boolean;
-
- /**
- * Checks if the given x and y coordinate are within the hit area of the Interactive Object.
- *
- * This method assumes that the coordinate values have already been translated into the space of the Interactive Object.
- *
- * If the coordinates are within the hit area they are set into the Interactive Objects Input `localX` and `localY` properties.
- * @param object The Interactive Object to check against.
- * @param x The translated x coordinate for the hit test.
- * @param y The translated y coordinate for the hit test.
- */
- pointWithinInteractiveObject(object: Phaser.Types.Input.InteractiveObject, x: number, y: number): boolean;
-
- /**
- * Transforms the pageX and pageY values of a Pointer into the scaled coordinate space of the Input Manager.
- * @param pointer The Pointer to transform the values for.
- * @param pageX The Page X value.
- * @param pageY The Page Y value.
- * @param wasMove Are we transforming the Pointer from a move event, or an up / down event?
- */
- transformPointer(pointer: Phaser.Input.Pointer, pageX: number, pageY: number, wasMove: boolean): void;
-
- /**
- * Destroys the Input Manager and all of its systems.
- *
- * There is no way to recover from doing this.
- */
- destroy(): void;
-
- }
-
- /**
- * The Input Plugin belongs to a Scene and handles all input related events and operations for it.
- *
- * You can access it from within a Scene using `this.input`.
- *
- * It emits events directly. For example, you can do:
- *
- * ```javascript
- * this.input.on('pointerdown', callback, context);
- * ```
- *
- * To listen for a pointer down event anywhere on the game canvas.
- *
- * Game Objects can be enabled for input by calling their `setInteractive` method. After which they
- * will directly emit input events:
- *
- * ```javascript
- * var sprite = this.add.sprite(x, y, texture);
- * sprite.setInteractive();
- * sprite.on('pointerdown', callback, context);
- * ```
- *
- * There are lots of game configuration options available relating to input.
- * See the [Input Config object]{@linkcode Phaser.Types.Core.InputConfig} for more details, including how to deal with Phaser
- * listening for input events outside of the canvas, how to set a default number of pointers, input
- * capture settings and more.
- *
- * Please also see the Input examples and tutorials for further information.
- */
- class InputPlugin extends Phaser.Events.EventEmitter {
- /**
- *
- * @param scene A reference to the Scene that this Input Plugin is responsible for.
- */
- constructor(scene: Phaser.Scene);
-
- /**
- * A reference to the Scene that this Input Plugin is responsible for.
- */
- scene: Phaser.Scene;
-
- /**
- * A reference to the Scene Systems class.
- */
- systems: Phaser.Scenes.Systems;
-
- /**
- * A reference to the Scene Systems Settings.
- */
- settings: Phaser.Types.Scenes.SettingsObject;
-
- /**
- * A reference to the Game Input Manager.
- */
- manager: Phaser.Input.InputManager;
-
- /**
- * If `true` this Input Plugin will process DOM input events.
- */
- enabled: boolean;
-
- /**
- * A reference to the Scene Display List. This property is set during the `boot` method.
- */
- displayList: Phaser.GameObjects.DisplayList;
-
- /**
- * A reference to the Scene Cameras Manager. This property is set during the `boot` method.
- */
- cameras: Phaser.Cameras.Scene2D.CameraManager;
-
- /**
- * A reference to the Mouse Manager.
- *
- * This property is only set if Mouse support has been enabled in your Game Configuration file.
- *
- * If you just wish to get access to the mouse pointer, use the `mousePointer` property instead.
- */
- mouse: Phaser.Input.Mouse.MouseManager;
-
- /**
- * When set to `true` (the default) the Input Plugin will emulate DOM behavior by only emitting events from
- * the top-most Game Objects in the Display List.
- *
- * If set to `false` it will emit events from all Game Objects below a Pointer, not just the top one.
- */
- topOnly: boolean;
-
- /**
- * How often should the Pointers be checked?
- *
- * The value is a time, given in ms, and is the time that must have elapsed between game steps before
- * the Pointers will be polled again. When a pointer is polled it runs a hit test to see which Game
- * Objects are currently below it, or being interacted with it.
- *
- * Pointers will *always* be checked if they have been moved by the user, or press or released.
- *
- * This property only controls how often they will be polled if they have not been updated.
- * You should set this if you want to have Game Objects constantly check against the pointers, even
- * if the pointer didn't itself move.
- *
- * Set to 0 to poll constantly. Set to -1 to only poll on user movement.
- */
- pollRate: integer;
-
- /**
- * The distance, in pixels, a pointer has to move while being held down, before it thinks it is being dragged.
- */
- dragDistanceThreshold: number;
-
- /**
- * The amount of time, in ms, a pointer has to be held down before it thinks it is dragging.
- *
- * The default polling rate is to poll only on move so once the time threshold is reached the
- * drag event will not start until you move the mouse. If you want it to start immediately
- * when the time threshold is reached, you must increase the polling rate by calling
- * [setPollAlways]{@linkcode Phaser.Input.InputPlugin#setPollAlways} or
- * [setPollRate]{@linkcode Phaser.Input.InputPlugin#setPollRate}.
- */
- dragTimeThreshold: number;
-
- /**
- * Checks to see if both this plugin and the Scene to which it belongs is active.
- */
- isActive(): boolean;
-
- /**
- * This is called automatically by the Input Manager.
- * It emits events for plugins to listen to and also handles polling updates, if enabled.
- * @param time The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
- * @param delta The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.
- */
- updatePoll(time: number, delta: number): boolean;
-
- /**
- * Clears a Game Object so it no longer has an Interactive Object associated with it.
- * The Game Object is then queued for removal from the Input Plugin on the next update.
- * @param gameObject The Game Object that will have its Interactive Object removed.
- * @param skipQueue Skip adding this Game Object into the removal queue? Default false.
- */
- clear(gameObject: Phaser.GameObjects.GameObject, skipQueue?: boolean): Phaser.GameObjects.GameObject;
-
- /**
- * Disables Input on a single Game Object.
- *
- * An input disabled Game Object still retains its Interactive Object component and can be re-enabled
- * at any time, by passing it to `InputPlugin.enable`.
- * @param gameObject The Game Object to have its input system disabled.
- */
- disable(gameObject: Phaser.GameObjects.GameObject): void;
-
- /**
- * Enable a Game Object for interaction.
- *
- * If the Game Object already has an Interactive Object component, it is enabled and returned.
- *
- * Otherwise, a new Interactive Object component is created and assigned to the Game Object's `input` property.
- *
- * Input works by using hit areas, these are nearly always geometric shapes, such as rectangles or circles, that act as the hit area
- * for the Game Object. However, you can provide your own hit area shape and callback, should you wish to handle some more advanced
- * input detection.
- *
- * If no arguments are provided it will try and create a rectangle hit area based on the texture frame the Game Object is using. If
- * this isn't a texture-bound object, such as a Graphics or BitmapText object, this will fail, and you'll need to provide a specific
- * shape for it to use.
- *
- * You can also provide an Input Configuration Object as the only argument to this method.
- * @param gameObject The Game Object to be enabled for input.
- * @param shape 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 callback The 'contains' function to invoke to check if the pointer is within the hit area.
- * @param dropZone Is this Game Object a drop zone or not? Default false.
- */
- enable(gameObject: Phaser.GameObjects.GameObject, shape?: Phaser.Types.Input.InputConfiguration | any, callback?: Phaser.Types.Input.HitAreaCallback, dropZone?: boolean): Phaser.Input.InputPlugin;
-
- /**
- * Takes the given Pointer and performs a hit test against it, to see which interactive Game Objects
- * it is currently above.
- *
- * The hit test is performed against which-ever Camera the Pointer is over. If it is over multiple
- * cameras, it starts checking the camera at the top of the camera list, and if nothing is found, iterates down the list.
- * @param pointer The Pointer to check against the Game Objects.
- */
- hitTestPointer(pointer: Phaser.Input.Pointer): Phaser.GameObjects.GameObject[];
-
- /**
- * Returns the drag state of the given Pointer for this Input Plugin.
- *
- * The state will be one of the following:
- *
- * 0 = Not dragging anything
- * 1 = Primary button down and objects below, so collect a draglist
- * 2 = Pointer being checked if meets drag criteria
- * 3 = Pointer meets criteria, notify the draglist
- * 4 = Pointer actively dragging the draglist and has moved
- * 5 = Pointer actively dragging but has been released, notify draglist
- * @param pointer The Pointer to get the drag state for.
- */
- getDragState(pointer: Phaser.Input.Pointer): integer;
-
- /**
- * Sets the drag state of the given Pointer for this Input Plugin.
- *
- * The state must be one of the following values:
- *
- * 0 = Not dragging anything
- * 1 = Primary button down and objects below, so collect a draglist
- * 2 = Pointer being checked if meets drag criteria
- * 3 = Pointer meets criteria, notify the draglist
- * 4 = Pointer actively dragging the draglist and has moved
- * 5 = Pointer actively dragging but has been released, notify draglist
- * @param pointer The Pointer to set the drag state for.
- * @param state The drag state value. An integer between 0 and 5.
- */
- setDragState(pointer: Phaser.Input.Pointer, state: integer): void;
-
- /**
- * Sets the draggable state of the given array of Game Objects.
- *
- * They can either be set to be draggable, or can have their draggable state removed by passing `false`.
- *
- * A Game Object will not fire drag events unless it has been specifically enabled for drag.
- * @param gameObjects An array of Game Objects to change the draggable state on.
- * @param value Set to `true` if the Game Objects should be made draggable, `false` if they should be unset. Default true.
- */
- setDraggable(gameObjects: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[], value?: boolean): Phaser.Input.InputPlugin;
-
- /**
- * Creates a function that can be passed to `setInteractive`, `enable` or `setHitArea` that will handle
- * pixel-perfect input detection on an Image or Sprite based Game Object, or any custom class that extends them.
- *
- * The following will create a sprite that is clickable on any pixel that has an alpha value >= 1.
- *
- * ```javascript
- * this.add.sprite(x, y, key).setInteractive(this.input.makePixelPerfect());
- * ```
- *
- * The following will create a sprite that is clickable on any pixel that has an alpha value >= 150.
- *
- * ```javascript
- * this.add.sprite(x, y, key).setInteractive(this.input.makePixelPerfect(150));
- * ```
- *
- * Once you have made an Interactive Object pixel perfect it impacts all input related events for it: down, up,
- * dragstart, drag, etc.
- *
- * As a pointer interacts with the Game Object it will constantly poll the texture, extracting a single pixel from
- * the given coordinates and checking its color values. This is an expensive process, so should only be enabled on
- * Game Objects that really need it.
- *
- * You cannot make non-texture based Game Objects pixel perfect. So this will not work on Graphics, BitmapText,
- * Render Textures, Text, Tilemaps, Containers or Particles.
- * @param alphaTolerance The alpha level that the pixel should be above to be included as a successful interaction. Default 1.
- */
- makePixelPerfect(alphaTolerance?: integer): Function;
-
- /**
- * Sets the hit area for the given array of Game Objects.
- *
- * A hit area is typically one of the geometric shapes Phaser provides, such as a `Phaser.Geom.Rectangle`
- * or `Phaser.Geom.Circle`. However, it can be any object as long as it works with the provided callback.
- *
- * If no hit area is provided a Rectangle is created based on the size of the Game Object, if possible
- * to calculate.
- *
- * The hit area callback is the function that takes an `x` and `y` coordinate and returns a boolean if
- * those values fall within the area of the shape or not. All of the Phaser geometry objects provide this,
- * such as `Phaser.Geom.Rectangle.Contains`.
- * @param gameObjects An array of Game Objects to set the hit area on.
- * @param shape 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 callback The 'contains' function to invoke to check if the pointer is within the hit area.
- */
- setHitArea(gameObjects: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[], shape?: Phaser.Types.Input.InputConfiguration | any, callback?: Phaser.Types.Input.HitAreaCallback): Phaser.Input.InputPlugin;
-
- /**
- * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Circle` shape, using
- * the given coordinates and radius to control its position and size.
- * @param gameObjects An array of Game Objects to set as having a circle hit area.
- * @param x The center of the circle.
- * @param y The center of the circle.
- * @param radius The radius of the circle.
- * @param callback The hit area callback. If undefined it uses Circle.Contains.
- */
- setHitAreaCircle(gameObjects: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[], x: number, y: number, radius: number, callback?: Phaser.Types.Input.HitAreaCallback): Phaser.Input.InputPlugin;
-
- /**
- * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Ellipse` shape, using
- * the given coordinates and dimensions to control its position and size.
- * @param gameObjects An array of Game Objects to set as having an ellipse hit area.
- * @param x The center of the ellipse.
- * @param y The center of the ellipse.
- * @param width The width of the ellipse.
- * @param height The height of the ellipse.
- * @param callback The hit area callback. If undefined it uses Ellipse.Contains.
- */
- setHitAreaEllipse(gameObjects: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[], x: number, y: number, width: number, height: number, callback?: Phaser.Types.Input.HitAreaCallback): Phaser.Input.InputPlugin;
-
- /**
- * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Rectangle` shape, using
- * the Game Objects texture frame to define the position and size of the hit area.
- * @param gameObjects An array of Game Objects to set as having an ellipse hit area.
- * @param callback The hit area callback. If undefined it uses Rectangle.Contains.
- */
- setHitAreaFromTexture(gameObjects: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[], callback?: Phaser.Types.Input.HitAreaCallback): Phaser.Input.InputPlugin;
-
- /**
- * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Rectangle` shape, using
- * the given coordinates and dimensions to control its position and size.
- * @param gameObjects An array of Game Objects to set as having a rectangular hit area.
- * @param x The top-left of the rectangle.
- * @param y The top-left of the rectangle.
- * @param width The width of the rectangle.
- * @param height The height of the rectangle.
- * @param callback The hit area callback. If undefined it uses Rectangle.Contains.
- */
- setHitAreaRectangle(gameObjects: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[], x: number, y: number, width: number, height: number, callback?: Phaser.Types.Input.HitAreaCallback): Phaser.Input.InputPlugin;
-
- /**
- * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Triangle` shape, using
- * the given coordinates to control the position of its points.
- * @param gameObjects An array of Game Objects to set as having a triangular hit area.
- * @param x1 The x coordinate of the first point of the triangle.
- * @param y1 The y coordinate of the first point of the triangle.
- * @param x2 The x coordinate of the second point of the triangle.
- * @param y2 The y coordinate of the second point of the triangle.
- * @param x3 The x coordinate of the third point of the triangle.
- * @param y3 The y coordinate of the third point of the triangle.
- * @param callback The hit area callback. If undefined it uses Triangle.Contains.
- */
- setHitAreaTriangle(gameObjects: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[], x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, callback?: Phaser.Types.Input.HitAreaCallback): Phaser.Input.InputPlugin;
-
- /**
- * Creates an Input Debug Shape for the given Game Object.
- *
- * The Game Object must have _already_ been enabled for input prior to calling this method.
- *
- * This is intended to assist you during development and debugging.
- *
- * Debug Shapes can only be created for Game Objects that are using standard Phaser Geometry for input,
- * including: Circle, Ellipse, Line, Polygon, Rectangle and Triangle.
- *
- * Game Objects that are using their automatic hit areas are using Rectangles by default, so will also work.
- *
- * The Debug Shape is created and added to the display list and is then kept in sync with the Game Object
- * it is connected with. Should you need to modify it yourself, such as to hide it, you can access it via
- * the Game Object property: `GameObject.input.hitAreaDebug`.
- *
- * Calling this method on a Game Object that already has a Debug Shape will first destroy the old shape,
- * before creating a new one. If you wish to remove the Debug Shape entirely, you should call the
- * method `InputPlugin.removeDebug`.
- *
- * Note that the debug shape will only show the outline of the input area. If the input test is using a
- * pixel perfect check, for example, then this is not displayed. If you are using a custom shape, that
- * doesn't extend one of the base Phaser Geometry objects, as your hit area, then this method will not
- * work.
- * @param gameObject The Game Object to create the input debug shape for.
- * @param color The outline color of the debug shape. Default 0x00ff00.
- */
- enableDebug(gameObject: Phaser.GameObjects.GameObject, color?: number): Phaser.Input.InputPlugin;
-
- /**
- * Removes an Input Debug Shape from the given Game Object.
- *
- * The shape is destroyed immediately and the `hitAreaDebug` property is set to `null`.
- * @param gameObject The Game Object to remove the input debug shape from.
- */
- removeDebug(gameObject: Phaser.GameObjects.GameObject): Phaser.Input.InputPlugin;
-
- /**
- * Sets the Pointers to always poll.
- *
- * When a pointer is polled it runs a hit test to see which Game Objects are currently below it,
- * or being interacted with it, regardless if the Pointer has actually moved or not.
- *
- * You should enable this if you want objects in your game to fire over / out events, and the objects
- * are constantly moving, but the pointer may not have. Polling every frame has additional computation
- * costs, especially if there are a large number of interactive objects in your game.
- */
- setPollAlways(): Phaser.Input.InputPlugin;
-
- /**
- * Sets the Pointers to only poll when they are moved or updated.
- *
- * When a pointer is polled it runs a hit test to see which Game Objects are currently below it,
- * or being interacted with it.
- */
- setPollOnMove(): Phaser.Input.InputPlugin;
-
- /**
- * Sets the poll rate value. This is the amount of time that should have elapsed before a pointer
- * will be polled again. See the `setPollAlways` and `setPollOnMove` methods.
- * @param value The amount of time, in ms, that should elapsed before re-polling the pointers.
- */
- setPollRate(value: number): Phaser.Input.InputPlugin;
-
- /**
- * When set to `true` the global Input Manager will emulate DOM behavior by only emitting events from
- * the top-most Scene in the Scene List. By default, if a Scene receives an input event it will then stop the event
- * from flowing down to any Scenes below it in the Scene list. To disable this behavior call this method with `false`.
- * @param value Set to `true` to stop processing input events on the Scene that receives it, or `false` to let the event continue down the Scene list.
- */
- setGlobalTopOnly(value: boolean): Phaser.Input.InputPlugin;
-
- /**
- * When set to `true` this Input Plugin will emulate DOM behavior by only emitting events from
- * the top-most Game Objects in the Display List.
- *
- * If set to `false` it will emit events from all Game Objects below a Pointer, not just the top one.
- * @param value `true` to only include the top-most Game Object, or `false` to include all Game Objects in a hit test.
- */
- setTopOnly(value: boolean): Phaser.Input.InputPlugin;
-
- /**
- * Given an array of Game Objects, sort the array and return it, so that the objects are in depth index order
- * with the lowest at the bottom.
- * @param gameObjects An array of Game Objects to be sorted.
- */
- sortGameObjects(gameObjects: Phaser.GameObjects.GameObject[]): Phaser.GameObjects.GameObject[];
-
- /**
- * This method should be called from within an input event handler, such as `pointerdown`.
- *
- * When called, it stops the Input Manager from allowing _this specific event_ to be processed by any other Scene
- * not yet handled in the scene list.
- */
- stopPropagation(): Phaser.Input.InputPlugin;
-
- /**
- * Adds new Pointer objects to the Input Manager.
- *
- * By default Phaser creates 2 pointer objects: `mousePointer` and `pointer1`.
- *
- * You can create more either by calling this method, or by setting the `input.activePointers` property
- * in the Game Config, up to a maximum of 10 pointers.
- *
- * The first 10 pointers are available via the `InputPlugin.pointerX` properties, once they have been added
- * via this method.
- * @param quantity The number of new Pointers to create. A maximum of 10 is allowed in total. Default 1.
- */
- addPointer(quantity?: integer): Phaser.Input.Pointer[];
-
- /**
- * Tells the Input system to set a custom cursor.
- *
- * This cursor will be the default cursor used when interacting with the game canvas.
- *
- * If an Interactive Object also sets a custom cursor, this is the cursor that is reset after its use.
- *
- * Any valid CSS cursor value is allowed, including paths to image files, i.e.:
- *
- * ```javascript
- * this.input.setDefaultCursor('url(assets/cursors/sword.cur), pointer');
- * ```
- *
- * Please read about the differences between browsers when it comes to the file formats and sizes they support:
- *
- * https://developer.mozilla.org/en-US/docs/Web/CSS/cursor
- * https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_User_Interface/Using_URL_values_for_the_cursor_property
- *
- * It's up to you to pick a suitable cursor format that works across the range of browsers you need to support.
- * @param cursor The CSS to be used when setting the default cursor.
- */
- setDefaultCursor(cursor: string): Phaser.Input.InputPlugin;
-
- /**
- * The x coordinates of the ActivePointer based on the first camera in the camera list.
- * This is only safe to use if your game has just 1 non-transformed camera and doesn't use multi-touch.
- */
- readonly x: number;
-
- /**
- * The y coordinates of the ActivePointer based on the first camera in the camera list.
- * This is only safe to use if your game has just 1 non-transformed camera and doesn't use multi-touch.
- */
- readonly y: number;
-
- /**
- * Are any mouse or touch pointers currently over the game canvas?
- */
- readonly isOver: boolean;
-
- /**
- * The mouse has its own unique Pointer object, which you can reference directly if making a _desktop specific game_.
- * If you are supporting both desktop and touch devices then do not use this property, instead use `activePointer`
- * which will always map to the most recently interacted pointer.
- */
- readonly mousePointer: Phaser.Input.Pointer;
-
- /**
- * The current active input Pointer.
- */
- readonly activePointer: Phaser.Input.Pointer;
-
- /**
- * A touch-based Pointer object.
- * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
- */
- readonly pointer1: Phaser.Input.Pointer;
-
- /**
- * A touch-based Pointer object.
- * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
- */
- readonly pointer2: Phaser.Input.Pointer;
-
- /**
- * A touch-based Pointer object.
- * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
- */
- readonly pointer3: Phaser.Input.Pointer;
-
- /**
- * A touch-based Pointer object.
- * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
- */
- readonly pointer4: Phaser.Input.Pointer;
-
- /**
- * A touch-based Pointer object.
- * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
- */
- readonly pointer5: Phaser.Input.Pointer;
-
- /**
- * A touch-based Pointer object.
- * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
- */
- readonly pointer6: Phaser.Input.Pointer;
-
- /**
- * A touch-based Pointer object.
- * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
- */
- readonly pointer7: Phaser.Input.Pointer;
-
- /**
- * A touch-based Pointer object.
- * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
- */
- readonly pointer8: Phaser.Input.Pointer;
-
- /**
- * A touch-based Pointer object.
- * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
- */
- readonly pointer9: Phaser.Input.Pointer;
-
- /**
- * A touch-based Pointer object.
- * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
- */
- readonly pointer10: Phaser.Input.Pointer;
-
- /**
- * An instance of the Gamepad Plugin class, if enabled via the `input.gamepad` Scene or Game Config property.
- * Use this to create access Gamepads connected to the browser and respond to gamepad buttons.
- */
- gamepad: Phaser.Input.Gamepad.GamepadPlugin;
-
- /**
- * An instance of the Keyboard Plugin class, if enabled via the `input.keyboard` Scene or Game Config property.
- * Use this to create Key objects and listen for keyboard specific events.
- */
- keyboard: Phaser.Input.Keyboard.KeyboardPlugin;
-
- }
-
- namespace InputPluginCache {
- /**
- * Static method called directly by the Core internal Plugins.
- * Key is a reference used to get the plugin from the plugins object (i.e. InputPlugin)
- * Plugin is the object to instantiate to create the plugin
- * Mapping is what the plugin is injected into the Scene.Systems as (i.e. input)
- * @param key A reference used to get this plugin from the plugin cache.
- * @param plugin The plugin to be stored. Should be the core object, not instantiated.
- * @param mapping If this plugin is to be injected into the Input Plugin, this is the property key used.
- * @param settingsKey The key in the Scene Settings to check to see if this plugin should install or not.
- * @param configKey The key in the Game Config to check to see if this plugin should install or not.
- */
- function register(key: string, plugin: Function, mapping: string, settingsKey: string, configKey: string): void;
-
- /**
- * Returns the input plugin object from the cache based on the given key.
- * @param key The key of the input plugin to get.
- */
- function getCore(key: string): Phaser.Types.Input.InputPluginContainer;
-
- /**
- * Installs all of the registered Input Plugins into the given target.
- * @param target The target InputPlugin to install the plugins into.
- */
- function install(target: Phaser.Input.InputPlugin): void;
-
- /**
- * Removes an input plugin based on the given key.
- * @param key The key of the input plugin to remove.
- */
- function remove(key: string): void;
-
- }
-
- /**
- * A Pointer object encapsulates both mouse and touch input within Phaser.
- *
- * By default, Phaser will create 2 pointers for your game to use. If you require more, i.e. for a multi-touch
- * game, then use the `InputPlugin.addPointer` method to do so, rather than instantiating this class directly,
- * otherwise it won't be managed by the input system.
- *
- * You can reference the current active pointer via `InputPlugin.activePointer`. You can also use the properties
- * `InputPlugin.pointer1` through to `pointer10`, for each pointer you have enabled in your game.
- *
- * The properties of this object are set by the Input Plugin during processing. This object is then sent in all
- * input related events that the Input Plugin emits, so you can reference properties from it directly in your
- * callbacks.
- */
- class Pointer {
- /**
- *
- * @param manager A reference to the Input Manager.
- * @param id The internal ID of this Pointer.
- */
- constructor(manager: Phaser.Input.InputManager, id: integer);
-
- /**
- * A reference to the Input Manager.
- */
- manager: Phaser.Input.InputManager;
-
- /**
- * The internal ID of this Pointer.
- */
- readonly id: integer;
-
- /**
- * The most recent native DOM Event this Pointer has processed.
- */
- event: TouchEvent | MouseEvent;
-
- /**
- * The DOM element the Pointer was pressed down on, taken from the DOM event.
- * In a default set-up this will be the Canvas that Phaser is rendering to, or the Window element.
- */
- readonly downElement: any;
-
- /**
- * The DOM element the Pointer was released on, taken from the DOM event.
- * In a default set-up this will be the Canvas that Phaser is rendering to, or the Window element.
- */
- readonly upElement: any;
-
- /**
- * The camera the Pointer interacted with during its last update.
- *
- * A Pointer can only ever interact with one camera at once, which will be the top-most camera
- * in the list should multiple cameras be positioned on-top of each other.
- */
- camera: Phaser.Cameras.Scene2D.Camera;
-
- /**
- * A read-only property that indicates which button was pressed, or released, on the pointer
- * during the most recent event. It is only set during `up` and `down` events.
- *
- * On Touch devices the value is always 0.
- *
- * Users may change the configuration of buttons on their pointing device so that if an event's button property
- * is zero, it may not have been caused by the button that is physically left–most on the pointing device;
- * however, it should behave as if the left button was clicked in the standard button layout.
- */
- readonly button: integer;
-
- /**
- * 0: No button or un-initialized
- * 1: Left button
- * 2: Right button
- * 4: Wheel button or middle button
- * 8: 4th button (typically the "Browser Back" button)
- * 16: 5th button (typically the "Browser Forward" button)
- *
- * For a mouse configured for left-handed use, the button actions are reversed.
- * In this case, the values are read from right to left.
- */
- buttons: integer;
-
- /**
- * The position of the Pointer in screen space.
- */
- readonly position: Phaser.Math.Vector2;
-
- /**
- * The previous position of the Pointer in screen space.
- *
- * The old x and y values are stored in here during the InputManager.transformPointer call.
- *
- * Use the properties `velocity`, `angle` and `distance` to create your own gesture recognition.
- */
- readonly prevPosition: Phaser.Math.Vector2;
-
- /**
- * The current velocity of the Pointer, based on its current and previous positions.
- *
- * This value is smoothed out each frame, according to the `motionFactor` property.
- *
- * This property is updated whenever the Pointer moves, regardless of any button states. In other words,
- * it changes based on movement alone - a button doesn't have to be pressed first.
- */
- readonly velocity: Phaser.Math.Vector2;
-
- /**
- * The current angle the Pointer is moving, in radians, based on its previous and current position.
- *
- * The angle is based on the old position facing to the current position.
- *
- * This property is updated whenever the Pointer moves, regardless of any button states. In other words,
- * it changes based on movement alone - a button doesn't have to be pressed first.
- */
- readonly angle: number;
-
- /**
- * The distance the Pointer has moved, based on its previous and current position.
- *
- * This value is smoothed out each frame, according to the `motionFactor` property.
- *
- * This property is updated whenever the Pointer moves, regardless of any button states. In other words,
- * it changes based on movement alone - a button doesn't have to be pressed first.
- *
- * If you need the total distance travelled since the primary buttons was pressed down,
- * then use the `Pointer.getDistance` method.
- */
- readonly distance: number;
-
- /**
- * The smoothing factor to apply to the Pointer position.
- *
- * Due to their nature, pointer positions are inherently noisy. While this is fine for lots of games, if you need cleaner positions
- * then you can set this value to apply an automatic smoothing to the positions as they are recorded.
- *
- * The default value of zero means 'no smoothing'.
- * Set to a small value, such as 0.2, to apply an average level of smoothing between positions. You can do this by changing this
- * value directly, or by setting the `input.smoothFactor` property in the Game Config.
- *
- * Positions are only smoothed when the pointer moves. If the primary button on this Pointer enters an Up or Down state, then the position
- * is always precise, and not smoothed.
- */
- smoothFactor: number;
-
- /**
- * The factor applied to the motion smoothing each frame.
- *
- * This value is passed to the Smooth Step Interpolation that is used to calculate the velocity,
- * angle and distance of the Pointer. It's applied every frame, until the midPoint reaches the current
- * position of the Pointer. 0.2 provides a good average but can be increased if you need a
- * quicker update and are working in a high performance environment. Never set this value to
- * zero.
- */
- motionFactor: number;
-
- /**
- * The x position of this Pointer, translated into the coordinate space of the most recent Camera it interacted with.
- *
- * If you wish to use this value _outside_ of an input event handler then you should update it first by calling
- * the `Pointer.updateWorldPoint` method.
- */
- worldX: number;
-
- /**
- * The y position of this Pointer, translated into the coordinate space of the most recent Camera it interacted with.
- *
- * If you wish to use this value _outside_ of an input event handler then you should update it first by calling
- * the `Pointer.updateWorldPoint` method.
- */
- worldY: number;
-
- /**
- * Time when this Pointer was most recently moved (regardless of the state of its buttons, if any)
- */
- moveTime: number;
-
- /**
- * X coordinate of the Pointer when Button 1 (left button), or Touch, was pressed, used for dragging objects.
- */
- downX: number;
-
- /**
- * Y coordinate of the Pointer when Button 1 (left button), or Touch, was pressed, used for dragging objects.
- */
- downY: number;
-
- /**
- * Time when Button 1 (left button), or Touch, was pressed, used for dragging objects.
- */
- downTime: number;
-
- /**
- * X coordinate of the Pointer when Button 1 (left button), or Touch, was released, used for dragging objects.
- */
- upX: number;
-
- /**
- * Y coordinate of the Pointer when Button 1 (left button), or Touch, was released, used for dragging objects.
- */
- upY: number;
-
- /**
- * Time when Button 1 (left button), or Touch, was released, used for dragging objects.
- */
- upTime: number;
-
- /**
- * Is the primary button down? (usually button 0, the left mouse button)
- */
- primaryDown: boolean;
-
- /**
- * Is _any_ button on this pointer considered as being down?
- */
- isDown: boolean;
-
- /**
- * Did the previous input event come from a Touch input (true) or Mouse? (false)
- */
- wasTouch: boolean;
-
- /**
- * Did this Pointer get canceled by a touchcancel event?
- *
- * Note: "canceled" is the American-English spelling of "cancelled". Please don't submit PRs correcting it!
- */
- wasCanceled: boolean;
-
- /**
- * If the mouse is locked, the horizontal relative movement of the Pointer in pixels since last frame.
- */
- movementX: number;
-
- /**
- * If the mouse is locked, the vertical relative movement of the Pointer in pixels since last frame.
- */
- movementY: number;
-
- /**
- * The identifier property of the Pointer as set by the DOM event when this Pointer is started.
- */
- identifier: number;
-
- /**
- * The pointerId property of the Pointer as set by the DOM event when this Pointer is started.
- * The browser can and will recycle this value.
- */
- pointerId: number;
-
- /**
- * An active Pointer is one that is currently pressed down on the display.
- * A Mouse is always considered as active.
- */
- active: boolean;
-
- /**
- * Is this pointer Pointer Locked?
- *
- * Only a mouse pointer can be locked and it only becomes locked when requested via
- * the browsers Pointer Lock API.
- *
- * You can request this by calling the `this.input.mouse.requestPointerLock()` method from
- * a `pointerdown` or `pointerup` event handler.
- */
- readonly locked: boolean;
-
- /**
- * The horizontal scroll amount that occurred due to the user moving a mouse wheel or similar input device.
- */
- deltaX: number;
-
- /**
- * The vertical scroll amount that occurred due to the user moving a mouse wheel or similar input device.
- * This value will typically be less than 0 if the user scrolls up and greater than zero if scrolling down.
- */
- deltaY: number;
-
- /**
- * The z-axis scroll amount that occurred due to the user moving a mouse wheel or similar input device.
- */
- deltaZ: number;
-
- /**
- * Takes a Camera and updates this Pointer's `worldX` and `worldY` values so they are
- * the result of a translation through the given Camera.
- *
- * Note that the values will be automatically replaced the moment the Pointer is
- * updated by an input event, such as a mouse move, so should be used immediately.
- * @param camera The Camera which is being tested against.
- */
- updateWorldPoint(camera: Phaser.Cameras.Scene2D.Camera): this;
-
- /**
- * Takes a Camera and returns a Vector2 containing the translated position of this Pointer
- * within that Camera. This can be used to convert this Pointers position into camera space.
- * @param camera The Camera to use for the translation.
- * @param output A Vector2-like object in which to store the translated position.
- */
- positionToCamera(camera: Phaser.Cameras.Scene2D.Camera, output?: Phaser.Math.Vector2 | object): Phaser.Math.Vector2 | object;
-
- /**
- * Checks to see if any buttons are being held down on this Pointer.
- */
- noButtonDown(): boolean;
-
- /**
- * Checks to see if the left button is being held down on this Pointer.
- */
- leftButtonDown(): boolean;
-
- /**
- * Checks to see if the right button is being held down on this Pointer.
- */
- rightButtonDown(): boolean;
-
- /**
- * Checks to see if the middle button is being held down on this Pointer.
- */
- middleButtonDown(): boolean;
-
- /**
- * Checks to see if the back button is being held down on this Pointer.
- */
- backButtonDown(): boolean;
-
- /**
- * Checks to see if the forward button is being held down on this Pointer.
- */
- forwardButtonDown(): boolean;
-
- /**
- * Checks to see if the left button was just released on this Pointer.
- */
- leftButtonReleased(): boolean;
-
- /**
- * Checks to see if the right button was just released on this Pointer.
- */
- rightButtonReleased(): boolean;
-
- /**
- * Checks to see if the middle button was just released on this Pointer.
- */
- middleButtonReleased(): boolean;
-
- /**
- * Checks to see if the back button was just released on this Pointer.
- */
- backButtonReleased(): boolean;
-
- /**
- * Checks to see if the forward button was just released on this Pointer.
- */
- forwardButtonReleased(): boolean;
-
- /**
- * If the Pointer has a button pressed down at the time this method is called, it will return the
- * distance between the Pointer's `downX` and `downY` values and the current position.
- *
- * If no button is held down, it will return the last recorded distance, based on where
- * the Pointer was when the button was released.
- *
- * If you wish to get the distance being travelled currently, based on the velocity of the Pointer,
- * then see the `Pointer.distance` property.
- */
- getDistance(): number;
-
- /**
- * If the Pointer has a button pressed down at the time this method is called, it will return the
- * horizontal distance between the Pointer's `downX` and `downY` values and the current position.
- *
- * If no button is held down, it will return the last recorded horizontal distance, based on where
- * the Pointer was when the button was released.
- */
- getDistanceX(): number;
-
- /**
- * If the Pointer has a button pressed down at the time this method is called, it will return the
- * vertical distance between the Pointer's `downX` and `downY` values and the current position.
- *
- * If no button is held down, it will return the last recorded vertical distance, based on where
- * the Pointer was when the button was released.
- */
- getDistanceY(): number;
-
- /**
- * If the Pointer has a button pressed down at the time this method is called, it will return the
- * duration since the button was pressed down.
- *
- * If no button is held down, it will return the last recorded duration, based on the time
- * the Pointer button was released.
- */
- getDuration(): number;
-
- /**
- * If the Pointer has a button pressed down at the time this method is called, it will return the
- * angle between the Pointer's `downX` and `downY` values and the current position.
- *
- * If no button is held down, it will return the last recorded angle, based on where
- * the Pointer was when the button was released.
- *
- * The angle is based on the old position facing to the current position.
- *
- * If you wish to get the current angle, based on the velocity of the Pointer, then
- * see the `Pointer.angle` property.
- */
- getAngle(): number;
-
- /**
- * Takes the previous and current Pointer positions and then generates an array of interpolated values between
- * the two. The array will be populated up to the size of the `steps` argument.
- *
- * ```javaScript
- * var points = pointer.getInterpolatedPosition(4);
- *
- * // points[0] = { x: 0, y: 0 }
- * // points[1] = { x: 2, y: 1 }
- * // points[2] = { x: 3, y: 2 }
- * // points[3] = { x: 6, y: 3 }
- * ```
- *
- * Use this if you need to get smoothed values between the previous and current pointer positions. DOM pointer
- * events can often fire faster than the main browser loop, and this will help you avoid janky movement
- * especially if you have an object following a Pointer.
- *
- * Note that if you provide an output array it will only be populated up to the number of steps provided.
- * It will not clear any previous data that may have existed beyond the range of the steps count.
- *
- * Internally it uses the Smooth Step interpolation calculation.
- * @param steps The number of interpolation steps to use. Default 10.
- * @param out An array to store the results in. If not provided a new one will be created.
- */
- getInterpolatedPosition(steps?: integer, out?: any[]): any[];
-
- /**
- * Destroys this Pointer instance and resets its external references.
- */
- destroy(): void;
-
- /**
- * The x position of this Pointer.
- * The value is in screen space.
- * See `worldX` to get a camera converted position.
- */
- x: number;
-
- /**
- * The y position of this Pointer.
- * The value is in screen space.
- * See `worldY` to get a camera converted position.
- */
- y: number;
-
- /**
- * Time when this Pointer was most recently updated by a DOM Event.
- * This comes directly from the `event.timeStamp` property.
- * If no event has yet taken place, it will return zero.
- */
- readonly time: number;
-
- }
-
/**
* The mouse pointer is being held down.
*/
@@ -41374,6 +40427,27 @@ declare namespace Phaser {
*/
var MOUSE_WHEEL: integer;
+ /**
+ * Creates a new Interactive Object.
+ *
+ * This is called automatically by the Input Manager when you enable a Game Object for input.
+ *
+ * The resulting Interactive Object is mapped to the Game Object's `input` property.
+ * @param gameObject The Game Object to which this Interactive Object is bound.
+ * @param hitArea The hit area for this Interactive Object. Typically a geometry shape, like a Rectangle or Circle.
+ * @param hitAreaCallback The 'contains' check callback that the hit area shape will use for all hit tests.
+ */
+ function CreateInteractiveObject(gameObject: Phaser.GameObjects.GameObject, hitArea: any, hitAreaCallback: Phaser.Types.Input.HitAreaCallback): Phaser.Types.Input.InteractiveObject;
+
+ /**
+ * Creates a new Pixel Perfect Handler function.
+ *
+ * Access via `InputPlugin.makePixelPerfect` rather than calling it directly.
+ * @param textureManager A reference to the Texture Manager.
+ * @param alphaTolerance The alpha level that the pixel should be above to be included as a successful interaction.
+ */
+ function CreatePixelPerfectHandler(textureManager: Phaser.Textures.TextureManager, alphaTolerance: integer): Function;
+
namespace Events {
/**
* The Input Plugin Boot Event.
@@ -42173,6 +41247,102 @@ declare namespace Phaser {
}
+ namespace Configs {
+ /**
+ * Tatar SNES USB Controller Gamepad Configuration.
+ * USB Gamepad (STANDARD GAMEPAD Vendor: 0079 Product: 0011)
+ */
+ var SNES_USB: object;
+
+ /**
+ * PlayStation DualShock 4 Gamepad Configuration.
+ * Sony PlayStation DualShock 4 (v2) wireless controller
+ */
+ var DUALSHOCK_4: object;
+
+ /**
+ * XBox 360 Gamepad Configuration.
+ */
+ var XBOX_360: object;
+
+ }
+
+ namespace Events {
+ /**
+ * The Gamepad Button Down Event.
+ *
+ * This event is dispatched by the Gamepad Plugin when a button has been pressed on any active Gamepad.
+ *
+ * Listen to this event from within a Scene using: `this.input.gamepad.on('down', listener)`.
+ *
+ * You can also listen for a DOWN event from a Gamepad instance. See the [GAMEPAD_BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_DOWN} event for details.
+ */
+ const BUTTON_DOWN: any;
+
+ /**
+ * The Gamepad Button Up Event.
+ *
+ * This event is dispatched by the Gamepad Plugin when a button has been released on any active Gamepad.
+ *
+ * Listen to this event from within a Scene using: `this.input.gamepad.on('up', listener)`.
+ *
+ * You can also listen for an UP event from a Gamepad instance. See the [GAMEPAD_BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_UP} event for details.
+ */
+ const BUTTON_UP: any;
+
+ /**
+ * The Gamepad Connected Event.
+ *
+ * This event is dispatched by the Gamepad Plugin when a Gamepad has been connected.
+ *
+ * Listen to this event from within a Scene using: `this.input.gamepad.once('connected', listener)`.
+ *
+ * Note that the browser may require you to press a button on a gamepad before it will allow you to access it,
+ * this is for security reasons. However, it may also trust the page already, in which case you won't get the
+ * 'connected' event and instead should check `GamepadPlugin.total` to see if it thinks there are any gamepads
+ * already connected.
+ */
+ const CONNECTED: any;
+
+ /**
+ * The Gamepad Disconnected Event.
+ *
+ * This event is dispatched by the Gamepad Plugin when a Gamepad has been disconnected.
+ *
+ * Listen to this event from within a Scene using: `this.input.gamepad.once('disconnected', listener)`.
+ */
+ const DISCONNECTED: any;
+
+ /**
+ * The Gamepad Button Down Event.
+ *
+ * This event is dispatched by a Gamepad instance when a button has been pressed on it.
+ *
+ * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin:
+ * `this.input.gamepad.pad1.on('down', listener)`.
+ *
+ * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'.
+ *
+ * You can also listen for a DOWN event from the Gamepad Plugin. See the [BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_DOWN} event for details.
+ */
+ const GAMEPAD_BUTTON_DOWN: any;
+
+ /**
+ * The Gamepad Button Up Event.
+ *
+ * This event is dispatched by a Gamepad instance when a button has been released on it.
+ *
+ * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin:
+ * `this.input.gamepad.pad1.on('up', listener)`.
+ *
+ * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'.
+ *
+ * You can also listen for an UP event from the Gamepad Plugin. See the [BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_UP} event for details.
+ */
+ const GAMEPAD_BUTTON_UP: any;
+
+ }
+
/**
* A single Gamepad.
*
@@ -42541,105 +41711,1087 @@ declare namespace Phaser {
}
- namespace Configs {
+ }
+
+ /**
+ * The Input Manager is responsible for handling the pointer related systems in a single Phaser Game instance.
+ *
+ * Based on the Game Config it will create handlers for mouse and touch support.
+ *
+ * Keyboard and Gamepad are plugins, handled directly by the InputPlugin class.
+ *
+ * It then manages the events, pointer creation and general hit test related operations.
+ *
+ * You rarely need to interact with the Input Manager directly, and as such, all of its properties and methods
+ * should be considered private. Instead, you should use the Input Plugin, which is a Scene level system, responsible
+ * for dealing with all input events for a Scene.
+ */
+ class InputManager {
+ /**
+ *
+ * @param game The Game instance that owns the Input Manager.
+ * @param config The Input Configuration object, as set in the Game Config.
+ */
+ constructor(game: Phaser.Game, config: object);
+
+ /**
+ * The Game instance that owns the Input Manager.
+ * A Game only maintains on instance of the Input Manager at any time.
+ */
+ readonly game: Phaser.Game;
+
+ /**
+ * A reference to the global Game Scale Manager.
+ * Used for all bounds checks and pointer scaling.
+ */
+ scaleManager: Phaser.Scale.ScaleManager;
+
+ /**
+ * The Canvas that is used for all DOM event input listeners.
+ */
+ canvas: HTMLCanvasElement;
+
+ /**
+ * The Game Configuration object, as set during the game boot.
+ */
+ config: Phaser.Core.Config;
+
+ /**
+ * If set, the Input Manager will run its update loop every frame.
+ */
+ enabled: boolean;
+
+ /**
+ * The Event Emitter instance that the Input Manager uses to emit events from.
+ */
+ events: Phaser.Events.EventEmitter;
+
+ /**
+ * Are any mouse or touch pointers currently over the game canvas?
+ * This is updated automatically by the canvas over and out handlers.
+ */
+ readonly isOver: boolean;
+
+ /**
+ * The default CSS cursor to be used when interacting with your game.
+ *
+ * See the `setDefaultCursor` method for more details.
+ */
+ defaultCursor: string;
+
+ /**
+ * A reference to the Keyboard Manager class, if enabled via the `input.keyboard` Game Config property.
+ */
+ keyboard: Phaser.Input.Keyboard.KeyboardManager;
+
+ /**
+ * A reference to the Mouse Manager class, if enabled via the `input.mouse` Game Config property.
+ */
+ mouse: Phaser.Input.Mouse.MouseManager;
+
+ /**
+ * A reference to the Touch Manager class, if enabled via the `input.touch` Game Config property.
+ */
+ touch: Phaser.Input.Touch.TouchManager;
+
+ /**
+ * An array of Pointers that have been added to the game.
+ * The first entry is reserved for the Mouse Pointer, the rest are Touch Pointers.
+ *
+ * By default there is 1 touch pointer enabled. If you need more use the `addPointer` method to start them,
+ * or set the `input.activePointers` property in the Game Config.
+ */
+ pointers: Phaser.Input.Pointer[];
+
+ /**
+ * The number of touch objects activated and being processed each update.
+ *
+ * You can change this by either calling `addPointer` at run-time, or by
+ * setting the `input.activePointers` property in the Game Config.
+ */
+ readonly pointersTotal: integer;
+
+ /**
+ * The mouse has its own unique Pointer object, which you can reference directly if making a _desktop specific game_.
+ * If you are supporting both desktop and touch devices then do not use this property, instead use `activePointer`
+ * which will always map to the most recently interacted pointer.
+ */
+ mousePointer: Phaser.Input.Pointer;
+
+ /**
+ * The most recently active Pointer object.
+ *
+ * If you've only 1 Pointer in your game then this will accurately be either the first finger touched, or the mouse.
+ *
+ * If your game doesn't need to support multi-touch then you can safely use this property in all of your game
+ * code and it will adapt to be either the mouse or the touch, based on device.
+ */
+ activePointer: Phaser.Input.Pointer;
+
+ /**
+ * If the top-most Scene in the Scene List receives an input it will stop input from
+ * propagating any lower down the scene list, i.e. if you have a UI Scene at the top
+ * and click something on it, that click will not then be passed down to any other
+ * Scene below. Disable this to have input events passed through all Scenes, all the time.
+ */
+ globalTopOnly: boolean;
+
+ /**
+ * The time this Input Manager was last updated.
+ * This value is populated by the Game Step each frame.
+ */
+ readonly time: number;
+
+ /**
+ * The Boot handler is called by Phaser.Game when it first starts up.
+ * The renderer is available by now.
+ */
+ protected boot(): void;
+
+ /**
+ * Tells the Input system to set a custom cursor.
+ *
+ * This cursor will be the default cursor used when interacting with the game canvas.
+ *
+ * If an Interactive Object also sets a custom cursor, this is the cursor that is reset after its use.
+ *
+ * Any valid CSS cursor value is allowed, including paths to image files, i.e.:
+ *
+ * ```javascript
+ * this.input.setDefaultCursor('url(assets/cursors/sword.cur), pointer');
+ * ```
+ *
+ * Please read about the differences between browsers when it comes to the file formats and sizes they support:
+ *
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/cursor
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_User_Interface/Using_URL_values_for_the_cursor_property
+ *
+ * It's up to you to pick a suitable cursor format that works across the range of browsers you need to support.
+ * @param cursor The CSS to be used when setting the default cursor.
+ */
+ setDefaultCursor(cursor: string): void;
+
+ /**
+ * Adds new Pointer objects to the Input Manager.
+ *
+ * By default Phaser creates 2 pointer objects: `mousePointer` and `pointer1`.
+ *
+ * You can create more either by calling this method, or by setting the `input.activePointers` property
+ * in the Game Config, up to a maximum of 10 pointers.
+ *
+ * The first 10 pointers are available via the `InputPlugin.pointerX` properties, once they have been added
+ * via this method.
+ * @param quantity The number of new Pointers to create. A maximum of 10 is allowed in total. Default 1.
+ */
+ addPointer(quantity?: integer): Phaser.Input.Pointer[];
+
+ /**
+ * Internal method that gets a list of all the active Input Plugins in the game
+ * and updates each of them in turn, in reverse order (top to bottom), to allow
+ * for DOM top-level event handling simulation.
+ * @param type The type of event to process.
+ * @param pointers An array of Pointers on which the event occurred.
+ */
+ updateInputPlugins(type: integer, pointers: Phaser.Input.Pointer[]): void;
+
+ /**
+ * Performs a hit test using the given Pointer and camera, against an array of interactive Game Objects.
+ *
+ * The Game Objects are culled against the camera, and then the coordinates are translated into the local camera space
+ * and used to determine if they fall within the remaining Game Objects hit areas or not.
+ *
+ * If nothing is matched an empty array is returned.
+ *
+ * This method is called automatically by InputPlugin.hitTestPointer and doesn't usually need to be invoked directly.
+ * @param pointer The Pointer to test against.
+ * @param gameObjects An array of interactive Game Objects to check.
+ * @param camera The Camera which is being tested against.
+ * @param output An array to store the results in. If not given, a new empty array is created.
+ */
+ hitTest(pointer: Phaser.Input.Pointer, gameObjects: any[], camera: Phaser.Cameras.Scene2D.Camera, output?: any[]): any[];
+
+ /**
+ * Checks if the given x and y coordinate are within the hit area of the Game Object.
+ *
+ * This method assumes that the coordinate values have already been translated into the space of the Game Object.
+ *
+ * If the coordinates are within the hit area they are set into the Game Objects Input `localX` and `localY` properties.
+ * @param gameObject The interactive Game Object to check against.
+ * @param x The translated x coordinate for the hit test.
+ * @param y The translated y coordinate for the hit test.
+ */
+ pointWithinHitArea(gameObject: Phaser.GameObjects.GameObject, x: number, y: number): boolean;
+
+ /**
+ * Checks if the given x and y coordinate are within the hit area of the Interactive Object.
+ *
+ * This method assumes that the coordinate values have already been translated into the space of the Interactive Object.
+ *
+ * If the coordinates are within the hit area they are set into the Interactive Objects Input `localX` and `localY` properties.
+ * @param object The Interactive Object to check against.
+ * @param x The translated x coordinate for the hit test.
+ * @param y The translated y coordinate for the hit test.
+ */
+ pointWithinInteractiveObject(object: Phaser.Types.Input.InteractiveObject, x: number, y: number): boolean;
+
+ /**
+ * Transforms the pageX and pageY values of a Pointer into the scaled coordinate space of the Input Manager.
+ * @param pointer The Pointer to transform the values for.
+ * @param pageX The Page X value.
+ * @param pageY The Page Y value.
+ * @param wasMove Are we transforming the Pointer from a move event, or an up / down event?
+ */
+ transformPointer(pointer: Phaser.Input.Pointer, pageX: number, pageY: number, wasMove: boolean): void;
+
+ /**
+ * Destroys the Input Manager and all of its systems.
+ *
+ * There is no way to recover from doing this.
+ */
+ destroy(): void;
+
+ }
+
+ /**
+ * The Input Plugin belongs to a Scene and handles all input related events and operations for it.
+ *
+ * You can access it from within a Scene using `this.input`.
+ *
+ * It emits events directly. For example, you can do:
+ *
+ * ```javascript
+ * this.input.on('pointerdown', callback, context);
+ * ```
+ *
+ * To listen for a pointer down event anywhere on the game canvas.
+ *
+ * Game Objects can be enabled for input by calling their `setInteractive` method. After which they
+ * will directly emit input events:
+ *
+ * ```javascript
+ * var sprite = this.add.sprite(x, y, texture);
+ * sprite.setInteractive();
+ * sprite.on('pointerdown', callback, context);
+ * ```
+ *
+ * There are lots of game configuration options available relating to input.
+ * See the [Input Config object]{@linkcode Phaser.Types.Core.InputConfig} for more details, including how to deal with Phaser
+ * listening for input events outside of the canvas, how to set a default number of pointers, input
+ * capture settings and more.
+ *
+ * Please also see the Input examples and tutorials for further information.
+ */
+ class InputPlugin extends Phaser.Events.EventEmitter {
+ /**
+ *
+ * @param scene A reference to the Scene that this Input Plugin is responsible for.
+ */
+ constructor(scene: Phaser.Scene);
+
+ /**
+ * An instance of the Gamepad Plugin class, if enabled via the `input.gamepad` Scene or Game Config property.
+ * Use this to create access Gamepads connected to the browser and respond to gamepad buttons.
+ */
+ gamepad: Phaser.Input.Gamepad.GamepadPlugin;
+
+ /**
+ * A reference to the Scene that this Input Plugin is responsible for.
+ */
+ scene: Phaser.Scene;
+
+ /**
+ * A reference to the Scene Systems class.
+ */
+ systems: Phaser.Scenes.Systems;
+
+ /**
+ * A reference to the Scene Systems Settings.
+ */
+ settings: Phaser.Types.Scenes.SettingsObject;
+
+ /**
+ * A reference to the Game Input Manager.
+ */
+ manager: Phaser.Input.InputManager;
+
+ /**
+ * If `true` this Input Plugin will process DOM input events.
+ */
+ enabled: boolean;
+
+ /**
+ * A reference to the Scene Display List. This property is set during the `boot` method.
+ */
+ displayList: Phaser.GameObjects.DisplayList;
+
+ /**
+ * A reference to the Scene Cameras Manager. This property is set during the `boot` method.
+ */
+ cameras: Phaser.Cameras.Scene2D.CameraManager;
+
+ /**
+ * A reference to the Mouse Manager.
+ *
+ * This property is only set if Mouse support has been enabled in your Game Configuration file.
+ *
+ * If you just wish to get access to the mouse pointer, use the `mousePointer` property instead.
+ */
+ mouse: Phaser.Input.Mouse.MouseManager;
+
+ /**
+ * When set to `true` (the default) the Input Plugin will emulate DOM behavior by only emitting events from
+ * the top-most Game Objects in the Display List.
+ *
+ * If set to `false` it will emit events from all Game Objects below a Pointer, not just the top one.
+ */
+ topOnly: boolean;
+
+ /**
+ * How often should the Pointers be checked?
+ *
+ * The value is a time, given in ms, and is the time that must have elapsed between game steps before
+ * the Pointers will be polled again. When a pointer is polled it runs a hit test to see which Game
+ * Objects are currently below it, or being interacted with it.
+ *
+ * Pointers will *always* be checked if they have been moved by the user, or press or released.
+ *
+ * This property only controls how often they will be polled if they have not been updated.
+ * You should set this if you want to have Game Objects constantly check against the pointers, even
+ * if the pointer didn't itself move.
+ *
+ * Set to 0 to poll constantly. Set to -1 to only poll on user movement.
+ */
+ pollRate: integer;
+
+ /**
+ * The distance, in pixels, a pointer has to move while being held down, before it thinks it is being dragged.
+ */
+ dragDistanceThreshold: number;
+
+ /**
+ * The amount of time, in ms, a pointer has to be held down before it thinks it is dragging.
+ *
+ * The default polling rate is to poll only on move so once the time threshold is reached the
+ * drag event will not start until you move the mouse. If you want it to start immediately
+ * when the time threshold is reached, you must increase the polling rate by calling
+ * [setPollAlways]{@linkcode Phaser.Input.InputPlugin#setPollAlways} or
+ * [setPollRate]{@linkcode Phaser.Input.InputPlugin#setPollRate}.
+ */
+ dragTimeThreshold: number;
+
+ /**
+ * Checks to see if both this plugin and the Scene to which it belongs is active.
+ */
+ isActive(): boolean;
+
+ /**
+ * This is called automatically by the Input Manager.
+ * It emits events for plugins to listen to and also handles polling updates, if enabled.
+ * @param time The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
+ * @param delta The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.
+ */
+ updatePoll(time: number, delta: number): boolean;
+
+ /**
+ * Clears a Game Object so it no longer has an Interactive Object associated with it.
+ * The Game Object is then queued for removal from the Input Plugin on the next update.
+ * @param gameObject The Game Object that will have its Interactive Object removed.
+ * @param skipQueue Skip adding this Game Object into the removal queue? Default false.
+ */
+ clear(gameObject: Phaser.GameObjects.GameObject, skipQueue?: boolean): Phaser.GameObjects.GameObject;
+
+ /**
+ * Disables Input on a single Game Object.
+ *
+ * An input disabled Game Object still retains its Interactive Object component and can be re-enabled
+ * at any time, by passing it to `InputPlugin.enable`.
+ * @param gameObject The Game Object to have its input system disabled.
+ */
+ disable(gameObject: Phaser.GameObjects.GameObject): void;
+
+ /**
+ * Enable a Game Object for interaction.
+ *
+ * If the Game Object already has an Interactive Object component, it is enabled and returned.
+ *
+ * Otherwise, a new Interactive Object component is created and assigned to the Game Object's `input` property.
+ *
+ * Input works by using hit areas, these are nearly always geometric shapes, such as rectangles or circles, that act as the hit area
+ * for the Game Object. However, you can provide your own hit area shape and callback, should you wish to handle some more advanced
+ * input detection.
+ *
+ * If no arguments are provided it will try and create a rectangle hit area based on the texture frame the Game Object is using. If
+ * this isn't a texture-bound object, such as a Graphics or BitmapText object, this will fail, and you'll need to provide a specific
+ * shape for it to use.
+ *
+ * You can also provide an Input Configuration Object as the only argument to this method.
+ * @param gameObject The Game Object to be enabled for input.
+ * @param shape 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 callback The 'contains' function to invoke to check if the pointer is within the hit area.
+ * @param dropZone Is this Game Object a drop zone or not? Default false.
+ */
+ enable(gameObject: Phaser.GameObjects.GameObject, shape?: Phaser.Types.Input.InputConfiguration | any, callback?: Phaser.Types.Input.HitAreaCallback, dropZone?: boolean): Phaser.Input.InputPlugin;
+
+ /**
+ * Takes the given Pointer and performs a hit test against it, to see which interactive Game Objects
+ * it is currently above.
+ *
+ * The hit test is performed against which-ever Camera the Pointer is over. If it is over multiple
+ * cameras, it starts checking the camera at the top of the camera list, and if nothing is found, iterates down the list.
+ * @param pointer The Pointer to check against the Game Objects.
+ */
+ hitTestPointer(pointer: Phaser.Input.Pointer): Phaser.GameObjects.GameObject[];
+
+ /**
+ * Returns the drag state of the given Pointer for this Input Plugin.
+ *
+ * The state will be one of the following:
+ *
+ * 0 = Not dragging anything
+ * 1 = Primary button down and objects below, so collect a draglist
+ * 2 = Pointer being checked if meets drag criteria
+ * 3 = Pointer meets criteria, notify the draglist
+ * 4 = Pointer actively dragging the draglist and has moved
+ * 5 = Pointer actively dragging but has been released, notify draglist
+ * @param pointer The Pointer to get the drag state for.
+ */
+ getDragState(pointer: Phaser.Input.Pointer): integer;
+
+ /**
+ * Sets the drag state of the given Pointer for this Input Plugin.
+ *
+ * The state must be one of the following values:
+ *
+ * 0 = Not dragging anything
+ * 1 = Primary button down and objects below, so collect a draglist
+ * 2 = Pointer being checked if meets drag criteria
+ * 3 = Pointer meets criteria, notify the draglist
+ * 4 = Pointer actively dragging the draglist and has moved
+ * 5 = Pointer actively dragging but has been released, notify draglist
+ * @param pointer The Pointer to set the drag state for.
+ * @param state The drag state value. An integer between 0 and 5.
+ */
+ setDragState(pointer: Phaser.Input.Pointer, state: integer): void;
+
+ /**
+ * Sets the draggable state of the given array of Game Objects.
+ *
+ * They can either be set to be draggable, or can have their draggable state removed by passing `false`.
+ *
+ * A Game Object will not fire drag events unless it has been specifically enabled for drag.
+ * @param gameObjects An array of Game Objects to change the draggable state on.
+ * @param value Set to `true` if the Game Objects should be made draggable, `false` if they should be unset. Default true.
+ */
+ setDraggable(gameObjects: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[], value?: boolean): Phaser.Input.InputPlugin;
+
+ /**
+ * Creates a function that can be passed to `setInteractive`, `enable` or `setHitArea` that will handle
+ * pixel-perfect input detection on an Image or Sprite based Game Object, or any custom class that extends them.
+ *
+ * The following will create a sprite that is clickable on any pixel that has an alpha value >= 1.
+ *
+ * ```javascript
+ * this.add.sprite(x, y, key).setInteractive(this.input.makePixelPerfect());
+ * ```
+ *
+ * The following will create a sprite that is clickable on any pixel that has an alpha value >= 150.
+ *
+ * ```javascript
+ * this.add.sprite(x, y, key).setInteractive(this.input.makePixelPerfect(150));
+ * ```
+ *
+ * Once you have made an Interactive Object pixel perfect it impacts all input related events for it: down, up,
+ * dragstart, drag, etc.
+ *
+ * As a pointer interacts with the Game Object it will constantly poll the texture, extracting a single pixel from
+ * the given coordinates and checking its color values. This is an expensive process, so should only be enabled on
+ * Game Objects that really need it.
+ *
+ * You cannot make non-texture based Game Objects pixel perfect. So this will not work on Graphics, BitmapText,
+ * Render Textures, Text, Tilemaps, Containers or Particles.
+ * @param alphaTolerance The alpha level that the pixel should be above to be included as a successful interaction. Default 1.
+ */
+ makePixelPerfect(alphaTolerance?: integer): Function;
+
+ /**
+ * Sets the hit area for the given array of Game Objects.
+ *
+ * A hit area is typically one of the geometric shapes Phaser provides, such as a `Phaser.Geom.Rectangle`
+ * or `Phaser.Geom.Circle`. However, it can be any object as long as it works with the provided callback.
+ *
+ * If no hit area is provided a Rectangle is created based on the size of the Game Object, if possible
+ * to calculate.
+ *
+ * The hit area callback is the function that takes an `x` and `y` coordinate and returns a boolean if
+ * those values fall within the area of the shape or not. All of the Phaser geometry objects provide this,
+ * such as `Phaser.Geom.Rectangle.Contains`.
+ * @param gameObjects An array of Game Objects to set the hit area on.
+ * @param shape 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 callback The 'contains' function to invoke to check if the pointer is within the hit area.
+ */
+ setHitArea(gameObjects: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[], shape?: Phaser.Types.Input.InputConfiguration | any, callback?: Phaser.Types.Input.HitAreaCallback): Phaser.Input.InputPlugin;
+
+ /**
+ * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Circle` shape, using
+ * the given coordinates and radius to control its position and size.
+ * @param gameObjects An array of Game Objects to set as having a circle hit area.
+ * @param x The center of the circle.
+ * @param y The center of the circle.
+ * @param radius The radius of the circle.
+ * @param callback The hit area callback. If undefined it uses Circle.Contains.
+ */
+ setHitAreaCircle(gameObjects: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[], x: number, y: number, radius: number, callback?: Phaser.Types.Input.HitAreaCallback): Phaser.Input.InputPlugin;
+
+ /**
+ * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Ellipse` shape, using
+ * the given coordinates and dimensions to control its position and size.
+ * @param gameObjects An array of Game Objects to set as having an ellipse hit area.
+ * @param x The center of the ellipse.
+ * @param y The center of the ellipse.
+ * @param width The width of the ellipse.
+ * @param height The height of the ellipse.
+ * @param callback The hit area callback. If undefined it uses Ellipse.Contains.
+ */
+ setHitAreaEllipse(gameObjects: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[], x: number, y: number, width: number, height: number, callback?: Phaser.Types.Input.HitAreaCallback): Phaser.Input.InputPlugin;
+
+ /**
+ * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Rectangle` shape, using
+ * the Game Objects texture frame to define the position and size of the hit area.
+ * @param gameObjects An array of Game Objects to set as having an ellipse hit area.
+ * @param callback The hit area callback. If undefined it uses Rectangle.Contains.
+ */
+ setHitAreaFromTexture(gameObjects: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[], callback?: Phaser.Types.Input.HitAreaCallback): Phaser.Input.InputPlugin;
+
+ /**
+ * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Rectangle` shape, using
+ * the given coordinates and dimensions to control its position and size.
+ * @param gameObjects An array of Game Objects to set as having a rectangular hit area.
+ * @param x The top-left of the rectangle.
+ * @param y The top-left of the rectangle.
+ * @param width The width of the rectangle.
+ * @param height The height of the rectangle.
+ * @param callback The hit area callback. If undefined it uses Rectangle.Contains.
+ */
+ setHitAreaRectangle(gameObjects: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[], x: number, y: number, width: number, height: number, callback?: Phaser.Types.Input.HitAreaCallback): Phaser.Input.InputPlugin;
+
+ /**
+ * Sets the hit area for an array of Game Objects to be a `Phaser.Geom.Triangle` shape, using
+ * the given coordinates to control the position of its points.
+ * @param gameObjects An array of Game Objects to set as having a triangular hit area.
+ * @param x1 The x coordinate of the first point of the triangle.
+ * @param y1 The y coordinate of the first point of the triangle.
+ * @param x2 The x coordinate of the second point of the triangle.
+ * @param y2 The y coordinate of the second point of the triangle.
+ * @param x3 The x coordinate of the third point of the triangle.
+ * @param y3 The y coordinate of the third point of the triangle.
+ * @param callback The hit area callback. If undefined it uses Triangle.Contains.
+ */
+ setHitAreaTriangle(gameObjects: Phaser.GameObjects.GameObject | Phaser.GameObjects.GameObject[], x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, callback?: Phaser.Types.Input.HitAreaCallback): Phaser.Input.InputPlugin;
+
+ /**
+ * Creates an Input Debug Shape for the given Game Object.
+ *
+ * The Game Object must have _already_ been enabled for input prior to calling this method.
+ *
+ * This is intended to assist you during development and debugging.
+ *
+ * Debug Shapes can only be created for Game Objects that are using standard Phaser Geometry for input,
+ * including: Circle, Ellipse, Line, Polygon, Rectangle and Triangle.
+ *
+ * Game Objects that are using their automatic hit areas are using Rectangles by default, so will also work.
+ *
+ * The Debug Shape is created and added to the display list and is then kept in sync with the Game Object
+ * it is connected with. Should you need to modify it yourself, such as to hide it, you can access it via
+ * the Game Object property: `GameObject.input.hitAreaDebug`.
+ *
+ * Calling this method on a Game Object that already has a Debug Shape will first destroy the old shape,
+ * before creating a new one. If you wish to remove the Debug Shape entirely, you should call the
+ * method `InputPlugin.removeDebug`.
+ *
+ * Note that the debug shape will only show the outline of the input area. If the input test is using a
+ * pixel perfect check, for example, then this is not displayed. If you are using a custom shape, that
+ * doesn't extend one of the base Phaser Geometry objects, as your hit area, then this method will not
+ * work.
+ * @param gameObject The Game Object to create the input debug shape for.
+ * @param color The outline color of the debug shape. Default 0x00ff00.
+ */
+ enableDebug(gameObject: Phaser.GameObjects.GameObject, color?: number): Phaser.Input.InputPlugin;
+
+ /**
+ * Removes an Input Debug Shape from the given Game Object.
+ *
+ * The shape is destroyed immediately and the `hitAreaDebug` property is set to `null`.
+ * @param gameObject The Game Object to remove the input debug shape from.
+ */
+ removeDebug(gameObject: Phaser.GameObjects.GameObject): Phaser.Input.InputPlugin;
+
+ /**
+ * Sets the Pointers to always poll.
+ *
+ * When a pointer is polled it runs a hit test to see which Game Objects are currently below it,
+ * or being interacted with it, regardless if the Pointer has actually moved or not.
+ *
+ * You should enable this if you want objects in your game to fire over / out events, and the objects
+ * are constantly moving, but the pointer may not have. Polling every frame has additional computation
+ * costs, especially if there are a large number of interactive objects in your game.
+ */
+ setPollAlways(): Phaser.Input.InputPlugin;
+
+ /**
+ * Sets the Pointers to only poll when they are moved or updated.
+ *
+ * When a pointer is polled it runs a hit test to see which Game Objects are currently below it,
+ * or being interacted with it.
+ */
+ setPollOnMove(): Phaser.Input.InputPlugin;
+
+ /**
+ * Sets the poll rate value. This is the amount of time that should have elapsed before a pointer
+ * will be polled again. See the `setPollAlways` and `setPollOnMove` methods.
+ * @param value The amount of time, in ms, that should elapsed before re-polling the pointers.
+ */
+ setPollRate(value: number): Phaser.Input.InputPlugin;
+
+ /**
+ * When set to `true` the global Input Manager will emulate DOM behavior by only emitting events from
+ * the top-most Scene in the Scene List. By default, if a Scene receives an input event it will then stop the event
+ * from flowing down to any Scenes below it in the Scene list. To disable this behavior call this method with `false`.
+ * @param value Set to `true` to stop processing input events on the Scene that receives it, or `false` to let the event continue down the Scene list.
+ */
+ setGlobalTopOnly(value: boolean): Phaser.Input.InputPlugin;
+
+ /**
+ * When set to `true` this Input Plugin will emulate DOM behavior by only emitting events from
+ * the top-most Game Objects in the Display List.
+ *
+ * If set to `false` it will emit events from all Game Objects below a Pointer, not just the top one.
+ * @param value `true` to only include the top-most Game Object, or `false` to include all Game Objects in a hit test.
+ */
+ setTopOnly(value: boolean): Phaser.Input.InputPlugin;
+
+ /**
+ * Given an array of Game Objects, sort the array and return it, so that the objects are in depth index order
+ * with the lowest at the bottom.
+ * @param gameObjects An array of Game Objects to be sorted.
+ */
+ sortGameObjects(gameObjects: Phaser.GameObjects.GameObject[]): Phaser.GameObjects.GameObject[];
+
+ /**
+ * This method should be called from within an input event handler, such as `pointerdown`.
+ *
+ * When called, it stops the Input Manager from allowing _this specific event_ to be processed by any other Scene
+ * not yet handled in the scene list.
+ */
+ stopPropagation(): Phaser.Input.InputPlugin;
+
+ /**
+ * Adds new Pointer objects to the Input Manager.
+ *
+ * By default Phaser creates 2 pointer objects: `mousePointer` and `pointer1`.
+ *
+ * You can create more either by calling this method, or by setting the `input.activePointers` property
+ * in the Game Config, up to a maximum of 10 pointers.
+ *
+ * The first 10 pointers are available via the `InputPlugin.pointerX` properties, once they have been added
+ * via this method.
+ * @param quantity The number of new Pointers to create. A maximum of 10 is allowed in total. Default 1.
+ */
+ addPointer(quantity?: integer): Phaser.Input.Pointer[];
+
+ /**
+ * Tells the Input system to set a custom cursor.
+ *
+ * This cursor will be the default cursor used when interacting with the game canvas.
+ *
+ * If an Interactive Object also sets a custom cursor, this is the cursor that is reset after its use.
+ *
+ * Any valid CSS cursor value is allowed, including paths to image files, i.e.:
+ *
+ * ```javascript
+ * this.input.setDefaultCursor('url(assets/cursors/sword.cur), pointer');
+ * ```
+ *
+ * Please read about the differences between browsers when it comes to the file formats and sizes they support:
+ *
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/cursor
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_User_Interface/Using_URL_values_for_the_cursor_property
+ *
+ * It's up to you to pick a suitable cursor format that works across the range of browsers you need to support.
+ * @param cursor The CSS to be used when setting the default cursor.
+ */
+ setDefaultCursor(cursor: string): Phaser.Input.InputPlugin;
+
+ /**
+ * The x coordinates of the ActivePointer based on the first camera in the camera list.
+ * This is only safe to use if your game has just 1 non-transformed camera and doesn't use multi-touch.
+ */
+ readonly x: number;
+
+ /**
+ * The y coordinates of the ActivePointer based on the first camera in the camera list.
+ * This is only safe to use if your game has just 1 non-transformed camera and doesn't use multi-touch.
+ */
+ readonly y: number;
+
+ /**
+ * Are any mouse or touch pointers currently over the game canvas?
+ */
+ readonly isOver: boolean;
+
+ /**
+ * The mouse has its own unique Pointer object, which you can reference directly if making a _desktop specific game_.
+ * If you are supporting both desktop and touch devices then do not use this property, instead use `activePointer`
+ * which will always map to the most recently interacted pointer.
+ */
+ readonly mousePointer: Phaser.Input.Pointer;
+
+ /**
+ * The current active input Pointer.
+ */
+ readonly activePointer: Phaser.Input.Pointer;
+
+ /**
+ * A touch-based Pointer object.
+ * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
+ */
+ readonly pointer1: Phaser.Input.Pointer;
+
+ /**
+ * A touch-based Pointer object.
+ * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
+ */
+ readonly pointer2: Phaser.Input.Pointer;
+
+ /**
+ * A touch-based Pointer object.
+ * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
+ */
+ readonly pointer3: Phaser.Input.Pointer;
+
+ /**
+ * A touch-based Pointer object.
+ * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
+ */
+ readonly pointer4: Phaser.Input.Pointer;
+
+ /**
+ * A touch-based Pointer object.
+ * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
+ */
+ readonly pointer5: Phaser.Input.Pointer;
+
+ /**
+ * A touch-based Pointer object.
+ * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
+ */
+ readonly pointer6: Phaser.Input.Pointer;
+
+ /**
+ * A touch-based Pointer object.
+ * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
+ */
+ readonly pointer7: Phaser.Input.Pointer;
+
+ /**
+ * A touch-based Pointer object.
+ * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
+ */
+ readonly pointer8: Phaser.Input.Pointer;
+
+ /**
+ * A touch-based Pointer object.
+ * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
+ */
+ readonly pointer9: Phaser.Input.Pointer;
+
+ /**
+ * A touch-based Pointer object.
+ * This will be `undefined` by default unless you add a new Pointer using `addPointer`.
+ */
+ readonly pointer10: Phaser.Input.Pointer;
+
+ /**
+ * An instance of the Keyboard Plugin class, if enabled via the `input.keyboard` Scene or Game Config property.
+ * Use this to create Key objects and listen for keyboard specific events.
+ */
+ keyboard: Phaser.Input.Keyboard.KeyboardPlugin;
+
+ }
+
+ namespace InputPluginCache {
+ /**
+ * Static method called directly by the Core internal Plugins.
+ * Key is a reference used to get the plugin from the plugins object (i.e. InputPlugin)
+ * Plugin is the object to instantiate to create the plugin
+ * Mapping is what the plugin is injected into the Scene.Systems as (i.e. input)
+ * @param key A reference used to get this plugin from the plugin cache.
+ * @param plugin The plugin to be stored. Should be the core object, not instantiated.
+ * @param mapping If this plugin is to be injected into the Input Plugin, this is the property key used.
+ * @param settingsKey The key in the Scene Settings to check to see if this plugin should install or not.
+ * @param configKey The key in the Game Config to check to see if this plugin should install or not.
+ */
+ function register(key: string, plugin: Function, mapping: string, settingsKey: string, configKey: string): void;
+
+ /**
+ * Returns the input plugin object from the cache based on the given key.
+ * @param key The key of the input plugin to get.
+ */
+ function getCore(key: string): Phaser.Types.Input.InputPluginContainer;
+
+ /**
+ * Installs all of the registered Input Plugins into the given target.
+ * @param target The target InputPlugin to install the plugins into.
+ */
+ function install(target: Phaser.Input.InputPlugin): void;
+
+ /**
+ * Removes an input plugin based on the given key.
+ * @param key The key of the input plugin to remove.
+ */
+ function remove(key: string): void;
+
+ }
+
+ namespace Keyboard {
+ /**
+ * A KeyCombo will listen for a specific string of keys from the Keyboard, and when it receives them
+ * it will emit a `keycombomatch` event from the Keyboard Manager.
+ *
+ * The keys to be listened for can be defined as:
+ *
+ * A string (i.e. 'ATARI')
+ * An array of either integers (key codes) or strings, or a mixture of both
+ * An array of objects (such as Key objects) with a public 'keyCode' property
+ *
+ * For example, to listen for the Konami code (up, up, down, down, left, right, left, right, b, a, enter)
+ * you could pass the following array of key codes:
+ *
+ * ```javascript
+ * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true });
+ *
+ * this.input.keyboard.on('keycombomatch', function (event) {
+ * console.log('Konami Code entered!');
+ * });
+ * ```
+ *
+ * Or, to listen for the user entering the word PHASER:
+ *
+ * ```javascript
+ * this.input.keyboard.createCombo('PHASER');
+ * ```
+ */
+ class KeyCombo {
/**
- * Tatar SNES USB Controller Gamepad Configuration.
- * USB Gamepad (STANDARD GAMEPAD Vendor: 0079 Product: 0011)
+ *
+ * @param keyboardPlugin A reference to the Keyboard Plugin.
+ * @param keys The keys that comprise this combo.
+ * @param config A Key Combo configuration object.
*/
- var SNES_USB: object;
+ constructor(keyboardPlugin: Phaser.Input.Keyboard.KeyboardPlugin, keys: string | integer[] | object[], config?: Phaser.Types.Input.Keyboard.KeyComboConfig);
/**
- * PlayStation DualShock 4 Gamepad Configuration.
- * Sony PlayStation DualShock 4 (v2) wireless controller
+ * A reference to the Keyboard Manager
*/
- var DUALSHOCK_4: object;
+ manager: Phaser.Input.Keyboard.KeyboardPlugin;
/**
- * XBox 360 Gamepad Configuration.
+ * A flag that controls if this Key Combo is actively processing keys or not.
*/
- var XBOX_360: object;
+ enabled: boolean;
+
+ /**
+ * An array of the keycodes that comprise this combo.
+ */
+ keyCodes: any[];
+
+ /**
+ * The current keyCode the combo is waiting for.
+ */
+ current: integer;
+
+ /**
+ * The current index of the key being waited for in the 'keys' string.
+ */
+ index: integer;
+
+ /**
+ * The length of this combo (in keycodes)
+ */
+ size: number;
+
+ /**
+ * The time the previous key in the combo was matched.
+ */
+ timeLastMatched: number;
+
+ /**
+ * Has this Key Combo been matched yet?
+ */
+ matched: boolean;
+
+ /**
+ * The time the entire combo was matched.
+ */
+ timeMatched: number;
+
+ /**
+ * If they press the wrong key do we reset the combo?
+ */
+ resetOnWrongKey: boolean;
+
+ /**
+ * The max delay in ms between each key press. Above this the combo is reset. 0 means disabled.
+ */
+ maxKeyDelay: integer;
+
+ /**
+ * If previously matched and they press the first key of the combo again, will it reset?
+ */
+ resetOnMatch: boolean;
+
+ /**
+ * If the combo matches, will it delete itself?
+ */
+ deleteOnMatch: boolean;
+
+ /**
+ * How far complete is this combo? A value between 0 and 1.
+ */
+ readonly progress: number;
+
+ /**
+ * Destroys this Key Combo and all of its references.
+ */
+ destroy(): void;
}
namespace Events {
/**
- * The Gamepad Button Down Event.
+ * The Global Key Down Event.
*
- * This event is dispatched by the Gamepad Plugin when a button has been pressed on any active Gamepad.
+ * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down.
*
- * Listen to this event from within a Scene using: `this.input.gamepad.on('down', listener)`.
+ * Listen to this event from within a Scene using: `this.input.keyboard.on('keydown', listener)`.
*
- * You can also listen for a DOWN event from a Gamepad instance. See the [GAMEPAD_BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_DOWN} event for details.
+ * You can also listen for a specific key being pressed. See [Keyboard.Events.KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_DOWN} for details.
+ *
+ * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details.
+ *
+ * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting.
+ * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details.
+ *
+ * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling.
+ * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key.
+ * There are others. So, please check your extensions if you find you have specific keys that don't work.
*/
- const BUTTON_DOWN: any;
+ const ANY_KEY_DOWN: any;
/**
- * The Gamepad Button Up Event.
+ * The Global Key Up Event.
*
- * This event is dispatched by the Gamepad Plugin when a button has been released on any active Gamepad.
+ * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released.
*
- * Listen to this event from within a Scene using: `this.input.gamepad.on('up', listener)`.
+ * Listen to this event from within a Scene using: `this.input.keyboard.on('keyup', listener)`.
*
- * You can also listen for an UP event from a Gamepad instance. See the [GAMEPAD_BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:GAMEPAD_BUTTON_UP} event for details.
+ * You can also listen for a specific key being released. See [Keyboard.Events.KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_UP} for details.
+ *
+ * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details.
*/
- const BUTTON_UP: any;
+ const ANY_KEY_UP: any;
/**
- * The Gamepad Connected Event.
+ * The Key Combo Match Event.
*
- * This event is dispatched by the Gamepad Plugin when a Gamepad has been connected.
+ * This event is dispatched by the Keyboard Plugin when a [Key Combo]{@link Phaser.Input.Keyboard.KeyCombo} is matched.
*
- * Listen to this event from within a Scene using: `this.input.gamepad.once('connected', listener)`.
+ * Listen for this event from the Key Plugin after a combo has been created:
*
- * Note that the browser may require you to press a button on a gamepad before it will allow you to access it,
- * this is for security reasons. However, it may also trust the page already, in which case you won't get the
- * 'connected' event and instead should check `GamepadPlugin.total` to see if it thinks there are any gamepads
- * already connected.
+ * ```javascript
+ * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true });
+ *
+ * this.input.keyboard.on('keycombomatch', function (event) {
+ * console.log('Konami Code entered!');
+ * });
+ * ```
*/
- const CONNECTED: any;
+ const COMBO_MATCH: any;
/**
- * The Gamepad Disconnected Event.
+ * The Key Down Event.
*
- * This event is dispatched by the Gamepad Plugin when a Gamepad has been disconnected.
+ * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is pressed.
*
- * Listen to this event from within a Scene using: `this.input.gamepad.once('disconnected', listener)`.
+ * Listen for this event from the Key object instance directly:
+ *
+ * ```javascript
+ * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE);
+ *
+ * spaceBar.on('down', listener)
+ * ```
+ *
+ * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details.
*/
- const DISCONNECTED: any;
+ const DOWN: any;
/**
- * The Gamepad Button Down Event.
+ * The Key Down Event.
*
- * This event is dispatched by a Gamepad instance when a button has been pressed on it.
+ * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down.
*
- * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin:
- * `this.input.gamepad.pad1.on('down', listener)`.
+ * Unlike the `ANY_KEY_DOWN` event, this one has a special dynamic event name. For example, to listen for the `A` key being pressed
+ * use the following from within a Scene: `this.input.keyboard.on('keydown-A', listener)`. You can replace the `-A` part of the event
+ * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar:
+ * `this.input.keyboard.on('keydown-SPACE', listener)`.
*
- * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'.
+ * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details.
*
- * You can also listen for a DOWN event from the Gamepad Plugin. See the [BUTTON_DOWN]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_DOWN} event for details.
+ * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details.
+ *
+ * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting.
+ * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details.
+ *
+ * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling.
+ * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key.
+ * There are others. So, please check your extensions if you find you have specific keys that don't work.
*/
- const GAMEPAD_BUTTON_DOWN: any;
+ const KEY_DOWN: any;
/**
- * The Gamepad Button Up Event.
+ * The Key Up Event.
*
- * This event is dispatched by a Gamepad instance when a button has been released on it.
+ * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released.
*
- * Listen to this event from a Gamepad instance. Once way to get this is from the `pad1`, `pad2`, etc properties on the Gamepad Plugin:
- * `this.input.gamepad.pad1.on('up', listener)`.
+ * Unlike the `ANY_KEY_UP` event, this one has a special dynamic event name. For example, to listen for the `A` key being released
+ * use the following from within a Scene: `this.input.keyboard.on('keyup-A', listener)`. You can replace the `-A` part of the event
+ * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar:
+ * `this.input.keyboard.on('keyup-SPACE', listener)`.
*
- * Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'.
+ * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details.
*
- * You can also listen for an UP event from the Gamepad Plugin. See the [BUTTON_UP]{@linkcode Phaser.Input.Gamepad.Events#event:BUTTON_UP} event for details.
+ * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details.
*/
- const GAMEPAD_BUTTON_UP: any;
+ const KEY_UP: any;
+
+ /**
+ * The Key Up Event.
+ *
+ * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is released.
+ *
+ * Listen for this event from the Key object instance directly:
+ *
+ * ```javascript
+ * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE);
+ *
+ * spaceBar.on('up', listener)
+ * ```
+ *
+ * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details.
+ */
+ const UP: any;
}
- }
-
- namespace Keyboard {
/**
* The Keyboard Manager is a helper class that belongs to the global Input Manager.
*
@@ -43107,245 +43259,6 @@ declare namespace Phaser {
}
- /**
- * A KeyCombo will listen for a specific string of keys from the Keyboard, and when it receives them
- * it will emit a `keycombomatch` event from the Keyboard Manager.
- *
- * The keys to be listened for can be defined as:
- *
- * A string (i.e. 'ATARI')
- * An array of either integers (key codes) or strings, or a mixture of both
- * An array of objects (such as Key objects) with a public 'keyCode' property
- *
- * For example, to listen for the Konami code (up, up, down, down, left, right, left, right, b, a, enter)
- * you could pass the following array of key codes:
- *
- * ```javascript
- * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true });
- *
- * this.input.keyboard.on('keycombomatch', function (event) {
- * console.log('Konami Code entered!');
- * });
- * ```
- *
- * Or, to listen for the user entering the word PHASER:
- *
- * ```javascript
- * this.input.keyboard.createCombo('PHASER');
- * ```
- */
- class KeyCombo {
- /**
- *
- * @param keyboardPlugin A reference to the Keyboard Plugin.
- * @param keys The keys that comprise this combo.
- * @param config A Key Combo configuration object.
- */
- constructor(keyboardPlugin: Phaser.Input.Keyboard.KeyboardPlugin, keys: string | integer[] | object[], config?: Phaser.Types.Input.Keyboard.KeyComboConfig);
-
- /**
- * A reference to the Keyboard Manager
- */
- manager: Phaser.Input.Keyboard.KeyboardPlugin;
-
- /**
- * A flag that controls if this Key Combo is actively processing keys or not.
- */
- enabled: boolean;
-
- /**
- * An array of the keycodes that comprise this combo.
- */
- keyCodes: any[];
-
- /**
- * The current keyCode the combo is waiting for.
- */
- current: integer;
-
- /**
- * The current index of the key being waited for in the 'keys' string.
- */
- index: integer;
-
- /**
- * The length of this combo (in keycodes)
- */
- size: number;
-
- /**
- * The time the previous key in the combo was matched.
- */
- timeLastMatched: number;
-
- /**
- * Has this Key Combo been matched yet?
- */
- matched: boolean;
-
- /**
- * The time the entire combo was matched.
- */
- timeMatched: number;
-
- /**
- * If they press the wrong key do we reset the combo?
- */
- resetOnWrongKey: boolean;
-
- /**
- * The max delay in ms between each key press. Above this the combo is reset. 0 means disabled.
- */
- maxKeyDelay: integer;
-
- /**
- * If previously matched and they press the first key of the combo again, will it reset?
- */
- resetOnMatch: boolean;
-
- /**
- * If the combo matches, will it delete itself?
- */
- deleteOnMatch: boolean;
-
- /**
- * How far complete is this combo? A value between 0 and 1.
- */
- readonly progress: number;
-
- /**
- * Destroys this Key Combo and all of its references.
- */
- destroy(): void;
-
- }
-
- namespace Events {
- /**
- * The Global Key Down Event.
- *
- * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down.
- *
- * Listen to this event from within a Scene using: `this.input.keyboard.on('keydown', listener)`.
- *
- * You can also listen for a specific key being pressed. See [Keyboard.Events.KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_DOWN} for details.
- *
- * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details.
- *
- * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting.
- * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details.
- *
- * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling.
- * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key.
- * There are others. So, please check your extensions if you find you have specific keys that don't work.
- */
- const ANY_KEY_DOWN: any;
-
- /**
- * The Global Key Up Event.
- *
- * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released.
- *
- * Listen to this event from within a Scene using: `this.input.keyboard.on('keyup', listener)`.
- *
- * You can also listen for a specific key being released. See [Keyboard.Events.KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:KEY_UP} for details.
- *
- * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details.
- */
- const ANY_KEY_UP: any;
-
- /**
- * The Key Combo Match Event.
- *
- * This event is dispatched by the Keyboard Plugin when a [Key Combo]{@link Phaser.Input.Keyboard.KeyCombo} is matched.
- *
- * Listen for this event from the Key Plugin after a combo has been created:
- *
- * ```javascript
- * this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true });
- *
- * this.input.keyboard.on('keycombomatch', function (event) {
- * console.log('Konami Code entered!');
- * });
- * ```
- */
- const COMBO_MATCH: any;
-
- /**
- * The Key Down Event.
- *
- * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is pressed.
- *
- * Listen for this event from the Key object instance directly:
- *
- * ```javascript
- * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE);
- *
- * spaceBar.on('down', listener)
- * ```
- *
- * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details.
- */
- const DOWN: any;
-
- /**
- * The Key Down Event.
- *
- * This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down.
- *
- * Unlike the `ANY_KEY_DOWN` event, this one has a special dynamic event name. For example, to listen for the `A` key being pressed
- * use the following from within a Scene: `this.input.keyboard.on('keydown-A', listener)`. You can replace the `-A` part of the event
- * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar:
- * `this.input.keyboard.on('keydown-SPACE', listener)`.
- *
- * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_DOWN} for details.
- *
- * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.DOWN]{@linkcode Phaser.Input.Keyboard.Events#event:DOWN} for details.
- *
- * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting.
- * Read [this article on ghosting]{@link http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/} for details.
- *
- * Also, please be aware that some browser extensions can disable or override Phaser keyboard handling.
- * For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key.
- * There are others. So, please check your extensions if you find you have specific keys that don't work.
- */
- const KEY_DOWN: any;
-
- /**
- * The Key Up Event.
- *
- * This event is dispatched by the Keyboard Plugin when any key on the keyboard is released.
- *
- * Unlike the `ANY_KEY_UP` event, this one has a special dynamic event name. For example, to listen for the `A` key being released
- * use the following from within a Scene: `this.input.keyboard.on('keyup-A', listener)`. You can replace the `-A` part of the event
- * name with any valid [Key Code string]{@link Phaser.Input.Keyboard.KeyCodes}. For example, this will listen for the space bar:
- * `this.input.keyboard.on('keyup-SPACE', listener)`.
- *
- * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details.
- *
- * Finally, you can create Key objects, which you can also listen for events from. See [Keyboard.Events.UP]{@linkcode Phaser.Input.Keyboard.Events#event:UP} for details.
- */
- const KEY_UP: any;
-
- /**
- * The Key Up Event.
- *
- * This event is dispatched by a [Key]{@link Phaser.Input.Keyboard.Key} object when it is released.
- *
- * Listen for this event from the Key object instance directly:
- *
- * ```javascript
- * var spaceBar = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE);
- *
- * spaceBar.on('up', listener)
- * ```
- *
- * You can also create a generic 'global' listener. See [Keyboard.Events.ANY_KEY_UP]{@linkcode Phaser.Input.Keyboard.Events#event:ANY_KEY_UP} for details.
- */
- const UP: any;
-
- }
-
/**
* Returns `true` if the Key was pressed down within the `duration` value given, based on the current
* game clock time. Or `false` if it either isn't down, or was pressed down longer ago than the given duration.
@@ -44180,6 +44093,468 @@ declare namespace Phaser {
}
+ /**
+ * A Pointer object encapsulates both mouse and touch input within Phaser.
+ *
+ * By default, Phaser will create 2 pointers for your game to use. If you require more, i.e. for a multi-touch
+ * game, then use the `InputPlugin.addPointer` method to do so, rather than instantiating this class directly,
+ * otherwise it won't be managed by the input system.
+ *
+ * You can reference the current active pointer via `InputPlugin.activePointer`. You can also use the properties
+ * `InputPlugin.pointer1` through to `pointer10`, for each pointer you have enabled in your game.
+ *
+ * The properties of this object are set by the Input Plugin during processing. This object is then sent in all
+ * input related events that the Input Plugin emits, so you can reference properties from it directly in your
+ * callbacks.
+ */
+ class Pointer {
+ /**
+ *
+ * @param manager A reference to the Input Manager.
+ * @param id The internal ID of this Pointer.
+ */
+ constructor(manager: Phaser.Input.InputManager, id: integer);
+
+ /**
+ * A reference to the Input Manager.
+ */
+ manager: Phaser.Input.InputManager;
+
+ /**
+ * The internal ID of this Pointer.
+ */
+ readonly id: integer;
+
+ /**
+ * The most recent native DOM Event this Pointer has processed.
+ */
+ event: TouchEvent | MouseEvent;
+
+ /**
+ * The DOM element the Pointer was pressed down on, taken from the DOM event.
+ * In a default set-up this will be the Canvas that Phaser is rendering to, or the Window element.
+ */
+ readonly downElement: any;
+
+ /**
+ * The DOM element the Pointer was released on, taken from the DOM event.
+ * In a default set-up this will be the Canvas that Phaser is rendering to, or the Window element.
+ */
+ readonly upElement: any;
+
+ /**
+ * The camera the Pointer interacted with during its last update.
+ *
+ * A Pointer can only ever interact with one camera at once, which will be the top-most camera
+ * in the list should multiple cameras be positioned on-top of each other.
+ */
+ camera: Phaser.Cameras.Scene2D.Camera;
+
+ /**
+ * A read-only property that indicates which button was pressed, or released, on the pointer
+ * during the most recent event. It is only set during `up` and `down` events.
+ *
+ * On Touch devices the value is always 0.
+ *
+ * Users may change the configuration of buttons on their pointing device so that if an event's button property
+ * is zero, it may not have been caused by the button that is physically left–most on the pointing device;
+ * however, it should behave as if the left button was clicked in the standard button layout.
+ */
+ readonly button: integer;
+
+ /**
+ * 0: No button or un-initialized
+ * 1: Left button
+ * 2: Right button
+ * 4: Wheel button or middle button
+ * 8: 4th button (typically the "Browser Back" button)
+ * 16: 5th button (typically the "Browser Forward" button)
+ *
+ * For a mouse configured for left-handed use, the button actions are reversed.
+ * In this case, the values are read from right to left.
+ */
+ buttons: integer;
+
+ /**
+ * The position of the Pointer in screen space.
+ */
+ readonly position: Phaser.Math.Vector2;
+
+ /**
+ * The previous position of the Pointer in screen space.
+ *
+ * The old x and y values are stored in here during the InputManager.transformPointer call.
+ *
+ * Use the properties `velocity`, `angle` and `distance` to create your own gesture recognition.
+ */
+ readonly prevPosition: Phaser.Math.Vector2;
+
+ /**
+ * The current velocity of the Pointer, based on its current and previous positions.
+ *
+ * This value is smoothed out each frame, according to the `motionFactor` property.
+ *
+ * This property is updated whenever the Pointer moves, regardless of any button states. In other words,
+ * it changes based on movement alone - a button doesn't have to be pressed first.
+ */
+ readonly velocity: Phaser.Math.Vector2;
+
+ /**
+ * The current angle the Pointer is moving, in radians, based on its previous and current position.
+ *
+ * The angle is based on the old position facing to the current position.
+ *
+ * This property is updated whenever the Pointer moves, regardless of any button states. In other words,
+ * it changes based on movement alone - a button doesn't have to be pressed first.
+ */
+ readonly angle: number;
+
+ /**
+ * The distance the Pointer has moved, based on its previous and current position.
+ *
+ * This value is smoothed out each frame, according to the `motionFactor` property.
+ *
+ * This property is updated whenever the Pointer moves, regardless of any button states. In other words,
+ * it changes based on movement alone - a button doesn't have to be pressed first.
+ *
+ * If you need the total distance travelled since the primary buttons was pressed down,
+ * then use the `Pointer.getDistance` method.
+ */
+ readonly distance: number;
+
+ /**
+ * The smoothing factor to apply to the Pointer position.
+ *
+ * Due to their nature, pointer positions are inherently noisy. While this is fine for lots of games, if you need cleaner positions
+ * then you can set this value to apply an automatic smoothing to the positions as they are recorded.
+ *
+ * The default value of zero means 'no smoothing'.
+ * Set to a small value, such as 0.2, to apply an average level of smoothing between positions. You can do this by changing this
+ * value directly, or by setting the `input.smoothFactor` property in the Game Config.
+ *
+ * Positions are only smoothed when the pointer moves. If the primary button on this Pointer enters an Up or Down state, then the position
+ * is always precise, and not smoothed.
+ */
+ smoothFactor: number;
+
+ /**
+ * The factor applied to the motion smoothing each frame.
+ *
+ * This value is passed to the Smooth Step Interpolation that is used to calculate the velocity,
+ * angle and distance of the Pointer. It's applied every frame, until the midPoint reaches the current
+ * position of the Pointer. 0.2 provides a good average but can be increased if you need a
+ * quicker update and are working in a high performance environment. Never set this value to
+ * zero.
+ */
+ motionFactor: number;
+
+ /**
+ * The x position of this Pointer, translated into the coordinate space of the most recent Camera it interacted with.
+ *
+ * If you wish to use this value _outside_ of an input event handler then you should update it first by calling
+ * the `Pointer.updateWorldPoint` method.
+ */
+ worldX: number;
+
+ /**
+ * The y position of this Pointer, translated into the coordinate space of the most recent Camera it interacted with.
+ *
+ * If you wish to use this value _outside_ of an input event handler then you should update it first by calling
+ * the `Pointer.updateWorldPoint` method.
+ */
+ worldY: number;
+
+ /**
+ * Time when this Pointer was most recently moved (regardless of the state of its buttons, if any)
+ */
+ moveTime: number;
+
+ /**
+ * X coordinate of the Pointer when Button 1 (left button), or Touch, was pressed, used for dragging objects.
+ */
+ downX: number;
+
+ /**
+ * Y coordinate of the Pointer when Button 1 (left button), or Touch, was pressed, used for dragging objects.
+ */
+ downY: number;
+
+ /**
+ * Time when Button 1 (left button), or Touch, was pressed, used for dragging objects.
+ */
+ downTime: number;
+
+ /**
+ * X coordinate of the Pointer when Button 1 (left button), or Touch, was released, used for dragging objects.
+ */
+ upX: number;
+
+ /**
+ * Y coordinate of the Pointer when Button 1 (left button), or Touch, was released, used for dragging objects.
+ */
+ upY: number;
+
+ /**
+ * Time when Button 1 (left button), or Touch, was released, used for dragging objects.
+ */
+ upTime: number;
+
+ /**
+ * Is the primary button down? (usually button 0, the left mouse button)
+ */
+ primaryDown: boolean;
+
+ /**
+ * Is _any_ button on this pointer considered as being down?
+ */
+ isDown: boolean;
+
+ /**
+ * Did the previous input event come from a Touch input (true) or Mouse? (false)
+ */
+ wasTouch: boolean;
+
+ /**
+ * Did this Pointer get canceled by a touchcancel event?
+ *
+ * Note: "canceled" is the American-English spelling of "cancelled". Please don't submit PRs correcting it!
+ */
+ wasCanceled: boolean;
+
+ /**
+ * If the mouse is locked, the horizontal relative movement of the Pointer in pixels since last frame.
+ */
+ movementX: number;
+
+ /**
+ * If the mouse is locked, the vertical relative movement of the Pointer in pixels since last frame.
+ */
+ movementY: number;
+
+ /**
+ * The identifier property of the Pointer as set by the DOM event when this Pointer is started.
+ */
+ identifier: number;
+
+ /**
+ * The pointerId property of the Pointer as set by the DOM event when this Pointer is started.
+ * The browser can and will recycle this value.
+ */
+ pointerId: number;
+
+ /**
+ * An active Pointer is one that is currently pressed down on the display.
+ * A Mouse is always considered as active.
+ */
+ active: boolean;
+
+ /**
+ * Is this pointer Pointer Locked?
+ *
+ * Only a mouse pointer can be locked and it only becomes locked when requested via
+ * the browsers Pointer Lock API.
+ *
+ * You can request this by calling the `this.input.mouse.requestPointerLock()` method from
+ * a `pointerdown` or `pointerup` event handler.
+ */
+ readonly locked: boolean;
+
+ /**
+ * The horizontal scroll amount that occurred due to the user moving a mouse wheel or similar input device.
+ */
+ deltaX: number;
+
+ /**
+ * The vertical scroll amount that occurred due to the user moving a mouse wheel or similar input device.
+ * This value will typically be less than 0 if the user scrolls up and greater than zero if scrolling down.
+ */
+ deltaY: number;
+
+ /**
+ * The z-axis scroll amount that occurred due to the user moving a mouse wheel or similar input device.
+ */
+ deltaZ: number;
+
+ /**
+ * Takes a Camera and updates this Pointer's `worldX` and `worldY` values so they are
+ * the result of a translation through the given Camera.
+ *
+ * Note that the values will be automatically replaced the moment the Pointer is
+ * updated by an input event, such as a mouse move, so should be used immediately.
+ * @param camera The Camera which is being tested against.
+ */
+ updateWorldPoint(camera: Phaser.Cameras.Scene2D.Camera): this;
+
+ /**
+ * Takes a Camera and returns a Vector2 containing the translated position of this Pointer
+ * within that Camera. This can be used to convert this Pointers position into camera space.
+ * @param camera The Camera to use for the translation.
+ * @param output A Vector2-like object in which to store the translated position.
+ */
+ positionToCamera(camera: Phaser.Cameras.Scene2D.Camera, output?: Phaser.Math.Vector2 | object): Phaser.Math.Vector2 | object;
+
+ /**
+ * Checks to see if any buttons are being held down on this Pointer.
+ */
+ noButtonDown(): boolean;
+
+ /**
+ * Checks to see if the left button is being held down on this Pointer.
+ */
+ leftButtonDown(): boolean;
+
+ /**
+ * Checks to see if the right button is being held down on this Pointer.
+ */
+ rightButtonDown(): boolean;
+
+ /**
+ * Checks to see if the middle button is being held down on this Pointer.
+ */
+ middleButtonDown(): boolean;
+
+ /**
+ * Checks to see if the back button is being held down on this Pointer.
+ */
+ backButtonDown(): boolean;
+
+ /**
+ * Checks to see if the forward button is being held down on this Pointer.
+ */
+ forwardButtonDown(): boolean;
+
+ /**
+ * Checks to see if the left button was just released on this Pointer.
+ */
+ leftButtonReleased(): boolean;
+
+ /**
+ * Checks to see if the right button was just released on this Pointer.
+ */
+ rightButtonReleased(): boolean;
+
+ /**
+ * Checks to see if the middle button was just released on this Pointer.
+ */
+ middleButtonReleased(): boolean;
+
+ /**
+ * Checks to see if the back button was just released on this Pointer.
+ */
+ backButtonReleased(): boolean;
+
+ /**
+ * Checks to see if the forward button was just released on this Pointer.
+ */
+ forwardButtonReleased(): boolean;
+
+ /**
+ * If the Pointer has a button pressed down at the time this method is called, it will return the
+ * distance between the Pointer's `downX` and `downY` values and the current position.
+ *
+ * If no button is held down, it will return the last recorded distance, based on where
+ * the Pointer was when the button was released.
+ *
+ * If you wish to get the distance being travelled currently, based on the velocity of the Pointer,
+ * then see the `Pointer.distance` property.
+ */
+ getDistance(): number;
+
+ /**
+ * If the Pointer has a button pressed down at the time this method is called, it will return the
+ * horizontal distance between the Pointer's `downX` and `downY` values and the current position.
+ *
+ * If no button is held down, it will return the last recorded horizontal distance, based on where
+ * the Pointer was when the button was released.
+ */
+ getDistanceX(): number;
+
+ /**
+ * If the Pointer has a button pressed down at the time this method is called, it will return the
+ * vertical distance between the Pointer's `downX` and `downY` values and the current position.
+ *
+ * If no button is held down, it will return the last recorded vertical distance, based on where
+ * the Pointer was when the button was released.
+ */
+ getDistanceY(): number;
+
+ /**
+ * If the Pointer has a button pressed down at the time this method is called, it will return the
+ * duration since the button was pressed down.
+ *
+ * If no button is held down, it will return the last recorded duration, based on the time
+ * the Pointer button was released.
+ */
+ getDuration(): number;
+
+ /**
+ * If the Pointer has a button pressed down at the time this method is called, it will return the
+ * angle between the Pointer's `downX` and `downY` values and the current position.
+ *
+ * If no button is held down, it will return the last recorded angle, based on where
+ * the Pointer was when the button was released.
+ *
+ * The angle is based on the old position facing to the current position.
+ *
+ * If you wish to get the current angle, based on the velocity of the Pointer, then
+ * see the `Pointer.angle` property.
+ */
+ getAngle(): number;
+
+ /**
+ * Takes the previous and current Pointer positions and then generates an array of interpolated values between
+ * the two. The array will be populated up to the size of the `steps` argument.
+ *
+ * ```javaScript
+ * var points = pointer.getInterpolatedPosition(4);
+ *
+ * // points[0] = { x: 0, y: 0 }
+ * // points[1] = { x: 2, y: 1 }
+ * // points[2] = { x: 3, y: 2 }
+ * // points[3] = { x: 6, y: 3 }
+ * ```
+ *
+ * Use this if you need to get smoothed values between the previous and current pointer positions. DOM pointer
+ * events can often fire faster than the main browser loop, and this will help you avoid janky movement
+ * especially if you have an object following a Pointer.
+ *
+ * Note that if you provide an output array it will only be populated up to the number of steps provided.
+ * It will not clear any previous data that may have existed beyond the range of the steps count.
+ *
+ * Internally it uses the Smooth Step interpolation calculation.
+ * @param steps The number of interpolation steps to use. Default 10.
+ * @param out An array to store the results in. If not provided a new one will be created.
+ */
+ getInterpolatedPosition(steps?: integer, out?: any[]): any[];
+
+ /**
+ * Destroys this Pointer instance and resets its external references.
+ */
+ destroy(): void;
+
+ /**
+ * The x position of this Pointer.
+ * The value is in screen space.
+ * See `worldX` to get a camera converted position.
+ */
+ x: number;
+
+ /**
+ * The y position of this Pointer.
+ * The value is in screen space.
+ * See `worldY` to get a camera converted position.
+ */
+ y: number;
+
+ /**
+ * Time when this Pointer was most recently updated by a DOM Event.
+ * This comes directly from the `event.timeStamp` property.
+ * If no event has yet taken place, it will return zero.
+ */
+ readonly time: number;
+
+ }
+
namespace Touch {
/**
* The Touch Manager is a helper class that belongs to the Input Manager.
@@ -44307,6 +44682,214 @@ declare namespace Phaser {
}
namespace Loader {
+ /**
+ * The Loader is idle.
+ */
+ var LOADER_IDLE: integer;
+
+ /**
+ * The Loader is actively loading.
+ */
+ var LOADER_LOADING: integer;
+
+ /**
+ * The Loader is processing files is has loaded.
+ */
+ var LOADER_PROCESSING: integer;
+
+ /**
+ * The Loader has completed loading and processing.
+ */
+ var LOADER_COMPLETE: integer;
+
+ /**
+ * The Loader is shutting down.
+ */
+ var LOADER_SHUTDOWN: integer;
+
+ /**
+ * The Loader has been destroyed.
+ */
+ var LOADER_DESTROYED: integer;
+
+ /**
+ * File is in the load queue but not yet started
+ */
+ var FILE_PENDING: integer;
+
+ /**
+ * File has been started to load by the loader (onLoad called)
+ */
+ var FILE_LOADING: integer;
+
+ /**
+ * File has loaded successfully, awaiting processing
+ */
+ var FILE_LOADED: integer;
+
+ /**
+ * File failed to load
+ */
+ var FILE_FAILED: integer;
+
+ /**
+ * File is being processed (onProcess callback)
+ */
+ var FILE_PROCESSING: integer;
+
+ /**
+ * The File has errored somehow during processing.
+ */
+ var FILE_ERRORED: integer;
+
+ /**
+ * File has finished processing.
+ */
+ var FILE_COMPLETE: integer;
+
+ /**
+ * File has been destroyed
+ */
+ var FILE_DESTROYED: integer;
+
+ /**
+ * File was populated from local data and doesn't need an HTTP request
+ */
+ var FILE_POPULATED: integer;
+
+ namespace Events {
+ /**
+ * The Loader Plugin Add File Event.
+ *
+ * This event is dispatched when a new file is successfully added to the Loader and placed into the load queue.
+ *
+ * Listen to it from a Scene using: `this.load.on('addfile', listener)`.
+ *
+ * If you add lots of files to a Loader from a `preload` method, it will dispatch this event for each one of them.
+ */
+ const ADD: any;
+
+ /**
+ * The Loader Plugin Complete Event.
+ *
+ * This event is dispatched when the Loader has fully processed everything in the load queue.
+ * By this point every loaded file will now be in its associated cache and ready for use.
+ *
+ * Listen to it from a Scene using: `this.load.on('complete', listener)`.
+ */
+ const COMPLETE: any;
+
+ /**
+ * The File Load Complete Event.
+ *
+ * This event is dispatched by the Loader Plugin when any file in the queue finishes loading.
+ *
+ * Listen to it from a Scene using: `this.load.on('filecomplete', listener)`.
+ *
+ * You can also listen for the completion of a specific file. See the [FILE_KEY_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_KEY_COMPLETE} event.
+ */
+ const FILE_COMPLETE: any;
+
+ /**
+ * The File Load Complete Event.
+ *
+ * This event is dispatched by the Loader Plugin when any file in the queue finishes loading.
+ *
+ * It uses a special dynamic event name constructed from the key and type of the file.
+ *
+ * For example, if you have loaded an `image` with a key of `monster`, you can listen for it
+ * using the following:
+ *
+ * ```javascript
+ * this.load.on('filecomplete-image-monster', function (key, type, data) {
+ * // Your handler code
+ * });
+ * ```
+ *
+ * Or, if you have loaded a texture `atlas` with a key of `Level1`:
+ *
+ * ```javascript
+ * this.load.on('filecomplete-atlas-Level1', function (key, type, data) {
+ * // Your handler code
+ * });
+ * ```
+ *
+ * Or, if you have loaded a sprite sheet with a key of `Explosion` and a prefix of `GAMEOVER`:
+ *
+ * ```javascript
+ * this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) {
+ * // Your handler code
+ * });
+ * ```
+ *
+ * You can also listen for the generic completion of files. See the [FILE_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_COMPLETE} event.
+ */
+ const FILE_KEY_COMPLETE: any;
+
+ /**
+ * The File Load Error Event.
+ *
+ * This event is dispatched by the Loader Plugin when a file fails to load.
+ *
+ * Listen to it from a Scene using: `this.load.on('loaderror', listener)`.
+ */
+ const FILE_LOAD_ERROR: any;
+
+ /**
+ * The File Load Event.
+ *
+ * This event is dispatched by the Loader Plugin when a file finishes loading,
+ * but _before_ it is processed and added to the internal Phaser caches.
+ *
+ * Listen to it from a Scene using: `this.load.on('load', listener)`.
+ */
+ const FILE_LOAD: any;
+
+ /**
+ * The File Load Progress Event.
+ *
+ * This event is dispatched by the Loader Plugin during the load of a file, if the browser receives a DOM ProgressEvent and
+ * the `lengthComputable` event property is true. Depending on the size of the file and browser in use, this may, or may not happen.
+ *
+ * Listen to it from a Scene using: `this.load.on('fileprogress', listener)`.
+ */
+ const FILE_PROGRESS: any;
+
+ /**
+ * The Loader Plugin Post Process Event.
+ *
+ * This event is dispatched by the Loader Plugin when the Loader has finished loading everything in the load queue.
+ * It is dispatched before the internal lists are cleared and each File is destroyed.
+ *
+ * Use this hook to perform any last minute processing of files that can only happen once the
+ * Loader has completed, but prior to it emitting the `complete` event.
+ *
+ * Listen to it from a Scene using: `this.load.on('postprocess', listener)`.
+ */
+ const POST_PROCESS: any;
+
+ /**
+ * The Loader Plugin Progress Event.
+ *
+ * This event is dispatched when the Loader updates its load progress, typically as a result of a file having completed loading.
+ *
+ * Listen to it from a Scene using: `this.load.on('progress', listener)`.
+ */
+ const PROGRESS: any;
+
+ /**
+ * The Loader Plugin Start Event.
+ *
+ * This event is dispatched when the Loader starts running. At this point load progress is zero.
+ *
+ * This event is dispatched even if there aren't any files in the load queue.
+ *
+ * Listen to it from a Scene using: `this.load.on('start', listener)`.
+ */
+ const START: any;
+
+ }
+
/**
* The base File class used by all File Types that the Loader can support.
* You shouldn't create an instance of a File directly, but should extend it with your own class, setting a custom type and processing methods.
@@ -44511,6 +45094,871 @@ declare namespace Phaser {
}
+ namespace FileTypes {
+ /**
+ * A single Animation JSON File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#animation method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#animation.
+ */
+ class AnimationJSONFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json".
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ * @param dataKey When the JSON file loads only this property will be stored in the Cache.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.JSONFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject, dataKey?: string);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ /**
+ * Called at the end of the load process, after the Loader has finished all files in its queue.
+ */
+ onLoadComplete(): void;
+
+ }
+
+ /**
+ * A single JSON based Texture Atlas File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#atlas method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#atlas.
+ *
+ * https://www.codeandweb.com/texturepacker/tutorials/how-to-create-sprite-sheets-for-phaser3?source=photonstorm
+ */
+ class AtlasJSONFile extends Phaser.Loader.MultiFile {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param textureURL The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
+ * @param atlasURL The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json".
+ * @param textureXhrSettings An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings.
+ * @param atlasXhrSettings An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.AtlasJSONFileConfig, textureURL?: string | string[], atlasURL?: string, textureXhrSettings?: Phaser.Types.Loader.XHRSettingsObject, atlasXhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ }
+
+ /**
+ * A single XML based Texture Atlas File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#atlasXML method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#atlasXML.
+ */
+ class AtlasXMLFile extends Phaser.Loader.MultiFile {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param textureURL The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
+ * @param atlasURL The absolute or relative URL to load the texture atlas xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml".
+ * @param textureXhrSettings An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings.
+ * @param atlasXhrSettings An XHR Settings configuration object for the atlas xml file. Used in replacement of the Loaders default XHR Settings.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.AtlasXMLFileConfig, textureURL?: string | string[], atlasURL?: string, textureXhrSettings?: Phaser.Types.Loader.XHRSettingsObject, atlasXhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ }
+
+ /**
+ * A single Audio File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#audio method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#audio.
+ */
+ class AudioFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param urlConfig The absolute or relative URL to load this file from in a config object.
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ * @param audioContext The AudioContext this file will use to process itself.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.AudioFileConfig, urlConfig?: any, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject, audioContext?: AudioContext);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ }
+
+ /**
+ * An Audio Sprite File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#audioSprite method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#audioSprite.
+ */
+ class AudioSpriteFile extends Phaser.Loader.MultiFile {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param jsonURL The absolute or relative URL to load the json file from. Or a well formed JSON object to use instead.
+ * @param audioURL The absolute or relative URL to load the audio file from. If empty it will be obtained by parsing the JSON file.
+ * @param audioConfig The audio configuration options.
+ * @param audioXhrSettings An XHR Settings configuration object for the audio file. Used in replacement of the Loaders default XHR Settings.
+ * @param jsonXhrSettings An XHR Settings configuration object for the json file. Used in replacement of the Loaders default XHR Settings.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.AudioSpriteFileConfig, jsonURL: string, audioURL?: Object, audioConfig?: any, audioXhrSettings?: Phaser.Types.Loader.XHRSettingsObject, jsonXhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called by each File when it finishes loading.
+ * @param file The File that has completed processing.
+ */
+ onFileComplete(file: Phaser.Loader.File): void;
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ }
+
+ /**
+ * A single Binary File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#binary method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#binary.
+ */
+ class BinaryFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.bin`, i.e. if `key` was "alien" then the URL will be "alien.bin".
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ * @param dataType Optional type to cast the binary file to once loaded. For example, `Uint8Array`.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.BinaryFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject, dataType?: any);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ }
+
+ /**
+ * A single Bitmap Font based File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#bitmapFont method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#bitmapFont.
+ */
+ class BitmapFontFile extends Phaser.Loader.MultiFile {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param textureURL The absolute or relative URL to load the font image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
+ * @param fontDataURL The absolute or relative URL to load the font xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml".
+ * @param textureXhrSettings An XHR Settings configuration object for the font image file. Used in replacement of the Loaders default XHR Settings.
+ * @param fontDataXhrSettings An XHR Settings configuration object for the font data xml file. Used in replacement of the Loaders default XHR Settings.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.BitmapFontFileConfig, textureURL?: string | string[], fontDataURL?: string, textureXhrSettings?: Phaser.Types.Loader.XHRSettingsObject, fontDataXhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ }
+
+ /**
+ * A single CSS File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#css method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#css.
+ */
+ class CSSFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js".
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.CSSFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ }
+
+ /**
+ * A single GLSL File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#glsl method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#glsl.
+ */
+ class GLSLFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt".
+ * @param shaderType The type of shader. Either `fragment` for a fragment shader, or `vertex` for a vertex shader. This is ignored if you load a shader bundle. Default 'fragment'.
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.GLSLFileConfig, url?: string, shaderType?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ /**
+ * Returns the name of the shader from the header block.
+ * @param headerSource The header data.
+ */
+ getShaderName(headerSource: string[]): string;
+
+ /**
+ * Returns the type of the shader from the header block.
+ * @param headerSource The header data.
+ */
+ getShaderType(headerSource: string[]): string;
+
+ /**
+ * Returns the shader uniforms from the header block.
+ * @param headerSource The header data.
+ */
+ getShaderUniforms(headerSource: string[]): any;
+
+ }
+
+ /**
+ * A single Audio File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#audio method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#audio.
+ */
+ class HTML5AudioFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param urlConfig The absolute or relative URL to load this file from.
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.AudioFileConfig, urlConfig?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called when the file finishes loading.
+ */
+ onLoad(): void;
+
+ /**
+ * Called if the file errors while loading.
+ */
+ onError(): void;
+
+ /**
+ * Called during the file load progress. Is sent a DOM ProgressEvent.
+ */
+ onProgress(): void;
+
+ /**
+ * Called by the Loader, starts the actual file downloading.
+ * During the load the methods onLoad, onError and onProgress are called, based on the XHR events.
+ * You shouldn't normally call this method directly, it's meant to be invoked by the Loader.
+ */
+ load(): void;
+
+ }
+
+ /**
+ * A single HTML File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#html method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#html.
+ */
+ class HTMLFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.html".
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.HTMLFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ }
+
+ /**
+ * A single HTML File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#htmlTexture method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#htmlTexture.
+ */
+ class HTMLTextureFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
+ * @param width The width of the texture the HTML will be rendered to.
+ * @param height The height of the texture the HTML will be rendered to.
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig, url?: string, width?: integer, height?: integer, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ }
+
+ /**
+ * A single Image File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#image method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#image.
+ */
+ class ImageFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ * @param frameConfig The frame configuration object. Only provided for, and used by, Sprite Sheets.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.ImageFileConfig, url?: string | string[], xhrSettings?: Phaser.Types.Loader.XHRSettingsObject, frameConfig?: Phaser.Types.Loader.FileTypes.ImageFrameConfig);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ }
+
+ /**
+ * A single JSON File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#json method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#json.
+ */
+ class JSONFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json".
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ * @param dataKey When the JSON file loads only this property will be stored in the Cache.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.JSONFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject, dataKey?: string);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ }
+
+ /**
+ * A single Multi Texture Atlas File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#multiatlas method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#multiatlas.
+ */
+ class MultiAtlasFile extends Phaser.Loader.MultiFile {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key of the file. Must be unique within both the Loader and the Texture Manager.
+ * @param atlasURL The absolute or relative URL to load the multi atlas json file from.
+ * @param path Optional path to use when loading the textures defined in the atlas data.
+ * @param baseURL Optional Base URL to use when loading the textures defined in the atlas data.
+ * @param atlasXhrSettings Extra XHR Settings specifically for the atlas json file.
+ * @param textureXhrSettings Extra XHR Settings specifically for the texture files.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string, atlasURL?: string, path?: string, baseURL?: string, atlasXhrSettings?: Phaser.Types.Loader.XHRSettingsObject, textureXhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called by each File when it finishes loading.
+ * @param file The File that has completed processing.
+ */
+ onFileComplete(file: Phaser.Loader.File): void;
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ }
+
+ /**
+ * A Multi Script File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#scripts method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#scripts.
+ */
+ class MultiScriptFile extends Phaser.Loader.MultiFile {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url An array of absolute or relative URLs to load the script files from. They are processed in the order given in the array.
+ * @param xhrSettings An XHR Settings configuration object for the script files. Used in replacement of the Loaders default XHR Settings.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.MultiScriptFileConfig, url?: string[], xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ }
+
+ /**
+ * A single JSON Pack File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#pack method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#pack.
+ */
+ class PackFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json".
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ * @param dataKey When the JSON file loads only this property will be stored in the Cache.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.PackFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject, dataKey?: string);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ }
+
+ /**
+ * A single Plugin Script File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#plugin method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#plugin.
+ */
+ class PluginFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js".
+ * @param start Automatically start the plugin after loading? Default false.
+ * @param mapping If this plugin is to be injected into the Scene, this is the property key used.
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.PluginFileConfig, url?: string, start?: boolean, mapping?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ }
+
+ /**
+ * An external Scene JavaScript File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#sceneFile method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#sceneFile.
+ */
+ class SceneFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js".
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.SceneFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ }
+
+ /**
+ * A single Scene Plugin Script File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#scenePlugin method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#scenePlugin.
+ */
+ class ScenePluginFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js".
+ * @param systemKey If this plugin is to be added to Scene.Systems, this is the property key for it.
+ * @param sceneKey If this plugin is to be added to the Scene, this is the property key for it.
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.ScenePluginFileConfig, url?: string, systemKey?: string, sceneKey?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ }
+
+ /**
+ * A single Script File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#script method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#script.
+ */
+ class ScriptFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js".
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.ScriptFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ }
+
+ /**
+ * A single Sprite Sheet Image File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#spritesheet method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#spritesheet.
+ */
+ class SpriteSheetFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
+ * @param frameConfig The frame configuration object.
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.SpriteSheetFileConfig, url?: string | string[], frameConfig?: Phaser.Types.Loader.FileTypes.ImageFrameConfig, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ }
+
+ /**
+ * A single SVG File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#svg method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#svg.
+ */
+ class SVGFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.svg`, i.e. if `key` was "alien" then the URL will be "alien.svg".
+ * @param svgConfig The svg size configuration object.
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.SVGFileConfig, url?: string, svgConfig?: Phaser.Types.Loader.FileTypes.SVGSizeConfig, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ }
+
+ /**
+ * A single Text File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#text method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#text.
+ */
+ class TextFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt".
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.TextFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ }
+
+ /**
+ * A single Tilemap CSV File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#tilemapCSV method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#tilemapCSV.
+ */
+ class TilemapCSVFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.csv`, i.e. if `key` was "alien" then the URL will be "alien.csv".
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.TilemapCSVFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ }
+
+ /**
+ * A single Impact.js Tilemap JSON File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#tilemapImpact method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#tilemapImpact.
+ */
+ class TilemapImpactFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json".
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.TilemapImpactFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ }
+
+ /**
+ * A single Tiled Tilemap JSON File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#tilemapTiledJSON method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#tilemapTiledJSON.
+ */
+ class TilemapJSONFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json".
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.TilemapJSONFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ }
+
+ /**
+ * A single text file based Unity Texture Atlas File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#unityAtlas method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#unityAtlas.
+ */
+ class UnityAtlasFile extends Phaser.Loader.MultiFile {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param textureURL The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
+ * @param atlasURL The absolute or relative URL to load the texture atlas data file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt".
+ * @param textureXhrSettings An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings.
+ * @param atlasXhrSettings An XHR Settings configuration object for the atlas data file. Used in replacement of the Loaders default XHR Settings.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.UnityAtlasFileConfig, textureURL?: string | string[], atlasURL?: string, textureXhrSettings?: Phaser.Types.Loader.XHRSettingsObject, atlasXhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ */
+ addToCache(): void;
+
+ }
+
+ /**
+ * A single Video File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#video method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#video.
+ */
+ class VideoFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param urlConfig The absolute or relative URL to load this file from in a config object.
+ * @param loadEvent The load event to listen for when _not_ loading as a blob. Either 'loadeddata', 'canplay' or 'canplaythrough'.
+ * @param asBlob Load the video as a data blob, or via the Video element?
+ * @param noAudio Does the video have an audio track? If not you can enable auto-playing on it.
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.VideoFileConfig, urlConfig?: any, loadEvent?: string, asBlob?: boolean, noAudio?: boolean, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ /**
+ * Called by the Loader, starts the actual file downloading.
+ * During the load the methods onLoad, onError and onProgress are called, based on the XHR events.
+ * You shouldn't normally call this method directly, it's meant to be invoked by the Loader.
+ */
+ load(): void;
+
+ }
+
+ /**
+ * A single XML File suitable for loading by the Loader.
+ *
+ * These are created when you use the Phaser.Loader.LoaderPlugin#xml method and are not typically created directly.
+ *
+ * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#xml.
+ */
+ class XMLFile extends Phaser.Loader.File {
+ /**
+ *
+ * @param loader A reference to the Loader that is responsible for this file.
+ * @param key The key to use for this file, or a file configuration object.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml".
+ * @param xhrSettings Extra XHR Settings specifically for this file.
+ */
+ constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.XMLFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ */
+ onProcess(): void;
+
+ }
+
+ }
+
namespace FileTypesManager {
/**
* Static method called when a LoaderPlugin is created.
@@ -44576,335 +46024,6 @@ declare namespace Phaser {
*/
constructor(scene: Phaser.Scene);
- /**
- * The Scene which owns this Loader instance.
- */
- scene: Phaser.Scene;
-
- /**
- * A reference to the Scene Systems.
- */
- systems: Phaser.Scenes.Systems;
-
- /**
- * A reference to the global Cache Manager.
- */
- cacheManager: Phaser.Cache.CacheManager;
-
- /**
- * A reference to the global Texture Manager.
- */
- textureManager: Phaser.Textures.TextureManager;
-
- /**
- * A reference to the global Scene Manager.
- */
- protected sceneManager: Phaser.Scenes.SceneManager;
-
- /**
- * An optional prefix that is automatically prepended to the start of every file key.
- * If prefix was `MENU.` and you load an image with the key 'Background' the resulting key would be `MENU.Background`.
- * You can set this directly, or call `Loader.setPrefix()`. It will then affect every file added to the Loader
- * from that point on. It does _not_ change any file already in the load queue.
- */
- prefix: string;
-
- /**
- * The value of `path`, if set, is placed before any _relative_ file path given. For example:
- *
- * ```javascript
- * this.load.path = "images/sprites/";
- * this.load.image("ball", "ball.png");
- * this.load.image("tree", "level1/oaktree.png");
- * this.load.image("boom", "http://server.com/explode.png");
- * ```
- *
- * Would load the `ball` file from `images/sprites/ball.png` and the tree from
- * `images/sprites/level1/oaktree.png` but the file `boom` would load from the URL
- * given as it's an absolute URL.
- *
- * Please note that the path is added before the filename but *after* the baseURL (if set.)
- *
- * If you set this property directly then it _must_ end with a "/". Alternatively, call `setPath()` and it'll do it for you.
- */
- path: string;
-
- /**
- * If you want to append a URL before the path of any asset you can set this here.
- *
- * Useful if allowing the asset base url to be configured outside of the game code.
- *
- * If you set this property directly then it _must_ end with a "/". Alternatively, call `setBaseURL()` and it'll do it for you.
- */
- baseURL: string;
-
- /**
- * The number of concurrent / parallel resources to try and fetch at once.
- *
- * Old browsers limit 6 requests per domain; modern ones, especially those with HTTP/2 don't limit it at all.
- *
- * The default is 32 but you can change this in your Game Config, or by changing this property before the Loader starts.
- */
- maxParallelDownloads: integer;
-
- /**
- * xhr specific global settings (can be overridden on a per-file basis)
- */
- xhr: Phaser.Types.Loader.XHRSettingsObject;
-
- /**
- * The crossOrigin value applied to loaded images. Very often this needs to be set to 'anonymous'.
- */
- crossOrigin: string;
-
- /**
- * The total number of files to load. It may not always be accurate because you may add to the Loader during the process
- * of loading, especially if you load a Pack File. Therefore this value can change, but in most cases remains static.
- */
- totalToLoad: integer;
-
- /**
- * The progress of the current load queue, as a float value between 0 and 1.
- * This is updated automatically as files complete loading.
- * Note that it is possible for this value to go down again if you add content to the current load queue during a load.
- */
- progress: number;
-
- /**
- * Files are placed in this Set when they're added to the Loader via `addFile`.
- *
- * They are moved to the `inflight` Set when they start loading, and assuming a successful
- * load, to the `queue` Set for further processing.
- *
- * By the end of the load process this Set will be empty.
- */
- list: Phaser.Structs.Set;
-
- /**
- * Files are stored in this Set while they're in the process of being loaded.
- *
- * Upon a successful load they are moved to the `queue` Set.
- *
- * By the end of the load process this Set will be empty.
- */
- inflight: Phaser.Structs.Set;
-
- /**
- * Files are stored in this Set while they're being processed.
- *
- * If the process is successful they are moved to their final destination, which could be
- * a Cache or the Texture Manager.
- *
- * At the end of the load process this Set will be empty.
- */
- queue: Phaser.Structs.Set;
-
- /**
- * The total number of files that failed to load during the most recent load.
- * This value is reset when you call `Loader.start`.
- */
- totalFailed: integer;
-
- /**
- * The total number of files that successfully loaded during the most recent load.
- * This value is reset when you call `Loader.start`.
- */
- totalComplete: integer;
-
- /**
- * The current state of the Loader.
- */
- readonly state: integer;
-
- /**
- * If you want to append a URL before the path of any asset you can set this here.
- *
- * Useful if allowing the asset base url to be configured outside of the game code.
- *
- * Once a base URL is set it will affect every file loaded by the Loader from that point on. It does _not_ change any
- * file _already_ being loaded. To reset it, call this method with no arguments.
- * @param url The URL to use. Leave empty to reset.
- */
- setBaseURL(url?: string): Phaser.Loader.LoaderPlugin;
-
- /**
- * The value of `path`, if set, is placed before any _relative_ file path given. For example:
- *
- * ```javascript
- * this.load.setPath("images/sprites/");
- * this.load.image("ball", "ball.png");
- * this.load.image("tree", "level1/oaktree.png");
- * this.load.image("boom", "http://server.com/explode.png");
- * ```
- *
- * Would load the `ball` file from `images/sprites/ball.png` and the tree from
- * `images/sprites/level1/oaktree.png` but the file `boom` would load from the URL
- * given as it's an absolute URL.
- *
- * Please note that the path is added before the filename but *after* the baseURL (if set.)
- *
- * Once a path is set it will then affect every file added to the Loader from that point on. It does _not_ change any
- * file _already_ in the load queue. To reset it, call this method with no arguments.
- * @param path The path to use. Leave empty to reset.
- */
- setPath(path?: string): Phaser.Loader.LoaderPlugin;
-
- /**
- * An optional prefix that is automatically prepended to the start of every file key.
- *
- * If prefix was `MENU.` and you load an image with the key 'Background' the resulting key would be `MENU.Background`.
- *
- * Once a prefix is set it will then affect every file added to the Loader from that point on. It does _not_ change any
- * file _already_ in the load queue. To reset it, call this method with no arguments.
- * @param prefix The prefix to use. Leave empty to reset.
- */
- setPrefix(prefix?: string): Phaser.Loader.LoaderPlugin;
-
- /**
- * Sets the Cross Origin Resource Sharing value used when loading files.
- *
- * Files can override this value on a per-file basis by specifying an alternative `crossOrigin` value in their file config.
- *
- * Once CORs is set it will then affect every file loaded by the Loader from that point on, as long as they don't have
- * their own CORs setting. To reset it, call this method with no arguments.
- *
- * For more details about CORs see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
- * @param crossOrigin The value to use for the `crossOrigin` property in the load request.
- */
- setCORS(crossOrigin?: string): Phaser.Loader.LoaderPlugin;
-
- /**
- * Adds a file, or array of files, into the load queue.
- *
- * The file must be an instance of `Phaser.Loader.File`, or a class that extends it. The Loader will check that the key
- * used by the file won't conflict with any other key either in the loader, the inflight queue or the target cache.
- * If allowed it will then add the file into the pending list, read for the load to start. Or, if the load has already
- * started, ready for the next batch of files to be pulled from the list to the inflight queue.
- *
- * You should not normally call this method directly, but rather use one of the Loader methods like `image` or `atlas`,
- * however you can call this as long as the file given to it is well formed.
- * @param file The file, or array of files, to be added to the load queue.
- */
- addFile(file: Phaser.Loader.File | Phaser.Loader.File[]): void;
-
- /**
- * Checks the key and type of the given file to see if it will conflict with anything already
- * in a Cache, the Texture Manager, or the list or inflight queues.
- * @param file The file to check the key of.
- */
- keyExists(file: Phaser.Loader.File): boolean;
-
- /**
- * Takes a well formed, fully parsed pack file object and adds its entries into the load queue. Usually you do not call
- * this method directly, but instead use `Loader.pack` and supply a path to a JSON file that holds the
- * pack data. However, if you've got the data prepared you can pass it to this method.
- *
- * You can also provide an optional key. If you do then it will only add the entries from that part of the pack into
- * to the load queue. If not specified it will add all entries it finds. For more details about the pack file format
- * see the `LoaderPlugin.pack` method.
- * @param data The Pack File data to be parsed and each entry of it to added to the load queue.
- * @param packKey An optional key to use from the pack file data.
- */
- addPack(data: any, packKey?: string): boolean;
-
- /**
- * Is the Loader actively loading, or processing loaded files?
- */
- isLoading(): boolean;
-
- /**
- * Is the Loader ready to start a new load?
- */
- isReady(): boolean;
-
- /**
- * Starts the Loader running. This will reset the progress and totals and then emit a `start` event.
- * If there is nothing in the queue the Loader will immediately complete, otherwise it will start
- * loading the first batch of files.
- *
- * The Loader is started automatically if the queue is populated within your Scenes `preload` method.
- *
- * However, outside of this, you need to call this method to start it.
- *
- * If the Loader is already running this method will simply return.
- */
- start(): void;
-
- /**
- * Called automatically during the load process.
- * It updates the `progress` value and then emits a progress event, which you can use to
- * display a loading bar in your game.
- */
- updateProgress(): void;
-
- /**
- * Called automatically during the load process.
- */
- update(): void;
-
- /**
- * An internal method called automatically by the XHRLoader belong to a File.
- *
- * This method will remove the given file from the inflight Set and update the load progress.
- * If the file was successful its `onProcess` method is called, otherwise it is added to the delete queue.
- * @param file The File that just finished loading, or errored during load.
- * @param success `true` if the file loaded successfully, otherwise `false`.
- */
- nextFile(file: Phaser.Loader.File, success: boolean): void;
-
- /**
- * An internal method that is called automatically by the File when it has finished processing.
- *
- * If the process was successful, and the File isn't part of a MultiFile, its `addToCache` method is called.
- *
- * It this then removed from the queue. If there are no more files to load `loadComplete` is called.
- * @param file The file that has finished processing.
- */
- fileProcessComplete(file: Phaser.Loader.File): void;
-
- /**
- * Called at the end when the load queue is exhausted and all files have either loaded or errored.
- * By this point every loaded file will now be in its associated cache and ready for use.
- *
- * Also clears down the Sets, puts progress to 1 and clears the deletion queue.
- */
- loadComplete(): void;
-
- /**
- * Adds a File into the pending-deletion queue.
- * @param file The File to be queued for deletion when the Loader completes.
- */
- flagForRemoval(file: Phaser.Loader.File): void;
-
- /**
- * Converts the given JSON data into a file that the browser then prompts you to download so you can save it locally.
- *
- * The data must be well formed JSON and ready-parsed, not a JavaScript object.
- * @param data The JSON data, ready parsed.
- * @param filename The name to save the JSON file as. Default file.json.
- */
- saveJSON(data: any, filename?: string): Phaser.Loader.LoaderPlugin;
-
- /**
- * Causes the browser to save the given data as a file to its default Downloads folder.
- *
- * Creates a DOM level anchor link, assigns it as being a `download` anchor, sets the href
- * to be an ObjectURL based on the given data, and then invokes a click event.
- * @param data The data to be saved. Will be passed through URL.createObjectURL.
- * @param filename The filename to save the file as. Default file.json.
- * @param filetype The file type to use when saving the file. Defaults to JSON. Default application/json.
- */
- save(data: any, filename?: string, filetype?: string): Phaser.Loader.LoaderPlugin;
-
- /**
- * Resets the Loader.
- *
- * This will clear all lists and reset the base URL, path and prefix.
- *
- * Warning: If the Loader is currently downloading files, or has files in its queue, they will be aborted.
- */
- reset(): void;
-
/**
* Adds an Animation JSON Data file, or array of Animation JSON files, to the current load queue.
*
@@ -46236,118 +47355,6 @@ declare namespace Phaser {
*/
plugin(key: string | Phaser.Types.Loader.FileTypes.PluginFileConfig | Phaser.Types.Loader.FileTypes.PluginFileConfig[], url?: string | Function, start?: boolean, mapping?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject): Phaser.Loader.LoaderPlugin;
- /**
- * Adds an SVG File, or array of SVG Files, to the current load queue. When the files are loaded they
- * will be rendered to bitmap textures and stored in the Texture Manager.
- *
- * You can call this method from within your Scene's `preload`, along with any other files you wish to load:
- *
- * ```javascript
- * function preload ()
- * {
- * this.load.svg('morty', 'images/Morty.svg');
- * }
- * ```
- *
- * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts,
- * or if it's already running, when the next free load slot becomes available. This happens automatically if you
- * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued
- * it means you cannot use the file immediately after calling this method, but must wait for the file to complete.
- * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the
- * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been
- * loaded.
- *
- * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load.
- * The key should be unique both in terms of files being loaded and files already present in the Texture Manager.
- * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file
- * then remove it from the Texture Manager first, before loading a new one.
- *
- * Instead of passing arguments you can pass a configuration object, such as:
- *
- * ```javascript
- * this.load.svg({
- * key: 'morty',
- * url: 'images/Morty.svg'
- * });
- * ```
- *
- * See the documentation for `Phaser.Types.Loader.FileTypes.SVGFileConfig` for more details.
- *
- * Once the file has finished loading you can use it as a texture for a Game Object by referencing its key:
- *
- * ```javascript
- * this.load.svg('morty', 'images/Morty.svg');
- * // and later in your game ...
- * this.add.image(x, y, 'morty');
- * ```
- *
- * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files
- * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and
- * this is what you would use to retrieve the image from the Texture Manager.
- *
- * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it.
- *
- * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien"
- * and no URL is given then the Loader will set the URL to be "alien.html". It will always add `.html` as the extension, although
- * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL.
- *
- * You can optionally pass an SVG Resize Configuration object when you load an SVG file. By default the SVG will be rendered to a texture
- * at the same size defined in the SVG file attributes. However, this isn't always desirable. You may wish to resize the SVG (either down
- * or up) to improve texture clarity, or reduce texture memory consumption. You can either specify an exact width and height to resize
- * the SVG to:
- *
- * ```javascript
- * function preload ()
- * {
- * this.load.svg('morty', 'images/Morty.svg', { width: 300, height: 600 });
- * }
- * ```
- *
- * Or when using a configuration object:
- *
- * ```javascript
- * this.load.svg({
- * key: 'morty',
- * url: 'images/Morty.svg',
- * svgConfig: {
- * width: 300,
- * height: 600
- * }
- * });
- * ```
- *
- * Alternatively, you can just provide a scale factor instead:
- *
- * ```javascript
- * function preload ()
- * {
- * this.load.svg('morty', 'images/Morty.svg', { scale: 2.5 });
- * }
- * ```
- *
- * Or when using a configuration object:
- *
- * ```javascript
- * this.load.svg({
- * key: 'morty',
- * url: 'images/Morty.svg',
- * svgConfig: {
- * scale: 2.5
- * }
- * });
- * ```
- *
- * If scale, width and height values are all given, the scale has priority and the width and height values are ignored.
- *
- * Note: The ability to load this type of file will only be available if the SVG File type has been built into Phaser.
- * It is available in the default build but can be excluded from custom builds.
- * @param key The key to use for this file, or a file configuration object, or array of them.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.svg`, i.e. if `key` was "alien" then the URL will be "alien.svg".
- * @param svgConfig The svg size configuration object.
- * @param xhrSettings An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings.
- */
- svg(key: string | Phaser.Types.Loader.FileTypes.SVGFileConfig | Phaser.Types.Loader.FileTypes.SVGFileConfig[], url?: string, svgConfig?: Phaser.Types.Loader.FileTypes.SVGSizeConfig, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject): Phaser.Loader.LoaderPlugin;
-
/**
* Adds an external Scene file, or array of Scene files, to the current load queue.
*
@@ -46647,6 +47654,118 @@ declare namespace Phaser {
*/
spritesheet(key: string | Phaser.Types.Loader.FileTypes.SpriteSheetFileConfig | Phaser.Types.Loader.FileTypes.SpriteSheetFileConfig[], url?: string, frameConfig?: Phaser.Types.Loader.FileTypes.ImageFrameConfig, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject): Phaser.Loader.LoaderPlugin;
+ /**
+ * Adds an SVG File, or array of SVG Files, to the current load queue. When the files are loaded they
+ * will be rendered to bitmap textures and stored in the Texture Manager.
+ *
+ * You can call this method from within your Scene's `preload`, along with any other files you wish to load:
+ *
+ * ```javascript
+ * function preload ()
+ * {
+ * this.load.svg('morty', 'images/Morty.svg');
+ * }
+ * ```
+ *
+ * The file is **not** loaded right away. It is added to a queue ready to be loaded either when the loader starts,
+ * or if it's already running, when the next free load slot becomes available. This happens automatically if you
+ * are calling this from within the Scene's `preload` method, or a related callback. Because the file is queued
+ * it means you cannot use the file immediately after calling this method, but must wait for the file to complete.
+ * The typical flow for a Phaser Scene is that you load assets in the Scene's `preload` method and then when the
+ * Scene's `create` method is called you are guaranteed that all of those assets are ready for use and have been
+ * loaded.
+ *
+ * The key must be a unique String. It is used to add the file to the global Texture Manager upon a successful load.
+ * The key should be unique both in terms of files being loaded and files already present in the Texture Manager.
+ * Loading a file using a key that is already taken will result in a warning. If you wish to replace an existing file
+ * then remove it from the Texture Manager first, before loading a new one.
+ *
+ * Instead of passing arguments you can pass a configuration object, such as:
+ *
+ * ```javascript
+ * this.load.svg({
+ * key: 'morty',
+ * url: 'images/Morty.svg'
+ * });
+ * ```
+ *
+ * See the documentation for `Phaser.Types.Loader.FileTypes.SVGFileConfig` for more details.
+ *
+ * Once the file has finished loading you can use it as a texture for a Game Object by referencing its key:
+ *
+ * ```javascript
+ * this.load.svg('morty', 'images/Morty.svg');
+ * // and later in your game ...
+ * this.add.image(x, y, 'morty');
+ * ```
+ *
+ * If you have specified a prefix in the loader, via `Loader.setPrefix` then this value will be prepended to this files
+ * key. For example, if the prefix was `MENU.` and the key was `Background` the final key will be `MENU.Background` and
+ * this is what you would use to retrieve the image from the Texture Manager.
+ *
+ * The URL can be relative or absolute. If the URL is relative the `Loader.baseURL` and `Loader.path` values will be prepended to it.
+ *
+ * If the URL isn't specified the Loader will take the key and create a filename from that. For example if the key is "alien"
+ * and no URL is given then the Loader will set the URL to be "alien.html". It will always add `.html` as the extension, although
+ * this can be overridden if using an object instead of method arguments. If you do not desire this action then provide a URL.
+ *
+ * You can optionally pass an SVG Resize Configuration object when you load an SVG file. By default the SVG will be rendered to a texture
+ * at the same size defined in the SVG file attributes. However, this isn't always desirable. You may wish to resize the SVG (either down
+ * or up) to improve texture clarity, or reduce texture memory consumption. You can either specify an exact width and height to resize
+ * the SVG to:
+ *
+ * ```javascript
+ * function preload ()
+ * {
+ * this.load.svg('morty', 'images/Morty.svg', { width: 300, height: 600 });
+ * }
+ * ```
+ *
+ * Or when using a configuration object:
+ *
+ * ```javascript
+ * this.load.svg({
+ * key: 'morty',
+ * url: 'images/Morty.svg',
+ * svgConfig: {
+ * width: 300,
+ * height: 600
+ * }
+ * });
+ * ```
+ *
+ * Alternatively, you can just provide a scale factor instead:
+ *
+ * ```javascript
+ * function preload ()
+ * {
+ * this.load.svg('morty', 'images/Morty.svg', { scale: 2.5 });
+ * }
+ * ```
+ *
+ * Or when using a configuration object:
+ *
+ * ```javascript
+ * this.load.svg({
+ * key: 'morty',
+ * url: 'images/Morty.svg',
+ * svgConfig: {
+ * scale: 2.5
+ * }
+ * });
+ * ```
+ *
+ * If scale, width and height values are all given, the scale has priority and the width and height values are ignored.
+ *
+ * Note: The ability to load this type of file will only be available if the SVG File type has been built into Phaser.
+ * It is available in the default build but can be excluded from custom builds.
+ * @param key The key to use for this file, or a file configuration object, or array of them.
+ * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.svg`, i.e. if `key` was "alien" then the URL will be "alien.svg".
+ * @param svgConfig The svg size configuration object.
+ * @param xhrSettings An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings.
+ */
+ svg(key: string | Phaser.Types.Loader.FileTypes.SVGFileConfig | Phaser.Types.Loader.FileTypes.SVGFileConfig[], url?: string, svgConfig?: Phaser.Types.Loader.FileTypes.SVGSizeConfig, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject): Phaser.Loader.LoaderPlugin;
+
/**
* Adds a Text file, or array of Text files, to the current load queue.
*
@@ -47116,6 +48235,335 @@ declare namespace Phaser {
*/
xml(key: string | Phaser.Types.Loader.FileTypes.XMLFileConfig | Phaser.Types.Loader.FileTypes.XMLFileConfig[], url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject): Phaser.Loader.LoaderPlugin;
+ /**
+ * The Scene which owns this Loader instance.
+ */
+ scene: Phaser.Scene;
+
+ /**
+ * A reference to the Scene Systems.
+ */
+ systems: Phaser.Scenes.Systems;
+
+ /**
+ * A reference to the global Cache Manager.
+ */
+ cacheManager: Phaser.Cache.CacheManager;
+
+ /**
+ * A reference to the global Texture Manager.
+ */
+ textureManager: Phaser.Textures.TextureManager;
+
+ /**
+ * A reference to the global Scene Manager.
+ */
+ protected sceneManager: Phaser.Scenes.SceneManager;
+
+ /**
+ * An optional prefix that is automatically prepended to the start of every file key.
+ * If prefix was `MENU.` and you load an image with the key 'Background' the resulting key would be `MENU.Background`.
+ * You can set this directly, or call `Loader.setPrefix()`. It will then affect every file added to the Loader
+ * from that point on. It does _not_ change any file already in the load queue.
+ */
+ prefix: string;
+
+ /**
+ * The value of `path`, if set, is placed before any _relative_ file path given. For example:
+ *
+ * ```javascript
+ * this.load.path = "images/sprites/";
+ * this.load.image("ball", "ball.png");
+ * this.load.image("tree", "level1/oaktree.png");
+ * this.load.image("boom", "http://server.com/explode.png");
+ * ```
+ *
+ * Would load the `ball` file from `images/sprites/ball.png` and the tree from
+ * `images/sprites/level1/oaktree.png` but the file `boom` would load from the URL
+ * given as it's an absolute URL.
+ *
+ * Please note that the path is added before the filename but *after* the baseURL (if set.)
+ *
+ * If you set this property directly then it _must_ end with a "/". Alternatively, call `setPath()` and it'll do it for you.
+ */
+ path: string;
+
+ /**
+ * If you want to append a URL before the path of any asset you can set this here.
+ *
+ * Useful if allowing the asset base url to be configured outside of the game code.
+ *
+ * If you set this property directly then it _must_ end with a "/". Alternatively, call `setBaseURL()` and it'll do it for you.
+ */
+ baseURL: string;
+
+ /**
+ * The number of concurrent / parallel resources to try and fetch at once.
+ *
+ * Old browsers limit 6 requests per domain; modern ones, especially those with HTTP/2 don't limit it at all.
+ *
+ * The default is 32 but you can change this in your Game Config, or by changing this property before the Loader starts.
+ */
+ maxParallelDownloads: integer;
+
+ /**
+ * xhr specific global settings (can be overridden on a per-file basis)
+ */
+ xhr: Phaser.Types.Loader.XHRSettingsObject;
+
+ /**
+ * The crossOrigin value applied to loaded images. Very often this needs to be set to 'anonymous'.
+ */
+ crossOrigin: string;
+
+ /**
+ * The total number of files to load. It may not always be accurate because you may add to the Loader during the process
+ * of loading, especially if you load a Pack File. Therefore this value can change, but in most cases remains static.
+ */
+ totalToLoad: integer;
+
+ /**
+ * The progress of the current load queue, as a float value between 0 and 1.
+ * This is updated automatically as files complete loading.
+ * Note that it is possible for this value to go down again if you add content to the current load queue during a load.
+ */
+ progress: number;
+
+ /**
+ * Files are placed in this Set when they're added to the Loader via `addFile`.
+ *
+ * They are moved to the `inflight` Set when they start loading, and assuming a successful
+ * load, to the `queue` Set for further processing.
+ *
+ * By the end of the load process this Set will be empty.
+ */
+ list: Phaser.Structs.Set;
+
+ /**
+ * Files are stored in this Set while they're in the process of being loaded.
+ *
+ * Upon a successful load they are moved to the `queue` Set.
+ *
+ * By the end of the load process this Set will be empty.
+ */
+ inflight: Phaser.Structs.Set;
+
+ /**
+ * Files are stored in this Set while they're being processed.
+ *
+ * If the process is successful they are moved to their final destination, which could be
+ * a Cache or the Texture Manager.
+ *
+ * At the end of the load process this Set will be empty.
+ */
+ queue: Phaser.Structs.Set;
+
+ /**
+ * The total number of files that failed to load during the most recent load.
+ * This value is reset when you call `Loader.start`.
+ */
+ totalFailed: integer;
+
+ /**
+ * The total number of files that successfully loaded during the most recent load.
+ * This value is reset when you call `Loader.start`.
+ */
+ totalComplete: integer;
+
+ /**
+ * The current state of the Loader.
+ */
+ readonly state: integer;
+
+ /**
+ * If you want to append a URL before the path of any asset you can set this here.
+ *
+ * Useful if allowing the asset base url to be configured outside of the game code.
+ *
+ * Once a base URL is set it will affect every file loaded by the Loader from that point on. It does _not_ change any
+ * file _already_ being loaded. To reset it, call this method with no arguments.
+ * @param url The URL to use. Leave empty to reset.
+ */
+ setBaseURL(url?: string): Phaser.Loader.LoaderPlugin;
+
+ /**
+ * The value of `path`, if set, is placed before any _relative_ file path given. For example:
+ *
+ * ```javascript
+ * this.load.setPath("images/sprites/");
+ * this.load.image("ball", "ball.png");
+ * this.load.image("tree", "level1/oaktree.png");
+ * this.load.image("boom", "http://server.com/explode.png");
+ * ```
+ *
+ * Would load the `ball` file from `images/sprites/ball.png` and the tree from
+ * `images/sprites/level1/oaktree.png` but the file `boom` would load from the URL
+ * given as it's an absolute URL.
+ *
+ * Please note that the path is added before the filename but *after* the baseURL (if set.)
+ *
+ * Once a path is set it will then affect every file added to the Loader from that point on. It does _not_ change any
+ * file _already_ in the load queue. To reset it, call this method with no arguments.
+ * @param path The path to use. Leave empty to reset.
+ */
+ setPath(path?: string): Phaser.Loader.LoaderPlugin;
+
+ /**
+ * An optional prefix that is automatically prepended to the start of every file key.
+ *
+ * If prefix was `MENU.` and you load an image with the key 'Background' the resulting key would be `MENU.Background`.
+ *
+ * Once a prefix is set it will then affect every file added to the Loader from that point on. It does _not_ change any
+ * file _already_ in the load queue. To reset it, call this method with no arguments.
+ * @param prefix The prefix to use. Leave empty to reset.
+ */
+ setPrefix(prefix?: string): Phaser.Loader.LoaderPlugin;
+
+ /**
+ * Sets the Cross Origin Resource Sharing value used when loading files.
+ *
+ * Files can override this value on a per-file basis by specifying an alternative `crossOrigin` value in their file config.
+ *
+ * Once CORs is set it will then affect every file loaded by the Loader from that point on, as long as they don't have
+ * their own CORs setting. To reset it, call this method with no arguments.
+ *
+ * For more details about CORs see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
+ * @param crossOrigin The value to use for the `crossOrigin` property in the load request.
+ */
+ setCORS(crossOrigin?: string): Phaser.Loader.LoaderPlugin;
+
+ /**
+ * Adds a file, or array of files, into the load queue.
+ *
+ * The file must be an instance of `Phaser.Loader.File`, or a class that extends it. The Loader will check that the key
+ * used by the file won't conflict with any other key either in the loader, the inflight queue or the target cache.
+ * If allowed it will then add the file into the pending list, read for the load to start. Or, if the load has already
+ * started, ready for the next batch of files to be pulled from the list to the inflight queue.
+ *
+ * You should not normally call this method directly, but rather use one of the Loader methods like `image` or `atlas`,
+ * however you can call this as long as the file given to it is well formed.
+ * @param file The file, or array of files, to be added to the load queue.
+ */
+ addFile(file: Phaser.Loader.File | Phaser.Loader.File[]): void;
+
+ /**
+ * Checks the key and type of the given file to see if it will conflict with anything already
+ * in a Cache, the Texture Manager, or the list or inflight queues.
+ * @param file The file to check the key of.
+ */
+ keyExists(file: Phaser.Loader.File): boolean;
+
+ /**
+ * Takes a well formed, fully parsed pack file object and adds its entries into the load queue. Usually you do not call
+ * this method directly, but instead use `Loader.pack` and supply a path to a JSON file that holds the
+ * pack data. However, if you've got the data prepared you can pass it to this method.
+ *
+ * You can also provide an optional key. If you do then it will only add the entries from that part of the pack into
+ * to the load queue. If not specified it will add all entries it finds. For more details about the pack file format
+ * see the `LoaderPlugin.pack` method.
+ * @param data The Pack File data to be parsed and each entry of it to added to the load queue.
+ * @param packKey An optional key to use from the pack file data.
+ */
+ addPack(data: any, packKey?: string): boolean;
+
+ /**
+ * Is the Loader actively loading, or processing loaded files?
+ */
+ isLoading(): boolean;
+
+ /**
+ * Is the Loader ready to start a new load?
+ */
+ isReady(): boolean;
+
+ /**
+ * Starts the Loader running. This will reset the progress and totals and then emit a `start` event.
+ * If there is nothing in the queue the Loader will immediately complete, otherwise it will start
+ * loading the first batch of files.
+ *
+ * The Loader is started automatically if the queue is populated within your Scenes `preload` method.
+ *
+ * However, outside of this, you need to call this method to start it.
+ *
+ * If the Loader is already running this method will simply return.
+ */
+ start(): void;
+
+ /**
+ * Called automatically during the load process.
+ * It updates the `progress` value and then emits a progress event, which you can use to
+ * display a loading bar in your game.
+ */
+ updateProgress(): void;
+
+ /**
+ * Called automatically during the load process.
+ */
+ update(): void;
+
+ /**
+ * An internal method called automatically by the XHRLoader belong to a File.
+ *
+ * This method will remove the given file from the inflight Set and update the load progress.
+ * If the file was successful its `onProcess` method is called, otherwise it is added to the delete queue.
+ * @param file The File that just finished loading, or errored during load.
+ * @param success `true` if the file loaded successfully, otherwise `false`.
+ */
+ nextFile(file: Phaser.Loader.File, success: boolean): void;
+
+ /**
+ * An internal method that is called automatically by the File when it has finished processing.
+ *
+ * If the process was successful, and the File isn't part of a MultiFile, its `addToCache` method is called.
+ *
+ * It this then removed from the queue. If there are no more files to load `loadComplete` is called.
+ * @param file The file that has finished processing.
+ */
+ fileProcessComplete(file: Phaser.Loader.File): void;
+
+ /**
+ * Called at the end when the load queue is exhausted and all files have either loaded or errored.
+ * By this point every loaded file will now be in its associated cache and ready for use.
+ *
+ * Also clears down the Sets, puts progress to 1 and clears the deletion queue.
+ */
+ loadComplete(): void;
+
+ /**
+ * Adds a File into the pending-deletion queue.
+ * @param file The File to be queued for deletion when the Loader completes.
+ */
+ flagForRemoval(file: Phaser.Loader.File): void;
+
+ /**
+ * Converts the given JSON data into a file that the browser then prompts you to download so you can save it locally.
+ *
+ * The data must be well formed JSON and ready-parsed, not a JavaScript object.
+ * @param data The JSON data, ready parsed.
+ * @param filename The name to save the JSON file as. Default file.json.
+ */
+ saveJSON(data: any, filename?: string): Phaser.Loader.LoaderPlugin;
+
+ /**
+ * Causes the browser to save the given data as a file to its default Downloads folder.
+ *
+ * Creates a DOM level anchor link, assigns it as being a `download` anchor, sets the href
+ * to be an ObjectURL based on the given data, and then invokes a click event.
+ * @param data The data to be saved. Will be passed through URL.createObjectURL.
+ * @param filename The filename to save the file as. Default file.json.
+ * @param filetype The file type to use when saving the file. Defaults to JSON. Default application/json.
+ */
+ save(data: any, filename?: string, filetype?: string): Phaser.Loader.LoaderPlugin;
+
+ /**
+ * Resets the Loader.
+ *
+ * This will clear all lists and reset the base URL, path and prefix.
+ *
+ * Warning: If the Loader is currently downloading files, or has files in its queue, they will be aborted.
+ */
+ reset(): void;
+
}
/**
@@ -47246,1082 +48694,121 @@ declare namespace Phaser {
*/
function XHRSettings(responseType?: XMLHttpRequestResponseType, async?: boolean, user?: string, password?: string, timeout?: integer): Phaser.Types.Loader.XHRSettingsObject;
- /**
- * The Loader is idle.
- */
- var LOADER_IDLE: integer;
-
- /**
- * The Loader is actively loading.
- */
- var LOADER_LOADING: integer;
-
- /**
- * The Loader is processing files is has loaded.
- */
- var LOADER_PROCESSING: integer;
-
- /**
- * The Loader has completed loading and processing.
- */
- var LOADER_COMPLETE: integer;
-
- /**
- * The Loader is shutting down.
- */
- var LOADER_SHUTDOWN: integer;
-
- /**
- * The Loader has been destroyed.
- */
- var LOADER_DESTROYED: integer;
-
- /**
- * File is in the load queue but not yet started
- */
- var FILE_PENDING: integer;
-
- /**
- * File has been started to load by the loader (onLoad called)
- */
- var FILE_LOADING: integer;
-
- /**
- * File has loaded successfully, awaiting processing
- */
- var FILE_LOADED: integer;
-
- /**
- * File failed to load
- */
- var FILE_FAILED: integer;
-
- /**
- * File is being processed (onProcess callback)
- */
- var FILE_PROCESSING: integer;
-
- /**
- * The File has errored somehow during processing.
- */
- var FILE_ERRORED: integer;
-
- /**
- * File has finished processing.
- */
- var FILE_COMPLETE: integer;
-
- /**
- * File has been destroyed
- */
- var FILE_DESTROYED: integer;
-
- /**
- * File was populated from local data and doesn't need an HTTP request
- */
- var FILE_POPULATED: integer;
-
- namespace Events {
- /**
- * The Loader Plugin Add File Event.
- *
- * This event is dispatched when a new file is successfully added to the Loader and placed into the load queue.
- *
- * Listen to it from a Scene using: `this.load.on('addfile', listener)`.
- *
- * If you add lots of files to a Loader from a `preload` method, it will dispatch this event for each one of them.
- */
- const ADD: any;
-
- /**
- * The Loader Plugin Complete Event.
- *
- * This event is dispatched when the Loader has fully processed everything in the load queue.
- * By this point every loaded file will now be in its associated cache and ready for use.
- *
- * Listen to it from a Scene using: `this.load.on('complete', listener)`.
- */
- const COMPLETE: any;
-
- /**
- * The File Load Complete Event.
- *
- * This event is dispatched by the Loader Plugin when any file in the queue finishes loading.
- *
- * Listen to it from a Scene using: `this.load.on('filecomplete', listener)`.
- *
- * You can also listen for the completion of a specific file. See the [FILE_KEY_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_KEY_COMPLETE} event.
- */
- const FILE_COMPLETE: any;
-
- /**
- * The File Load Complete Event.
- *
- * This event is dispatched by the Loader Plugin when any file in the queue finishes loading.
- *
- * It uses a special dynamic event name constructed from the key and type of the file.
- *
- * For example, if you have loaded an `image` with a key of `monster`, you can listen for it
- * using the following:
- *
- * ```javascript
- * this.load.on('filecomplete-image-monster', function (key, type, data) {
- * // Your handler code
- * });
- * ```
- *
- * Or, if you have loaded a texture `atlas` with a key of `Level1`:
- *
- * ```javascript
- * this.load.on('filecomplete-atlas-Level1', function (key, type, data) {
- * // Your handler code
- * });
- * ```
- *
- * Or, if you have loaded a sprite sheet with a key of `Explosion` and a prefix of `GAMEOVER`:
- *
- * ```javascript
- * this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) {
- * // Your handler code
- * });
- * ```
- *
- * You can also listen for the generic completion of files. See the [FILE_COMPLETE]{@linkcode Phaser.Loader.Events#event:FILE_COMPLETE} event.
- */
- const FILE_KEY_COMPLETE: any;
-
- /**
- * The File Load Error Event.
- *
- * This event is dispatched by the Loader Plugin when a file fails to load.
- *
- * Listen to it from a Scene using: `this.load.on('loaderror', listener)`.
- */
- const FILE_LOAD_ERROR: any;
-
- /**
- * The File Load Event.
- *
- * This event is dispatched by the Loader Plugin when a file finishes loading,
- * but _before_ it is processed and added to the internal Phaser caches.
- *
- * Listen to it from a Scene using: `this.load.on('load', listener)`.
- */
- const FILE_LOAD: any;
-
- /**
- * The File Load Progress Event.
- *
- * This event is dispatched by the Loader Plugin during the load of a file, if the browser receives a DOM ProgressEvent and
- * the `lengthComputable` event property is true. Depending on the size of the file and browser in use, this may, or may not happen.
- *
- * Listen to it from a Scene using: `this.load.on('fileprogress', listener)`.
- */
- const FILE_PROGRESS: any;
-
- /**
- * The Loader Plugin Post Process Event.
- *
- * This event is dispatched by the Loader Plugin when the Loader has finished loading everything in the load queue.
- * It is dispatched before the internal lists are cleared and each File is destroyed.
- *
- * Use this hook to perform any last minute processing of files that can only happen once the
- * Loader has completed, but prior to it emitting the `complete` event.
- *
- * Listen to it from a Scene using: `this.load.on('postprocess', listener)`.
- */
- const POST_PROCESS: any;
-
- /**
- * The Loader Plugin Progress Event.
- *
- * This event is dispatched when the Loader updates its load progress, typically as a result of a file having completed loading.
- *
- * Listen to it from a Scene using: `this.load.on('progress', listener)`.
- */
- const PROGRESS: any;
-
- /**
- * The Loader Plugin Start Event.
- *
- * This event is dispatched when the Loader starts running. At this point load progress is zero.
- *
- * This event is dispatched even if there aren't any files in the load queue.
- *
- * Listen to it from a Scene using: `this.load.on('start', listener)`.
- */
- const START: any;
-
- }
-
- namespace FileTypes {
- /**
- * A single Animation JSON File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#animation method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#animation.
- */
- class AnimationJSONFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json".
- * @param xhrSettings Extra XHR Settings specifically for this file.
- * @param dataKey When the JSON file loads only this property will be stored in the Cache.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.JSONFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject, dataKey?: string);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- /**
- * Called at the end of the load process, after the Loader has finished all files in its queue.
- */
- onLoadComplete(): void;
-
- }
-
- /**
- * A single JSON based Texture Atlas File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#atlas method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#atlas.
- *
- * https://www.codeandweb.com/texturepacker/tutorials/how-to-create-sprite-sheets-for-phaser3?source=photonstorm
- */
- class AtlasJSONFile extends Phaser.Loader.MultiFile {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param textureURL The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
- * @param atlasURL The absolute or relative URL to load the texture atlas json data file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json".
- * @param textureXhrSettings An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings.
- * @param atlasXhrSettings An XHR Settings configuration object for the atlas json file. Used in replacement of the Loaders default XHR Settings.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.AtlasJSONFileConfig, textureURL?: string | string[], atlasURL?: string, textureXhrSettings?: Phaser.Types.Loader.XHRSettingsObject, atlasXhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- }
-
- /**
- * A single XML based Texture Atlas File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#atlasXML method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#atlasXML.
- */
- class AtlasXMLFile extends Phaser.Loader.MultiFile {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param textureURL The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
- * @param atlasURL The absolute or relative URL to load the texture atlas xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml".
- * @param textureXhrSettings An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings.
- * @param atlasXhrSettings An XHR Settings configuration object for the atlas xml file. Used in replacement of the Loaders default XHR Settings.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.AtlasXMLFileConfig, textureURL?: string | string[], atlasURL?: string, textureXhrSettings?: Phaser.Types.Loader.XHRSettingsObject, atlasXhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- }
-
- /**
- * A single Audio File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#audio method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#audio.
- */
- class AudioFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param urlConfig The absolute or relative URL to load this file from in a config object.
- * @param xhrSettings Extra XHR Settings specifically for this file.
- * @param audioContext The AudioContext this file will use to process itself.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.AudioFileConfig, urlConfig?: any, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject, audioContext?: AudioContext);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- }
-
- /**
- * An Audio Sprite File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#audioSprite method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#audioSprite.
- */
- class AudioSpriteFile extends Phaser.Loader.MultiFile {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param jsonURL The absolute or relative URL to load the json file from. Or a well formed JSON object to use instead.
- * @param audioURL The absolute or relative URL to load the audio file from. If empty it will be obtained by parsing the JSON file.
- * @param audioConfig The audio configuration options.
- * @param audioXhrSettings An XHR Settings configuration object for the audio file. Used in replacement of the Loaders default XHR Settings.
- * @param jsonXhrSettings An XHR Settings configuration object for the json file. Used in replacement of the Loaders default XHR Settings.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.AudioSpriteFileConfig, jsonURL: string, audioURL?: Object, audioConfig?: any, audioXhrSettings?: Phaser.Types.Loader.XHRSettingsObject, jsonXhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called by each File when it finishes loading.
- * @param file The File that has completed processing.
- */
- onFileComplete(file: Phaser.Loader.File): void;
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- }
-
- /**
- * A single Binary File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#binary method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#binary.
- */
- class BinaryFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.bin`, i.e. if `key` was "alien" then the URL will be "alien.bin".
- * @param xhrSettings Extra XHR Settings specifically for this file.
- * @param dataType Optional type to cast the binary file to once loaded. For example, `Uint8Array`.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.BinaryFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject, dataType?: any);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- }
-
- /**
- * A single Bitmap Font based File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#bitmapFont method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#bitmapFont.
- */
- class BitmapFontFile extends Phaser.Loader.MultiFile {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param textureURL The absolute or relative URL to load the font image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
- * @param fontDataURL The absolute or relative URL to load the font xml data file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml".
- * @param textureXhrSettings An XHR Settings configuration object for the font image file. Used in replacement of the Loaders default XHR Settings.
- * @param fontDataXhrSettings An XHR Settings configuration object for the font data xml file. Used in replacement of the Loaders default XHR Settings.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.BitmapFontFileConfig, textureURL?: string | string[], fontDataURL?: string, textureXhrSettings?: Phaser.Types.Loader.XHRSettingsObject, fontDataXhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- }
-
- /**
- * A single CSS File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#css method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#css.
- */
- class CSSFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js".
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.CSSFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- }
-
- /**
- * A single GLSL File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#glsl method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#glsl.
- */
- class GLSLFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt".
- * @param shaderType The type of shader. Either `fragment` for a fragment shader, or `vertex` for a vertex shader. This is ignored if you load a shader bundle. Default 'fragment'.
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.GLSLFileConfig, url?: string, shaderType?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- /**
- * Returns the name of the shader from the header block.
- * @param headerSource The header data.
- */
- getShaderName(headerSource: string[]): string;
-
- /**
- * Returns the type of the shader from the header block.
- * @param headerSource The header data.
- */
- getShaderType(headerSource: string[]): string;
-
- /**
- * Returns the shader uniforms from the header block.
- * @param headerSource The header data.
- */
- getShaderUniforms(headerSource: string[]): any;
-
- }
-
- /**
- * A single Audio File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#audio method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#audio.
- */
- class HTML5AudioFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param urlConfig The absolute or relative URL to load this file from.
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.AudioFileConfig, urlConfig?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called when the file finishes loading.
- */
- onLoad(): void;
-
- /**
- * Called if the file errors while loading.
- */
- onError(): void;
-
- /**
- * Called during the file load progress. Is sent a DOM ProgressEvent.
- */
- onProgress(): void;
-
- /**
- * Called by the Loader, starts the actual file downloading.
- * During the load the methods onLoad, onError and onProgress are called, based on the XHR events.
- * You shouldn't normally call this method directly, it's meant to be invoked by the Loader.
- */
- load(): void;
-
- }
-
- /**
- * A single HTML File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#html method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#html.
- */
- class HTMLFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.html".
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.HTMLFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- }
-
- /**
- * A single HTML File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#htmlTexture method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#htmlTexture.
- */
- class HTMLTextureFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
- * @param width The width of the texture the HTML will be rendered to.
- * @param height The height of the texture the HTML will be rendered to.
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.HTMLTextureFileConfig, url?: string, width?: integer, height?: integer, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- }
-
- /**
- * A single Image File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#image method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#image.
- */
- class ImageFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
- * @param xhrSettings Extra XHR Settings specifically for this file.
- * @param frameConfig The frame configuration object. Only provided for, and used by, Sprite Sheets.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.ImageFileConfig, url?: string | string[], xhrSettings?: Phaser.Types.Loader.XHRSettingsObject, frameConfig?: Phaser.Types.Loader.FileTypes.ImageFrameConfig);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- }
-
- /**
- * A single JSON File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#json method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#json.
- */
- class JSONFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json".
- * @param xhrSettings Extra XHR Settings specifically for this file.
- * @param dataKey When the JSON file loads only this property will be stored in the Cache.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.JSONFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject, dataKey?: string);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- }
-
- /**
- * A single Multi Texture Atlas File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#multiatlas method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#multiatlas.
- */
- class MultiAtlasFile extends Phaser.Loader.MultiFile {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key of the file. Must be unique within both the Loader and the Texture Manager.
- * @param atlasURL The absolute or relative URL to load the multi atlas json file from.
- * @param path Optional path to use when loading the textures defined in the atlas data.
- * @param baseURL Optional Base URL to use when loading the textures defined in the atlas data.
- * @param atlasXhrSettings Extra XHR Settings specifically for the atlas json file.
- * @param textureXhrSettings Extra XHR Settings specifically for the texture files.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string, atlasURL?: string, path?: string, baseURL?: string, atlasXhrSettings?: Phaser.Types.Loader.XHRSettingsObject, textureXhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called by each File when it finishes loading.
- * @param file The File that has completed processing.
- */
- onFileComplete(file: Phaser.Loader.File): void;
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- }
-
- /**
- * A Multi Script File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#scripts method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#scripts.
- */
- class MultiScriptFile extends Phaser.Loader.MultiFile {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url An array of absolute or relative URLs to load the script files from. They are processed in the order given in the array.
- * @param xhrSettings An XHR Settings configuration object for the script files. Used in replacement of the Loaders default XHR Settings.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.MultiScriptFileConfig, url?: string[], xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- }
-
- /**
- * A single JSON Pack File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#pack method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#pack.
- */
- class PackFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json".
- * @param xhrSettings Extra XHR Settings specifically for this file.
- * @param dataKey When the JSON file loads only this property will be stored in the Cache.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.PackFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject, dataKey?: string);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- }
-
- /**
- * A single Plugin Script File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#plugin method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#plugin.
- */
- class PluginFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js".
- * @param start Automatically start the plugin after loading? Default false.
- * @param mapping If this plugin is to be injected into the Scene, this is the property key used.
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.PluginFileConfig, url?: string, start?: boolean, mapping?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- }
-
- /**
- * A single SVG File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#svg method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#svg.
- */
- class SVGFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.svg`, i.e. if `key` was "alien" then the URL will be "alien.svg".
- * @param svgConfig The svg size configuration object.
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.SVGFileConfig, url?: string, svgConfig?: Phaser.Types.Loader.FileTypes.SVGSizeConfig, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- }
-
- /**
- * An external Scene JavaScript File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#sceneFile method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#sceneFile.
- */
- class SceneFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js".
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.SceneFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- }
-
- /**
- * A single Scene Plugin Script File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#scenePlugin method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#scenePlugin.
- */
- class ScenePluginFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js".
- * @param systemKey If this plugin is to be added to Scene.Systems, this is the property key for it.
- * @param sceneKey If this plugin is to be added to the Scene, this is the property key for it.
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.ScenePluginFileConfig, url?: string, systemKey?: string, sceneKey?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- }
-
- /**
- * A single Script File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#script method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#script.
- */
- class ScriptFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.js`, i.e. if `key` was "alien" then the URL will be "alien.js".
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.ScriptFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- }
-
- /**
- * A single Sprite Sheet Image File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#spritesheet method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#spritesheet.
- */
- class SpriteSheetFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
- * @param frameConfig The frame configuration object.
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.SpriteSheetFileConfig, url?: string | string[], frameConfig?: Phaser.Types.Loader.FileTypes.ImageFrameConfig, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- }
-
- /**
- * A single Text File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#text method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#text.
- */
- class TextFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt".
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.TextFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- }
-
- /**
- * A single Tilemap CSV File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#tilemapCSV method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#tilemapCSV.
- */
- class TilemapCSVFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.csv`, i.e. if `key` was "alien" then the URL will be "alien.csv".
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.TilemapCSVFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- }
-
- /**
- * A single Impact.js Tilemap JSON File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#tilemapImpact method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#tilemapImpact.
- */
- class TilemapImpactFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json".
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.TilemapImpactFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- }
-
- /**
- * A single Tiled Tilemap JSON File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#tilemapTiledJSON method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#tilemapTiledJSON.
- */
- class TilemapJSONFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.json`, i.e. if `key` was "alien" then the URL will be "alien.json".
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.TilemapJSONFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- }
-
- /**
- * A single text file based Unity Texture Atlas File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#unityAtlas method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#unityAtlas.
- */
- class UnityAtlasFile extends Phaser.Loader.MultiFile {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param textureURL The absolute or relative URL to load the texture image file from. If undefined or `null` it will be set to `.png`, i.e. if `key` was "alien" then the URL will be "alien.png".
- * @param atlasURL The absolute or relative URL to load the texture atlas data file from. If undefined or `null` it will be set to `.txt`, i.e. if `key` was "alien" then the URL will be "alien.txt".
- * @param textureXhrSettings An XHR Settings configuration object for the atlas image file. Used in replacement of the Loaders default XHR Settings.
- * @param atlasXhrSettings An XHR Settings configuration object for the atlas data file. Used in replacement of the Loaders default XHR Settings.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.UnityAtlasFileConfig, textureURL?: string | string[], atlasURL?: string, textureXhrSettings?: Phaser.Types.Loader.XHRSettingsObject, atlasXhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- */
- addToCache(): void;
-
- }
-
- /**
- * A single Video File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#video method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#video.
- */
- class VideoFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param urlConfig The absolute or relative URL to load this file from in a config object.
- * @param loadEvent The load event to listen for when _not_ loading as a blob. Either 'loadeddata', 'canplay' or 'canplaythrough'.
- * @param asBlob Load the video as a data blob, or via the Video element?
- * @param noAudio Does the video have an audio track? If not you can enable auto-playing on it.
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.VideoFileConfig, urlConfig?: any, loadEvent?: string, asBlob?: boolean, noAudio?: boolean, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- /**
- * Called by the Loader, starts the actual file downloading.
- * During the load the methods onLoad, onError and onProgress are called, based on the XHR events.
- * You shouldn't normally call this method directly, it's meant to be invoked by the Loader.
- */
- load(): void;
-
- }
-
- /**
- * A single XML File suitable for loading by the Loader.
- *
- * These are created when you use the Phaser.Loader.LoaderPlugin#xml method and are not typically created directly.
- *
- * For documentation about what all the arguments and configuration options mean please see Phaser.Loader.LoaderPlugin#xml.
- */
- class XMLFile extends Phaser.Loader.File {
- /**
- *
- * @param loader A reference to the Loader that is responsible for this file.
- * @param key The key to use for this file, or a file configuration object.
- * @param url The absolute or relative URL to load this file from. If undefined or `null` it will be set to `.xml`, i.e. if `key` was "alien" then the URL will be "alien.xml".
- * @param xhrSettings Extra XHR Settings specifically for this file.
- */
- constructor(loader: Phaser.Loader.LoaderPlugin, key: string | Phaser.Types.Loader.FileTypes.XMLFileConfig, url?: string, xhrSettings?: Phaser.Types.Loader.XHRSettingsObject);
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- */
- onProcess(): void;
-
- }
-
- }
-
}
namespace Math {
+ namespace Angle {
+ /**
+ * Find the angle of a segment from (x1, y1) -> (x2, y2).
+ * @param x1 The x coordinate of the first point.
+ * @param y1 The y coordinate of the first point.
+ * @param x2 The x coordinate of the second point.
+ * @param y2 The y coordinate of the second point.
+ */
+ function Between(x1: number, y1: number, x2: number, y2: number): number;
+
+ /**
+ * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y).
+ *
+ * Calculates the angle of the vector from the first point to the second point.
+ * @param point1 The first point.
+ * @param point2 The second point.
+ */
+ function BetweenPoints(point1: Phaser.Geom.Point | object, point2: Phaser.Geom.Point | object): number;
+
+ /**
+ * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y).
+ *
+ * The difference between this method and {@link Phaser.Math.Angle.BetweenPoints} is that this assumes the y coordinate
+ * travels down the screen.
+ * @param point1 The first point.
+ * @param point2 The second point.
+ */
+ function BetweenPointsY(point1: Phaser.Geom.Point | object, point2: Phaser.Geom.Point | object): number;
+
+ /**
+ * Find the angle of a segment from (x1, y1) -> (x2, y2).
+ *
+ * The difference between this method and {@link Phaser.Math.Angle.Between} is that this assumes the y coordinate
+ * travels down the screen.
+ * @param x1 The x coordinate of the first point.
+ * @param y1 The y coordinate of the first point.
+ * @param x2 The x coordinate of the second point.
+ * @param y2 The y coordinate of the second point.
+ */
+ function BetweenY(x1: number, y1: number, x2: number, y2: number): number;
+
+ /**
+ * Takes an angle in Phasers default clockwise format and converts it so that
+ * 0 is North, 90 is West, 180 is South and 270 is East,
+ * therefore running counter-clockwise instead of clockwise.
+ *
+ * You can pass in the angle from a Game Object using:
+ *
+ * ```javascript
+ * var converted = CounterClockwise(gameobject.rotation);
+ * ```
+ *
+ * All values for this function are in radians.
+ * @param angle The angle to convert, in radians.
+ */
+ function CounterClockwise(angle: number): number;
+
+ /**
+ * Normalize an angle to the [0, 2pi] range.
+ * @param angle The angle to normalize, in radians.
+ */
+ function Normalize(angle: number): number;
+
+ /**
+ * Reverse the given angle.
+ * @param angle The angle to reverse, in radians.
+ */
+ function Reverse(angle: number): number;
+
+ /**
+ * Rotates `currentAngle` towards `targetAngle`, taking the shortest rotation distance. The `lerp` argument is the amount to rotate by in this call.
+ * @param currentAngle The current angle, in radians.
+ * @param targetAngle The target angle to rotate to, in radians.
+ * @param lerp The lerp value to add to the current angle. Default 0.05.
+ */
+ function RotateTo(currentAngle: number, targetAngle: number, lerp?: number): number;
+
+ /**
+ * Gets the shortest angle between `angle1` and `angle2`.
+ *
+ * Both angles must be in the range -180 to 180, which is the same clamped
+ * range that `sprite.angle` uses, so you can pass in two sprite angles to
+ * this method and get the shortest angle back between the two of them.
+ *
+ * The angle returned will be in the same range. If the returned angle is
+ * greater than 0 then it's a counter-clockwise rotation, if < 0 then it's
+ * a clockwise rotation.
+ *
+ * TODO: Wrap the angles in this function?
+ * @param angle1 The first angle in the range -180 to 180.
+ * @param angle2 The second angle in the range -180 to 180.
+ */
+ function ShortestBetween(angle1: number, angle2: number): number;
+
+ /**
+ * Wrap an angle.
+ *
+ * Wraps the angle to a value in the range of -PI to PI.
+ * @param angle The angle to wrap, in radians.
+ */
+ function Wrap(angle: number): number;
+
+ /**
+ * Wrap an angle in degrees.
+ *
+ * Wraps the angle to a value in the range of -180 to 180.
+ * @param angle The angle to wrap, in degrees.
+ */
+ function WrapDegrees(angle: number): number;
+
+ }
+
/**
* Calculate the mean average of the given values.
* @param values The values to average.
@@ -48370,6 +48857,49 @@ declare namespace Phaser {
*/
function Clamp(value: number, min: number, max: number): number;
+ /**
+ * The value of PI * 2.
+ */
+ var PI2: number;
+
+ /**
+ * The value of PI * 0.5.
+ */
+ var TAU: number;
+
+ /**
+ * An epsilon value (1.0e-6)
+ */
+ var EPSILON: number;
+
+ /**
+ * For converting degrees to radians (PI / 180)
+ */
+ var DEG_TO_RAD: number;
+
+ /**
+ * For converting radians to degrees (180 / PI)
+ */
+ var RAD_TO_DEG: number;
+
+ /**
+ * An instance of the Random Number Generator.
+ * This is not set until the Game boots.
+ */
+ var RND: Phaser.Math.RandomDataGenerator;
+
+ /**
+ * The minimum safe integer this browser supports.
+ * We use a const for backward compatibility with Internet Explorer.
+ */
+ var MIN_SAFE_INTEGER: number;
+
+ /**
+ * The maximum safe integer this browser supports.
+ * We use a const for backward compatibility with Internet Explorer.
+ */
+ var MAX_SAFE_INTEGER: number;
+
/**
* Convert the given angle from degrees, to the equivalent angle in radians.
* @param degrees The angle (in degrees) to convert to radians.
@@ -48383,6 +48913,316 @@ declare namespace Phaser {
*/
function Difference(a: number, b: number): number;
+ namespace Distance {
+ /**
+ * Calculate the distance between two sets of coordinates (points).
+ * @param x1 The x coordinate of the first point.
+ * @param y1 The y coordinate of the first point.
+ * @param x2 The x coordinate of the second point.
+ * @param y2 The y coordinate of the second point.
+ */
+ function Between(x1: number, y1: number, x2: number, y2: number): number;
+
+ /**
+ * Calculate the distance between two points.
+ * @param a The first point.
+ * @param b The second point.
+ */
+ function BetweenPoints(a: Phaser.Types.Math.Vector2Like, b: Phaser.Types.Math.Vector2Like): number;
+
+ /**
+ * Calculate the squared distance between two points.
+ * @param a The first point.
+ * @param b The second point.
+ */
+ function BetweenPointsSquared(a: Phaser.Types.Math.Vector2Like, b: Phaser.Types.Math.Vector2Like): number;
+
+ /**
+ * Calculate the Chebyshev distance between two sets of coordinates (points).
+ *
+ * Chebyshev distance (or chessboard distance) is the maximum of the horizontal and vertical distances.
+ * It's the effective distance when movement can be horizontal, vertical, or diagonal.
+ * @param x1 The x coordinate of the first point.
+ * @param y1 The y coordinate of the first point.
+ * @param x2 The x coordinate of the second point.
+ * @param y2 The y coordinate of the second point.
+ */
+ function Chebyshev(x1: number, y1: number, x2: number, y2: number): number;
+
+ /**
+ * Calculate the distance between two sets of coordinates (points) to the power of `pow`.
+ * @param x1 The x coordinate of the first point.
+ * @param y1 The y coordinate of the first point.
+ * @param x2 The x coordinate of the second point.
+ * @param y2 The y coordinate of the second point.
+ * @param pow The exponent.
+ */
+ function Power(x1: number, y1: number, x2: number, y2: number, pow: number): number;
+
+ /**
+ * Calculate the snake distance between two sets of coordinates (points).
+ *
+ * Snake distance (rectilinear distance, Manhattan distance) is the sum of the horizontal and vertical distances.
+ * It's the effective distance when movement is allowed only horizontally or vertically (but not both).
+ * @param x1 The x coordinate of the first point.
+ * @param y1 The y coordinate of the first point.
+ * @param x2 The x coordinate of the second point.
+ * @param y2 The y coordinate of the second point.
+ */
+ function Snake(x1: number, y1: number, x2: number, y2: number): number;
+
+ /**
+ * Calculate the distance between two sets of coordinates (points), squared.
+ * @param x1 The x coordinate of the first point.
+ * @param y1 The y coordinate of the first point.
+ * @param x2 The x coordinate of the second point.
+ * @param y2 The y coordinate of the second point.
+ */
+ function Squared(x1: number, y1: number, x2: number, y2: number): number;
+
+ }
+
+ namespace Easing {
+ namespace Back {
+ /**
+ * Back ease-in.
+ * @param v The value to be tweened.
+ * @param overshoot The overshoot amount. Default 1.70158.
+ */
+ function In(v: number, overshoot?: number): number;
+
+ /**
+ * Back ease-in/out.
+ * @param v The value to be tweened.
+ * @param overshoot The overshoot amount. Default 1.70158.
+ */
+ function InOut(v: number, overshoot?: number): number;
+
+ /**
+ * Back ease-out.
+ * @param v The value to be tweened.
+ * @param overshoot The overshoot amount. Default 1.70158.
+ */
+ function Out(v: number, overshoot?: number): number;
+
+ }
+
+ namespace Bounce {
+ /**
+ * Bounce ease-in.
+ * @param v The value to be tweened.
+ */
+ function In(v: number): number;
+
+ /**
+ * Bounce ease-in/out.
+ * @param v The value to be tweened.
+ */
+ function InOut(v: number): number;
+
+ /**
+ * Bounce ease-out.
+ * @param v The value to be tweened.
+ */
+ function Out(v: number): number;
+
+ }
+
+ namespace Circular {
+ /**
+ * Circular ease-in.
+ * @param v The value to be tweened.
+ */
+ function In(v: number): number;
+
+ /**
+ * Circular ease-in/out.
+ * @param v The value to be tweened.
+ */
+ function InOut(v: number): number;
+
+ /**
+ * Circular ease-out.
+ * @param v The value to be tweened.
+ */
+ function Out(v: number): number;
+
+ }
+
+ namespace Cubic {
+ /**
+ * Cubic ease-in.
+ * @param v The value to be tweened.
+ */
+ function In(v: number): number;
+
+ /**
+ * Cubic ease-in/out.
+ * @param v The value to be tweened.
+ */
+ function InOut(v: number): number;
+
+ /**
+ * Cubic ease-out.
+ * @param v The value to be tweened.
+ */
+ function Out(v: number): number;
+
+ }
+
+ namespace Elastic {
+ /**
+ * Elastic ease-in.
+ * @param v The value to be tweened.
+ * @param amplitude The amplitude of the elastic ease. Default 0.1.
+ * @param period Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. Default 0.1.
+ */
+ function In(v: number, amplitude?: number, period?: number): number;
+
+ /**
+ * Elastic ease-in/out.
+ * @param v The value to be tweened.
+ * @param amplitude The amplitude of the elastic ease. Default 0.1.
+ * @param period Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. Default 0.1.
+ */
+ function InOut(v: number, amplitude?: number, period?: number): number;
+
+ /**
+ * Elastic ease-out.
+ * @param v The value to be tweened.
+ * @param amplitude The amplitude of the elastic ease. Default 0.1.
+ * @param period Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. Default 0.1.
+ */
+ function Out(v: number, amplitude?: number, period?: number): number;
+
+ }
+
+ namespace Expo {
+ /**
+ * Exponential ease-in.
+ * @param v The value to be tweened.
+ */
+ function In(v: number): number;
+
+ /**
+ * Exponential ease-in/out.
+ * @param v The value to be tweened.
+ */
+ function InOut(v: number): number;
+
+ /**
+ * Exponential ease-out.
+ * @param v The value to be tweened.
+ */
+ function Out(v: number): number;
+
+ }
+
+ namespace Linear {
+ /**
+ * Linear easing (no variation).
+ * @param v The value to be tweened.
+ */
+ function Linear(v: number): number;
+
+ }
+
+ namespace Quadratic {
+ /**
+ * Quadratic ease-in.
+ * @param v The value to be tweened.
+ */
+ function In(v: number): number;
+
+ /**
+ * Quadratic ease-in/out.
+ * @param v The value to be tweened.
+ */
+ function InOut(v: number): number;
+
+ /**
+ * Quadratic ease-out.
+ * @param v The value to be tweened.
+ */
+ function Out(v: number): number;
+
+ }
+
+ namespace Quartic {
+ /**
+ * Quartic ease-in.
+ * @param v The value to be tweened.
+ */
+ function In(v: number): number;
+
+ /**
+ * Quartic ease-in/out.
+ * @param v The value to be tweened.
+ */
+ function InOut(v: number): number;
+
+ /**
+ * Quartic ease-out.
+ * @param v The value to be tweened.
+ */
+ function Out(v: number): number;
+
+ }
+
+ namespace Quintic {
+ /**
+ * Quintic ease-in.
+ * @param v The value to be tweened.
+ */
+ function In(v: number): number;
+
+ /**
+ * Quintic ease-in/out.
+ * @param v The value to be tweened.
+ */
+ function InOut(v: number): number;
+
+ /**
+ * Quintic ease-out.
+ * @param v The value to be tweened.
+ */
+ function Out(v: number): number;
+
+ }
+
+ namespace Sine {
+ /**
+ * Sinusoidal ease-in.
+ * @param v The value to be tweened.
+ */
+ function In(v: number): number;
+
+ /**
+ * Sinusoidal ease-in/out.
+ * @param v The value to be tweened.
+ */
+ function InOut(v: number): number;
+
+ /**
+ * Sinusoidal ease-out.
+ * @param v The value to be tweened.
+ */
+ function Out(v: number): number;
+
+ }
+
+ namespace Stepped {
+ /**
+ * Stepped easing.
+ * @param v The value to be tweened.
+ * @param steps The number of steps in the ease. Default 1.
+ */
+ function Stepped(v: number, steps?: number): number;
+
+ }
+
+ }
+
/**
* Calculates the factorial of a given number for integer values greater than 0.
* @param value A positive integer to calculate the factorial of.
@@ -48414,6 +49254,53 @@ declare namespace Phaser {
*/
function FromPercent(percent: number, min: number, max?: number): number;
+ namespace Fuzzy {
+ /**
+ * Calculate the fuzzy ceiling of the given value.
+ * @param value The value.
+ * @param epsilon The epsilon. Default 0.0001.
+ */
+ function Ceil(value: number, epsilon?: number): number;
+
+ /**
+ * Check whether the given values are fuzzily equal.
+ *
+ * Two numbers are fuzzily equal if their difference is less than `epsilon`.
+ * @param a The first value.
+ * @param b The second value.
+ * @param epsilon The epsilon. Default 0.0001.
+ */
+ function Equal(a: number, b: number, epsilon?: number): boolean;
+
+ /**
+ * Calculate the fuzzy floor of the given value.
+ * @param value The value.
+ * @param epsilon The epsilon. Default 0.0001.
+ */
+ function Floor(value: number, epsilon?: number): number;
+
+ /**
+ * Check whether `a` is fuzzily greater than `b`.
+ *
+ * `a` is fuzzily greater than `b` if it is more than `b - epsilon`.
+ * @param a The first value.
+ * @param b The second value.
+ * @param epsilon The epsilon. Default 0.0001.
+ */
+ function GreaterThan(a: number, b: number, epsilon?: number): boolean;
+
+ /**
+ * Check whether `a` is fuzzily less than `b`.
+ *
+ * `a` is fuzzily less than `b` if it is less than `b + epsilon`.
+ * @param a The first value.
+ * @param b The second value.
+ * @param epsilon The epsilon. Default 0.0001.
+ */
+ function LessThan(a: number, b: number, epsilon?: number): boolean;
+
+ }
+
/**
* Calculate a per-ms speed from a distance and time (given in seconds).
* @param distance The distance.
@@ -48421,6 +49308,67 @@ declare namespace Phaser {
*/
function GetSpeed(distance: number, time: integer): number;
+ namespace Interpolation {
+ /**
+ * A bezier interpolation method.
+ * @param v The input array of values to interpolate between.
+ * @param k The percentage of interpolation, between 0 and 1.
+ */
+ function Bezier(v: number[], k: number): number;
+
+ /**
+ * A Catmull-Rom interpolation method.
+ * @param v The input array of values to interpolate between.
+ * @param k The percentage of interpolation, between 0 and 1.
+ */
+ function CatmullRom(v: number[], k: number): number;
+
+ /**
+ * A cubic bezier interpolation method.
+ *
+ * https://medium.com/@adrian_cooney/bezier-interpolation-13b68563313a
+ * @param t The percentage of interpolation, between 0 and 1.
+ * @param p0 The start point.
+ * @param p1 The first control point.
+ * @param p2 The second control point.
+ * @param p3 The end point.
+ */
+ function CubicBezier(t: number, p0: number, p1: number, p2: number, p3: number): number;
+
+ /**
+ * A linear interpolation method.
+ * @param v The input array of values to interpolate between.
+ * @param k The percentage of interpolation, between 0 and 1.
+ */
+ function Linear(v: number[], k: number): number;
+
+ /**
+ * A quadratic bezier interpolation method.
+ * @param t The percentage of interpolation, between 0 and 1.
+ * @param p0 The start point.
+ * @param p1 The control point.
+ * @param p2 The end point.
+ */
+ function QuadraticBezier(t: number, p0: number, p1: number, p2: number): number;
+
+ /**
+ * A Smoother Step interpolation method.
+ * @param t The percentage of interpolation, between 0 and 1.
+ * @param min The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'.
+ * @param max The maximum value, also known as the 'right edge', assumed greater than the 'left edge'.
+ */
+ function SmootherStep(t: number, min: number, max: number): number;
+
+ /**
+ * A Smooth Step interpolation method.
+ * @param t The percentage of interpolation, between 0 and 1.
+ * @param min The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'.
+ * @param max The maximum value, also known as the 'right edge', assumed greater than the 'left edge'.
+ */
+ function SmoothStep(t: number, min: number, max: number): number;
+
+ }
+
/**
* Check if a given value is an even number.
* @param value The number to perform the check with.
@@ -48821,6 +49769,29 @@ declare namespace Phaser {
*/
function Percent(value: number, min: number, max?: number, upperMax?: number): number;
+ namespace Pow2 {
+ /**
+ * Returns the nearest power of 2 to the given `value`.
+ * @param value The value.
+ */
+ function GetNext(value: number): integer;
+
+ /**
+ * Checks if the given `width` and `height` are a power of two.
+ * Useful for checking texture dimensions.
+ * @param width The width.
+ * @param height The height.
+ */
+ function IsSize(width: number, height: number): boolean;
+
+ /**
+ * Tests the value and returns `true` if it is a power of two.
+ * @param value The value to check if it's a power of two.
+ */
+ function IsValue(value: number): boolean;
+
+ }
+
/**
* A quaternion.
*/
@@ -49006,6 +49977,149 @@ declare namespace Phaser {
*/
function RadToDeg(radians: number): integer;
+ /**
+ * A seeded Random Data Generator.
+ *
+ * Access via `Phaser.Math.RND` which is an instance of this class pre-defined
+ * by Phaser. Or, create your own instance to use as you require.
+ *
+ * The `Math.RND` generator is seeded by the Game Config property value `seed`.
+ * If no such config property exists, a random number is used.
+ *
+ * If you create your own instance of this class you should provide a seed for it.
+ * If no seed is given it will use a 'random' one based on Date.now.
+ */
+ class RandomDataGenerator {
+ /**
+ *
+ * @param seeds The seeds to use for the random number generator.
+ */
+ constructor(seeds?: string | string[]);
+
+ /**
+ * Signs to choose from.
+ */
+ signs: number[];
+
+ /**
+ * Initialize the state of the random data generator.
+ * @param seeds The seeds to initialize the random data generator with.
+ */
+ init(seeds: string | string[]): void;
+
+ /**
+ * Reset the seed of the random data generator.
+ *
+ * _Note_: the seed array is only processed up to the first `undefined` (or `null`) value, should such be present.
+ * @param seeds The array of seeds: the `toString()` of each value is used.
+ */
+ sow(seeds: string[]): void;
+
+ /**
+ * Returns a random integer between 0 and 2^32.
+ */
+ integer(): number;
+
+ /**
+ * Returns a random real number between 0 and 1.
+ */
+ frac(): number;
+
+ /**
+ * Returns a random real number between 0 and 2^32.
+ */
+ real(): number;
+
+ /**
+ * Returns a random integer between and including min and max.
+ * @param min The minimum value in the range.
+ * @param max The maximum value in the range.
+ */
+ integerInRange(min: number, max: number): number;
+
+ /**
+ * Returns a random integer between and including min and max.
+ * This method is an alias for RandomDataGenerator.integerInRange.
+ * @param min The minimum value in the range.
+ * @param max The maximum value in the range.
+ */
+ between(min: number, max: number): number;
+
+ /**
+ * Returns a random real number between min and max.
+ * @param min The minimum value in the range.
+ * @param max The maximum value in the range.
+ */
+ realInRange(min: number, max: number): number;
+
+ /**
+ * Returns a random real number between -1 and 1.
+ */
+ normal(): number;
+
+ /**
+ * Returns a valid RFC4122 version4 ID hex string from https://gist.github.com/1308368
+ */
+ uuid(): string;
+
+ /**
+ * Returns a random element from within the given array.
+ * @param array The array to pick a random element from.
+ */
+ pick(array: T[]): T;
+
+ /**
+ * Returns a sign to be used with multiplication operator.
+ */
+ sign(): number;
+
+ /**
+ * Returns a random element from within the given array, favoring the earlier entries.
+ * @param array The array to pick a random element from.
+ */
+ weightedPick(array: T[]): T;
+
+ /**
+ * Returns a random timestamp between min and max, or between the beginning of 2000 and the end of 2020 if min and max aren't specified.
+ * @param min The minimum value in the range.
+ * @param max The maximum value in the range.
+ */
+ timestamp(min: number, max: number): number;
+
+ /**
+ * Returns a random angle between -180 and 180.
+ */
+ angle(): number;
+
+ /**
+ * Returns a random rotation in radians, between -3.141 and 3.141
+ */
+ rotation(): number;
+
+ /**
+ * Gets or Sets the state of the generator. This allows you to retain the values
+ * that the generator is using between games, i.e. in a game save file.
+ *
+ * To seed this generator with a previously saved state you can pass it as the
+ * `seed` value in your game config, or call this method directly after Phaser has booted.
+ *
+ * Call this method with no parameters to return the current state.
+ *
+ * If providing a state it should match the same format that this method
+ * returns, which is a string with a header `!rnd` followed by the `c`,
+ * `s0`, `s1` and `s2` values respectively, each comma-delimited.
+ * @param state Generator state to be set.
+ */
+ state(state?: string): string;
+
+ /**
+ * Shuffles the given array, using the current seed.
+ * @param array The array to be shuffled.
+ */
+ shuffle(array?: T[]): T[];
+
+ }
+
/**
* Compute a random unit vector.
*
@@ -49108,18 +50222,6 @@ declare namespace Phaser {
*/
function SinCosTableGenerator(length: number, sinAmp?: number, cosAmp?: number, frequency?: number): Phaser.Types.Math.SinCosTable;
- /**
- * Calculate a smooth interpolation percentage of `x` between `min` and `max`.
- *
- * The function receives the number `x` as an argument and returns 0 if `x` is less than or equal to the left edge,
- * 1 if `x` is greater than or equal to the right edge, and smoothly interpolates, using a Hermite polynomial,
- * between 0 and 1 otherwise.
- * @param x The input value.
- * @param min The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'.
- * @param max The maximum value, also known as the 'right edge', assumed greater than the 'left edge'.
- */
- function SmoothStep(x: number, min: number, max: number): number;
-
/**
* Calculate a smoother interpolation percentage of `x` between `min` and `max`.
*
@@ -49135,11 +50237,61 @@ declare namespace Phaser {
function SmootherStep(x: number, min: number, max: number): number;
/**
- * Returns a Vec2 containing the x and y position of the given index in a `width` x `height` sized grid.
+ * Calculate a smooth interpolation percentage of `x` between `min` and `max`.
+ *
+ * The function receives the number `x` as an argument and returns 0 if `x` is less than or equal to the left edge,
+ * 1 if `x` is greater than or equal to the right edge, and smoothly interpolates, using a Hermite polynomial,
+ * between 0 and 1 otherwise.
+ * @param x The input value.
+ * @param min The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'.
+ * @param max The maximum value, also known as the 'right edge', assumed greater than the 'left edge'.
+ */
+ function SmoothStep(x: number, min: number, max: number): number;
+
+ namespace Snap {
+ /**
+ * Snap a value to nearest grid slice, using ceil.
+ *
+ * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `15`.
+ * As will `14` snap to `15`... but `16` will snap to `20`.
+ * @param value The value to snap.
+ * @param gap The interval gap of the grid.
+ * @param start Optional starting offset for gap. Default 0.
+ * @param divide If `true` it will divide the snapped value by the gap before returning. Default false.
+ */
+ function Ceil(value: number, gap: number, start?: number, divide?: boolean): number;
+
+ /**
+ * Snap a value to nearest grid slice, using floor.
+ *
+ * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`.
+ * As will `14` snap to `10`... but `16` will snap to `15`.
+ * @param value The value to snap.
+ * @param gap The interval gap of the grid.
+ * @param start Optional starting offset for gap. Default 0.
+ * @param divide If `true` it will divide the snapped value by the gap before returning. Default false.
+ */
+ function Floor(value: number, gap: number, start?: number, divide?: boolean): number;
+
+ /**
+ * Snap a value to nearest grid slice, using rounding.
+ *
+ * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10` whereas `14` will snap to `15`.
+ * @param value The value to snap.
+ * @param gap The interval gap of the grid.
+ * @param start Optional starting offset for gap. Default 0.
+ * @param divide If `true` it will divide the snapped value by the gap before returning. Default false.
+ */
+ function To(value: number, gap: number, start?: number, divide?: boolean): number;
+
+ }
+
+ /**
+ * Returns a Vector2 containing the x and y position of the given index in a `width` x `height` sized grid.
*
* For example, in a 6 x 4 grid, index 16 would equal x: 4 y: 2.
*
- * If the given index is out of range an empty Vec2 is returned.
+ * If the given index is out of range an empty Vector2 is returned.
* @param index The position within the grid to get the x/y value for.
* @param width The width of the grid.
* @param height The height of the grid.
@@ -49838,783 +50990,6 @@ declare namespace Phaser {
*/
function Wrap(value: number, min: number, max: number): number;
- namespace Angle {
- /**
- * Find the angle of a segment from (x1, y1) -> (x2, y2).
- * @param x1 The x coordinate of the first point.
- * @param y1 The y coordinate of the first point.
- * @param x2 The x coordinate of the second point.
- * @param y2 The y coordinate of the second point.
- */
- function Between(x1: number, y1: number, x2: number, y2: number): number;
-
- /**
- * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y).
- *
- * Calculates the angle of the vector from the first point to the second point.
- * @param point1 The first point.
- * @param point2 The second point.
- */
- function BetweenPoints(point1: Phaser.Geom.Point | object, point2: Phaser.Geom.Point | object): number;
-
- /**
- * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y).
- *
- * The difference between this method and {@link Phaser.Math.Angle.BetweenPoints} is that this assumes the y coordinate
- * travels down the screen.
- * @param point1 The first point.
- * @param point2 The second point.
- */
- function BetweenPointsY(point1: Phaser.Geom.Point | object, point2: Phaser.Geom.Point | object): number;
-
- /**
- * Find the angle of a segment from (x1, y1) -> (x2, y2).
- *
- * The difference between this method and {@link Phaser.Math.Angle.Between} is that this assumes the y coordinate
- * travels down the screen.
- * @param x1 The x coordinate of the first point.
- * @param y1 The y coordinate of the first point.
- * @param x2 The x coordinate of the second point.
- * @param y2 The y coordinate of the second point.
- */
- function BetweenY(x1: number, y1: number, x2: number, y2: number): number;
-
- /**
- * Takes an angle in Phasers default clockwise format and converts it so that
- * 0 is North, 90 is West, 180 is South and 270 is East,
- * therefore running counter-clockwise instead of clockwise.
- *
- * You can pass in the angle from a Game Object using:
- *
- * ```javascript
- * var converted = CounterClockwise(gameobject.rotation);
- * ```
- *
- * All values for this function are in radians.
- * @param angle The angle to convert, in radians.
- */
- function CounterClockwise(angle: number): number;
-
- /**
- * Normalize an angle to the [0, 2pi] range.
- * @param angle The angle to normalize, in radians.
- */
- function Normalize(angle: number): number;
-
- /**
- * Reverse the given angle.
- * @param angle The angle to reverse, in radians.
- */
- function Reverse(angle: number): number;
-
- /**
- * Rotates `currentAngle` towards `targetAngle`, taking the shortest rotation distance. The `lerp` argument is the amount to rotate by in this call.
- * @param currentAngle The current angle, in radians.
- * @param targetAngle The target angle to rotate to, in radians.
- * @param lerp The lerp value to add to the current angle. Default 0.05.
- */
- function RotateTo(currentAngle: number, targetAngle: number, lerp?: number): number;
-
- /**
- * Gets the shortest angle between `angle1` and `angle2`.
- *
- * Both angles must be in the range -180 to 180, which is the same clamped
- * range that `sprite.angle` uses, so you can pass in two sprite angles to
- * this method and get the shortest angle back between the two of them.
- *
- * The angle returned will be in the same range. If the returned angle is
- * greater than 0 then it's a counter-clockwise rotation, if < 0 then it's
- * a clockwise rotation.
- *
- * TODO: Wrap the angles in this function?
- * @param angle1 The first angle in the range -180 to 180.
- * @param angle2 The second angle in the range -180 to 180.
- */
- function ShortestBetween(angle1: number, angle2: number): number;
-
- /**
- * Wrap an angle.
- *
- * Wraps the angle to a value in the range of -PI to PI.
- * @param angle The angle to wrap, in radians.
- */
- function Wrap(angle: number): number;
-
- /**
- * Wrap an angle in degrees.
- *
- * Wraps the angle to a value in the range of -180 to 180.
- * @param angle The angle to wrap, in degrees.
- */
- function WrapDegrees(angle: number): number;
-
- }
-
- /**
- * The value of PI * 2.
- */
- var PI2: number;
-
- /**
- * The value of PI * 0.5.
- */
- var TAU: number;
-
- /**
- * An epsilon value (1.0e-6)
- */
- var EPSILON: number;
-
- /**
- * For converting degrees to radians (PI / 180)
- */
- var DEG_TO_RAD: number;
-
- /**
- * For converting radians to degrees (180 / PI)
- */
- var RAD_TO_DEG: number;
-
- /**
- * An instance of the Random Number Generator.
- * This is not set until the Game boots.
- */
- var RND: Phaser.Math.RandomDataGenerator;
-
- /**
- * The minimum safe integer this browser supports.
- * We use a const for backward compatibility with Internet Explorer.
- */
- var MIN_SAFE_INTEGER: number;
-
- /**
- * The maximum safe integer this browser supports.
- * We use a const for backward compatibility with Internet Explorer.
- */
- var MAX_SAFE_INTEGER: number;
-
- namespace Distance {
- /**
- * Calculate the distance between two sets of coordinates (points).
- * @param x1 The x coordinate of the first point.
- * @param y1 The y coordinate of the first point.
- * @param x2 The x coordinate of the second point.
- * @param y2 The y coordinate of the second point.
- */
- function Between(x1: number, y1: number, x2: number, y2: number): number;
-
- /**
- * Calculate the distance between two points.
- * @param a The first point.
- * @param b The second point.
- */
- function BetweenPoints(a: Phaser.Types.Math.Vector2Like, b: Phaser.Types.Math.Vector2Like): number;
-
- /**
- * Calculate the squared distance between two points.
- * @param a The first point.
- * @param b The second point.
- */
- function BetweenPointsSquared(a: Phaser.Types.Math.Vector2Like, b: Phaser.Types.Math.Vector2Like): number;
-
- /**
- * Calculate the Chebyshev distance between two sets of coordinates (points).
- *
- * Chebyshev distance (or chessboard distance) is the maximum of the horizontal and vertical distances.
- * It's the effective distance when movement can be horizontal, vertical, or diagonal.
- * @param x1 The x coordinate of the first point.
- * @param y1 The y coordinate of the first point.
- * @param x2 The x coordinate of the second point.
- * @param y2 The y coordinate of the second point.
- */
- function Chebyshev(x1: number, y1: number, x2: number, y2: number): number;
-
- /**
- * Calculate the distance between two sets of coordinates (points) to the power of `pow`.
- * @param x1 The x coordinate of the first point.
- * @param y1 The y coordinate of the first point.
- * @param x2 The x coordinate of the second point.
- * @param y2 The y coordinate of the second point.
- * @param pow The exponent.
- */
- function Power(x1: number, y1: number, x2: number, y2: number, pow: number): number;
-
- /**
- * Calculate the snake distance between two sets of coordinates (points).
- *
- * Snake distance (rectilinear distance, Manhattan distance) is the sum of the horizontal and vertical distances.
- * It's the effective distance when movement is allowed only horizontally or vertically (but not both).
- * @param x1 The x coordinate of the first point.
- * @param y1 The y coordinate of the first point.
- * @param x2 The x coordinate of the second point.
- * @param y2 The y coordinate of the second point.
- */
- function Snake(x1: number, y1: number, x2: number, y2: number): number;
-
- /**
- * Calculate the distance between two sets of coordinates (points), squared.
- * @param x1 The x coordinate of the first point.
- * @param y1 The y coordinate of the first point.
- * @param x2 The x coordinate of the second point.
- * @param y2 The y coordinate of the second point.
- */
- function Squared(x1: number, y1: number, x2: number, y2: number): number;
-
- }
-
- namespace Easing {
- namespace Back {
- /**
- * Back ease-in.
- * @param v The value to be tweened.
- * @param overshoot The overshoot amount. Default 1.70158.
- */
- function In(v: number, overshoot?: number): number;
-
- /**
- * Back ease-in/out.
- * @param v The value to be tweened.
- * @param overshoot The overshoot amount. Default 1.70158.
- */
- function InOut(v: number, overshoot?: number): number;
-
- /**
- * Back ease-out.
- * @param v The value to be tweened.
- * @param overshoot The overshoot amount. Default 1.70158.
- */
- function Out(v: number, overshoot?: number): number;
-
- }
-
- namespace Bounce {
- /**
- * Bounce ease-in.
- * @param v The value to be tweened.
- */
- function In(v: number): number;
-
- /**
- * Bounce ease-in/out.
- * @param v The value to be tweened.
- */
- function InOut(v: number): number;
-
- /**
- * Bounce ease-out.
- * @param v The value to be tweened.
- */
- function Out(v: number): number;
-
- }
-
- namespace Circular {
- /**
- * Circular ease-in.
- * @param v The value to be tweened.
- */
- function In(v: number): number;
-
- /**
- * Circular ease-in/out.
- * @param v The value to be tweened.
- */
- function InOut(v: number): number;
-
- /**
- * Circular ease-out.
- * @param v The value to be tweened.
- */
- function Out(v: number): number;
-
- }
-
- namespace Cubic {
- /**
- * Cubic ease-in.
- * @param v The value to be tweened.
- */
- function In(v: number): number;
-
- /**
- * Cubic ease-in/out.
- * @param v The value to be tweened.
- */
- function InOut(v: number): number;
-
- /**
- * Cubic ease-out.
- * @param v The value to be tweened.
- */
- function Out(v: number): number;
-
- }
-
- namespace Elastic {
- /**
- * Elastic ease-in.
- * @param v The value to be tweened.
- * @param amplitude The amplitude of the elastic ease. Default 0.1.
- * @param period Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. Default 0.1.
- */
- function In(v: number, amplitude?: number, period?: number): number;
-
- /**
- * Elastic ease-in/out.
- * @param v The value to be tweened.
- * @param amplitude The amplitude of the elastic ease. Default 0.1.
- * @param period Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. Default 0.1.
- */
- function InOut(v: number, amplitude?: number, period?: number): number;
-
- /**
- * Elastic ease-out.
- * @param v The value to be tweened.
- * @param amplitude The amplitude of the elastic ease. Default 0.1.
- * @param period Sets how tight the sine-wave is, where smaller values are tighter waves, which result in more cycles. Default 0.1.
- */
- function Out(v: number, amplitude?: number, period?: number): number;
-
- }
-
- namespace Expo {
- /**
- * Exponential ease-in.
- * @param v The value to be tweened.
- */
- function In(v: number): number;
-
- /**
- * Exponential ease-in/out.
- * @param v The value to be tweened.
- */
- function InOut(v: number): number;
-
- /**
- * Exponential ease-out.
- * @param v The value to be tweened.
- */
- function Out(v: number): number;
-
- }
-
- namespace Linear {
- /**
- * Linear easing (no variation).
- * @param v The value to be tweened.
- */
- function Linear(v: number): number;
-
- }
-
- namespace Quadratic {
- /**
- * Quadratic ease-in.
- * @param v The value to be tweened.
- */
- function In(v: number): number;
-
- /**
- * Quadratic ease-in/out.
- * @param v The value to be tweened.
- */
- function InOut(v: number): number;
-
- /**
- * Quadratic ease-out.
- * @param v The value to be tweened.
- */
- function Out(v: number): number;
-
- }
-
- namespace Quartic {
- /**
- * Quartic ease-in.
- * @param v The value to be tweened.
- */
- function In(v: number): number;
-
- /**
- * Quartic ease-in/out.
- * @param v The value to be tweened.
- */
- function InOut(v: number): number;
-
- /**
- * Quartic ease-out.
- * @param v The value to be tweened.
- */
- function Out(v: number): number;
-
- }
-
- namespace Quintic {
- /**
- * Quintic ease-in.
- * @param v The value to be tweened.
- */
- function In(v: number): number;
-
- /**
- * Quintic ease-in/out.
- * @param v The value to be tweened.
- */
- function InOut(v: number): number;
-
- /**
- * Quintic ease-out.
- * @param v The value to be tweened.
- */
- function Out(v: number): number;
-
- }
-
- namespace Sine {
- /**
- * Sinusoidal ease-in.
- * @param v The value to be tweened.
- */
- function In(v: number): number;
-
- /**
- * Sinusoidal ease-in/out.
- * @param v The value to be tweened.
- */
- function InOut(v: number): number;
-
- /**
- * Sinusoidal ease-out.
- * @param v The value to be tweened.
- */
- function Out(v: number): number;
-
- }
-
- namespace Stepped {
- /**
- * Stepped easing.
- * @param v The value to be tweened.
- * @param steps The number of steps in the ease. Default 1.
- */
- function Stepped(v: number, steps?: number): number;
-
- }
-
- }
-
- namespace Fuzzy {
- /**
- * Calculate the fuzzy ceiling of the given value.
- * @param value The value.
- * @param epsilon The epsilon. Default 0.0001.
- */
- function Ceil(value: number, epsilon?: number): number;
-
- /**
- * Check whether the given values are fuzzily equal.
- *
- * Two numbers are fuzzily equal if their difference is less than `epsilon`.
- * @param a The first value.
- * @param b The second value.
- * @param epsilon The epsilon. Default 0.0001.
- */
- function Equal(a: number, b: number, epsilon?: number): boolean;
-
- /**
- * Calculate the fuzzy floor of the given value.
- * @param value The value.
- * @param epsilon The epsilon. Default 0.0001.
- */
- function Floor(value: number, epsilon?: number): number;
-
- /**
- * Check whether `a` is fuzzily greater than `b`.
- *
- * `a` is fuzzily greater than `b` if it is more than `b - epsilon`.
- * @param a The first value.
- * @param b The second value.
- * @param epsilon The epsilon. Default 0.0001.
- */
- function GreaterThan(a: number, b: number, epsilon?: number): boolean;
-
- /**
- * Check whether `a` is fuzzily less than `b`.
- *
- * `a` is fuzzily less than `b` if it is less than `b + epsilon`.
- * @param a The first value.
- * @param b The second value.
- * @param epsilon The epsilon. Default 0.0001.
- */
- function LessThan(a: number, b: number, epsilon?: number): boolean;
-
- }
-
- namespace Interpolation {
- /**
- * A bezier interpolation method.
- * @param v The input array of values to interpolate between.
- * @param k The percentage of interpolation, between 0 and 1.
- */
- function Bezier(v: number[], k: number): number;
-
- /**
- * A Catmull-Rom interpolation method.
- * @param v The input array of values to interpolate between.
- * @param k The percentage of interpolation, between 0 and 1.
- */
- function CatmullRom(v: number[], k: number): number;
-
- /**
- * A cubic bezier interpolation method.
- *
- * https://medium.com/@adrian_cooney/bezier-interpolation-13b68563313a
- * @param t The percentage of interpolation, between 0 and 1.
- * @param p0 The start point.
- * @param p1 The first control point.
- * @param p2 The second control point.
- * @param p3 The end point.
- */
- function CubicBezier(t: number, p0: number, p1: number, p2: number, p3: number): number;
-
- /**
- * A linear interpolation method.
- * @param v The input array of values to interpolate between.
- * @param k The percentage of interpolation, between 0 and 1.
- */
- function Linear(v: number[], k: number): number;
-
- /**
- * A quadratic bezier interpolation method.
- * @param t The percentage of interpolation, between 0 and 1.
- * @param p0 The start point.
- * @param p1 The control point.
- * @param p2 The end point.
- */
- function QuadraticBezier(t: number, p0: number, p1: number, p2: number): number;
-
- /**
- * A Smooth Step interpolation method.
- * @param t The percentage of interpolation, between 0 and 1.
- * @param min The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'.
- * @param max The maximum value, also known as the 'right edge', assumed greater than the 'left edge'.
- */
- function SmoothStep(t: number, min: number, max: number): number;
-
- /**
- * A Smoother Step interpolation method.
- * @param t The percentage of interpolation, between 0 and 1.
- * @param min The minimum value, also known as the 'left edge', assumed smaller than the 'right edge'.
- * @param max The maximum value, also known as the 'right edge', assumed greater than the 'left edge'.
- */
- function SmootherStep(t: number, min: number, max: number): number;
-
- }
-
- namespace Pow2 {
- /**
- * Returns the nearest power of 2 to the given `value`.
- * @param value The value.
- */
- function GetNext(value: number): integer;
-
- /**
- * Checks if the given `width` and `height` are a power of two.
- * Useful for checking texture dimensions.
- * @param width The width.
- * @param height The height.
- */
- function IsSize(width: number, height: number): boolean;
-
- /**
- * Tests the value and returns `true` if it is a power of two.
- * @param value The value to check if it's a power of two.
- */
- function IsValue(value: number): boolean;
-
- }
-
- /**
- * A seeded Random Data Generator.
- *
- * Access via `Phaser.Math.RND` which is an instance of this class pre-defined
- * by Phaser. Or, create your own instance to use as you require.
- *
- * The `Math.RND` generator is seeded by the Game Config property value `seed`.
- * If no such config property exists, a random number is used.
- *
- * If you create your own instance of this class you should provide a seed for it.
- * If no seed is given it will use a 'random' one based on Date.now.
- */
- class RandomDataGenerator {
- /**
- *
- * @param seeds The seeds to use for the random number generator.
- */
- constructor(seeds?: string | string[]);
-
- /**
- * Signs to choose from.
- */
- signs: number[];
-
- /**
- * Initialize the state of the random data generator.
- * @param seeds The seeds to initialize the random data generator with.
- */
- init(seeds: string | string[]): void;
-
- /**
- * Reset the seed of the random data generator.
- *
- * _Note_: the seed array is only processed up to the first `undefined` (or `null`) value, should such be present.
- * @param seeds The array of seeds: the `toString()` of each value is used.
- */
- sow(seeds: string[]): void;
-
- /**
- * Returns a random integer between 0 and 2^32.
- */
- integer(): number;
-
- /**
- * Returns a random real number between 0 and 1.
- */
- frac(): number;
-
- /**
- * Returns a random real number between 0 and 2^32.
- */
- real(): number;
-
- /**
- * Returns a random integer between and including min and max.
- * @param min The minimum value in the range.
- * @param max The maximum value in the range.
- */
- integerInRange(min: number, max: number): number;
-
- /**
- * Returns a random integer between and including min and max.
- * This method is an alias for RandomDataGenerator.integerInRange.
- * @param min The minimum value in the range.
- * @param max The maximum value in the range.
- */
- between(min: number, max: number): number;
-
- /**
- * Returns a random real number between min and max.
- * @param min The minimum value in the range.
- * @param max The maximum value in the range.
- */
- realInRange(min: number, max: number): number;
-
- /**
- * Returns a random real number between -1 and 1.
- */
- normal(): number;
-
- /**
- * Returns a valid RFC4122 version4 ID hex string from https://gist.github.com/1308368
- */
- uuid(): string;
-
- /**
- * Returns a random element from within the given array.
- * @param array The array to pick a random element from.
- */
- pick(array: T[]): T;
-
- /**
- * Returns a sign to be used with multiplication operator.
- */
- sign(): number;
-
- /**
- * Returns a random element from within the given array, favoring the earlier entries.
- * @param array The array to pick a random element from.
- */
- weightedPick(array: T[]): T;
-
- /**
- * Returns a random timestamp between min and max, or between the beginning of 2000 and the end of 2020 if min and max aren't specified.
- * @param min The minimum value in the range.
- * @param max The maximum value in the range.
- */
- timestamp(min: number, max: number): number;
-
- /**
- * Returns a random angle between -180 and 180.
- */
- angle(): number;
-
- /**
- * Returns a random rotation in radians, between -3.141 and 3.141
- */
- rotation(): number;
-
- /**
- * Gets or Sets the state of the generator. This allows you to retain the values
- * that the generator is using between games, i.e. in a game save file.
- *
- * To seed this generator with a previously saved state you can pass it as the
- * `seed` value in your game config, or call this method directly after Phaser has booted.
- *
- * Call this method with no parameters to return the current state.
- *
- * If providing a state it should match the same format that this method
- * returns, which is a string with a header `!rnd` followed by the `c`,
- * `s0`, `s1` and `s2` values respectively, each comma-delimited.
- * @param state Generator state to be set.
- */
- state(state?: string): string;
-
- /**
- * Shuffles the given array, using the current seed.
- * @param array The array to be shuffled.
- */
- shuffle(array?: T[]): T[];
-
- }
-
- namespace Snap {
- /**
- * Snap a value to nearest grid slice, using ceil.
- *
- * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `15`.
- * As will `14` snap to `15`... but `16` will snap to `20`.
- * @param value The value to snap.
- * @param gap The interval gap of the grid.
- * @param start Optional starting offset for gap. Default 0.
- * @param divide If `true` it will divide the snapped value by the gap before returning. Default false.
- */
- function Ceil(value: number, gap: number, start?: number, divide?: boolean): number;
-
- /**
- * Snap a value to nearest grid slice, using floor.
- *
- * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`.
- * As will `14` snap to `10`... but `16` will snap to `15`.
- * @param value The value to snap.
- * @param gap The interval gap of the grid.
- * @param start Optional starting offset for gap. Default 0.
- * @param divide If `true` it will divide the snapped value by the gap before returning. Default false.
- */
- function Floor(value: number, gap: number, start?: number, divide?: boolean): number;
-
- /**
- * Snap a value to nearest grid slice, using rounding.
- *
- * Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10` whereas `14` will snap to `15`.
- * @param value The value to snap.
- * @param gap The interval gap of the grid.
- * @param start Optional starting offset for gap. Default 0.
- * @param divide If `true` it will divide the snapped value by the gap before returning. Default false.
- */
- function To(value: number, gap: number, start?: number, divide?: boolean): number;
-
- }
-
}
/**
@@ -53438,6 +53813,8 @@ declare namespace Phaser {
shift?: Phaser.Input.Keyboard.Key;
};
+ type KeyboardKeydownCallback = (event: KeyboardEvent)=>void;
+
type KeyComboConfig = {
/**
* If they press the wrong key do we reset the combo?
@@ -53457,8 +53834,6 @@ declare namespace Phaser {
deleteOnMatch?: boolean;
};
- type KeyboardKeydownCallback = (event: KeyboardEvent)=>void;
-
}
/**
@@ -54059,44 +54434,6 @@ declare namespace Phaser {
xhrSettings?: Phaser.Types.Loader.XHRSettingsObject;
};
- type SVGFileConfig = {
- /**
- * The key of the file. Must be unique within both the Loader and the Texture Manager.
- */
- key: string;
- /**
- * The absolute or relative URL to load the file from.
- */
- url?: string;
- /**
- * The default file extension to use if no url is provided.
- */
- extension?: string;
- /**
- * Extra XHR Settings specifically for this file.
- */
- xhrSettings?: Phaser.Types.Loader.XHRSettingsObject;
- /**
- * The svg size configuration object.
- */
- svgConfig?: Phaser.Types.Loader.FileTypes.SVGSizeConfig;
- };
-
- type SVGSizeConfig = {
- /**
- * An optional width. The SVG will be resized to this size before being rendered to a texture.
- */
- width?: integer;
- /**
- * An optional height. The SVG will be resized to this size before being rendered to a texture.
- */
- height?: integer;
- /**
- * An optional scale. If given it overrides the width / height properties. The SVG is scaled by the scale factor before being rendered to a texture.
- */
- scale?: number;
- };
-
type SceneFileConfig = {
/**
* The key of the file. Must be unique within both the Loader and the Text Cache.
@@ -54189,6 +54526,44 @@ declare namespace Phaser {
xhrSettings?: Phaser.Types.Loader.XHRSettingsObject;
};
+ type SVGFileConfig = {
+ /**
+ * The key of the file. Must be unique within both the Loader and the Texture Manager.
+ */
+ key: string;
+ /**
+ * The absolute or relative URL to load the file from.
+ */
+ url?: string;
+ /**
+ * The default file extension to use if no url is provided.
+ */
+ extension?: string;
+ /**
+ * Extra XHR Settings specifically for this file.
+ */
+ xhrSettings?: Phaser.Types.Loader.XHRSettingsObject;
+ /**
+ * The svg size configuration object.
+ */
+ svgConfig?: Phaser.Types.Loader.FileTypes.SVGSizeConfig;
+ };
+
+ type SVGSizeConfig = {
+ /**
+ * An optional width. The SVG will be resized to this size before being rendered to a texture.
+ */
+ width?: integer;
+ /**
+ * An optional height. The SVG will be resized to this size before being rendered to a texture.
+ */
+ height?: integer;
+ /**
+ * An optional scale. If given it overrides the width / height properties. The SVG is scaled by the scale factor before being rendered to a texture.
+ */
+ scale?: number;
+ };
+
type TextFileConfig = {
/**
* The key of the file. Must be unique within both the Loader and the Text Cache.
@@ -55095,6 +55470,182 @@ declare namespace Phaser {
}
namespace Matter {
+ type MatterBody = MatterJS.Body | Phaser.GameObjects.GameObject | Phaser.Physics.Matter.Image | Phaser.Physics.Matter.Sprite | Phaser.Physics.Matter.TileBody;
+
+ type MatterBodyConfig = {
+ /**
+ * An arbitrary string-based name to help identify this body.
+ */
+ label?: string;
+ /**
+ * An array of bodies that make up this body. The first body in the array must always be a self reference to the current body instance. All bodies in the `parts` array together form a single rigid compound body.
+ */
+ parts?: MatterJS.Body[];
+ /**
+ * An object reserved for storing plugin-specific properties.
+ */
+ plugin?: any;
+ /**
+ * A number specifying the angle of the body, in radians.
+ */
+ angle?: number;
+ /**
+ * An array of `Vector` objects that specify the convex hull of the rigid body. These should be provided about the origin `(0, 0)`.
+ */
+ vertices?: Phaser.Types.Math.Vector2Like[];
+ /**
+ * A `Vector` that specifies the current world-space position of the body.
+ */
+ position?: Phaser.Types.Math.Vector2Like;
+ /**
+ * A `Vector` that specifies the force to apply in the current step. It is zeroed after every `Body.update`. See also `Body.applyForce`.
+ */
+ force?: Phaser.Types.Math.Vector2Like;
+ /**
+ * A `Number` that specifies the torque (turning force) to apply in the current step. It is zeroed after every `Body.update`.
+ */
+ torque?: number;
+ /**
+ * A flag that indicates whether a body is a sensor. Sensor triggers collision events, but doesn't react with colliding body physically.
+ */
+ isSensor?: boolean;
+ /**
+ * A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed.
+ */
+ isStatic?: boolean;
+ /**
+ * A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping by the `Matter.Sleeping` module (if sleeping is enabled by the engine).
+ */
+ sleepThreshold?: number;
+ /**
+ * A `Number` that defines the density of the body, that is its mass per unit area. If you pass the density via `Body.create` the `mass` property is automatically calculated for you based on the size (area) of the object. This is generally preferable to simply setting mass and allows for more intuitive definition of materials (e.g. rock has a higher density than wood).
+ */
+ density?: number;
+ /**
+ * A `Number` that defines the restitution (elasticity) of the body. The value is always positive and is in the range `(0, 1)`.
+ */
+ restitution?: number;
+ /**
+ * A `Number` that defines the friction of the body. The value is always positive and is in the range `(0, 1)`. A value of `0` means that the body may slide indefinitely. A value of `1` means the body may come to a stop almost instantly after a force is applied.
+ */
+ friction?: number;
+ /**
+ * A `Number` that defines the static friction of the body (in the Coulomb friction model). A value of `0` means the body will never 'stick' when it is nearly stationary and only dynamic `friction` is used. The higher the value (e.g. `10`), the more force it will take to initially get the body moving when nearly stationary. This value is multiplied with the `friction` property to make it easier to change `friction` and maintain an appropriate amount of static friction.
+ */
+ frictionStatic?: number;
+ /**
+ * A `Number` that defines the air friction of the body (air resistance). A value of `0` means the body will never slow as it moves through space. The higher the value, the faster a body slows when moving through space.
+ */
+ frictionAir?: number;
+ /**
+ * An `Object` that specifies the collision filtering properties of this body.
+ */
+ collisionFilter?: Phaser.Types.Physics.Matter.MatterCollisionFilter;
+ /**
+ * A `Number` that specifies a tolerance on how far a body is allowed to 'sink' or rotate into other bodies. Avoid changing this value unless you understand the purpose of `slop` in physics engines. The default should generally suffice, although very large bodies may require larger values for stable stacking.
+ */
+ slop?: number;
+ /**
+ * A `Number` that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed.
+ */
+ timeScale?: number;
+ /**
+ * A number, or array of numbers, to chamfer the vertices of the body, or a full Chamfer configuration object.
+ */
+ chamfer?: number | number[] | Phaser.Types.Physics.Matter.MatterChamferConfig;
+ /**
+ * The radius of this body if a circle.
+ */
+ circleRadius?: number;
+ /**
+ * A `Number` that defines the mass of the body, although it may be more appropriate to specify the `density` property instead. If you modify this value, you must also modify the `body.inverseMass` property (`1 / mass`).
+ */
+ mass?: number;
+ /**
+ * A `Number` that defines the inverse mass of the body (`1 / mass`). If you modify this value, you must also modify the `body.mass` property.
+ */
+ inverseMass?: number;
+ /**
+ * A `Vector` that specifies the initial scale of the body.
+ */
+ scale?: Phaser.Types.Math.Vector2Like;
+ /**
+ * A `Vector` that scales the influence of World gravity when applied to this body.
+ */
+ gravityScale?: Phaser.Types.Math.Vector2Like;
+ /**
+ * A boolean that toggles if this body should ignore world gravity or not.
+ */
+ ignoreGravity?: boolean;
+ /**
+ * A boolean that toggles if this body should ignore pointer / mouse constraints or not.
+ */
+ ignorePointer?: boolean;
+ /**
+ * The Debug Render configuration object for this body.
+ */
+ render?: Phaser.Types.Physics.Matter.MatterBodyRenderConfig;
+ /**
+ * A callback that is invoked when this Body starts colliding with any other Body. You can register callbacks by providing a function of type `( pair: Matter.Pair) => void`.
+ */
+ onCollideCallback?: Function;
+ /**
+ * A callback that is invoked when this Body stops colliding with any other Body. You can register callbacks by providing a function of type `( pair: Matter.Pair) => void`.
+ */
+ onCollideEndCallback?: Function;
+ /**
+ * A callback that is invoked for the duration that this Body is colliding with any other Body. You can register callbacks by providing a function of type `( pair: Matter.Pair) => void`.
+ */
+ onCollideActiveCallback?: Function;
+ /**
+ * A collision callback dictionary used by the `Body.setOnCollideWith` function.
+ */
+ onCollideWith?: any;
+ };
+
+ type MatterBodyRenderConfig = {
+ /**
+ * Should this body be rendered by the Debug Renderer?
+ */
+ visible?: boolean;
+ /**
+ * The opacity of the body and all parts within it.
+ */
+ opacity?: number;
+ /**
+ * The color value of the fill when rendering this body.
+ */
+ fillColor?: number;
+ /**
+ * The opacity of the fill when rendering this body, a value between 0 and 1.
+ */
+ fillOpacity?: number;
+ /**
+ * The color value of the line stroke when rendering this body.
+ */
+ lineColor?: number;
+ /**
+ * The opacity of the line when rendering this body, a value between 0 and 1.
+ */
+ lineOpacity?: number;
+ /**
+ * If rendering lines, the thickness of the line.
+ */
+ lineThickness?: number;
+ /**
+ * Controls the offset between the body and the parent Game Object, if it has one.
+ */
+ sprite?: object;
+ /**
+ * The horizontal offset between the body and the parent Game Object texture, if it has one.
+ */
+ "sprite.xOffset"?: number;
+ /**
+ * The vertical offset between the body and the parent Game Object texture, if it has one.
+ */
+ "sprite.yOffset"?: number;
+ };
+
type MatterBodyTileOptions = {
/**
* Whether or not the newly created body should be made static. This defaults to true since typically tiles should not be moved.
@@ -55106,6 +55657,25 @@ declare namespace Phaser {
addToWorld?: boolean;
};
+ type MatterChamferConfig = {
+ /**
+ * A single number, or an array, to specify the radius for each vertex.
+ */
+ radius?: number | number[];
+ /**
+ * The quality of the chamfering. -1 means 'auto'.
+ */
+ quality?: number;
+ /**
+ * The minimum quality of the chamfering. The higher this value, the more vertices are created.
+ */
+ qualityMin?: number;
+ /**
+ * The maximum quality of the chamfering. The higher this value, the more vertices are created.
+ */
+ qualityMax?: number;
+ };
+
type MatterCollisionData = {
/**
* Have the pair collided or not?
@@ -55142,19 +55712,19 @@ declare namespace Phaser {
/**
* The collision normal, facing away from Body A.
*/
- normal: vector;
+ normal: MatterJS.Vector;
/**
* The tangent of the collision normal.
*/
- tangent: vector;
+ tangent: MatterJS.Vector;
/**
* The penetration distances between the two bodies.
*/
- penetration: vector;
+ penetration: MatterJS.Vector;
/**
* An array of support points, either exactly one or two points.
*/
- supports: vector[];
+ supports: MatterJS.Vector[];
/**
* The resulting inverse mass from the collision.
*/
@@ -55177,6 +55747,43 @@ declare namespace Phaser {
slop: number;
};
+ /**
+ * An `Object` that specifies the collision filtering properties of this body.
+ *
+ * Collisions between two bodies will obey the following rules:
+ * - If the two bodies have the same non-zero value of `collisionFilter.group`,
+ * they will always collide if the value is positive, and they will never collide
+ * if the value is negative.
+ * - If the two bodies have different values of `collisionFilter.group` or if one
+ * (or both) of the bodies has a value of 0, then the category/mask rules apply as follows:
+ *
+ * Each body belongs to a collision category, given by `collisionFilter.category`. This
+ * value is used as a bit field and the category should have only one bit set, meaning that
+ * the value of this property is a power of two in the range [1, 2^31]. Thus, there are 32
+ * different collision categories available.
+ *
+ * Each body also defines a collision bitmask, given by `collisionFilter.mask` which specifies
+ * the categories it collides with (the value is the bitwise AND value of all these categories).
+ *
+ * Using the category/mask rules, two bodies `A` and `B` collide if each includes the other's
+ * category in its mask, i.e. `(categoryA & maskB) !== 0` and `(categoryB & maskA) !== 0`
+ * are both true.
+ */
+ type MatterCollisionFilter = {
+ /**
+ * A bit field that specifies the collision category this body belongs to. The category value should have only one bit set, for example `0x0001`. This means there are up to 32 unique collision categories available.
+ */
+ category?: number;
+ /**
+ * A bit mask that specifies the collision categories this body may collide with.
+ */
+ mask?: number;
+ /**
+ * An Integer `Number`, that specifies the collision group this body belongs to.
+ */
+ group?: number;
+ };
+
type MatterCollisionPair = {
/**
* The unique auto-generated collision pair id. A combination of the body A and B IDs.
@@ -55193,7 +55800,7 @@ declare namespace Phaser {
/**
* An array containing all of the active contacts between bodies A and B.
*/
- activeContacts: any[];
+ activeContacts: MatterJS.Vector[];
/**
* The amount of separation that occured between bodies A and B.
*/
@@ -55244,7 +55851,149 @@ declare namespace Phaser {
slop: number;
};
+ type MatterConstraintConfig = {
+ /**
+ * An arbitrary string-based name to help identify this constraint.
+ */
+ label?: string;
+ /**
+ * The first possible `Body` that this constraint is attached to.
+ */
+ bodyA?: MatterJS.Body;
+ /**
+ * The second possible `Body` that this constraint is attached to.
+ */
+ bodyB?: MatterJS.Body;
+ /**
+ * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyA` if defined, otherwise a world-space position.
+ */
+ pointA?: Phaser.Types.Math.Vector2Like;
+ /**
+ * A `Vector` that specifies the offset of the constraint from center of the `constraint.bodyB` if defined, otherwise a world-space position.
+ */
+ pointB?: Phaser.Types.Math.Vector2Like;
+ /**
+ * A `Number` that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. A value of `1` means the constraint should be very stiff. A value of `0.2` means the constraint acts like a soft spring.
+ */
+ stiffness?: number;
+ /**
+ * A `Number` that specifies the angular stiffness of the constraint.
+ */
+ angularStiffness?: number;
+ /**
+ * The angleA of the constraint. If bodyA is set, the angle of bodyA is used instead.
+ */
+ angleA?: number;
+ /**
+ * The angleB of the constraint. If bodyB is set, the angle of bodyB is used instead.
+ */
+ angleB?: number;
+ /**
+ * A `Number` that specifies the damping of the constraint, i.e. the amount of resistance applied to each body based on their velocities to limit the amount of oscillation. Damping will only be apparent when the constraint also has a very low `stiffness`. A value of `0.1` means the constraint will apply heavy damping, resulting in little to no oscillation. A value of `0` means the constraint will apply no damping.
+ */
+ damping?: number;
+ /**
+ * A `Number` that specifies the target resting length of the constraint. It is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`.
+ */
+ length?: number;
+ /**
+ * An object reserved for storing plugin-specific properties.
+ */
+ plugin?: any;
+ /**
+ * The Debug Render configuration object for this constraint.
+ */
+ render?: Phaser.Types.Physics.Matter.MatterConstraintRenderConfig;
+ };
+
+ type MatterConstraintRenderConfig = {
+ /**
+ * Should this constraint be rendered by the Debug Renderer?
+ */
+ visible?: boolean;
+ /**
+ * If this constraint has anchors, should they be rendered? Pin constraints never have anchors.
+ */
+ anchors?: boolean;
+ /**
+ * The color value of the line stroke when rendering this constraint.
+ */
+ lineColor?: number;
+ /**
+ * The opacity of the line when rendering this constraint, a value between 0 and 1.
+ */
+ lineOpacity?: number;
+ /**
+ * If rendering lines, the thickness of the line.
+ */
+ lineThickness?: number;
+ /**
+ * The size of the circles drawn when rendering pin constraints.
+ */
+ pinSize?: number;
+ /**
+ * The size of the circles drawn as the constraint anchors.
+ */
+ anchorSize?: number;
+ /**
+ * The color value of constraint anchors.
+ */
+ anchorColor?: number;
+ };
+
type MatterDebugConfig = {
+ /**
+ * Render all of the body axes?
+ */
+ showAxes?: boolean;
+ /**
+ * Render just a single body axis?
+ */
+ showAngleIndicator?: boolean;
+ /**
+ * The color of the body angle / axes lines.
+ */
+ angleColor?: boolean;
+ /**
+ * Render the broadphase grid?
+ */
+ showBroadphase?: boolean;
+ /**
+ * The color of the broadphase grid.
+ */
+ broadphaseColor?: boolean;
+ /**
+ * Render the bounds of the bodies in the world?
+ */
+ showBounds?: boolean;
+ /**
+ * The color of the body bounds.
+ */
+ boundsColor?: boolean;
+ /**
+ * Render the velocity of the bodies in the world?
+ */
+ showVelocity?: boolean;
+ /**
+ * The color of the body velocity line.
+ */
+ velocityColor?: boolean;
+ /**
+ * Render the collision points and normals for colliding pairs.
+ */
+ showCollisions?: boolean;
+ /**
+ * The color of the collision points.
+ */
+ collisionColor?: boolean;
+ /**
+ * Render lines showing the separation between bodies.
+ */
+ showSeparation?: boolean;
+ /**
+ * The color of the body separation line.
+ */
+ separationColor?: boolean;
/**
* Render the dynamic bodies in the world to the Graphics object?
*/
@@ -55253,22 +56002,10 @@ declare namespace Phaser {
* Render the static bodies in the world to the Graphics object?
*/
showStaticBody?: boolean;
- /**
- * Render any sleeping bodies (dynamic or static) in the world to the Graphics object?
- */
- showSleeping?: boolean;
- /**
- * Render all world constraints to the Graphics object?
- */
- showJoint?: boolean;
/**
* When rendering bodies, render the internal edges as well?
*/
showInternalEdges?: boolean;
- /**
- * When rendering polygon bodies, render the convex hull as well?
- */
- showConvexHulls?: boolean;
/**
* Render the bodies using a fill color.
*/
@@ -55305,6 +56042,10 @@ declare namespace Phaser {
* The color value of the line stroke when rendering static bodies.
*/
staticLineColor?: number;
+ /**
+ * Render any sleeping bodies (dynamic or static) in the world to the Graphics object?
+ */
+ showSleeping?: boolean;
/**
* The amount to multiply the opacity of sleeping static bodies by.
*/
@@ -55317,6 +56058,34 @@ declare namespace Phaser {
* The color value of the line stroke when rendering sleeping dynamic bodies.
*/
sleepLineColor?: number;
+ /**
+ * Render bodies or body parts that are flagged as being a sensor?
+ */
+ showSensors?: boolean;
+ /**
+ * The fill color when rendering body sensors.
+ */
+ sensorFillColor?: number;
+ /**
+ * The line color when rendering body sensors.
+ */
+ sensorLineColor?: number;
+ /**
+ * Render the position of non-static bodies?
+ */
+ showPositions?: boolean;
+ /**
+ * The size of the rectangle drawn when rendering the body position.
+ */
+ positionSize?: number;
+ /**
+ * The color value of the rectangle drawn when rendering the body position.
+ */
+ positionColor?: number;
+ /**
+ * Render all world constraints to the Graphics object?
+ */
+ showJoint?: boolean;
/**
* The color value of joints when `showJoint` is set.
*/
@@ -55349,6 +56118,10 @@ declare namespace Phaser {
* The size of the circles drawn as the constraint anchors.
*/
anchorSize?: number;
+ /**
+ * When rendering polygon bodies, render the convex hull as well?
+ */
+ showConvexHulls?: boolean;
/**
* The color value of hulls when `showConvexHulls` is set.
*/
@@ -55386,6 +56159,65 @@ declare namespace Phaser {
deltaMax?: number;
};
+ type MatterSetBodyConfig = {
+ /**
+ * The shape type. Either `rectangle`, `circle`, `trapezoid`, `polygon`, `fromVertices`, `fromVerts` or `fromPhysicsEditor`.
+ */
+ type?: string;
+ /**
+ * The horizontal world position to place the body at.
+ */
+ x?: number;
+ /**
+ * The vertical world position to place the body at.
+ */
+ y?: number;
+ /**
+ * The width of the body.
+ */
+ width?: number;
+ /**
+ * The height of the body.
+ */
+ height?: number;
+ /**
+ * The radius of the body. Used by `circle` and `polygon` shapes.
+ */
+ radius?: number;
+ /**
+ * The max sizes of the body. Used by the `circle` shape.
+ */
+ maxSides?: number;
+ /**
+ * Used by the `trapezoid` shape. The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter.
+ */
+ slope?: number;
+ /**
+ * Used by the `polygon` shape. The number of sides the polygon will have.
+ */
+ sides?: number;
+ /**
+ * Used by the `fromVerts` shape. The vertices data. Either a path string or an array of vertices.
+ */
+ verts?: string | any[];
+ /**
+ * Used by the `fromVerts` shape. Flag internal edges (coincident part edges)
+ */
+ flagInternal?: boolean;
+ /**
+ * Used by the `fromVerts` shape. Whether Matter.js will discard collinear edges (to improve performance).
+ */
+ removeCollinear?: number;
+ /**
+ * Used by the `fromVerts` shape. During decomposition discard parts that have an area less than this.
+ */
+ minimumArea?: number;
+ /**
+ * Should the new body be automatically added to the world?
+ */
+ addToWorld?: boolean;
+ };
+
type MatterTileOptions = {
/**
* An existing Matter body to be used instead of creating a new one.
@@ -55403,9 +56235,9 @@ declare namespace Phaser {
type MatterWorldConfig = {
/**
- * Sets {@link Phaser.Physics.Matter.World#gravity}.
+ * Sets {@link Phaser.Physics.Matter.World#gravity}. If `false` Gravity will be set to zero.
*/
- gravity?: Phaser.Types.Math.Vector2Like;
+ gravity?: Phaser.Types.Math.Vector2Like | boolean;
/**
* Should the world have bounds enabled by default?
*/
@@ -56939,15 +57771,19 @@ declare namespace Phaser {
*/
repeatCounter?: integer;
/**
- * Ease value data.
+ * The property value at the start of the ease.
*/
start?: number;
/**
- * Ease value data.
+ * The current propety value.
*/
current?: number;
/**
- * Ease value data.
+ * The previous property value.
+ */
+ previous?: number;
+ /**
+ * The property value at the end of the ease.
*/
end?: number;
/**
@@ -58036,7 +58872,7 @@ declare namespace Phaser {
/**
* Sets whether this Body collides with the world boundary.
*
- * Optionally also sets the World Bounce values. If the `Body.worldBounce` is null, it's set to a new Vec2 first.
+ * Optionally also sets the World Bounce values. If the `Body.worldBounce` is null, it's set to a new Phaser.Math.Vector2 first.
* @param value `true` if this body should collide with the world bounds, otherwise `false`. Default true.
* @param bounceX If given this will be replace the `worldBounce.x` value.
* @param bounceY If given this will be replace the `worldBounce.y` value.
@@ -59533,7 +60369,7 @@ declare namespace Phaser {
/**
* Sets whether this Body collides with the world boundary.
*
- * Optionally also sets the World Bounce values. If the `Body.worldBounce` is null, it's set to a new Vec2 first.
+ * Optionally also sets the World Bounce values. If the `Body.worldBounce` is null, it's set to a new Phaser.Math.Vector2 first.
* @param value `true` if this body should collide with the world bounds, otherwise `false`. Default true.
* @param bounceX If given this will be replace the `worldBounce.x` value.
* @param bounceY If given this will be replace the `worldBounce.y` value.
@@ -60349,7 +61185,7 @@ declare namespace Phaser {
/**
* Sets whether this Body collides with the world boundary.
*
- * Optionally also sets the World Bounce values. If the `Body.worldBounce` is null, it's set to a new Vec2 first.
+ * Optionally also sets the World Bounce values. If the `Body.worldBounce` is null, it's set to a new Phaser.Math.Vector2 first.
* @param value `true` if this body should collide with the world bounds, otherwise `false`. Default true.
* @param bounceX If given this will be replace the `worldBounce.x` value.
* @param bounceY If given this will be replace the `worldBounce.y` value.
@@ -60651,6 +61487,530 @@ declare namespace Phaser {
}
+ namespace Components {
+ /**
+ * Provides methods used for setting the acceleration properties of an Arcade Physics Body.
+ */
+ interface Acceleration {
+ /**
+ * Sets the body's horizontal and vertical acceleration. If the vertical acceleration value is not provided, the vertical acceleration is set to the same value as the horizontal acceleration.
+ * @param x The horizontal acceleration
+ * @param y The vertical acceleration Default x.
+ */
+ setAcceleration(x: number, y?: number): this;
+ /**
+ * Sets the body's horizontal acceleration.
+ * @param value The horizontal acceleration
+ */
+ setAccelerationX(value: number): this;
+ /**
+ * Sets the body's vertical acceleration.
+ * @param value The vertical acceleration
+ */
+ setAccelerationY(value: number): this;
+ }
+
+ /**
+ * Provides methods used for setting the angular acceleration properties of an Arcade Physics Body.
+ */
+ interface Angular {
+ /**
+ * Sets the angular velocity of the body.
+ *
+ * In Arcade Physics, bodies cannot rotate. They are always axis-aligned.
+ * However, they can have angular motion, which is passed on to the Game Object bound to the body,
+ * causing them to visually rotate, even though the body remains axis-aligned.
+ * @param value The amount of angular velocity.
+ */
+ setAngularVelocity(value: number): this;
+ /**
+ * Sets the angular acceleration of the body.
+ *
+ * In Arcade Physics, bodies cannot rotate. They are always axis-aligned.
+ * However, they can have angular motion, which is passed on to the Game Object bound to the body,
+ * causing them to visually rotate, even though the body remains axis-aligned.
+ * @param value The amount of angular acceleration.
+ */
+ setAngularAcceleration(value: number): this;
+ /**
+ * Sets the angular drag of the body. Drag is applied to the current velocity, providing a form of deceleration.
+ * @param value The amount of drag.
+ */
+ setAngularDrag(value: number): this;
+ }
+
+ /**
+ * Provides methods used for setting the bounce properties of an Arcade Physics Body.
+ */
+ interface Bounce {
+ /**
+ * Sets the bounce values of this body.
+ *
+ * Bounce is the amount of restitution, or elasticity, the body has when it collides with another object.
+ * A value of 1 means that it will retain its full velocity after the rebound. A value of 0 means it will not rebound at all.
+ * @param x The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1.
+ * @param y The amount of vertical bounce to apply on collision. A float, typically between 0 and 1. Default x.
+ */
+ setBounce(x: number, y?: number): this;
+ /**
+ * Sets the horizontal bounce value for this body.
+ * @param value The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1.
+ */
+ setBounceX(value: number): this;
+ /**
+ * Sets the vertical bounce value for this body.
+ * @param value The amount of vertical bounce to apply on collision. A float, typically between 0 and 1.
+ */
+ setBounceY(value: number): this;
+ /**
+ * Sets whether this Body collides with the world boundary.
+ *
+ * Optionally also sets the World Bounce values. If the `Body.worldBounce` is null, it's set to a new Phaser.Math.Vector2 first.
+ * @param value `true` if this body should collide with the world bounds, otherwise `false`. Default true.
+ * @param bounceX If given this will be replace the `worldBounce.x` value.
+ * @param bounceY If given this will be replace the `worldBounce.y` value.
+ */
+ setCollideWorldBounds(value?: boolean, bounceX?: number, bounceY?: number): this;
+ }
+
+ /**
+ * Provides methods used for setting the debug properties of an Arcade Physics Body.
+ */
+ interface Debug {
+ /**
+ * Sets the debug values of this body.
+ *
+ * Bodies will only draw their debug if debug has been enabled for Arcade Physics as a whole.
+ * Note that there is a performance cost in drawing debug displays. It should never be used in production.
+ * @param showBody Set to `true` to have this body render its outline to the debug display.
+ * @param showVelocity Set to `true` to have this body render a velocity marker to the debug display.
+ * @param bodyColor The color of the body outline when rendered to the debug display.
+ */
+ setDebug(showBody: boolean, showVelocity: boolean, bodyColor: number): this;
+ /**
+ * Sets the color of the body outline when it renders to the debug display.
+ * @param value The color of the body outline when rendered to the debug display.
+ */
+ setDebugBodyColor(value: number): this;
+ /**
+ * Set to `true` to have this body render its outline to the debug display.
+ */
+ debugShowBody: boolean;
+ /**
+ * Set to `true` to have this body render a velocity marker to the debug display.
+ */
+ debugShowVelocity: boolean;
+ /**
+ * The color of the body outline when it renders to the debug display.
+ */
+ debugBodyColor: number;
+ }
+
+ /**
+ * Provides methods used for setting the drag properties of an Arcade Physics Body.
+ */
+ interface Drag {
+ /**
+ * Sets the body's horizontal and vertical drag. If the vertical drag value is not provided, the vertical drag is set to the same value as the horizontal drag.
+ *
+ * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time.
+ * It is the absolute loss of velocity due to movement, in pixels per second squared.
+ * The x and y components are applied separately.
+ *
+ * When `useDamping` is true, this is 1 minus the damping factor.
+ * A value of 1 means the Body loses no velocity.
+ * A value of 0.95 means the Body loses 5% of its velocity per step.
+ * A value of 0.5 means the Body loses 50% of its velocity per step.
+ *
+ * Drag is applied only when `acceleration` is zero.
+ * @param x The amount of horizontal drag to apply.
+ * @param y The amount of vertical drag to apply. Default x.
+ */
+ setDrag(x: number, y?: number): this;
+ /**
+ * Sets the body's horizontal drag.
+ *
+ * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time.
+ * It is the absolute loss of velocity due to movement, in pixels per second squared.
+ * The x and y components are applied separately.
+ *
+ * When `useDamping` is true, this is 1 minus the damping factor.
+ * A value of 1 means the Body loses no velocity.
+ * A value of 0.95 means the Body loses 5% of its velocity per step.
+ * A value of 0.5 means the Body loses 50% of its velocity per step.
+ *
+ * Drag is applied only when `acceleration` is zero.
+ * @param value The amount of horizontal drag to apply.
+ */
+ setDragX(value: number): this;
+ /**
+ * Sets the body's vertical drag.
+ *
+ * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time.
+ * It is the absolute loss of velocity due to movement, in pixels per second squared.
+ * The x and y components are applied separately.
+ *
+ * When `useDamping` is true, this is 1 minus the damping factor.
+ * A value of 1 means the Body loses no velocity.
+ * A value of 0.95 means the Body loses 5% of its velocity per step.
+ * A value of 0.5 means the Body loses 50% of its velocity per step.
+ *
+ * Drag is applied only when `acceleration` is zero.
+ * @param value The amount of vertical drag to apply.
+ */
+ setDragY(value: number): this;
+ /**
+ * If this Body is using `drag` for deceleration this function controls how the drag is applied.
+ * If set to `true` drag will use a damping effect rather than a linear approach. If you are
+ * creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in
+ * the game Asteroids) then you will get a far smoother and more visually correct deceleration
+ * by using damping, avoiding the axis-drift that is prone with linear deceleration.
+ *
+ * If you enable this property then you should use far smaller `drag` values than with linear, as
+ * they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow
+ * deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately.
+ * @param value `true` to use damping for deceleration, or `false` to use linear deceleration.
+ */
+ setDamping(value: boolean): this;
+ }
+
+ /**
+ * Provides methods used for setting the enable properties of an Arcade Physics Body.
+ */
+ interface Enable {
+ /**
+ * Enables this Game Object's Body.
+ * @param reset Also reset the Body and place it at (x, y).
+ * @param x The horizontal position to place the Game Object and Body.
+ * @param y The horizontal position to place the Game Object and Body.
+ * @param enableGameObject Also activate this Game Object.
+ * @param showGameObject Also show this Game Object.
+ */
+ enableBody(reset: boolean, x: number, y: number, enableGameObject: boolean, showGameObject: boolean): this;
+ /**
+ * Stops and disables this Game Object's Body.
+ * @param disableGameObject Also deactivate this Game Object. Default false.
+ * @param hideGameObject Also hide this Game Object. Default false.
+ */
+ disableBody(disableGameObject?: boolean, hideGameObject?: boolean): this;
+ /**
+ * Syncs the Body's position and size with its parent Game Object.
+ * You don't need to call this for Dynamic Bodies, as it happens automatically.
+ * But for Static bodies it's a useful way of modifying the position of a Static Body
+ * in the Physics World, based on its Game Object.
+ */
+ refreshBody(): this;
+ }
+
+ /**
+ * Sets the friction (e.g. the amount of velocity reduced over time) of the physics body when moving horizontally in the X axis. The higher than friction, the faster the body will slow down once force stops being applied to it.
+ */
+ interface Friction {
+ /**
+ * Sets the friction (e.g. the amount of velocity reduced over time) of the physics body when moving.
+ * The higher than friction, the faster the body will slow down once force stops being applied to it.
+ * @param x The amount of horizontal friction to apply.
+ * @param y The amount of vertical friction to apply. Default x.
+ */
+ setFriction(x: number, y?: number): this;
+ /**
+ * Sets the friction (e.g. the amount of velocity reduced over time) of the physics body when moving horizontally in the X axis.
+ * The higher than friction, the faster the body will slow down once force stops being applied to it.
+ * @param x The amount of friction to apply.
+ */
+ setFrictionX(x: number): this;
+ /**
+ * Sets the friction (e.g. the amount of velocity reduced over time) of the physics body when moving vertically in the Y axis.
+ * The higher than friction, the faster the body will slow down once force stops being applied to it.
+ * @param x The amount of friction to apply.
+ */
+ setFrictionY(x: number): this;
+ }
+
+ /**
+ * Provides methods for setting the gravity properties of an Arcade Physics Game Object.
+ * Should be applied as a mixin and not used directly.
+ */
+ interface Gravity {
+ /**
+ * Set the X and Y values of the gravitational pull to act upon this Arcade Physics Game Object. Values can be positive or negative. Larger values result in a stronger effect.
+ *
+ * If only one value is provided, this value will be used for both the X and Y axis.
+ * @param x The gravitational force to be applied to the X-axis.
+ * @param y The gravitational force to be applied to the Y-axis. If this is not specified, the X value will be used. Default x.
+ */
+ setGravity(x: number, y?: number): this;
+ /**
+ * Set the gravitational force to be applied to the X axis. Value can be positive or negative. Larger values result in a stronger effect.
+ * @param x The gravitational force to be applied to the X-axis.
+ */
+ setGravityX(x: number): this;
+ /**
+ * Set the gravitational force to be applied to the Y axis. Value can be positive or negative. Larger values result in a stronger effect.
+ * @param y The gravitational force to be applied to the Y-axis.
+ */
+ setGravityY(y: number): this;
+ }
+
+ /**
+ * Provides methods used for setting the immovable properties of an Arcade Physics Body.
+ */
+ interface Immovable {
+ /**
+ * Sets Whether this Body can be moved by collisions with another Body.
+ * @param value Sets if this body can be moved by collisions with another Body. Default true.
+ */
+ setImmovable(value?: boolean): this;
+ }
+
+ /**
+ * Provides methods used for setting the mass properties of an Arcade Physics Body.
+ */
+ interface Mass {
+ /**
+ * Sets the mass of the physics body
+ * @param value New value for the mass of the body.
+ */
+ setMass(value: number): this;
+ }
+
+ /**
+ * This method will search the given circular area and return an array of all physics bodies that
+ * overlap with it. It can return either Dynamic, Static bodies or a mixture of both.
+ *
+ * A body only has to intersect with the search area to be considered, it doesn't have to be fully
+ * contained within it.
+ *
+ * If Arcade Physics is set to use the RTree (which it is by default) then the search is rather fast,
+ * otherwise the search is O(N) for Dynamic Bodies.
+ */
+ interface OverlapCirc {
+ }
+
+ /**
+ * This method will search the given rectangular area and return an array of all physics bodies that
+ * overlap with it. It can return either Dynamic, Static bodies or a mixture of both.
+ *
+ * A body only has to intersect with the search area to be considered, it doesn't have to be fully
+ * contained within it.
+ *
+ * If Arcade Physics is set to use the RTree (which it is by default) then the search for is extremely fast,
+ * otherwise the search is O(N) for Dynamic Bodies.
+ */
+ interface OverlapRect {
+ }
+
+ /**
+ * Provides methods for setting the size of an Arcade Physics Game Object.
+ * Should be applied as a mixin and not used directly.
+ */
+ interface Size {
+ /**
+ * Sets the body offset. This allows you to adjust the difference between the center of the body
+ * and the x and y coordinates of the parent Game Object.
+ * @param x The amount to offset the body from the parent Game Object along the x-axis.
+ * @param y The amount to offset the body from the parent Game Object along the y-axis. Defaults to the value given for the x-axis. Default x.
+ */
+ setOffset(x: number, y?: number): this;
+ /**
+ * Sets the size of this physics body. Setting the size does not adjust the dimensions
+ * of the parent Game Object.
+ * @param width The new width of the physics body, in pixels.
+ * @param height The new height of the physics body, in pixels.
+ * @param center Should the body be re-positioned so its center aligns with the parent Game Object? Default true.
+ */
+ setSize(width: number, height: number, center?: boolean): this;
+ /**
+ * Sets this physics body to use a circle for collision instead of a rectangle.
+ * @param radius The radius of the physics body, in pixels.
+ * @param offsetX The amount to offset the body from the parent Game Object along the x-axis.
+ * @param offsetY The amount to offset the body from the parent Game Object along the y-axis.
+ */
+ setCircle(radius: number, offsetX?: number, offsetY?: number): this;
+ }
+
+ /**
+ * Provides methods for modifying the velocity of an Arcade Physics body.
+ *
+ * Should be applied as a mixin and not used directly.
+ */
+ interface Velocity {
+ /**
+ * Sets the velocity of the Body.
+ * @param x The horizontal velocity of the body. Positive values move the body to the right, while negative values move it to the left.
+ * @param y The vertical velocity of the body. Positive values move the body down, while negative values move it up. Default x.
+ */
+ setVelocity(x: number, y?: number): this;
+ /**
+ * Sets the horizontal component of the body's velocity.
+ *
+ * Positive values move the body to the right, while negative values move it to the left.
+ * @param x The new horizontal velocity.
+ */
+ setVelocityX(x: number): this;
+ /**
+ * Sets the vertical component of the body's velocity.
+ *
+ * Positive values move the body down, while negative values move it up.
+ * @param y The new vertical velocity of the body.
+ */
+ setVelocityY(y: number): this;
+ /**
+ * Sets the maximum velocity of the body.
+ * @param x The new maximum horizontal velocity.
+ * @param y The new maximum vertical velocity. Default x.
+ */
+ setMaxVelocity(x: number, y?: number): this;
+ }
+
+ }
+
+ /**
+ * Dynamic Body.
+ */
+ var DYNAMIC_BODY: number;
+
+ /**
+ * Static Body.
+ */
+ var STATIC_BODY: number;
+
+ /**
+ * Arcade Physics Group containing Dynamic Bodies.
+ */
+ var GROUP: number;
+
+ /**
+ * A Tilemap Layer.
+ */
+ var TILEMAPLAYER: number;
+
+ /**
+ * Facing no direction (initial value).
+ */
+ var FACING_NONE: number;
+
+ /**
+ * Facing up.
+ */
+ var FACING_UP: number;
+
+ /**
+ * Facing down.
+ */
+ var FACING_DOWN: number;
+
+ /**
+ * Facing left.
+ */
+ var FACING_LEFT: number;
+
+ /**
+ * Facing right.
+ */
+ var FACING_RIGHT: number;
+
+ namespace Events {
+ /**
+ * The Arcade Physics World Collide Event.
+ *
+ * This event is dispatched by an Arcade Physics World instance if two bodies collide _and_ at least
+ * one of them has their [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`.
+ *
+ * It provides an alternative means to handling collide events rather than using the callback approach.
+ *
+ * Listen to it from a Scene using: `this.physics.world.on('collide', listener)`.
+ *
+ * Please note that 'collide' and 'overlap' are two different things in Arcade Physics.
+ */
+ const COLLIDE: any;
+
+ /**
+ * The Arcade Physics World Overlap Event.
+ *
+ * This event is dispatched by an Arcade Physics World instance if two bodies overlap _and_ at least
+ * one of them has their [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`.
+ *
+ * It provides an alternative means to handling overlap events rather than using the callback approach.
+ *
+ * Listen to it from a Scene using: `this.physics.world.on('overlap', listener)`.
+ *
+ * Please note that 'collide' and 'overlap' are two different things in Arcade Physics.
+ */
+ const OVERLAP: any;
+
+ /**
+ * The Arcade Physics World Pause Event.
+ *
+ * This event is dispatched by an Arcade Physics World instance when it is paused.
+ *
+ * Listen to it from a Scene using: `this.physics.world.on('pause', listener)`.
+ */
+ const PAUSE: any;
+
+ /**
+ * The Arcade Physics World Resume Event.
+ *
+ * This event is dispatched by an Arcade Physics World instance when it resumes from a paused state.
+ *
+ * Listen to it from a Scene using: `this.physics.world.on('resume', listener)`.
+ */
+ const RESUME: any;
+
+ /**
+ * The Arcade Physics Tile Collide Event.
+ *
+ * This event is dispatched by an Arcade Physics World instance if a body collides with a Tile _and_
+ * has its [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`.
+ *
+ * It provides an alternative means to handling collide events rather than using the callback approach.
+ *
+ * Listen to it from a Scene using: `this.physics.world.on('tilecollide', listener)`.
+ *
+ * Please note that 'collide' and 'overlap' are two different things in Arcade Physics.
+ */
+ const TILE_COLLIDE: any;
+
+ /**
+ * The Arcade Physics Tile Overlap Event.
+ *
+ * This event is dispatched by an Arcade Physics World instance if a body overlaps with a Tile _and_
+ * has its [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`.
+ *
+ * It provides an alternative means to handling overlap events rather than using the callback approach.
+ *
+ * Listen to it from a Scene using: `this.physics.world.on('tileoverlap', listener)`.
+ *
+ * Please note that 'collide' and 'overlap' are two different things in Arcade Physics.
+ */
+ const TILE_OVERLAP: any;
+
+ /**
+ * The Arcade Physics World Bounds Event.
+ *
+ * This event is dispatched by an Arcade Physics World instance if a body makes contact with the world bounds _and_
+ * it has its [onWorldBounds]{@link Phaser.Physics.Arcade.Body#onWorldBounds} property set to `true`.
+ *
+ * It provides an alternative means to handling collide events rather than using the callback approach.
+ *
+ * Listen to it from a Scene using: `this.physics.world.on('worldbounds', listener)`.
+ */
+ const WORLD_BOUNDS: any;
+
+ /**
+ * The Arcade Physics World Step Event.
+ *
+ * This event is dispatched by an Arcade Physics World instance whenever a physics step is run.
+ * It is emitted _after_ the bodies and colliders have been updated.
+ *
+ * In high framerate settings this can be multiple times per game frame.
+ *
+ * Listen to it from a Scene using: `this.physics.world.on('worldstep', listener)`.
+ */
+ const WORLD_STEP: any;
+
+ }
+
/**
* The Arcade Physics Factory allows you to easily create Arcade Physics enabled Game Objects.
* Objects that are created by this Factory are automatically added to the physics world.
@@ -61304,6 +62664,73 @@ declare namespace Phaser {
}
+ namespace Tilemap {
+ /**
+ * A function to process the collision callbacks between a single tile and an Arcade Physics enabled Game Object.
+ * @param tile The Tile to process.
+ * @param sprite The Game Object to process with the Tile.
+ */
+ function ProcessTileCallbacks(tile: Phaser.Tilemaps.Tile, sprite: Phaser.GameObjects.Sprite): boolean;
+
+ /**
+ * Internal function to process the separation of a physics body from a tile.
+ * @param body The Body object to separate.
+ * @param x The x separation amount.
+ */
+ function ProcessTileSeparationX(body: Phaser.Physics.Arcade.Body, x: number): void;
+
+ /**
+ * Internal function to process the separation of a physics body from a tile.
+ * @param body The Body object to separate.
+ * @param y The y separation amount.
+ */
+ function ProcessTileSeparationY(body: Phaser.Physics.Arcade.Body, y: number): void;
+
+ /**
+ * The core separation function to separate a physics body and a tile.
+ * @param i The index of the tile within the map data.
+ * @param body The Body object to separate.
+ * @param tile The tile to collide against.
+ * @param tileWorldRect A rectangle-like object defining the dimensions of the tile.
+ * @param tilemapLayer The tilemapLayer to collide against.
+ * @param tileBias The tile bias value. Populated by the `World.TILE_BIAS` constant.
+ * @param isLayer Is this check coming from a TilemapLayer or an array of tiles?
+ */
+ function SeparateTile(i: number, body: Phaser.Physics.Arcade.Body, tile: Phaser.Tilemaps.Tile, tileWorldRect: Phaser.Geom.Rectangle, tilemapLayer: Phaser.Tilemaps.DynamicTilemapLayer | Phaser.Tilemaps.StaticTilemapLayer, tileBias: number, isLayer: boolean): boolean;
+
+ /**
+ * Check the body against the given tile on the X axis.
+ * Used internally by the SeparateTile function.
+ * @param body The Body object to separate.
+ * @param tile The tile to check.
+ * @param tileLeft The left position of the tile within the tile world.
+ * @param tileRight The right position of the tile within the tile world.
+ * @param tileBias The tile bias value. Populated by the `World.TILE_BIAS` constant.
+ * @param isLayer Is this check coming from a TilemapLayer or an array of tiles?
+ */
+ function TileCheckX(body: Phaser.Physics.Arcade.Body, tile: Phaser.Tilemaps.Tile, tileLeft: number, tileRight: number, tileBias: number, isLayer: boolean): number;
+
+ /**
+ * Check the body against the given tile on the Y axis.
+ * Used internally by the SeparateTile function.
+ * @param body The Body object to separate.
+ * @param tile The tile to check.
+ * @param tileTop The top position of the tile within the tile world.
+ * @param tileBottom The bottom position of the tile within the tile world.
+ * @param tileBias The tile bias value. Populated by the `World.TILE_BIAS` constant.
+ * @param isLayer Is this check coming from a TilemapLayer or an array of tiles?
+ */
+ function TileCheckY(body: Phaser.Physics.Arcade.Body, tile: Phaser.Tilemaps.Tile, tileTop: number, tileBottom: number, tileBias: number, isLayer: boolean): number;
+
+ /**
+ * Checks for intersection between the given tile rectangle-like object and an Arcade Physics body.
+ * @param tileWorldRect A rectangle object that defines the tile placement in the world.
+ * @param body The body to check for intersection against.
+ */
+ function TileIntersectsBody(tileWorldRect: Object, body: Phaser.Physics.Arcade.Body): boolean;
+
+ }
+
/**
* The Arcade Physics World.
*
@@ -61878,597 +63305,6 @@ declare namespace Phaser {
}
- namespace Components {
- /**
- * Provides methods used for setting the acceleration properties of an Arcade Physics Body.
- */
- interface Acceleration {
- /**
- * Sets the body's horizontal and vertical acceleration. If the vertical acceleration value is not provided, the vertical acceleration is set to the same value as the horizontal acceleration.
- * @param x The horizontal acceleration
- * @param y The vertical acceleration Default x.
- */
- setAcceleration(x: number, y?: number): this;
- /**
- * Sets the body's horizontal acceleration.
- * @param value The horizontal acceleration
- */
- setAccelerationX(value: number): this;
- /**
- * Sets the body's vertical acceleration.
- * @param value The vertical acceleration
- */
- setAccelerationY(value: number): this;
- }
-
- /**
- * Provides methods used for setting the angular acceleration properties of an Arcade Physics Body.
- */
- interface Angular {
- /**
- * Sets the angular velocity of the body.
- *
- * In Arcade Physics, bodies cannot rotate. They are always axis-aligned.
- * However, they can have angular motion, which is passed on to the Game Object bound to the body,
- * causing them to visually rotate, even though the body remains axis-aligned.
- * @param value The amount of angular velocity.
- */
- setAngularVelocity(value: number): this;
- /**
- * Sets the angular acceleration of the body.
- *
- * In Arcade Physics, bodies cannot rotate. They are always axis-aligned.
- * However, they can have angular motion, which is passed on to the Game Object bound to the body,
- * causing them to visually rotate, even though the body remains axis-aligned.
- * @param value The amount of angular acceleration.
- */
- setAngularAcceleration(value: number): this;
- /**
- * Sets the angular drag of the body. Drag is applied to the current velocity, providing a form of deceleration.
- * @param value The amount of drag.
- */
- setAngularDrag(value: number): this;
- }
-
- /**
- * Provides methods used for setting the bounce properties of an Arcade Physics Body.
- */
- interface Bounce {
- /**
- * Sets the bounce values of this body.
- *
- * Bounce is the amount of restitution, or elasticity, the body has when it collides with another object.
- * A value of 1 means that it will retain its full velocity after the rebound. A value of 0 means it will not rebound at all.
- * @param x The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1.
- * @param y The amount of vertical bounce to apply on collision. A float, typically between 0 and 1. Default x.
- */
- setBounce(x: number, y?: number): this;
- /**
- * Sets the horizontal bounce value for this body.
- * @param value The amount of horizontal bounce to apply on collision. A float, typically between 0 and 1.
- */
- setBounceX(value: number): this;
- /**
- * Sets the vertical bounce value for this body.
- * @param value The amount of vertical bounce to apply on collision. A float, typically between 0 and 1.
- */
- setBounceY(value: number): this;
- /**
- * Sets whether this Body collides with the world boundary.
- *
- * Optionally also sets the World Bounce values. If the `Body.worldBounce` is null, it's set to a new Vec2 first.
- * @param value `true` if this body should collide with the world bounds, otherwise `false`. Default true.
- * @param bounceX If given this will be replace the `worldBounce.x` value.
- * @param bounceY If given this will be replace the `worldBounce.y` value.
- */
- setCollideWorldBounds(value?: boolean, bounceX?: number, bounceY?: number): this;
- }
-
- /**
- * Provides methods used for setting the debug properties of an Arcade Physics Body.
- */
- interface Debug {
- /**
- * Sets the debug values of this body.
- *
- * Bodies will only draw their debug if debug has been enabled for Arcade Physics as a whole.
- * Note that there is a performance cost in drawing debug displays. It should never be used in production.
- * @param showBody Set to `true` to have this body render its outline to the debug display.
- * @param showVelocity Set to `true` to have this body render a velocity marker to the debug display.
- * @param bodyColor The color of the body outline when rendered to the debug display.
- */
- setDebug(showBody: boolean, showVelocity: boolean, bodyColor: number): this;
- /**
- * Sets the color of the body outline when it renders to the debug display.
- * @param value The color of the body outline when rendered to the debug display.
- */
- setDebugBodyColor(value: number): this;
- /**
- * Set to `true` to have this body render its outline to the debug display.
- */
- debugShowBody: boolean;
- /**
- * Set to `true` to have this body render a velocity marker to the debug display.
- */
- debugShowVelocity: boolean;
- /**
- * The color of the body outline when it renders to the debug display.
- */
- debugBodyColor: number;
- }
-
- /**
- * Provides methods used for setting the drag properties of an Arcade Physics Body.
- */
- interface Drag {
- /**
- * Sets the body's horizontal and vertical drag. If the vertical drag value is not provided, the vertical drag is set to the same value as the horizontal drag.
- *
- * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time.
- * It is the absolute loss of velocity due to movement, in pixels per second squared.
- * The x and y components are applied separately.
- *
- * When `useDamping` is true, this is 1 minus the damping factor.
- * A value of 1 means the Body loses no velocity.
- * A value of 0.95 means the Body loses 5% of its velocity per step.
- * A value of 0.5 means the Body loses 50% of its velocity per step.
- *
- * Drag is applied only when `acceleration` is zero.
- * @param x The amount of horizontal drag to apply.
- * @param y The amount of vertical drag to apply. Default x.
- */
- setDrag(x: number, y?: number): this;
- /**
- * Sets the body's horizontal drag.
- *
- * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time.
- * It is the absolute loss of velocity due to movement, in pixels per second squared.
- * The x and y components are applied separately.
- *
- * When `useDamping` is true, this is 1 minus the damping factor.
- * A value of 1 means the Body loses no velocity.
- * A value of 0.95 means the Body loses 5% of its velocity per step.
- * A value of 0.5 means the Body loses 50% of its velocity per step.
- *
- * Drag is applied only when `acceleration` is zero.
- * @param value The amount of horizontal drag to apply.
- */
- setDragX(value: number): this;
- /**
- * Sets the body's vertical drag.
- *
- * Drag can be considered as a form of deceleration that will return the velocity of a body back to zero over time.
- * It is the absolute loss of velocity due to movement, in pixels per second squared.
- * The x and y components are applied separately.
- *
- * When `useDamping` is true, this is 1 minus the damping factor.
- * A value of 1 means the Body loses no velocity.
- * A value of 0.95 means the Body loses 5% of its velocity per step.
- * A value of 0.5 means the Body loses 50% of its velocity per step.
- *
- * Drag is applied only when `acceleration` is zero.
- * @param value The amount of vertical drag to apply.
- */
- setDragY(value: number): this;
- /**
- * If this Body is using `drag` for deceleration this function controls how the drag is applied.
- * If set to `true` drag will use a damping effect rather than a linear approach. If you are
- * creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in
- * the game Asteroids) then you will get a far smoother and more visually correct deceleration
- * by using damping, avoiding the axis-drift that is prone with linear deceleration.
- *
- * If you enable this property then you should use far smaller `drag` values than with linear, as
- * they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow
- * deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately.
- * @param value `true` to use damping for deceleration, or `false` to use linear deceleration.
- */
- setDamping(value: boolean): this;
- }
-
- /**
- * Provides methods used for setting the enable properties of an Arcade Physics Body.
- */
- interface Enable {
- /**
- * Enables this Game Object's Body.
- * @param reset Also reset the Body and place it at (x, y).
- * @param x The horizontal position to place the Game Object and Body.
- * @param y The horizontal position to place the Game Object and Body.
- * @param enableGameObject Also activate this Game Object.
- * @param showGameObject Also show this Game Object.
- */
- enableBody(reset: boolean, x: number, y: number, enableGameObject: boolean, showGameObject: boolean): this;
- /**
- * Stops and disables this Game Object's Body.
- * @param disableGameObject Also deactivate this Game Object. Default false.
- * @param hideGameObject Also hide this Game Object. Default false.
- */
- disableBody(disableGameObject?: boolean, hideGameObject?: boolean): this;
- /**
- * Syncs the Body's position and size with its parent Game Object.
- * You don't need to call this for Dynamic Bodies, as it happens automatically.
- * But for Static bodies it's a useful way of modifying the position of a Static Body
- * in the Physics World, based on its Game Object.
- */
- refreshBody(): this;
- }
-
- /**
- * Sets the friction (e.g. the amount of velocity reduced over time) of the physics body when moving horizontally in the X axis. The higher than friction, the faster the body will slow down once force stops being applied to it.
- */
- interface Friction {
- /**
- * Sets the friction (e.g. the amount of velocity reduced over time) of the physics body when moving.
- * The higher than friction, the faster the body will slow down once force stops being applied to it.
- * @param x The amount of horizontal friction to apply.
- * @param y The amount of vertical friction to apply. Default x.
- */
- setFriction(x: number, y?: number): this;
- /**
- * Sets the friction (e.g. the amount of velocity reduced over time) of the physics body when moving horizontally in the X axis.
- * The higher than friction, the faster the body will slow down once force stops being applied to it.
- * @param x The amount of friction to apply.
- */
- setFrictionX(x: number): this;
- /**
- * Sets the friction (e.g. the amount of velocity reduced over time) of the physics body when moving vertically in the Y axis.
- * The higher than friction, the faster the body will slow down once force stops being applied to it.
- * @param x The amount of friction to apply.
- */
- setFrictionY(x: number): this;
- }
-
- /**
- * Provides methods for setting the gravity properties of an Arcade Physics Game Object.
- * Should be applied as a mixin and not used directly.
- */
- interface Gravity {
- /**
- * Set the X and Y values of the gravitational pull to act upon this Arcade Physics Game Object. Values can be positive or negative. Larger values result in a stronger effect.
- *
- * If only one value is provided, this value will be used for both the X and Y axis.
- * @param x The gravitational force to be applied to the X-axis.
- * @param y The gravitational force to be applied to the Y-axis. If this is not specified, the X value will be used. Default x.
- */
- setGravity(x: number, y?: number): this;
- /**
- * Set the gravitational force to be applied to the X axis. Value can be positive or negative. Larger values result in a stronger effect.
- * @param x The gravitational force to be applied to the X-axis.
- */
- setGravityX(x: number): this;
- /**
- * Set the gravitational force to be applied to the Y axis. Value can be positive or negative. Larger values result in a stronger effect.
- * @param y The gravitational force to be applied to the Y-axis.
- */
- setGravityY(y: number): this;
- }
-
- /**
- * Provides methods used for setting the immovable properties of an Arcade Physics Body.
- */
- interface Immovable {
- /**
- * Sets Whether this Body can be moved by collisions with another Body.
- * @param value Sets if this body can be moved by collisions with another Body. Default true.
- */
- setImmovable(value?: boolean): this;
- }
-
- /**
- * Provides methods used for setting the mass properties of an Arcade Physics Body.
- */
- interface Mass {
- /**
- * Sets the mass of the physics body
- * @param value New value for the mass of the body.
- */
- setMass(value: number): this;
- }
-
- /**
- * This method will search the given circular area and return an array of all physics bodies that
- * overlap with it. It can return either Dynamic, Static bodies or a mixture of both.
- *
- * A body only has to intersect with the search area to be considered, it doesn't have to be fully
- * contained within it.
- *
- * If Arcade Physics is set to use the RTree (which it is by default) then the search is rather fast,
- * otherwise the search is O(N) for Dynamic Bodies.
- */
- interface OverlapCirc {
- }
-
- /**
- * This method will search the given rectangular area and return an array of all physics bodies that
- * overlap with it. It can return either Dynamic, Static bodies or a mixture of both.
- *
- * A body only has to intersect with the search area to be considered, it doesn't have to be fully
- * contained within it.
- *
- * If Arcade Physics is set to use the RTree (which it is by default) then the search for is extremely fast,
- * otherwise the search is O(N) for Dynamic Bodies.
- */
- interface OverlapRect {
- }
-
- /**
- * Provides methods for setting the size of an Arcade Physics Game Object.
- * Should be applied as a mixin and not used directly.
- */
- interface Size {
- /**
- * Sets the body offset. This allows you to adjust the difference between the center of the body
- * and the x and y coordinates of the parent Game Object.
- * @param x The amount to offset the body from the parent Game Object along the x-axis.
- * @param y The amount to offset the body from the parent Game Object along the y-axis. Defaults to the value given for the x-axis. Default x.
- */
- setOffset(x: number, y?: number): this;
- /**
- * Sets the size of this physics body. Setting the size does not adjust the dimensions
- * of the parent Game Object.
- * @param width The new width of the physics body, in pixels.
- * @param height The new height of the physics body, in pixels.
- * @param center Should the body be re-positioned so its center aligns with the parent Game Object? Default true.
- */
- setSize(width: number, height: number, center?: boolean): this;
- /**
- * Sets this physics body to use a circle for collision instead of a rectangle.
- * @param radius The radius of the physics body, in pixels.
- * @param offsetX The amount to offset the body from the parent Game Object along the x-axis.
- * @param offsetY The amount to offset the body from the parent Game Object along the y-axis.
- */
- setCircle(radius: number, offsetX?: number, offsetY?: number): this;
- }
-
- /**
- * Provides methods for modifying the velocity of an Arcade Physics body.
- *
- * Should be applied as a mixin and not used directly.
- */
- interface Velocity {
- /**
- * Sets the velocity of the Body.
- * @param x The horizontal velocity of the body. Positive values move the body to the right, while negative values move it to the left.
- * @param y The vertical velocity of the body. Positive values move the body down, while negative values move it up. Default x.
- */
- setVelocity(x: number, y?: number): this;
- /**
- * Sets the horizontal component of the body's velocity.
- *
- * Positive values move the body to the right, while negative values move it to the left.
- * @param x The new horizontal velocity.
- */
- setVelocityX(x: number): this;
- /**
- * Sets the vertical component of the body's velocity.
- *
- * Positive values move the body down, while negative values move it up.
- * @param y The new vertical velocity of the body.
- */
- setVelocityY(y: number): this;
- /**
- * Sets the maximum velocity of the body.
- * @param x The new maximum horizontal velocity.
- * @param y The new maximum vertical velocity. Default x.
- */
- setMaxVelocity(x: number, y?: number): this;
- }
-
- }
-
- /**
- * Dynamic Body.
- */
- var DYNAMIC_BODY: number;
-
- /**
- * Static Body.
- */
- var STATIC_BODY: number;
-
- /**
- * Arcade Physics Group containing Dynamic Bodies.
- */
- var GROUP: number;
-
- /**
- * A Tilemap Layer.
- */
- var TILEMAPLAYER: number;
-
- /**
- * Facing no direction (initial value).
- */
- var FACING_NONE: number;
-
- /**
- * Facing up.
- */
- var FACING_UP: number;
-
- /**
- * Facing down.
- */
- var FACING_DOWN: number;
-
- /**
- * Facing left.
- */
- var FACING_LEFT: number;
-
- /**
- * Facing right.
- */
- var FACING_RIGHT: number;
-
- namespace Events {
- /**
- * The Arcade Physics World Collide Event.
- *
- * This event is dispatched by an Arcade Physics World instance if two bodies collide _and_ at least
- * one of them has their [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`.
- *
- * It provides an alternative means to handling collide events rather than using the callback approach.
- *
- * Listen to it from a Scene using: `this.physics.world.on('collide', listener)`.
- *
- * Please note that 'collide' and 'overlap' are two different things in Arcade Physics.
- */
- const COLLIDE: any;
-
- /**
- * The Arcade Physics World Overlap Event.
- *
- * This event is dispatched by an Arcade Physics World instance if two bodies overlap _and_ at least
- * one of them has their [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`.
- *
- * It provides an alternative means to handling overlap events rather than using the callback approach.
- *
- * Listen to it from a Scene using: `this.physics.world.on('overlap', listener)`.
- *
- * Please note that 'collide' and 'overlap' are two different things in Arcade Physics.
- */
- const OVERLAP: any;
-
- /**
- * The Arcade Physics World Pause Event.
- *
- * This event is dispatched by an Arcade Physics World instance when it is paused.
- *
- * Listen to it from a Scene using: `this.physics.world.on('pause', listener)`.
- */
- const PAUSE: any;
-
- /**
- * The Arcade Physics World Resume Event.
- *
- * This event is dispatched by an Arcade Physics World instance when it resumes from a paused state.
- *
- * Listen to it from a Scene using: `this.physics.world.on('resume', listener)`.
- */
- const RESUME: any;
-
- /**
- * The Arcade Physics Tile Collide Event.
- *
- * This event is dispatched by an Arcade Physics World instance if a body collides with a Tile _and_
- * has its [onCollide]{@link Phaser.Physics.Arcade.Body#onCollide} property set to `true`.
- *
- * It provides an alternative means to handling collide events rather than using the callback approach.
- *
- * Listen to it from a Scene using: `this.physics.world.on('tilecollide', listener)`.
- *
- * Please note that 'collide' and 'overlap' are two different things in Arcade Physics.
- */
- const TILE_COLLIDE: any;
-
- /**
- * The Arcade Physics Tile Overlap Event.
- *
- * This event is dispatched by an Arcade Physics World instance if a body overlaps with a Tile _and_
- * has its [onOverlap]{@link Phaser.Physics.Arcade.Body#onOverlap} property set to `true`.
- *
- * It provides an alternative means to handling overlap events rather than using the callback approach.
- *
- * Listen to it from a Scene using: `this.physics.world.on('tileoverlap', listener)`.
- *
- * Please note that 'collide' and 'overlap' are two different things in Arcade Physics.
- */
- const TILE_OVERLAP: any;
-
- /**
- * The Arcade Physics World Bounds Event.
- *
- * This event is dispatched by an Arcade Physics World instance if a body makes contact with the world bounds _and_
- * it has its [onWorldBounds]{@link Phaser.Physics.Arcade.Body#onWorldBounds} property set to `true`.
- *
- * It provides an alternative means to handling collide events rather than using the callback approach.
- *
- * Listen to it from a Scene using: `this.physics.world.on('worldbounds', listener)`.
- */
- const WORLD_BOUNDS: any;
-
- /**
- * The Arcade Physics World Step Event.
- *
- * This event is dispatched by an Arcade Physics World instance whenever a physics step is run.
- * It is emitted _after_ the bodies and colliders have been updated.
- *
- * In high framerate settings this can be multiple times per game frame.
- *
- * Listen to it from a Scene using: `this.physics.world.on('worldstep', listener)`.
- */
- const WORLD_STEP: any;
-
- }
-
- namespace Tilemap {
- /**
- * A function to process the collision callbacks between a single tile and an Arcade Physics enabled Game Object.
- * @param tile The Tile to process.
- * @param sprite The Game Object to process with the Tile.
- */
- function ProcessTileCallbacks(tile: Phaser.Tilemaps.Tile, sprite: Phaser.GameObjects.Sprite): boolean;
-
- /**
- * Internal function to process the separation of a physics body from a tile.
- * @param body The Body object to separate.
- * @param x The x separation amount.
- */
- function ProcessTileSeparationX(body: Phaser.Physics.Arcade.Body, x: number): void;
-
- /**
- * Internal function to process the separation of a physics body from a tile.
- * @param body The Body object to separate.
- * @param y The y separation amount.
- */
- function ProcessTileSeparationY(body: Phaser.Physics.Arcade.Body, y: number): void;
-
- /**
- * The core separation function to separate a physics body and a tile.
- * @param i The index of the tile within the map data.
- * @param body The Body object to separate.
- * @param tile The tile to collide against.
- * @param tileWorldRect A rectangle-like object defining the dimensions of the tile.
- * @param tilemapLayer The tilemapLayer to collide against.
- * @param tileBias The tile bias value. Populated by the `World.TILE_BIAS` constant.
- * @param isLayer Is this check coming from a TilemapLayer or an array of tiles?
- */
- function SeparateTile(i: number, body: Phaser.Physics.Arcade.Body, tile: Phaser.Tilemaps.Tile, tileWorldRect: Phaser.Geom.Rectangle, tilemapLayer: Phaser.Tilemaps.DynamicTilemapLayer | Phaser.Tilemaps.StaticTilemapLayer, tileBias: number, isLayer: boolean): boolean;
-
- /**
- * Check the body against the given tile on the X axis.
- * Used internally by the SeparateTile function.
- * @param body The Body object to separate.
- * @param tile The tile to check.
- * @param tileLeft The left position of the tile within the tile world.
- * @param tileRight The right position of the tile within the tile world.
- * @param tileBias The tile bias value. Populated by the `World.TILE_BIAS` constant.
- * @param isLayer Is this check coming from a TilemapLayer or an array of tiles?
- */
- function TileCheckX(body: Phaser.Physics.Arcade.Body, tile: Phaser.Tilemaps.Tile, tileLeft: number, tileRight: number, tileBias: number, isLayer: boolean): number;
-
- /**
- * Check the body against the given tile on the Y axis.
- * Used internally by the SeparateTile function.
- * @param body The Body object to separate.
- * @param tile The tile to check.
- * @param tileTop The top position of the tile within the tile world.
- * @param tileBottom The bottom position of the tile within the tile world.
- * @param tileBias The tile bias value. Populated by the `World.TILE_BIAS` constant.
- * @param isLayer Is this check coming from a TilemapLayer or an array of tiles?
- */
- function TileCheckY(body: Phaser.Physics.Arcade.Body, tile: Phaser.Tilemaps.Tile, tileTop: number, tileBottom: number, tileBias: number, isLayer: boolean): number;
-
- /**
- * Checks for intersection between the given tile rectangle-like object and an Arcade Physics body.
- * @param tileWorldRect A rectangle object that defines the tile placement in the world.
- * @param body The body to check for intersection against.
- */
- function TileIntersectsBody(tileWorldRect: Object, body: Phaser.Physics.Arcade.Body): boolean;
-
- }
-
}
/**
@@ -62842,6 +63678,325 @@ declare namespace Phaser {
}
+ namespace Components {
+ /**
+ * The Impact Acceleration component.
+ * Should be applied as a mixin.
+ */
+ interface Acceleration {
+ /**
+ * Sets the horizontal acceleration of this body.
+ * @param x The amount of acceleration to apply.
+ */
+ setAccelerationX(x: number): this;
+ /**
+ * Sets the vertical acceleration of this body.
+ * @param y The amount of acceleration to apply.
+ */
+ setAccelerationY(y: number): this;
+ /**
+ * Sets the horizontal and vertical acceleration of this body.
+ * @param x The amount of horizontal acceleration to apply.
+ * @param y The amount of vertical acceleration to apply.
+ */
+ setAcceleration(x: number, y: number): this;
+ }
+
+ /**
+ * The Impact Body Scale component.
+ * Should be applied as a mixin.
+ */
+ interface BodyScale {
+ /**
+ * Sets the size of the physics body.
+ * @param width The width of the body in pixels.
+ * @param height The height of the body in pixels. Default width.
+ */
+ setBodySize(width: number, height?: number): this;
+ /**
+ * Sets the scale of the physics body.
+ * @param scaleX The horizontal scale of the body.
+ * @param scaleY The vertical scale of the body. If not given, will use the horizontal scale value.
+ */
+ setBodyScale(scaleX: number, scaleY?: number): this;
+ }
+
+ /**
+ * The Impact Body Type component.
+ * Should be applied as a mixin.
+ */
+ interface BodyType {
+ /**
+ * [description]
+ */
+ getBodyType(): number;
+ /**
+ * [description]
+ */
+ setTypeNone(): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ setTypeA(): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ setTypeB(): Phaser.GameObjects.GameObject;
+ }
+
+ /**
+ * The Impact Bounce component.
+ * Should be applied as a mixin.
+ */
+ interface Bounce {
+ /**
+ * Sets the impact physics bounce, or restitution, value.
+ * @param value A value between 0 (no rebound) and 1 (full rebound)
+ */
+ setBounce(value: number): Phaser.GameObjects.GameObject;
+ /**
+ * Sets the minimum velocity the body is allowed to be moving to be considered for rebound.
+ * @param value The minimum allowed velocity.
+ */
+ setMinBounceVelocity(value: number): Phaser.GameObjects.GameObject;
+ /**
+ * The bounce, or restitution, value of this body.
+ * A value between 0 (no rebound) and 1 (full rebound)
+ */
+ bounce: number;
+ }
+
+ /**
+ * The Impact Check Against component.
+ * Should be applied as a mixin.
+ */
+ interface CheckAgainst {
+ /**
+ * [description]
+ */
+ setAvsB(): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ setBvsA(): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ setCheckAgainstNone(): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ setCheckAgainstA(): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ setCheckAgainstB(): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ checkAgainst: number;
+ }
+
+ /**
+ * The Impact Collides component.
+ * Should be applied as a mixin.
+ */
+ interface Collides {
+ /**
+ * [description]
+ * @param callback [description]
+ * @param scope [description]
+ */
+ setCollideCallback(callback: CollideCallback, scope: any): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ setCollidesNever(): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ setLiteCollision(): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ setPassiveCollision(): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ setActiveCollision(): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ setFixedCollision(): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ collides: number;
+ }
+
+ /**
+ * The Impact Debug component.
+ * Should be applied as a mixin.
+ */
+ interface Debug {
+ /**
+ * [description]
+ * @param showBody [description]
+ * @param showVelocity [description]
+ * @param bodyColor [description]
+ */
+ setDebug(showBody: boolean, showVelocity: boolean, bodyColor: number): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ * @param value [description]
+ */
+ setDebugBodyColor(value: number): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ debugShowBody: boolean;
+ /**
+ * [description]
+ */
+ debugShowVelocity: boolean;
+ /**
+ * [description]
+ */
+ debugBodyColor: number;
+ }
+
+ /**
+ * The Impact Friction component.
+ * Should be applied as a mixin.
+ */
+ interface Friction {
+ /**
+ * [description]
+ * @param x [description]
+ */
+ setFrictionX(x: number): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ * @param y [description]
+ */
+ setFrictionY(y: number): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ * @param x [description]
+ * @param y [description]
+ */
+ setFriction(x: number, y: number): Phaser.GameObjects.GameObject;
+ }
+
+ /**
+ * The Impact Gravity component.
+ * Should be applied as a mixin.
+ */
+ interface Gravity {
+ /**
+ * [description]
+ * @param value [description]
+ */
+ setGravity(value: number): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ gravity: number;
+ }
+
+ /**
+ * The Impact Offset component.
+ * Should be applied as a mixin.
+ */
+ interface Offset {
+ /**
+ * [description]
+ * @param x [description]
+ * @param y [description]
+ * @param width [description]
+ * @param height [description]
+ */
+ setOffset(x: number, y: number, width?: number, height?: number): Phaser.GameObjects.GameObject;
+ }
+
+ /**
+ * The Impact Set Game Object component.
+ * Should be applied as a mixin.
+ */
+ interface SetGameObject {
+ /**
+ * [description]
+ * @param gameObject [description]
+ * @param sync [description] Default true.
+ */
+ setGameObject(gameObject: Phaser.GameObjects.GameObject, sync?: boolean): Phaser.GameObjects.GameObject;
+ /**
+ * [description]
+ */
+ syncGameObject(): Phaser.GameObjects.GameObject;
+ }
+
+ /**
+ * The Impact Velocity component.
+ * Should be applied as a mixin.
+ */
+ interface Velocity {
+ /**
+ * Sets the horizontal velocity of the physics body.
+ * @param x The horizontal velocity value.
+ */
+ setVelocityX(x: number): this;
+ /**
+ * Sets the vertical velocity of the physics body.
+ * @param y The vertical velocity value.
+ */
+ setVelocityY(y: number): this;
+ /**
+ * Sets the horizontal and vertical velocities of the physics body.
+ * @param x The horizontal velocity value.
+ * @param y The vertical velocity value. If not given, defaults to the horizontal value. Default x.
+ */
+ setVelocity(x: number, y?: number): this;
+ /**
+ * Sets the maximum velocity this body can travel at.
+ * @param x The maximum allowed horizontal velocity.
+ * @param y The maximum allowed vertical velocity. If not given, defaults to the horizontal value. Default x.
+ */
+ setMaxVelocity(x: number, y?: number): this;
+ }
+
+ }
+
+ namespace Events {
+ /**
+ * The Impact Physics World Collide Event.
+ *
+ * This event is dispatched by an Impact Physics World instance if two bodies collide.
+ *
+ * Listen to it from a Scene using: `this.impact.world.on('collide', listener)`.
+ */
+ const COLLIDE: any;
+
+ /**
+ * The Impact Physics World Pause Event.
+ *
+ * This event is dispatched by an Impact Physics World instance when it is paused.
+ *
+ * Listen to it from a Scene using: `this.impact.world.on('pause', listener)`.
+ */
+ const PAUSE: any;
+
+ /**
+ * The Impact Physics World Resume Event.
+ *
+ * This event is dispatched by an Impact Physics World instance when it resumes from a paused state.
+ *
+ * Listen to it from a Scene using: `this.impact.world.on('resume', listener)`.
+ */
+ const RESUME: any;
+
+ }
+
/**
* The Impact Physics Factory allows you to easily create Impact Physics enabled Game Objects.
* Objects that are created by this Factory are automatically added to the physics world.
@@ -65958,333 +67113,894 @@ declare namespace Phaser {
}
+ }
+
+ namespace Matter {
+ /**
+ * The Body Bounds class contains methods to help you extract the world coordinates from various points around
+ * the bounds of a Matter Body. Because Matter bodies are positioned based on their center of mass, and not a
+ * dimension based center, you often need to get the bounds coordinates in order to properly align them in the world.
+ *
+ * You can access this class via the MatterPhysics class from a Scene, i.e.:
+ *
+ * ```javascript
+ * this.matter.bodyBounds.getTopLeft(body);
+ * ```
+ *
+ * See also the `MatterPhysics.alignBody` method.
+ */
+ class BodyBounds {
+ /**
+ * A Vector2 that stores the temporary bounds center value during calculations by methods in this class.
+ */
+ boundsCenter: Phaser.Math.Vector2;
+
+ /**
+ * A Vector2 that stores the temporary center diff values during calculations by methods in this class.
+ */
+ centerDiff: Phaser.Math.Vector2;
+
+ /**
+ * Parses the given body to get the bounds diff values from it.
+ *
+ * They're stored in this class in the temporary properties `boundsCenter` and `centerDiff`.
+ *
+ * This method is called automatically by all other methods in this class.
+ * @param body The Body to get the bounds position from.
+ */
+ parseBody(body: Phaser.Types.Physics.Matter.MatterBody): boolean;
+
+ /**
+ * Takes a Body and returns the world coordinates of the top-left of its _bounds_.
+ *
+ * Body bounds are updated by Matter each step and factor in scale and rotation.
+ * This will return the world coordinate based on the bodies _current_ position and bounds.
+ * @param body The Body to get the position from.
+ * @param x Optional horizontal offset to add to the returned coordinates. Default 0.
+ * @param y Optional vertical offset to add to the returned coordinates. Default 0.
+ */
+ getTopLeft(body: Phaser.Types.Physics.Matter.MatterBody, x?: number, y?: number): Phaser.Math.Vector2 | false;
+
+ /**
+ * Takes a Body and returns the world coordinates of the top-center of its _bounds_.
+ *
+ * Body bounds are updated by Matter each step and factor in scale and rotation.
+ * This will return the world coordinate based on the bodies _current_ position and bounds.
+ * @param body The Body to get the position from.
+ * @param x Optional horizontal offset to add to the returned coordinates. Default 0.
+ * @param y Optional vertical offset to add to the returned coordinates. Default 0.
+ */
+ getTopCenter(body: Phaser.Types.Physics.Matter.MatterBody, x?: number, y?: number): Phaser.Math.Vector2 | false;
+
+ /**
+ * Takes a Body and returns the world coordinates of the top-right of its _bounds_.
+ *
+ * Body bounds are updated by Matter each step and factor in scale and rotation.
+ * This will return the world coordinate based on the bodies _current_ position and bounds.
+ * @param body The Body to get the position from.
+ * @param x Optional horizontal offset to add to the returned coordinates. Default 0.
+ * @param y Optional vertical offset to add to the returned coordinates. Default 0.
+ */
+ getTopRight(body: Phaser.Types.Physics.Matter.MatterBody, x?: number, y?: number): Phaser.Math.Vector2 | false;
+
+ /**
+ * Takes a Body and returns the world coordinates of the left-center of its _bounds_.
+ *
+ * Body bounds are updated by Matter each step and factor in scale and rotation.
+ * This will return the world coordinate based on the bodies _current_ position and bounds.
+ * @param body The Body to get the position from.
+ * @param x Optional horizontal offset to add to the returned coordinates. Default 0.
+ * @param y Optional vertical offset to add to the returned coordinates. Default 0.
+ */
+ getLeftCenter(body: Phaser.Types.Physics.Matter.MatterBody, x?: number, y?: number): Phaser.Math.Vector2 | false;
+
+ /**
+ * Takes a Body and returns the world coordinates of the center of its _bounds_.
+ *
+ * Body bounds are updated by Matter each step and factor in scale and rotation.
+ * This will return the world coordinate based on the bodies _current_ position and bounds.
+ * @param body The Body to get the position from.
+ * @param x Optional horizontal offset to add to the returned coordinates. Default 0.
+ * @param y Optional vertical offset to add to the returned coordinates. Default 0.
+ */
+ getCenter(body: Phaser.Types.Physics.Matter.MatterBody, x?: number, y?: number): Phaser.Math.Vector2 | false;
+
+ /**
+ * Takes a Body and returns the world coordinates of the right-center of its _bounds_.
+ *
+ * Body bounds are updated by Matter each step and factor in scale and rotation.
+ * This will return the world coordinate based on the bodies _current_ position and bounds.
+ * @param body The Body to get the position from.
+ * @param x Optional horizontal offset to add to the returned coordinates. Default 0.
+ * @param y Optional vertical offset to add to the returned coordinates. Default 0.
+ */
+ getRightCenter(body: Phaser.Types.Physics.Matter.MatterBody, x?: number, y?: number): Phaser.Math.Vector2 | false;
+
+ /**
+ * Takes a Body and returns the world coordinates of the bottom-left of its _bounds_.
+ *
+ * Body bounds are updated by Matter each step and factor in scale and rotation.
+ * This will return the world coordinate based on the bodies _current_ position and bounds.
+ * @param body The Body to get the position from.
+ * @param x Optional horizontal offset to add to the returned coordinates. Default 0.
+ * @param y Optional vertical offset to add to the returned coordinates. Default 0.
+ */
+ getBottomLeft(body: Phaser.Types.Physics.Matter.MatterBody, x?: number, y?: number): Phaser.Math.Vector2 | false;
+
+ /**
+ * Takes a Body and returns the world coordinates of the bottom-center of its _bounds_.
+ *
+ * Body bounds are updated by Matter each step and factor in scale and rotation.
+ * This will return the world coordinate based on the bodies _current_ position and bounds.
+ * @param body The Body to get the position from.
+ * @param x Optional horizontal offset to add to the returned coordinates. Default 0.
+ * @param y Optional vertical offset to add to the returned coordinates. Default 0.
+ */
+ getBottomCenter(body: Phaser.Types.Physics.Matter.MatterBody, x?: number, y?: number): Phaser.Math.Vector2 | false;
+
+ /**
+ * Takes a Body and returns the world coordinates of the bottom-right of its _bounds_.
+ *
+ * Body bounds are updated by Matter each step and factor in scale and rotation.
+ * This will return the world coordinate based on the bodies _current_ position and bounds.
+ * @param body The Body to get the position from.
+ * @param x Optional horizontal offset to add to the returned coordinates. Default 0.
+ * @param y Optional vertical offset to add to the returned coordinates. Default 0.
+ */
+ getBottomRight(body: Phaser.Types.Physics.Matter.MatterBody, x?: number, y?: number): Phaser.Math.Vector2 | false;
+
+ }
+
namespace Components {
/**
- * The Impact Acceleration component.
- * Should be applied as a mixin.
- */
- interface Acceleration {
- /**
- * Sets the horizontal acceleration of this body.
- * @param x The amount of acceleration to apply.
- */
- setAccelerationX(x: number): this;
- /**
- * Sets the vertical acceleration of this body.
- * @param y The amount of acceleration to apply.
- */
- setAccelerationY(y: number): this;
- /**
- * Sets the horizontal and vertical acceleration of this body.
- * @param x The amount of horizontal acceleration to apply.
- * @param y The amount of vertical acceleration to apply.
- */
- setAcceleration(x: number, y: number): this;
- }
-
- /**
- * The Impact Body Scale component.
- * Should be applied as a mixin.
- */
- interface BodyScale {
- /**
- * Sets the size of the physics body.
- * @param width The width of the body in pixels.
- * @param height The height of the body in pixels. Default width.
- */
- setBodySize(width: number, height?: number): this;
- /**
- * Sets the scale of the physics body.
- * @param scaleX The horizontal scale of the body.
- * @param scaleY The vertical scale of the body. If not given, will use the horizontal scale value.
- */
- setBodyScale(scaleX: number, scaleY?: number): this;
- }
-
- /**
- * The Impact Body Type component.
- * Should be applied as a mixin.
- */
- interface BodyType {
- /**
- * [description]
- */
- getBodyType(): number;
- /**
- * [description]
- */
- setTypeNone(): Phaser.GameObjects.GameObject;
- /**
- * [description]
- */
- setTypeA(): Phaser.GameObjects.GameObject;
- /**
- * [description]
- */
- setTypeB(): Phaser.GameObjects.GameObject;
- }
-
- /**
- * The Impact Bounce component.
- * Should be applied as a mixin.
+ * A component to set restitution on objects.
*/
interface Bounce {
/**
- * Sets the impact physics bounce, or restitution, value.
- * @param value A value between 0 (no rebound) and 1 (full rebound)
+ * Sets the restitution on the physics object.
+ * @param value A Number that defines the restitution (elasticity) of the body. The value is always positive and is in the range (0, 1). A value of 0 means collisions may be perfectly inelastic and no bouncing may occur. A value of 0.8 means the body may bounce back with approximately 80% of its kinetic energy. Note that collision response is based on pairs of bodies, and that restitution values are combined with the following formula: `Math.max(bodyA.restitution, bodyB.restitution)`
*/
setBounce(value: number): Phaser.GameObjects.GameObject;
- /**
- * Sets the minimum velocity the body is allowed to be moving to be considered for rebound.
- * @param value The minimum allowed velocity.
- */
- setMinBounceVelocity(value: number): Phaser.GameObjects.GameObject;
- /**
- * The bounce, or restitution, value of this body.
- * A value between 0 (no rebound) and 1 (full rebound)
- */
- bounce: number;
}
/**
- * The Impact Check Against component.
- * Should be applied as a mixin.
+ * Contains methods for changing the collision filter of a Matter Body. Should be used as a mixin and not called directly.
*/
- interface CheckAgainst {
+ interface Collision {
/**
- * [description]
+ * Sets the collision category of this Game Object's Matter Body. This number must be a power of two between 2^0 (= 1) and 2^31.
+ * Two bodies with different collision groups (see {@link #setCollisionGroup}) will only collide if their collision
+ * categories are included in their collision masks (see {@link #setCollidesWith}).
+ * @param value Unique category bitfield.
*/
- setAvsB(): Phaser.GameObjects.GameObject;
+ setCollisionCategory(value: number): Phaser.GameObjects.GameObject;
/**
- * [description]
+ * Sets the collision group of this Game Object's Matter Body. If this is zero or two Matter Bodies have different values,
+ * they will collide according to the usual rules (see {@link #setCollisionCategory} and {@link #setCollisionGroup}).
+ * If two Matter Bodies have the same positive value, they will always collide; if they have the same negative value,
+ * they will never collide.
+ * @param value Unique group index.
*/
- setBvsA(): Phaser.GameObjects.GameObject;
+ setCollisionGroup(value: number): Phaser.GameObjects.GameObject;
/**
- * [description]
+ * Sets the collision mask for this Game Object's Matter Body. Two Matter Bodies with different collision groups will only
+ * collide if each one includes the other's category in its mask based on a bitwise AND, i.e. `(categoryA & maskB) !== 0`
+ * and `(categoryB & maskA) !== 0` are both true.
+ * @param categories A unique category bitfield, or an array of them.
*/
- setCheckAgainstNone(): Phaser.GameObjects.GameObject;
+ setCollidesWith(categories: number | number[]): Phaser.GameObjects.GameObject;
/**
- * [description]
+ * The callback is sent a `Phaser.Types.Physics.Matter.MatterCollisionData` object.
+ *
+ * This does not change the bodies collision category, group or filter. Those must be set in addition
+ * to the callback.
+ * @param callback The callback to invoke when this body starts colliding with another.
*/
- setCheckAgainstA(): Phaser.GameObjects.GameObject;
+ setOnCollide(callback: Function): Phaser.GameObjects.GameObject;
/**
- * [description]
+ * The callback is sent a `Phaser.Types.Physics.Matter.MatterCollisionData` object.
+ *
+ * This does not change the bodies collision category, group or filter. Those must be set in addition
+ * to the callback.
+ * @param callback The callback to invoke when this body stops colliding with another.
*/
- setCheckAgainstB(): Phaser.GameObjects.GameObject;
+ setOnCollideEnd(callback: Function): Phaser.GameObjects.GameObject;
/**
- * [description]
+ * The callback is sent a `Phaser.Types.Physics.Matter.MatterCollisionData` object.
+ *
+ * This does not change the bodies collision category, group or filter. Those must be set in addition
+ * to the callback.
+ * @param callback The callback to invoke for the duration of this body colliding with another.
*/
- checkAgainst: number;
+ setOnCollideActive(callback: Function): Phaser.GameObjects.GameObject;
+ /**
+ * The callback is sent a reference to the other body, along with a `Phaser.Types.Physics.Matter.MatterCollisionData` object.
+ *
+ * This does not change the bodies collision category, group or filter. Those must be set in addition
+ * to the callback.
+ * @param body The body, or an array of bodies, to test for collisions with.
+ * @param callback The callback to invoke when this body collides with the given body or bodies.
+ */
+ setOnCollideWith(body: MatterJS.Body | MatterJS.Body[], callback: Function): Phaser.GameObjects.GameObject;
}
/**
- * The Impact Collides component.
- * Should be applied as a mixin.
+ * A component to apply force to Matter.js bodies.
*/
- interface Collides {
+ interface Force {
/**
- * [description]
- * @param callback [description]
- * @param scope [description]
+ * Applies a force to a body.
+ * @param force A Vector that specifies the force to apply.
*/
- setCollideCallback(callback: CollideCallback, scope: any): Phaser.GameObjects.GameObject;
+ applyForce(force: Phaser.Math.Vector2): Phaser.GameObjects.GameObject;
/**
- * [description]
+ * Applies a force to a body from a given position.
+ * @param position The position in which the force comes from.
+ * @param force A Vector that specifies the force to apply.
*/
- setCollidesNever(): Phaser.GameObjects.GameObject;
+ applyForceFrom(position: Phaser.Math.Vector2, force: Phaser.Math.Vector2): Phaser.GameObjects.GameObject;
/**
- * [description]
+ * Apply thrust to the forward position of the body.
+ *
+ * Use very small values, such as 0.1, depending on the mass and required speed.
+ * @param speed A speed value to be applied to a directional force.
*/
- setLiteCollision(): Phaser.GameObjects.GameObject;
+ thrust(speed: number): Phaser.GameObjects.GameObject;
/**
- * [description]
+ * Apply thrust to the left position of the body.
+ *
+ * Use very small values, such as 0.1, depending on the mass and required speed.
+ * @param speed A speed value to be applied to a directional force.
*/
- setPassiveCollision(): Phaser.GameObjects.GameObject;
+ thrustLeft(speed: number): Phaser.GameObjects.GameObject;
/**
- * [description]
+ * Apply thrust to the right position of the body.
+ *
+ * Use very small values, such as 0.1, depending on the mass and required speed.
+ * @param speed A speed value to be applied to a directional force.
*/
- setActiveCollision(): Phaser.GameObjects.GameObject;
+ thrustRight(speed: number): Phaser.GameObjects.GameObject;
/**
- * [description]
+ * Apply thrust to the back position of the body.
+ *
+ * Use very small values, such as 0.1, depending on the mass and required speed.
+ * @param speed A speed value to be applied to a directional force.
*/
- setFixedCollision(): Phaser.GameObjects.GameObject;
- /**
- * [description]
- */
- collides: number;
+ thrustBack(speed: number): Phaser.GameObjects.GameObject;
}
/**
- * The Impact Debug component.
- * Should be applied as a mixin.
- */
- interface Debug {
- /**
- * [description]
- * @param showBody [description]
- * @param showVelocity [description]
- * @param bodyColor [description]
- */
- setDebug(showBody: boolean, showVelocity: boolean, bodyColor: number): Phaser.GameObjects.GameObject;
- /**
- * [description]
- * @param value [description]
- */
- setDebugBodyColor(value: number): Phaser.GameObjects.GameObject;
- /**
- * [description]
- */
- debugShowBody: boolean;
- /**
- * [description]
- */
- debugShowVelocity: boolean;
- /**
- * [description]
- */
- debugBodyColor: number;
- }
-
- /**
- * The Impact Friction component.
- * Should be applied as a mixin.
+ * Contains methods for changing the friction of a Game Object's Matter Body. Should be used a mixin, not called directly.
*/
interface Friction {
/**
- * [description]
- * @param x [description]
+ * Sets new friction values for this Game Object's Matter Body.
+ * @param value The new friction of the body, between 0 and 1, where 0 allows the Body to slide indefinitely, while 1 allows it to stop almost immediately after a force is applied.
+ * @param air If provided, the new air resistance of the Body. The higher the value, the faster the Body will slow as it moves through space. 0 means the body has no air resistance.
+ * @param fstatic If provided, the new static friction of the Body. The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary. 0 means the body will never "stick" when it is nearly stationary.
*/
- setFrictionX(x: number): Phaser.GameObjects.GameObject;
+ setFriction(value: number, air?: number, fstatic?: number): Phaser.GameObjects.GameObject;
/**
- * [description]
- * @param y [description]
+ * Sets a new air resistance for this Game Object's Matter Body.
+ * A value of 0 means the Body will never slow as it moves through space.
+ * The higher the value, the faster a Body slows when moving through space.
+ * @param value The new air resistance for the Body.
*/
- setFrictionY(y: number): Phaser.GameObjects.GameObject;
+ setFrictionAir(value: number): Phaser.GameObjects.GameObject;
/**
- * [description]
- * @param x [description]
- * @param y [description]
+ * Sets a new static friction for this Game Object's Matter Body.
+ * A value of 0 means the Body will never "stick" when it is nearly stationary.
+ * The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary.
+ * @param value The new static friction for the Body.
*/
- setFriction(x: number, y: number): Phaser.GameObjects.GameObject;
+ setFrictionStatic(value: number): Phaser.GameObjects.GameObject;
}
/**
- * The Impact Gravity component.
- * Should be applied as a mixin.
+ * A component to manipulate world gravity for Matter.js bodies.
*/
interface Gravity {
/**
- * [description]
- * @param value [description]
+ * A togglable function for ignoring world gravity in real-time on the current body.
+ * @param value Set to true to ignore the effect of world gravity, or false to not ignore it.
*/
- setGravity(value: number): Phaser.GameObjects.GameObject;
- /**
- * [description]
- */
- gravity: number;
+ setIgnoreGravity(value: boolean): Phaser.GameObjects.GameObject;
}
/**
- * The Impact Offset component.
- * Should be applied as a mixin.
+ * Allows accessing the mass, density, and center of mass of a Matter-enabled Game Object. Should be used as a mixin and not directly.
*/
- interface Offset {
+ interface Mass {
/**
- * [description]
- * @param x [description]
- * @param y [description]
- * @param width [description]
- * @param height [description]
+ * Sets the mass of the Game Object's Matter Body.
+ * @param value The new mass of the body.
*/
- setOffset(x: number, y: number, width?: number, height?: number): Phaser.GameObjects.GameObject;
+ setMass(value: number): Phaser.GameObjects.GameObject;
+ /**
+ * Sets density of the body.
+ * @param value The new density of the body.
+ */
+ setDensity(value: number): Phaser.GameObjects.GameObject;
+ /**
+ * The body's center of mass.
+ *
+ * Calling this creates a new `Vector2 each time to avoid mutation.
+ *
+ * If you only need to read the value and won't change it, you can get it from `GameObject.body.centerOfMass`.
+ */
+ readonly centerOfMass: Phaser.Math.Vector2;
}
/**
- * The Impact Set Game Object component.
- * Should be applied as a mixin.
+ * Enables a Matter-enabled Game Object to be a sensor. Should be used as a mixin and not directly.
*/
- interface SetGameObject {
+ interface Sensor {
/**
- * [description]
- * @param gameObject [description]
- * @param sync [description] Default true.
+ * Set the body belonging to this Game Object to be a sensor.
+ * Sensors trigger collision events, but don't react with colliding body physically.
+ * @param value `true` to set the body as a sensor, or `false` to disable it.
*/
- setGameObject(gameObject: Phaser.GameObjects.GameObject, sync?: boolean): Phaser.GameObjects.GameObject;
+ setSensor(value: boolean): Phaser.GameObjects.GameObject;
/**
- * [description]
+ * Is the body belonging to this Game Object a sensor or not?
*/
- syncGameObject(): Phaser.GameObjects.GameObject;
+ isSensor(): boolean;
}
/**
- * The Impact Velocity component.
- * Should be applied as a mixin.
+ * Enables a Matter-enabled Game Object to set its Body. Should be used as a mixin and not directly.
+ */
+ interface SetBody {
+ /**
+ * Set the body on a Game Object to a rectangle.
+ *
+ * Calling this methods resets previous properties you may have set on the body, including
+ * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
+ * @param width Width of the rectangle.
+ * @param height Height of the rectangle.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
+ */
+ setRectangle(width: number, height: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.GameObjects.GameObject;
+ /**
+ * Set the body on a Game Object to a circle.
+ *
+ * Calling this methods resets previous properties you may have set on the body, including
+ * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
+ * @param radius The radius of the circle.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
+ */
+ setCircle(radius: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.GameObjects.GameObject;
+ /**
+ * Set the body on the Game Object to a polygon shape.
+ *
+ * Calling this methods resets previous properties you may have set on the body, including
+ * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
+ * @param sides The number of sides the polygon will have.
+ * @param radius The "radius" of the polygon, i.e. the distance from its center to any vertex. This is also the radius of its circumcircle.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
+ */
+ setPolygon(sides: number, radius: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.GameObjects.GameObject;
+ /**
+ * Set the body on the Game Object to a trapezoid shape.
+ *
+ * Calling this methods resets previous properties you may have set on the body, including
+ * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
+ * @param width The width of the trapezoid Body.
+ * @param height The height of the trapezoid Body.
+ * @param slope The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
+ */
+ setTrapezoid(width: number, height: number, slope: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.GameObjects.GameObject;
+ /**
+ * Set this Game Object to use the given existing Matter Body.
+ *
+ * The body is first removed from the world before being added to this Game Object.
+ * @param body The Body this Game Object should use.
+ * @param addToWorld Should the body be immediately added to the World? Default true.
+ */
+ setExistingBody(body: MatterJS.Body, addToWorld?: boolean): Phaser.GameObjects.GameObject;
+ /**
+ * Set this Game Object to create and use a new Body based on the configuration object given.
+ *
+ * Calling this method resets previous properties you may have set on the body, including
+ * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
+ * @param config Either a string, such as `circle`, or a Matter Set Body Configuration object.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
+ */
+ setBody(config: string | Phaser.Types.Physics.Matter.MatterSetBodyConfig, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.GameObjects.GameObject;
+ }
+
+ /**
+ * Enables a Matter-enabled Game Object to be able to go to sleep. Should be used as a mixin and not directly.
+ */
+ interface Sleep {
+ /**
+ * Sets this Body to sleep.
+ */
+ setToSleep(): this;
+ /**
+ * Wakes this Body if asleep.
+ */
+ setAwake(): this;
+ /**
+ * Sets the number of updates in which this body must have near-zero velocity before it is set as sleeping (if sleeping is enabled by the engine).
+ * @param value A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping. Default 60.
+ */
+ setSleepThreshold(value?: number): this;
+ /**
+ * Enable sleep and wake events for this body.
+ *
+ * By default when a body goes to sleep, or wakes up, it will not emit any events.
+ *
+ * The events are emitted by the Matter World instance and can be listened to via
+ * the `SLEEP_START` and `SLEEP_END` events.
+ * @param start `true` if you want the sleep start event to be emitted for this body.
+ * @param end `true` if you want the sleep end event to be emitted for this body.
+ */
+ setSleepEvents(start: boolean, end: boolean): this;
+ /**
+ * Enables or disables the Sleep Start event for this body.
+ * @param value `true` to enable the sleep event, or `false` to disable it.
+ */
+ setSleepStartEvent(value: boolean): this;
+ /**
+ * Enables or disables the Sleep End event for this body.
+ * @param value `true` to enable the sleep event, or `false` to disable it.
+ */
+ setSleepEndEvent(value: boolean): this;
+ }
+
+ /**
+ * Provides methods used for getting and setting the static state of a physics body.
+ */
+ interface Static {
+ /**
+ * Changes the physics body to be either static `true` or dynamic `false`.
+ * @param value `true` to set the body as being static, or `false` to make it dynamic.
+ */
+ setStatic(value: boolean): Phaser.GameObjects.GameObject;
+ /**
+ * Returns `true` if the body is static, otherwise `false` for a dynamic body.
+ */
+ isStatic(): boolean;
+ }
+
+ /**
+ * Provides methods used for getting and setting the position, scale and rotation of a Game Object.
+ */
+ interface Transform {
+ /**
+ * The x position of this Game Object.
+ */
+ x: number;
+ /**
+ * The y position of this Game Object.
+ */
+ y: number;
+ /**
+ * The horizontal scale of this Game Object.
+ */
+ scaleX: number;
+ /**
+ * The vertical scale of this Game Object.
+ */
+ scaleY: number;
+ /**
+ * Use `angle` to set or get rotation of the physics body associated to this GameObject.
+ * Unlike rotation, when using set the value can be in degrees, which will be converted to radians internally.
+ */
+ angle: number;
+ /**
+ * Use `rotation` to set or get the rotation of the physics body associated with this GameObject.
+ * The value when set must be in radians.
+ */
+ rotation: number;
+ /**
+ * Sets the position of the physics body along x and y axes.
+ * Both the parameters to this function are optional and if not passed any they default to 0.
+ * Velocity, angle, force etc. are unchanged.
+ * @param x The horizontal position of the body. Default 0.
+ * @param y The vertical position of the body. Default x.
+ */
+ setPosition(x?: number, y?: number): this;
+ /**
+ * Immediately sets the angle of the Body.
+ * Angular velocity, position, force etc. are unchanged.
+ * @param radians The angle of the body, in radians. Default 0.
+ */
+ setRotation(radians?: number): this;
+ /**
+ * Setting fixed rotation sets the Body inertia to Infinity, which stops it
+ * from being able to rotate when forces are applied to it.
+ */
+ setFixedRotation(): this;
+ /**
+ * Immediately sets the angle of the Body.
+ * Angular velocity, position, force etc. are unchanged.
+ * @param degrees The angle to set, 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.
+ * @param point The point (Vector2) from which scaling will occur.
+ */
+ setScale(x?: number, y?: number, point?: Phaser.Math.Vector2): this;
+ }
+
+ /**
+ * Contains methods for changing the velocity of a Matter Body. Should be used as a mixin and not called directly.
*/
interface Velocity {
+ /**
+ * Sets the angular velocity of the body instantly.
+ * Position, angle, force etc. are unchanged.
+ * @param value The angular velocity.
+ */
+ setAngularVelocity(value: number): Phaser.GameObjects.GameObject;
/**
* Sets the horizontal velocity of the physics body.
* @param x The horizontal velocity value.
*/
- setVelocityX(x: number): this;
+ setVelocityX(x: number): Phaser.GameObjects.GameObject;
/**
- * Sets the vertical velocity of the physics body.
+ * Sets vertical velocity of the physics body.
* @param y The vertical velocity value.
*/
- setVelocityY(y: number): this;
+ setVelocityY(y: number): Phaser.GameObjects.GameObject;
/**
- * Sets the horizontal and vertical velocities of the physics body.
+ * Sets both the horizontal and vertical velocity of the physics body.
* @param x The horizontal velocity value.
- * @param y The vertical velocity value. If not given, defaults to the horizontal value. Default x.
+ * @param y The vertical velocity value, it can be either positive or negative. If not given, it will be the same as the `x` value. Default x.
*/
- setVelocity(x: number, y?: number): this;
- /**
- * Sets the maximum velocity this body can travel at.
- * @param x The maximum allowed horizontal velocity.
- * @param y The maximum allowed vertical velocity. If not given, defaults to the horizontal value. Default x.
- */
- setMaxVelocity(x: number, y?: number): this;
+ setVelocity(x: number, y?: number): Phaser.GameObjects.GameObject;
}
}
+ namespace Matter {
+ }
+
namespace Events {
- /**
- * The Impact Physics World Collide Event.
- *
- * This event is dispatched by an Impact Physics World instance if two bodies collide.
- *
- * Listen to it from a Scene using: `this.impact.world.on('collide', listener)`.
- */
- const COLLIDE: any;
+ type AfterAddEvent = {
+ /**
+ * An array of the object(s) that have been added. May be a single body, constraint, composite or a mixture of these.
+ */
+ object: any[];
+ /**
+ * The source object of the event.
+ */
+ source: any;
+ /**
+ * The name of the event.
+ */
+ name: string;
+ };
/**
- * The Impact Physics World Pause Event.
+ * The Matter Physics After Add Event.
*
- * This event is dispatched by an Impact Physics World instance when it is paused.
+ * This event is dispatched by a Matter Physics World instance at the end of the process when a new Body
+ * or Constraint has just been added to the world.
*
- * Listen to it from a Scene using: `this.impact.world.on('pause', listener)`.
+ * Listen to it from a Scene using: `this.matter.world.on('afteradd', listener)`.
+ */
+ const AFTER_ADD: any;
+
+ type AfterRemoveEvent = {
+ /**
+ * An array of the object(s) that were removed. May be a single body, constraint, composite or a mixture of these.
+ */
+ object: any[];
+ /**
+ * The source object of the event.
+ */
+ source: any;
+ /**
+ * The name of the event.
+ */
+ name: string;
+ };
+
+ /**
+ * The Matter Physics After Remove Event.
+ *
+ * This event is dispatched by a Matter Physics World instance at the end of the process when a
+ * Body or Constraint was removed from the world.
+ *
+ * Listen to it from a Scene using: `this.matter.world.on('afterremove', listener)`.
+ */
+ const AFTER_REMOVE: any;
+
+ type AfterUpdateEvent = {
+ /**
+ * The Matter Engine `timing.timestamp` value for the event.
+ */
+ timestamp: number;
+ /**
+ * The source object of the event.
+ */
+ source: any;
+ /**
+ * The name of the event.
+ */
+ name: string;
+ };
+
+ /**
+ * The Matter Physics After Update Event.
+ *
+ * This event is dispatched by a Matter Physics World instance after the engine has updated and all collision events have resolved.
+ *
+ * Listen to it from a Scene using: `this.matter.world.on('afterupdate', listener)`.
+ */
+ const AFTER_UPDATE: any;
+
+ type BeforeAddEvent = {
+ /**
+ * An array of the object(s) to be added. May be a single body, constraint, composite or a mixture of these.
+ */
+ object: any[];
+ /**
+ * The source object of the event.
+ */
+ source: any;
+ /**
+ * The name of the event.
+ */
+ name: string;
+ };
+
+ /**
+ * The Matter Physics Before Add Event.
+ *
+ * This event is dispatched by a Matter Physics World instance at the start of the process when a new Body
+ * or Constraint is being added to the world.
+ *
+ * Listen to it from a Scene using: `this.matter.world.on('beforeadd', listener)`.
+ */
+ const BEFORE_ADD: any;
+
+ type BeforeRemoveEvent = {
+ /**
+ * An array of the object(s) to be removed. May be a single body, constraint, composite or a mixture of these.
+ */
+ object: any[];
+ /**
+ * The source object of the event.
+ */
+ source: any;
+ /**
+ * The name of the event.
+ */
+ name: string;
+ };
+
+ /**
+ * The Matter Physics Before Remove Event.
+ *
+ * This event is dispatched by a Matter Physics World instance at the start of the process when a
+ * Body or Constraint is being removed from the world.
+ *
+ * Listen to it from a Scene using: `this.matter.world.on('beforeremove', listener)`.
+ */
+ const BEFORE_REMOVE: any;
+
+ type BeforeUpdateEvent = {
+ /**
+ * The Matter Engine `timing.timestamp` value for the event.
+ */
+ timestamp: number;
+ /**
+ * The source object of the event.
+ */
+ source: any;
+ /**
+ * The name of the event.
+ */
+ name: string;
+ };
+
+ /**
+ * The Matter Physics Before Update Event.
+ *
+ * This event is dispatched by a Matter Physics World instance right before all the collision processing takes place.
+ *
+ * Listen to it from a Scene using: `this.matter.world.on('beforeupdate', listener)`.
+ */
+ const BEFORE_UPDATE: any;
+
+ type CollisionActiveEvent = {
+ /**
+ * A list of all affected pairs in the collision.
+ */
+ pairs: Phaser.Types.Physics.Matter.MatterCollisionData[];
+ /**
+ * The Matter Engine `timing.timestamp` value for the event.
+ */
+ timestamp: number;
+ /**
+ * The source object of the event.
+ */
+ source: any;
+ /**
+ * The name of the event.
+ */
+ name: string;
+ };
+
+ /**
+ * The Matter Physics Collision Active Event.
+ *
+ * This event is dispatched by a Matter Physics World instance after the engine has updated.
+ * It provides a list of all pairs that are colliding in the current tick (if any).
+ *
+ * Listen to it from a Scene using: `this.matter.world.on('collisionactive', listener)`.
+ */
+ const COLLISION_ACTIVE: any;
+
+ type CollisionEndEvent = {
+ /**
+ * A list of all affected pairs in the collision.
+ */
+ pairs: Phaser.Types.Physics.Matter.MatterCollisionData[];
+ /**
+ * The Matter Engine `timing.timestamp` value for the event.
+ */
+ timestamp: number;
+ /**
+ * The source object of the event.
+ */
+ source: any;
+ /**
+ * The name of the event.
+ */
+ name: string;
+ };
+
+ /**
+ * The Matter Physics Collision End Event.
+ *
+ * This event is dispatched by a Matter Physics World instance after the engine has updated.
+ * It provides a list of all pairs that have finished colliding in the current tick (if any).
+ *
+ * Listen to it from a Scene using: `this.matter.world.on('collisionend', listener)`.
+ */
+ const COLLISION_END: any;
+
+ type CollisionStartEvent = {
+ /**
+ * A list of all affected pairs in the collision.
+ */
+ pairs: Phaser.Types.Physics.Matter.MatterCollisionData[];
+ /**
+ * The Matter Engine `timing.timestamp` value for the event.
+ */
+ timestamp: number;
+ /**
+ * The source object of the event.
+ */
+ source: any;
+ /**
+ * The name of the event.
+ */
+ name: string;
+ };
+
+ /**
+ * The Matter Physics Collision Start Event.
+ *
+ * This event is dispatched by a Matter Physics World instance after the engine has updated.
+ * It provides a list of all pairs that have started to collide in the current tick (if any).
+ *
+ * Listen to it from a Scene using: `this.matter.world.on('collisionstart', listener)`.
+ */
+ const COLLISION_START: any;
+
+ /**
+ * The Matter Physics Drag End Event.
+ *
+ * This event is dispatched by a Matter Physics World instance when a Pointer Constraint
+ * stops dragging a body.
+ *
+ * Listen to it from a Scene using: `this.matter.world.on('dragend', listener)`.
+ */
+ const DRAG_END: any;
+
+ /**
+ * The Matter Physics Drag Event.
+ *
+ * This event is dispatched by a Matter Physics World instance when a Pointer Constraint
+ * is actively dragging a body. It is emitted each time the pointer moves.
+ *
+ * Listen to it from a Scene using: `this.matter.world.on('drag', listener)`.
+ */
+ const DRAG: any;
+
+ /**
+ * The Matter Physics Drag Start Event.
+ *
+ * This event is dispatched by a Matter Physics World instance when a Pointer Constraint
+ * starts dragging a body.
+ *
+ * Listen to it from a Scene using: `this.matter.world.on('dragstart', listener)`.
+ */
+ const DRAG_START: any;
+
+ /**
+ * The Matter Physics World Pause Event.
+ *
+ * This event is dispatched by an Matter Physics World instance when it is paused.
+ *
+ * Listen to it from a Scene using: `this.matter.world.on('pause', listener)`.
*/
const PAUSE: any;
/**
- * The Impact Physics World Resume Event.
+ * The Matter Physics World Resume Event.
*
- * This event is dispatched by an Impact Physics World instance when it resumes from a paused state.
+ * This event is dispatched by an Matter Physics World instance when it resumes from a paused state.
*
- * Listen to it from a Scene using: `this.impact.world.on('resume', listener)`.
+ * Listen to it from a Scene using: `this.matter.world.on('resume', listener)`.
*/
const RESUME: any;
- }
+ type SleepEndEvent = {
+ /**
+ * The source object of the event.
+ */
+ source: any;
+ /**
+ * The name of the event.
+ */
+ name: string;
+ };
- }
+ /**
+ * The Matter Physics Sleep End Event.
+ *
+ * This event is dispatched by a Matter Physics World instance when a Body stop sleeping.
+ *
+ * Listen to it from a Scene using: `this.matter.world.on('sleepend', listener)`.
+ */
+ const SLEEP_END: any;
+
+ type SleepStartEvent = {
+ /**
+ * The source object of the event.
+ */
+ source: any;
+ /**
+ * The name of the event.
+ */
+ name: string;
+ };
+
+ /**
+ * The Matter Physics Sleep Start Event.
+ *
+ * This event is dispatched by a Matter Physics World instance when a Body goes to sleep.
+ *
+ * Listen to it from a Scene using: `this.matter.world.on('sleepstart', listener)`.
+ */
+ const SLEEP_START: any;
- namespace Matter {
- namespace Matter {
}
/**
- * The Matter Factory can create different types of bodies and them to a physics world.
+ * The Matter Factory is responsible for quickly creating a variety of different types of
+ * bodies, constraints and Game Objects and adding them into the physics world.
+ *
+ * You access the factory from within a Scene using `add`:
+ *
+ * ```javascript
+ * this.matter.add.rectangle(x, y, width, height);
+ * ```
+ *
+ * Use of the Factory is optional. All of the objects it creates can also be created
+ * directly via your own code or constructors. It is provided as a means to keep your
+ * code concise.
*/
class Factory {
/**
@@ -66314,30 +68030,30 @@ declare namespace Phaser {
* @param y The Y coordinate of the center of the Body.
* @param width The width of the Body.
* @param height The height of the Body.
- * @param options An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- rectangle(x: number, y: number, width: number, height: number, options: object): MatterJS.Body;
+ rectangle(x: number, y: number, width: number, height: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): MatterJS.Body;
/**
* Creates a new rigid trapezoidal Body and adds it to the World.
* @param x The X coordinate of the center of the Body.
* @param y The Y coordinate of the center of the Body.
- * @param width The width of the trapezoid of the Body.
- * @param height The height of the trapezoid of the Body.
+ * @param width The width of the trapezoid Body.
+ * @param height The height of the trapezoid Body.
* @param slope The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter.
- * @param options An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- trapezoid(x: number, y: number, width: number, height: number, slope: number, options: object): MatterJS.Body;
+ trapezoid(x: number, y: number, width: number, height: number, slope: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): MatterJS.Body;
/**
* Creates a new rigid circular Body and adds it to the World.
* @param x The X coordinate of the center of the Body.
* @param y The Y coordinate of the center of the Body.
* @param radius The radius of the circle.
- * @param options An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
* @param maxSides The maximum amount of sides to use for the polygon which will approximate this circle.
*/
- circle(x: number, y: number, radius: number, options?: object, maxSides?: number): MatterJS.Body;
+ circle(x: number, y: number, radius: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig, maxSides?: number): MatterJS.Body;
/**
* Creates a new rigid polygonal Body and adds it to the World.
@@ -66345,34 +68061,124 @@ declare namespace Phaser {
* @param y The Y coordinate of the center of the Body.
* @param sides The number of sides the polygon will have.
* @param radius The "radius" of the polygon, i.e. the distance from its center to any vertex. This is also the radius of its circumcircle.
- * @param options An object of properties to set on the Body. You can also specify a `chamfer` property to automatically adjust the body.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- polygon(x: number, y: number, sides: number, radius: number, options: object): MatterJS.Body;
+ polygon(x: number, y: number, sides: number, radius: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): MatterJS.Body;
/**
* Creates a body using the supplied vertices (or an array containing multiple sets of vertices) and adds it to the World.
* If the vertices are convex, they will pass through as supplied. Otherwise, if the vertices are concave, they will be decomposed. Note that this process is not guaranteed to support complex sets of vertices, e.g. ones with holes.
* @param x The X coordinate of the center of the Body.
* @param y The Y coordinate of the center of the Body.
- * @param vertexSets [description]
- * @param options [description]
+ * @param vertexSets The vertices data. Either a path string or an array of vertices.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
* @param flagInternal Flag internal edges (coincident part edges) Default false.
* @param removeCollinear Whether Matter.js will discard collinear edges (to improve performance). Default 0.01.
* @param minimumArea During decomposition discard parts that have an area less than this. Default 10.
*/
- fromVertices(x: number, y: number, vertexSets: string | any[], options?: object, flagInternal?: boolean, removeCollinear?: number, minimumArea?: number): MatterJS.Body;
+ fromVertices(x: number, y: number, vertexSets: string | any[], options?: Phaser.Types.Physics.Matter.MatterBodyConfig, flagInternal?: boolean, removeCollinear?: number, minimumArea?: number): MatterJS.Body;
/**
- * **This function is still in development**
+ * Creates a body using data exported from the application PhysicsEditor (https://www.codeandweb.com/physicseditor)
*
- * Creates a body using the supplied body data, as provided by a JSON file.
- * @param x The X coordinate of the body.
- * @param y The Y coordinate of the body.
- * @param data The body data object as parsed from the JSON body format.
- * @param options Optional Matter body configuration object, as passed to `Body.create`.
+ * The PhysicsEditor file should be loaded as JSON:
+ *
+ * ```javascript
+ * preload ()
+ * {
+ * this.load.json('vehicles', 'assets/vehicles.json);
+ * }
+ *
+ * create ()
+ * {
+ * const vehicleShapes = this.cache.json.get('vehicles');
+ * this.matter.add.fromPhysicsEditor(400, 300, vehicleShapes.truck);
+ * }
+ * ```
+ *
+ * Do not pass the entire JSON file to this method, but instead pass one of the shapes contained within it.
+ *
+ * If you pas in an `options` object, any settings in there will override those in the PhysicsEditor config object.
+ * @param x The horizontal world location of the body.
+ * @param y The vertical world location of the body.
+ * @param config The JSON data exported from PhysicsEditor.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
* @param addToWorld Should the newly created body be immediately added to the World? Default true.
*/
- fromJSON(x: number, y: number, data: object, options?: object, addToWorld?: boolean): MatterJS.Body;
+ fromPhysicsEditor(x: number, y: number, config: any, options?: Phaser.Types.Physics.Matter.MatterBodyConfig, addToWorld?: boolean): MatterJS.Body;
+
+ /**
+ * Creates a body using the path data from an SVG file.
+ *
+ * SVG Parsing requires the pathseg polyfill from https://github.com/progers/pathseg
+ *
+ * The SVG file should be loaded as XML, as this method requires the ability to extract
+ * the path data from it. I.e.:
+ *
+ * ```javascript
+ * preload ()
+ * {
+ * this.load.xml('face', 'assets/face.svg);
+ * }
+ *
+ * create ()
+ * {
+ * this.matter.add.fromSVG(400, 300, this.cache.xml.get('face'));
+ * }
+ * ```
+ * @param x The X coordinate of the body.
+ * @param y The Y coordinate of the body.
+ * @param xml The SVG Path data.
+ * @param scale Scale the vertices by this amount after creation. Default 1.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
+ * @param addToWorld Should the newly created body be immediately added to the World? Default true.
+ */
+ fromSVG(x: number, y: number, xml: object, scale?: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig, addToWorld?: boolean): MatterJS.Body;
+
+ /**
+ * Creates a body using the supplied physics data, as provided by a JSON file.
+ *
+ * The data file should be loaded as JSON:
+ *
+ * ```javascript
+ * preload ()
+ * {
+ * this.load.json('ninjas', 'assets/ninjas.json);
+ * }
+ *
+ * create ()
+ * {
+ * const ninjaShapes = this.cache.json.get('ninjas');
+ *
+ * this.matter.add.fromJSON(400, 300, ninjaShapes.shinobi);
+ * }
+ * ```
+ *
+ * Do not pass the entire JSON file to this method, but instead pass one of the shapes contained within it.
+ *
+ * If you pas in an `options` object, any settings in there will override those in the config object.
+ *
+ * The structure of the JSON file is as follows:
+ *
+ * ```text
+ * {
+ * 'generator_info': // The name of the application that created the JSON data
+ * 'shapeName': {
+ * 'type': // The type of body
+ * 'label': // Optional body label
+ * 'vertices': // An array, or an array of arrays, containing the vertex data in x/y object pairs
+ * }
+ * }
+ * ```
+ *
+ * At the time of writing, only the Phaser Physics Tracer App exports in this format.
+ * @param x The X coordinate of the body.
+ * @param y The Y coordinate of the body.
+ * @param config The JSON physics data.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
+ * @param addToWorld Should the newly created body be immediately added to the World? Default true.
+ */
+ fromJSON(x: number, y: number, config: any, options?: Phaser.Types.Physics.Matter.MatterBodyConfig, addToWorld?: boolean): MatterJS.Body;
/**
* Create a new composite containing Matter Image objects created in a grid arrangement.
@@ -66385,12 +68191,13 @@ declare namespace Phaser {
* @param rows The number of rows in the grid.
* @param columnGap The distance between each column. Default 0.
* @param rowGap The distance between each row. Default 0.
- * @param options [description]
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- imageStack(key: string, frame: string | integer, x: number, y: number, columns: number, rows: number, columnGap?: number, rowGap?: number, options?: object): MatterJS.Composite;
+ imageStack(key: string, frame: string | integer, x: number, y: number, columns: number, rows: number, columnGap?: number, rowGap?: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): MatterJS.Composite;
/**
* Create a new composite containing bodies created in the callback in a grid arrangement.
+ *
* This function uses the body bounds to prevent overlaps.
* @param x The horizontal position of this composite in the world.
* @param y The vertical position of this composite in the world.
@@ -66417,42 +68224,42 @@ declare namespace Phaser {
/**
* Chains all bodies in the given composite together using constraints.
- * @param composite [description]
- * @param xOffsetA [description]
- * @param yOffsetA [description]
- * @param xOffsetB [description]
- * @param yOffsetB [description]
- * @param options [description]
+ * @param composite The composite in which all bodies will be chained together sequentially.
+ * @param xOffsetA The horizontal offset of the BodyA constraint. This is a percentage based on the body size, not a world position.
+ * @param yOffsetA The vertical offset of the BodyA constraint. This is a percentage based on the body size, not a world position.
+ * @param xOffsetB The horizontal offset of the BodyB constraint. This is a percentage based on the body size, not a world position.
+ * @param yOffsetB The vertical offset of the BodyB constraint. This is a percentage based on the body size, not a world position.
+ * @param options An optional Constraint configuration object that is used to set initial Constraint properties on creation.
*/
- chain(composite: MatterJS.Composite, xOffsetA: number, yOffsetA: number, xOffsetB: number, yOffsetB: number, options: object): MatterJS.Composite;
+ chain(composite: MatterJS.Composite, xOffsetA: number, yOffsetA: number, xOffsetB: number, yOffsetB: number, options?: Phaser.Types.Physics.Matter.MatterConstraintConfig): MatterJS.Composite;
/**
* Connects bodies in the composite with constraints in a grid pattern, with optional cross braces.
- * @param composite [description]
- * @param columns [description]
- * @param rows [description]
- * @param crossBrace [description]
- * @param options [description]
+ * @param composite The composite in which all bodies will be chained together.
+ * @param columns The number of columns in the mesh.
+ * @param rows The number of rows in the mesh.
+ * @param crossBrace Create cross braces for the mesh as well?
+ * @param options An optional Constraint configuration object that is used to set initial Constraint properties on creation.
*/
- mesh(composite: MatterJS.Composite, columns: number, rows: number, crossBrace: boolean, options: object): MatterJS.Composite;
+ mesh(composite: MatterJS.Composite, columns: number, rows: number, crossBrace: boolean, options?: Phaser.Types.Physics.Matter.MatterConstraintConfig): MatterJS.Composite;
/**
* Creates a composite with a Newton's Cradle setup of bodies and constraints.
- * @param x [description]
- * @param y [description]
- * @param number [description]
- * @param size [description]
- * @param length [description]
+ * @param x The horizontal position of the start of the cradle.
+ * @param y The vertical position of the start of the cradle.
+ * @param number The number of balls in the cradle.
+ * @param size The radius of each ball in the cradle.
+ * @param length The length of the 'string' the balls hang from.
*/
newtonsCradle(x: number, y: number, number: number, size: number, length: number): MatterJS.Composite;
/**
* Creates a composite with simple car setup of bodies and constraints.
- * @param x [description]
- * @param y [description]
- * @param width [description]
- * @param height [description]
- * @param wheelSize [description]
+ * @param x The horizontal position of the car in the world.
+ * @param y The vertical position of the car in the world.
+ * @param width The width of the car chasis.
+ * @param height The height of the car chasis.
+ * @param wheelSize The radius of the car wheels.
*/
car(x: number, y: number, width: number, height: number, wheelSize: number): MatterJS.Composite;
@@ -66464,124 +68271,193 @@ declare namespace Phaser {
* @param rows The number of rows in the Composite.
* @param columnGap The distance between each column.
* @param rowGap The distance between each row.
- * @param crossBrace [description]
+ * @param crossBrace `true` to create cross braces between the bodies, or `false` to create just straight braces.
* @param particleRadius The radius of this circlular composite.
- * @param particleOptions [description]
- * @param constraintOptions [description]
+ * @param particleOptions An optional Body configuration object that is used to set initial Body properties on creation.
+ * @param constraintOptions An optional Constraint configuration object that is used to set initial Constraint properties on creation.
*/
- softBody(x: number, y: number, columns: number, rows: number, columnGap: number, rowGap: number, crossBrace: boolean, particleRadius: number, particleOptions: object, constraintOptions: object): MatterJS.Composite;
+ softBody(x: number, y: number, columns: number, rows: number, columnGap: number, rowGap: number, crossBrace: boolean, particleRadius: number, particleOptions?: Phaser.Types.Physics.Matter.MatterBodyConfig, constraintOptions?: Phaser.Types.Physics.Matter.MatterConstraintConfig): MatterJS.Composite;
/**
- * [description]
+ * This method is an alias for `Factory.constraint`.
+ *
+ * Constraints (or joints) are used for specifying that a fixed distance must be maintained
+ * between two bodies, or a body and a fixed world-space position.
+ *
+ * The stiffness of constraints can be modified to create springs or elastic.
+ *
+ * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness`
+ * value (e.g. `0.7` or above).
+ *
+ * If the constraint is unstable, try lowering the `stiffness` value and / or increasing
+ * `constraintIterations` within the Matter Config.
+ *
+ * For compound bodies, constraints must be applied to the parent body and not one of its parts.
* @param bodyA The first possible `Body` that this constraint is attached to.
* @param bodyB The second possible `Body` that this constraint is attached to.
* @param length A Number that specifies the target resting length of the constraint. If not given it is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`.
* @param stiffness A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. A value of `1` means the constraint should be very stiff. A value of `0.2` means the constraint acts as a soft spring. Default 1.
- * @param options [description] Default {}.
+ * @param options An optional Constraint configuration object that is used to set initial Constraint properties on creation.
*/
- joint(bodyA: MatterJS.Body, bodyB: MatterJS.Body, length?: number, stiffness?: number, options?: object): MatterJS.Constraint;
+ joint(bodyA: MatterJS.Body, bodyB: MatterJS.Body, length?: number, stiffness?: number, options?: Phaser.Types.Physics.Matter.MatterConstraintConfig): MatterJS.Constraint;
/**
- * [description]
+ * This method is an alias for `Factory.constraint`.
+ *
+ * Constraints (or joints) are used for specifying that a fixed distance must be maintained
+ * between two bodies, or a body and a fixed world-space position.
+ *
+ * The stiffness of constraints can be modified to create springs or elastic.
+ *
+ * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness`
+ * value (e.g. `0.7` or above).
+ *
+ * If the constraint is unstable, try lowering the `stiffness` value and / or increasing
+ * `constraintIterations` within the Matter Config.
+ *
+ * For compound bodies, constraints must be applied to the parent body and not one of its parts.
* @param bodyA The first possible `Body` that this constraint is attached to.
* @param bodyB The second possible `Body` that this constraint is attached to.
* @param length A Number that specifies the target resting length of the constraint. If not given it is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`.
* @param stiffness A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. A value of `1` means the constraint should be very stiff. A value of `0.2` means the constraint acts as a soft spring. Default 1.
- * @param options [description] Default {}.
+ * @param options An optional Constraint configuration object that is used to set initial Constraint properties on creation.
*/
- spring(bodyA: MatterJS.Body, bodyB: MatterJS.Body, length?: number, stiffness?: number, options?: object): MatterJS.Constraint;
+ spring(bodyA: MatterJS.Body, bodyB: MatterJS.Body, length?: number, stiffness?: number, options?: Phaser.Types.Physics.Matter.MatterConstraintConfig): MatterJS.Constraint;
/**
- * [description]
+ * Constraints (or joints) are used for specifying that a fixed distance must be maintained
+ * between two bodies, or a body and a fixed world-space position.
+ *
+ * The stiffness of constraints can be modified to create springs or elastic.
+ *
+ * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness`
+ * value (e.g. `0.7` or above).
+ *
+ * If the constraint is unstable, try lowering the `stiffness` value and / or increasing
+ * `constraintIterations` within the Matter Config.
+ *
+ * For compound bodies, constraints must be applied to the parent body and not one of its parts.
* @param bodyA The first possible `Body` that this constraint is attached to.
* @param bodyB The second possible `Body` that this constraint is attached to.
* @param length A Number that specifies the target resting length of the constraint. If not given it is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`.
* @param stiffness A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. A value of `1` means the constraint should be very stiff. A value of `0.2` means the constraint acts as a soft spring. Default 1.
- * @param options [description] Default {}.
+ * @param options An optional Constraint configuration object that is used to set initial Constraint properties on creation.
*/
- constraint(bodyA: MatterJS.Body, bodyB: MatterJS.Body, length?: number, stiffness?: number, options?: object): MatterJS.Constraint;
+ constraint(bodyA: MatterJS.Body, bodyB: MatterJS.Body, length?: number, stiffness?: number, options?: Phaser.Types.Physics.Matter.MatterConstraintConfig): MatterJS.Constraint;
/**
- * [description]
+ * Constraints (or joints) are used for specifying that a fixed distance must be maintained
+ * between two bodies, or a body and a fixed world-space position.
+ *
+ * A world constraint has only one body, you should specify a `pointA` position in
+ * the constraint options parameter to attach the constraint to the world.
+ *
+ * The stiffness of constraints can be modified to create springs or elastic.
+ *
+ * To simulate a revolute constraint (or pin joint) set `length: 0` and a high `stiffness`
+ * value (e.g. `0.7` or above).
+ *
+ * If the constraint is unstable, try lowering the `stiffness` value and / or increasing
+ * `constraintIterations` within the Matter Config.
+ *
+ * For compound bodies, constraints must be applied to the parent body and not one of its parts.
* @param body The Matter `Body` that this constraint is attached to.
* @param length A number that specifies the target resting length of the constraint. If not given it is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`.
* @param stiffness A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting `constraint.length`. A value of `1` means the constraint should be very stiff. A value of `0.2` means the constraint acts as a soft spring. Default 1.
- * @param options [description] Default {}.
+ * @param options An optional Constraint configuration object that is used to set initial Constraint properties on creation.
*/
- worldConstraint(body: MatterJS.Body, length?: number, stiffness?: number, options?: object): MatterJS.Constraint;
+ worldConstraint(body: MatterJS.Body, length?: number, stiffness?: number, options?: Phaser.Types.Physics.Matter.MatterConstraintConfig): MatterJS.Constraint;
/**
- * [description]
- * @param options [description]
+ * This method is an alias for `Factory.pointerConstraint`.
+ *
+ * A Pointer Constraint is a special type of constraint that allows you to click
+ * and drag bodies in a Matter World. It monitors the active Pointers in a Scene,
+ * and when one is pressed down it checks to see if that hit any part of any active
+ * body in the world. If it did, and the body has input enabled, it will begin to
+ * drag it until either released, or you stop it via the `stopDrag` method.
+ *
+ * You can adjust the stiffness, length and other properties of the constraint via
+ * the `options` object on creation.
+ * @param options An optional Constraint configuration object that is used to set initial Constraint properties on creation.
*/
- mouseSpring(options: object): MatterJS.Constraint;
+ mouseSpring(options?: Phaser.Types.Physics.Matter.MatterConstraintConfig): MatterJS.Constraint;
/**
- * [description]
- * @param options [description]
+ * A Pointer Constraint is a special type of constraint that allows you to click
+ * and drag bodies in a Matter World. It monitors the active Pointers in a Scene,
+ * and when one is pressed down it checks to see if that hit any part of any active
+ * body in the world. If it did, and the body has input enabled, it will begin to
+ * drag it until either released, or you stop it via the `stopDrag` method.
+ *
+ * You can adjust the stiffness, length and other properties of the constraint via
+ * the `options` object on creation.
+ * @param options An optional Constraint configuration object that is used to set initial Constraint properties on creation.
*/
- pointerConstraint(options: object): MatterJS.Constraint;
+ pointerConstraint(options?: Phaser.Types.Physics.Matter.MatterConstraintConfig): MatterJS.Constraint;
/**
- * [description]
+ * Creates a Matter Physics 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.
* @param x The horizontal position of this Game Object in the world.
* @param y The vertical position of this Game Object in the world.
* @param key The key 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. Set to `null` to skip this value.
- * @param options [description] Default {}.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- image(x: number, y: number, key: string, frame?: string | integer, options?: object): Phaser.Physics.Matter.Image;
+ image(x: number, y: number, key: string, frame?: string | integer, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.Physics.Matter.Image;
/**
- * [description]
- * @param tile [description]
- * @param options [description]
+ * Creates a wrapper around a Tile that provides access to a corresponding Matter body. A tile can only
+ * have one Matter body associated with it. You can either pass in an existing Matter body for
+ * the tile or allow the constructor to create the corresponding body for you. If the Tile has a
+ * collision group (defined in Tiled), those shapes will be used to create the body. If not, the
+ * tile's rectangle bounding box will be used.
+ *
+ * The corresponding body will be accessible on the Tile itself via Tile.physics.matterBody.
+ *
+ * Note: not all Tiled collision shapes are supported. See
+ * Phaser.Physics.Matter.TileBody#setFromTileCollision for more information.
+ * @param tile The target tile that should have a Matter body.
+ * @param options Options to be used when creating the Matter body.
*/
- tileBody(tile: Phaser.Tilemaps.Tile, options: object): Phaser.Physics.Matter.TileBody;
+ tileBody(tile: Phaser.Tilemaps.Tile, options?: Phaser.Types.Physics.Matter.MatterTileOptions): Phaser.Physics.Matter.TileBody;
/**
- * [description]
+ * Creates a Matter Physics Sprite Game Object.
+ *
+ * A Sprite Game Object is used for the display of both static and animated images in your game.
+ * Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled
+ * and animated.
+ *
+ * The main difference between a Sprite and an Image Game Object is that you cannot animate Images.
+ * As such, Sprites take a fraction longer to process and have a larger API footprint due to the Animation
+ * Component. If you do not require animation then you can safely use Images to replace Sprites in all cases.
* @param x The horizontal position of this Game Object in the world.
* @param y The vertical position of this Game Object in the world.
* @param key The key 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. Set to `null` to skip this value.
- * @param options [description] Default {}.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- sprite(x: number, y: number, key: string, frame?: string | integer, options?: object): Phaser.Physics.Matter.Sprite;
+ sprite(x: number, y: number, key: string, frame?: string | integer, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.Physics.Matter.Sprite;
/**
- * [description]
- * @param gameObject The Game Object to inject the Matter Body in to.
+ * Takes an existing Game Object and injects all of the Matter Components into it.
+ *
+ * This enables you to use component methods such as `setVelocity` or `isSensor` directly from
+ * this Game Object.
+ *
+ * You can also pass in either a Matter Body Configuration object, or a Matter Body instance
+ * to link with this Game Object.
+ * @param gameObject The Game Object to inject the Matter Components in to.
* @param options A Matter Body configuration object, or an instance of a Matter Body.
* @param addToWorld Add this Matter Body to the World? Default true.
*/
- gameObject(gameObject: Phaser.GameObjects.GameObject, options?: object | MatterJS.Body, addToWorld?: boolean): Phaser.GameObjects.GameObject;
-
- /**
- * Instantly sets the linear velocity of the given body. Position, angle, force etc. are unchanged.
- *
- * See also `force`.
- * @param body The Matter Body to set the velocity on.
- * @param velocity The velocity to set. An object with public `x` and `y` components.
- */
- velocity(body: MatterJS.Body, velocity: Phaser.Types.Math.Vector2Like): MatterJS.Body;
-
- /**
- * Instantly sets the angular velocity of the given body. Position, angle, force etc. are unchanged.
- *
- * See also `force`.
- * @param body The Matter Body to set the velocity on.
- * @param velocity The angular velocity to set.
- */
- angularVelocity(body: MatterJS.Body, velocity: number): MatterJS.Body;
-
- /**
- * Applies a force to a body from a given world-space position, including resulting torque.
- * @param body The Matter Body to set the force on.
- * @param position The world position to apply the force from. An object with public `x` and `y` components.
- * @param force The force to set. An object with public `x` and `y` components.
- */
- force(body: MatterJS.Body, position: Phaser.Types.Math.Vector2Like, force: Phaser.Types.Math.Vector2Like): MatterJS.Body;
+ gameObject(gameObject: Phaser.GameObjects.GameObject, options?: Phaser.Types.Physics.Matter.MatterBodyConfig | MatterJS.Body, addToWorld?: boolean): Phaser.GameObjects.GameObject;
/**
* Destroys this Factory.
@@ -66591,13 +68467,17 @@ declare namespace Phaser {
}
/**
- * [description]
+ * A Matter Game Object is a generic object that allows you to combine any Phaser Game Object,
+ * including those you have extended or created yourself, with all of the Matter Components.
+ *
+ * This enables you to use component methods such as `setVelocity` or `isSensor` directly from
+ * this Game Object.
* @param world The Matter world to add the body to.
* @param gameObject The Game Object that will have the Matter body applied to it.
* @param options A Matter Body configuration object, or an instance of a Matter Body.
* @param addToWorld Should the newly created body be immediately added to the World? Default true.
*/
- function MatterGameObject(world: Phaser.Physics.Matter.World, gameObject: Phaser.GameObjects.GameObject, options?: object | MatterJS.Body, addToWorld?: boolean): Phaser.GameObjects.GameObject;
+ function MatterGameObject(world: Phaser.Physics.Matter.World, gameObject: Phaser.GameObjects.GameObject, options?: Phaser.Types.Physics.Matter.MatterBodyConfig | MatterJS.Body, addToWorld?: boolean): Phaser.GameObjects.GameObject;
/**
* A Matter Physics Image Game Object.
@@ -66615,9 +68495,9 @@ declare namespace Phaser {
* @param y The vertical position of this Game Object in the world.
* @param texture The key 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 options Matter.js configuration object. Default {}.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- constructor(world: Phaser.Physics.Matter.World, x: number, y: number, texture: string, frame?: string | integer, options?: object);
+ constructor(world: Phaser.Physics.Matter.World, x: number, y: number, texture: string, frame?: string | integer, options?: Phaser.Types.Physics.Matter.MatterBodyConfig);
/**
* A reference to the Matter.World instance that this body belongs to.
@@ -67624,13 +69504,17 @@ declare namespace Phaser {
setFriction(value: number, air?: number, fstatic?: number): Phaser.GameObjects.GameObject;
/**
- * Sets a new air resistance for this Game Object's Matter Body. A value of 0 means the Body will never slow as it moves through space. The higher the value, the faster a Body slows when moving through space.
+ * Sets a new air resistance for this Game Object's Matter Body.
+ * A value of 0 means the Body will never slow as it moves through space.
+ * The higher the value, the faster a Body slows when moving through space.
* @param value The new air resistance for the Body.
*/
setFrictionAir(value: number): Phaser.GameObjects.GameObject;
/**
- * Sets a new static friction for this Game Object's Matter Body. A value of 0 means the Body will never "stick" when it is nearly stationary. The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary.
+ * Sets a new static friction for this Game Object's Matter Body.
+ * A value of 0 means the Body will never "stick" when it is nearly stationary.
+ * The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary.
* @param value The new static friction for the Body.
*/
setFrictionStatic(value: number): Phaser.GameObjects.GameObject;
@@ -67663,86 +69547,119 @@ declare namespace Phaser {
readonly centerOfMass: Phaser.Math.Vector2;
/**
- * [description]
- * @param value [description]
+ * Set the body belonging to this Game Object to be a sensor.
+ * Sensors trigger collision events, but don't react with colliding body physically.
+ * @param value `true` to set the body as a sensor, or `false` to disable it.
*/
setSensor(value: boolean): Phaser.GameObjects.GameObject;
/**
- * [description]
+ * Is the body belonging to this Game Object a sensor or not?
*/
isSensor(): boolean;
/**
* Set the body on a Game Object to a rectangle.
+ *
+ * Calling this methods resets previous properties you may have set on the body, including
+ * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
* @param width Width of the rectangle.
* @param height Height of the rectangle.
- * @param options [description]
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- setRectangle(width: number, height: number, options: object): Phaser.GameObjects.GameObject;
+ setRectangle(width: number, height: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.GameObjects.GameObject;
/**
- * [description]
- * @param radius [description]
- * @param options [description]
+ * Set the body on a Game Object to a circle.
+ *
+ * Calling this methods resets previous properties you may have set on the body, including
+ * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
+ * @param radius The radius of the circle.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- setCircle(radius: number, options: object): Phaser.GameObjects.GameObject;
+ setCircle(radius: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.GameObjects.GameObject;
/**
* Set the body on the Game Object to a polygon shape.
- * @param radius The radius of the polygon.
- * @param sides The amount of sides creating the polygon.
- * @param options A matterjs config object.
+ *
+ * Calling this methods resets previous properties you may have set on the body, including
+ * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
+ * @param sides The number of sides the polygon will have.
+ * @param radius The "radius" of the polygon, i.e. the distance from its center to any vertex. This is also the radius of its circumcircle.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- setPolygon(radius: number, sides: number, options: object): Phaser.GameObjects.GameObject;
+ setPolygon(sides: number, radius: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.GameObjects.GameObject;
/**
- * Creates a new matterjs trapezoid body.
- * @param width The width of the trapezoid.
- * @param height The height of the trapezoid.
- * @param slope The angle of slope for the trapezoid.
- * @param options A matterjs config object for the body.
+ * Set the body on the Game Object to a trapezoid shape.
+ *
+ * Calling this methods resets previous properties you may have set on the body, including
+ * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
+ * @param width The width of the trapezoid Body.
+ * @param height The height of the trapezoid Body.
+ * @param slope The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- setTrapezoid(width: number, height: number, slope: number, options: object): Phaser.GameObjects.GameObject;
+ setTrapezoid(width: number, height: number, slope: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.GameObjects.GameObject;
/**
- * [description]
- * @param body [description]
- * @param addToWorld Should the newly created body be immediately added to the World? Default true.
+ * Set this Game Object to use the given existing Matter Body.
+ *
+ * The body is first removed from the world before being added to this Game Object.
+ * @param body The Body this Game Object should use.
+ * @param addToWorld Should the body be immediately added to the World? Default true.
*/
setExistingBody(body: MatterJS.Body, addToWorld?: boolean): Phaser.GameObjects.GameObject;
/**
- * [description]
- * @param config [description]
- * @param options [description]
+ * Set this Game Object to create and use a new Body based on the configuration object given.
+ *
+ * Calling this method resets previous properties you may have set on the body, including
+ * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
+ * @param config Either a string, such as `circle`, or a Matter Set Body Configuration object.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- setBody(config: object, options: object): Phaser.GameObjects.GameObject;
+ setBody(config: string | Phaser.Types.Physics.Matter.MatterSetBodyConfig, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.GameObjects.GameObject;
/**
- * [description]
- * @param value [description] Default 60.
+ * Sets this Body to sleep.
*/
- setSleepThreshold(value?: number): Phaser.GameObjects.GameObject;
+ setToSleep(): this;
/**
- * [description]
- * @param start [description]
- * @param end [description]
+ * Wakes this Body if asleep.
*/
- setSleepEvents(start: boolean, end: boolean): Phaser.GameObjects.GameObject;
+ setAwake(): this;
/**
- * [description]
- * @param value [description]
+ * Sets the number of updates in which this body must have near-zero velocity before it is set as sleeping (if sleeping is enabled by the engine).
+ * @param value A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping. Default 60.
*/
- setSleepStartEvent(value: boolean): Phaser.GameObjects.GameObject;
+ setSleepThreshold(value?: number): this;
/**
- * [description]
- * @param value [description]
+ * Enable sleep and wake events for this body.
+ *
+ * By default when a body goes to sleep, or wakes up, it will not emit any events.
+ *
+ * The events are emitted by the Matter World instance and can be listened to via
+ * the `SLEEP_START` and `SLEEP_END` events.
+ * @param start `true` if you want the sleep start event to be emitted for this body.
+ * @param end `true` if you want the sleep end event to be emitted for this body.
*/
- setSleepEndEvent(value: boolean): Phaser.GameObjects.GameObject;
+ setSleepEvents(start: boolean, end: boolean): this;
+
+ /**
+ * Enables or disables the Sleep Start event for this body.
+ * @param value `true` to enable the sleep event, or `false` to disable it.
+ */
+ setSleepStartEvent(value: boolean): this;
+
+ /**
+ * Enables or disables the Sleep End event for this body.
+ * @param value `true` to enable the sleep event, or `false` to disable it.
+ */
+ setSleepEndEvent(value: boolean): this;
/**
* Changes the physics body to be either static `true` or dynamic `false`.
@@ -67755,30 +69672,6 @@ declare namespace Phaser {
*/
isStatic(): boolean;
- /**
- * Returns the center x offset of the Body this Game Object is using.
- *
- * This is calculated by taking the difference between the center of the frame and the center of
- * the physics body. If set, the `body.render.sprite.xOffset` value is then added to it.
- *
- * Use this when setting the Origin of a Physics Game Object post-creation, i.e.:
- *
- * `setOrigin(originX + centerOffsetX, originY + centerOffsetY)`
- */
- readonly centerOffsetX: number;
-
- /**
- * Returns the center y offset of the Body this Game Object is using.
- *
- * This is calculated by taking the difference between the center of the frame and the center of
- * the physics body. If set, the `body.render.sprite.yOffset` value is then added to it.
- *
- * Use this when setting the Origin of a Physics Game Object post-creation, i.e.:
- *
- * `setOrigin(originX + centerOffsetX, originY + centerOffsetY)`
- */
- readonly centerOffsetY: number;
-
/**
* Setting fixed rotation sets the Body inertia to Infinity, which stops it
* from being able to rotate when forces are applied to it.
@@ -67786,8 +69679,9 @@ declare namespace Phaser {
setFixedRotation(): this;
/**
- * [description]
- * @param value [description]
+ * Sets the angular velocity of the body instantly.
+ * Position, angle, force etc. are unchanged.
+ * @param value The angular velocity.
*/
setAngularVelocity(value: number): Phaser.GameObjects.GameObject;
@@ -67890,7 +69784,7 @@ declare namespace Phaser {
world: Phaser.Physics.Matter.World;
/**
- * An instance of the Matter Factory. This class provides lots of functions for creatying a
+ * An instance of the Matter Factory. This class provides lots of functions for creating a
* wide variety of physics objects and adds them automatically to the Matter World.
*
* You can use this class to cut-down on the amount of code required in your game, however,
@@ -67899,6 +69793,12 @@ declare namespace Phaser {
*/
add: Phaser.Physics.Matter.Factory;
+ /**
+ * An instance of the Body Bounds class. This class contains functions used for getting the
+ * world position from various points around the bounds of a physics body.
+ */
+ bodyBounds: Phaser.Physics.Matter.BodyBounds;
+
/**
* A reference to the `Matter.Body` module.
*
@@ -68165,7 +70065,7 @@ declare namespace Phaser {
* @param x The horizontal coordinate of the point.
* @param y The vertical coordinate of the point.
*/
- containsPoint(body: MatterJS.Body | MatterJS.Body[], x: number, y: number): boolean;
+ containsPoint(body: Phaser.Types.Physics.Matter.MatterBody | Phaser.Types.Physics.Matter.MatterBody[], x: number, y: number): boolean;
/**
* Checks the given coordinates to see if any vertices of the given bodies contain it.
@@ -68179,7 +70079,7 @@ declare namespace Phaser {
* @param y The vertical coordinate of the point.
* @param bodies An array of bodies to check. If not provided it will search all bodies in the world.
*/
- intersectPoint(x: number, y: number, bodies?: MatterJS.Body[]): MatterJS.Body[];
+ intersectPoint(x: number, y: number, bodies?: Phaser.Types.Physics.Matter.MatterBody[]): Phaser.Types.Physics.Matter.MatterBody[];
/**
* Checks the given rectangular area to see if any vertices of the given bodies intersect with it.
@@ -68194,7 +70094,7 @@ declare namespace Phaser {
* @param outside If `false` it checks for vertices inside the area, if `true` it checks for vertices outside the area. Default false.
* @param bodies An array of bodies to check. If not provided it will search all bodies in the world.
*/
- intersectRect(x: number, y: number, width: number, height: number, outside?: boolean, bodies?: MatterJS.Body[]): MatterJS.Body[];
+ intersectRect(x: number, y: number, width: number, height: number, outside?: boolean, bodies?: Phaser.Types.Physics.Matter.MatterBody[]): Phaser.Types.Physics.Matter.MatterBody[];
/**
* Checks the given ray segment to see if any vertices of the given bodies intersect with it.
@@ -68209,7 +70109,7 @@ declare namespace Phaser {
* @param rayWidth The width of the ray segment. Default 1.
* @param bodies An array of bodies to check. If not provided it will search all bodies in the world.
*/
- intersectRay(x1: number, y1: number, x2: number, y2: number, rayWidth?: number, bodies?: MatterJS.Body[]): MatterJS.Body[];
+ intersectRay(x1: number, y1: number, x2: number, y2: number, rayWidth?: number, bodies?: Phaser.Types.Physics.Matter.MatterBody[]): Phaser.Types.Physics.Matter.MatterBody[];
/**
* Checks the given Matter Body to see if it intersects with any of the given bodies.
@@ -68218,7 +70118,7 @@ declare namespace Phaser {
* @param body The target body.
* @param bodies An array of bodies to check the target body against. If not provided it will search all bodies in the world.
*/
- intersectBody(body: MatterJS.Body, bodies?: MatterJS.Body[]): MatterJS.Body[];
+ intersectBody(body: Phaser.Types.Physics.Matter.MatterBody, bodies?: Phaser.Types.Physics.Matter.MatterBody[]): Phaser.Types.Physics.Matter.MatterBody[];
/**
* Checks to see if the target body, or an array of target bodies, intersects with any of the given bodies.
@@ -68243,7 +70143,7 @@ declare namespace Phaser {
* @param processCallback An optional callback function that lets you perform additional checks against the two bodies if they overlap. If this is set then `overlapCallback` will only be invoked if this callback returns `true`.
* @param callbackContext The context, or scope, in which to run the callbacks.
*/
- overlap(target: MatterJS.Body | MatterJS.Body[], bodies?: MatterJS.Body[], overlapCallback?: ArcadePhysicsCallback, processCallback?: ArcadePhysicsCallback, callbackContext?: any): boolean;
+ overlap(target: Phaser.Types.Physics.Matter.MatterBody | Phaser.Types.Physics.Matter.MatterBody[], bodies?: Phaser.Types.Physics.Matter.MatterBody[], overlapCallback?: ArcadePhysicsCallback, processCallback?: ArcadePhysicsCallback, callbackContext?: any): boolean;
/**
* Sets the collision filter category of all given Matter Bodies to the given value.
@@ -68255,7 +70155,7 @@ declare namespace Phaser {
* @param bodies An array of bodies to update. If falsey it will use all bodies in the world.
* @param value Unique category bitfield.
*/
- setCollisionCategory(bodies: MatterJS.Body[], value: number): this;
+ setCollisionCategory(bodies: Phaser.Types.Physics.Matter.MatterBody[], value: number): this;
/**
* Sets the collision filter group of all given Matter Bodies to the given value.
@@ -68268,7 +70168,7 @@ declare namespace Phaser {
* @param bodies An array of bodies to update. If falsey it will use all bodies in the world.
* @param value Unique group index.
*/
- setCollisionGroup(bodies: MatterJS.Body[], value: number): this;
+ setCollisionGroup(bodies: Phaser.Types.Physics.Matter.MatterBody[], value: number): this;
/**
* Sets the collision filter mask of all given Matter Bodies to the given value.
@@ -68279,7 +70179,7 @@ declare namespace Phaser {
* @param bodies An array of bodies to update. If falsey it will use all bodies in the world.
* @param categories A unique category bitfield, or an array of them.
*/
- setCollidesWith(bodies: MatterJS.Body[], categories: number | number[]): this;
+ setCollidesWith(bodies: Phaser.Types.Physics.Matter.MatterBody[], categories: number | number[]): this;
/**
* Takes an array and returns a new array made from all of the Matter Bodies found in the original array.
@@ -68292,6 +70192,101 @@ declare namespace Phaser {
*/
getMatterBodies(bodies?: any[]): MatterJS.Body[];
+ /**
+ * Sets both the horizontal and vertical linear velocity of the physics bodies.
+ * @param bodies Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world.
+ * @param x The horizontal linear velocity value.
+ * @param y The vertical linear velocity value.
+ */
+ setVelocity(bodies: Phaser.Types.Physics.Matter.MatterBody | Phaser.Types.Physics.Matter.MatterBody[], x: number, y: number): this;
+
+ /**
+ * Sets just the horizontal linear velocity of the physics bodies.
+ * The vertical velocity of the body is unchanged.
+ * @param bodies Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world.
+ * @param x The horizontal linear velocity value.
+ */
+ setVelocityX(bodies: Phaser.Types.Physics.Matter.MatterBody | Phaser.Types.Physics.Matter.MatterBody[], x: number): this;
+
+ /**
+ * Sets just the vertical linear velocity of the physics bodies.
+ * The horizontal velocity of the body is unchanged.
+ * @param bodies Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world.
+ * @param y The vertical linear velocity value.
+ */
+ setVelocityY(bodies: Phaser.Types.Physics.Matter.MatterBody | Phaser.Types.Physics.Matter.MatterBody[], y: number): this;
+
+ /**
+ * Sets the angular velocity of the bodies instantly.
+ * Position, angle, force etc. are unchanged.
+ * @param bodies Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world.
+ * @param value The angular velocity.
+ */
+ setAngularVelocity(bodies: Phaser.Types.Physics.Matter.MatterBody | Phaser.Types.Physics.Matter.MatterBody[], value: number): this;
+
+ /**
+ * Applies a force to a body, at the bodies current position, including resulting torque.
+ * @param bodies Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world.
+ * @param force A Vector that specifies the force to apply.
+ */
+ applyForce(bodies: Phaser.Types.Physics.Matter.MatterBody | Phaser.Types.Physics.Matter.MatterBody[], force: Phaser.Types.Math.Vector2Like): this;
+
+ /**
+ * Applies a force to a body, from the given world position, including resulting torque.
+ * If no angle is given, the current body angle is used.
+ *
+ * Use very small speed values, such as 0.1, depending on the mass and required velocity.
+ * @param bodies Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world.
+ * @param position A Vector that specifies the world-space position to apply the force at.
+ * @param speed A speed value to be applied to a directional force.
+ * @param angle The angle, in radians, to apply the force from. Leave undefined to use the current body angle.
+ */
+ applyForceFromPosition(bodies: Phaser.Types.Physics.Matter.MatterBody | Phaser.Types.Physics.Matter.MatterBody[], position: Phaser.Types.Math.Vector2Like, speed: number, angle?: number): this;
+
+ /**
+ * Apply a force to a body based on the given angle and speed.
+ * If no angle is given, the current body angle is used.
+ *
+ * Use very small speed values, such as 0.1, depending on the mass and required velocity.
+ * @param bodies Either a single Body, or an array of bodies to update. If falsey it will use all bodies in the world.
+ * @param speed A speed value to be applied to a directional force.
+ * @param angle The angle, in radians, to apply the force from. Leave undefined to use the current body angle.
+ */
+ applyForceFromAngle(bodies: Phaser.Types.Physics.Matter.MatterBody | Phaser.Types.Physics.Matter.MatterBody[], speed: number, angle?: number): this;
+
+ /**
+ * Returns the length of the given constraint, which is the distance between the two points.
+ * @param constraint The constraint to get the length from.
+ */
+ getConstraintLength(constraint: MatterJS.Constraint): number;
+
+ /**
+ * Aligns a Body, or Matter Game Object, against the given coordinates.
+ *
+ * The alignment takes place using the body bounds, which take into consideration things
+ * like body scale and rotation.
+ *
+ * Although a Body has a `position` property, it is based on the center of mass for the body,
+ * not a dimension based center. This makes aligning bodies difficult, especially if they have
+ * rotated or scaled. This method will derive the correct position based on the body bounds and
+ * its center of mass offset, in order to align the body with the given coordinate.
+ *
+ * For example, if you wanted to align a body so it sat in the bottom-center of the
+ * Scene, and the world was 800 x 600 in size:
+ *
+ * ```javascript
+ * this.matter.alignBody(body, 400, 600, Phaser.Display.Align.BOTTOM_CENTER);
+ * ```
+ *
+ * You pass in 400 for the x coordinate, because that is the center of the world, and 600 for
+ * the y coordinate, as that is the base of the world.
+ * @param body The Body to align.
+ * @param x The horizontal position to align the body to.
+ * @param y The vertical position to align the body to.
+ * @param align One of the `Phaser.Display.Align` constants, such as `Phaser.Display.Align.TOP_LEFT`.
+ */
+ alignBody(body: Phaser.Types.Physics.Matter.MatterBody, x: number, y: number, align: integer): this;
+
}
/**
@@ -68313,9 +70308,9 @@ declare namespace Phaser {
* @param y The vertical position of this Game Object in the world.
* @param texture The key 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 options Matter.js configuration object. Default {}.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- constructor(world: Phaser.Physics.Matter.World, x: number, y: number, texture: string, frame?: string | integer, options?: object);
+ constructor(world: Phaser.Physics.Matter.World, x: number, y: number, texture: string, frame?: string | integer, options?: Phaser.Types.Physics.Matter.MatterBodyConfig);
/**
* A reference to the Matter.World instance that this body belongs to.
@@ -69322,13 +71317,17 @@ declare namespace Phaser {
setFriction(value: number, air?: number, fstatic?: number): Phaser.GameObjects.GameObject;
/**
- * Sets a new air resistance for this Game Object's Matter Body. A value of 0 means the Body will never slow as it moves through space. The higher the value, the faster a Body slows when moving through space.
+ * Sets a new air resistance for this Game Object's Matter Body.
+ * A value of 0 means the Body will never slow as it moves through space.
+ * The higher the value, the faster a Body slows when moving through space.
* @param value The new air resistance for the Body.
*/
setFrictionAir(value: number): Phaser.GameObjects.GameObject;
/**
- * Sets a new static friction for this Game Object's Matter Body. A value of 0 means the Body will never "stick" when it is nearly stationary. The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary.
+ * Sets a new static friction for this Game Object's Matter Body.
+ * A value of 0 means the Body will never "stick" when it is nearly stationary.
+ * The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary.
* @param value The new static friction for the Body.
*/
setFrictionStatic(value: number): Phaser.GameObjects.GameObject;
@@ -69361,86 +71360,119 @@ declare namespace Phaser {
readonly centerOfMass: Phaser.Math.Vector2;
/**
- * [description]
- * @param value [description]
+ * Set the body belonging to this Game Object to be a sensor.
+ * Sensors trigger collision events, but don't react with colliding body physically.
+ * @param value `true` to set the body as a sensor, or `false` to disable it.
*/
setSensor(value: boolean): Phaser.GameObjects.GameObject;
/**
- * [description]
+ * Is the body belonging to this Game Object a sensor or not?
*/
isSensor(): boolean;
/**
* Set the body on a Game Object to a rectangle.
+ *
+ * Calling this methods resets previous properties you may have set on the body, including
+ * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
* @param width Width of the rectangle.
* @param height Height of the rectangle.
- * @param options [description]
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- setRectangle(width: number, height: number, options: object): Phaser.GameObjects.GameObject;
+ setRectangle(width: number, height: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.GameObjects.GameObject;
/**
- * [description]
- * @param radius [description]
- * @param options [description]
+ * Set the body on a Game Object to a circle.
+ *
+ * Calling this methods resets previous properties you may have set on the body, including
+ * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
+ * @param radius The radius of the circle.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- setCircle(radius: number, options: object): Phaser.GameObjects.GameObject;
+ setCircle(radius: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.GameObjects.GameObject;
/**
* Set the body on the Game Object to a polygon shape.
- * @param radius The radius of the polygon.
- * @param sides The amount of sides creating the polygon.
- * @param options A matterjs config object.
+ *
+ * Calling this methods resets previous properties you may have set on the body, including
+ * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
+ * @param sides The number of sides the polygon will have.
+ * @param radius The "radius" of the polygon, i.e. the distance from its center to any vertex. This is also the radius of its circumcircle.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- setPolygon(radius: number, sides: number, options: object): Phaser.GameObjects.GameObject;
+ setPolygon(sides: number, radius: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.GameObjects.GameObject;
/**
- * Creates a new matterjs trapezoid body.
- * @param width The width of the trapezoid.
- * @param height The height of the trapezoid.
- * @param slope The angle of slope for the trapezoid.
- * @param options A matterjs config object for the body.
+ * Set the body on the Game Object to a trapezoid shape.
+ *
+ * Calling this methods resets previous properties you may have set on the body, including
+ * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
+ * @param width The width of the trapezoid Body.
+ * @param height The height of the trapezoid Body.
+ * @param slope The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- setTrapezoid(width: number, height: number, slope: number, options: object): Phaser.GameObjects.GameObject;
+ setTrapezoid(width: number, height: number, slope: number, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.GameObjects.GameObject;
/**
- * [description]
- * @param body [description]
- * @param addToWorld Should the newly created body be immediately added to the World? Default true.
+ * Set this Game Object to use the given existing Matter Body.
+ *
+ * The body is first removed from the world before being added to this Game Object.
+ * @param body The Body this Game Object should use.
+ * @param addToWorld Should the body be immediately added to the World? Default true.
*/
setExistingBody(body: MatterJS.Body, addToWorld?: boolean): Phaser.GameObjects.GameObject;
/**
- * [description]
- * @param config [description]
- * @param options [description]
+ * Set this Game Object to create and use a new Body based on the configuration object given.
+ *
+ * Calling this method resets previous properties you may have set on the body, including
+ * plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
+ * @param config Either a string, such as `circle`, or a Matter Set Body Configuration object.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- setBody(config: object, options: object): Phaser.GameObjects.GameObject;
+ setBody(config: string | Phaser.Types.Physics.Matter.MatterSetBodyConfig, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): Phaser.GameObjects.GameObject;
/**
- * [description]
- * @param value [description] Default 60.
+ * Sets this Body to sleep.
*/
- setSleepThreshold(value?: number): Phaser.GameObjects.GameObject;
+ setToSleep(): this;
/**
- * [description]
- * @param start [description]
- * @param end [description]
+ * Wakes this Body if asleep.
*/
- setSleepEvents(start: boolean, end: boolean): Phaser.GameObjects.GameObject;
+ setAwake(): this;
/**
- * [description]
- * @param value [description]
+ * Sets the number of updates in which this body must have near-zero velocity before it is set as sleeping (if sleeping is enabled by the engine).
+ * @param value A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping. Default 60.
*/
- setSleepStartEvent(value: boolean): Phaser.GameObjects.GameObject;
+ setSleepThreshold(value?: number): this;
/**
- * [description]
- * @param value [description]
+ * Enable sleep and wake events for this body.
+ *
+ * By default when a body goes to sleep, or wakes up, it will not emit any events.
+ *
+ * The events are emitted by the Matter World instance and can be listened to via
+ * the `SLEEP_START` and `SLEEP_END` events.
+ * @param start `true` if you want the sleep start event to be emitted for this body.
+ * @param end `true` if you want the sleep end event to be emitted for this body.
*/
- setSleepEndEvent(value: boolean): Phaser.GameObjects.GameObject;
+ setSleepEvents(start: boolean, end: boolean): this;
+
+ /**
+ * Enables or disables the Sleep Start event for this body.
+ * @param value `true` to enable the sleep event, or `false` to disable it.
+ */
+ setSleepStartEvent(value: boolean): this;
+
+ /**
+ * Enables or disables the Sleep End event for this body.
+ * @param value `true` to enable the sleep event, or `false` to disable it.
+ */
+ setSleepEndEvent(value: boolean): this;
/**
* Changes the physics body to be either static `true` or dynamic `false`.
@@ -69453,30 +71485,6 @@ declare namespace Phaser {
*/
isStatic(): boolean;
- /**
- * Returns the center x offset of the Body this Game Object is using.
- *
- * This is calculated by taking the difference between the center of the frame and the center of
- * the physics body. If set, the `body.render.sprite.xOffset` value is then added to it.
- *
- * Use this when setting the Origin of a Physics Game Object post-creation, i.e.:
- *
- * `setOrigin(originX + centerOffsetX, originY + centerOffsetY)`
- */
- readonly centerOffsetX: number;
-
- /**
- * Returns the center y offset of the Body this Game Object is using.
- *
- * This is calculated by taking the difference between the center of the frame and the center of
- * the physics body. If set, the `body.render.sprite.yOffset` value is then added to it.
- *
- * Use this when setting the Origin of a Physics Game Object post-creation, i.e.:
- *
- * `setOrigin(originX + centerOffsetX, originY + centerOffsetY)`
- */
- readonly centerOffsetY: number;
-
/**
* Setting fixed rotation sets the Body inertia to Infinity, which stops it
* from being able to rotate when forces are applied to it.
@@ -69484,8 +71492,9 @@ declare namespace Phaser {
setFixedRotation(): this;
/**
- * [description]
- * @param value [description]
+ * Sets the angular velocity of the body instantly.
+ * Position, angle, force etc. are unchanged.
+ * @param value The angular velocity.
*/
setAngularVelocity(value: number): Phaser.GameObjects.GameObject;
@@ -69525,7 +71534,7 @@ declare namespace Phaser {
class TileBody implements Phaser.Physics.Matter.Components.Bounce, Phaser.Physics.Matter.Components.Collision, Phaser.Physics.Matter.Components.Friction, Phaser.Physics.Matter.Components.Gravity, Phaser.Physics.Matter.Components.Mass, Phaser.Physics.Matter.Components.Sensor, Phaser.Physics.Matter.Components.Sleep, Phaser.Physics.Matter.Components.Static {
/**
*
- * @param world [description]
+ * @param world The Matter world instance this body belongs to.
* @param tile The target tile that should have a Matter body.
* @param options Options to be used when creating the Matter body.
*/
@@ -69656,13 +71665,17 @@ declare namespace Phaser {
setFriction(value: number, air?: number, fstatic?: number): Phaser.GameObjects.GameObject;
/**
- * Sets a new air resistance for this Game Object's Matter Body. A value of 0 means the Body will never slow as it moves through space. The higher the value, the faster a Body slows when moving through space.
+ * Sets a new air resistance for this Game Object's Matter Body.
+ * A value of 0 means the Body will never slow as it moves through space.
+ * The higher the value, the faster a Body slows when moving through space.
* @param value The new air resistance for the Body.
*/
setFrictionAir(value: number): Phaser.GameObjects.GameObject;
/**
- * Sets a new static friction for this Game Object's Matter Body. A value of 0 means the Body will never "stick" when it is nearly stationary. The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary.
+ * Sets a new static friction for this Game Object's Matter Body.
+ * A value of 0 means the Body will never "stick" when it is nearly stationary.
+ * The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary.
* @param value The new static friction for the Body.
*/
setFrictionStatic(value: number): Phaser.GameObjects.GameObject;
@@ -69695,40 +71708,56 @@ declare namespace Phaser {
readonly centerOfMass: Phaser.Math.Vector2;
/**
- * [description]
- * @param value [description]
+ * Set the body belonging to this Game Object to be a sensor.
+ * Sensors trigger collision events, but don't react with colliding body physically.
+ * @param value `true` to set the body as a sensor, or `false` to disable it.
*/
setSensor(value: boolean): Phaser.GameObjects.GameObject;
/**
- * [description]
+ * Is the body belonging to this Game Object a sensor or not?
*/
isSensor(): boolean;
/**
- * [description]
- * @param value [description] Default 60.
+ * Sets this Body to sleep.
*/
- setSleepThreshold(value?: number): Phaser.GameObjects.GameObject;
+ setToSleep(): this;
/**
- * [description]
- * @param start [description]
- * @param end [description]
+ * Wakes this Body if asleep.
*/
- setSleepEvents(start: boolean, end: boolean): Phaser.GameObjects.GameObject;
+ setAwake(): this;
/**
- * [description]
- * @param value [description]
+ * Sets the number of updates in which this body must have near-zero velocity before it is set as sleeping (if sleeping is enabled by the engine).
+ * @param value A `Number` that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping. Default 60.
*/
- setSleepStartEvent(value: boolean): Phaser.GameObjects.GameObject;
+ setSleepThreshold(value?: number): this;
/**
- * [description]
- * @param value [description]
+ * Enable sleep and wake events for this body.
+ *
+ * By default when a body goes to sleep, or wakes up, it will not emit any events.
+ *
+ * The events are emitted by the Matter World instance and can be listened to via
+ * the `SLEEP_START` and `SLEEP_END` events.
+ * @param start `true` if you want the sleep start event to be emitted for this body.
+ * @param end `true` if you want the sleep end event to be emitted for this body.
*/
- setSleepEndEvent(value: boolean): Phaser.GameObjects.GameObject;
+ setSleepEvents(start: boolean, end: boolean): this;
+
+ /**
+ * Enables or disables the Sleep Start event for this body.
+ * @param value `true` to enable the sleep event, or `false` to disable it.
+ */
+ setSleepStartEvent(value: boolean): this;
+
+ /**
+ * Enables or disables the Sleep End event for this body.
+ * @param value `true` to enable the sleep event, or `false` to disable it.
+ */
+ setSleepEndEvent(value: boolean): this;
/**
* Changes the physics body to be either static `true` or dynamic `false`.
@@ -69750,26 +71779,75 @@ declare namespace Phaser {
namespace PhysicsEditorParser {
/**
* Parses a body element exported by PhysicsEditor.
- * @param x x position.
- * @param y y position.
- * @param w width.
- * @param h height.
- * @param config body configuration and fixture (child body) definitions.
+ * @param x The horizontal world location of the body.
+ * @param y The vertical world location of the body.
+ * @param config The body configuration and fixture (child body) definitions, as exported by PhysicsEditor.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- function parseBody(x: number, y: number, w: number, h: number, config: object): object;
+ function parseBody(x: number, y: number, config: object, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): MatterJS.Body;
/**
* Parses an element of the "fixtures" list exported by PhysicsEditor
- * @param fixtureConfig the fixture object to parse
+ * @param fixtureConfig The fixture object to parse.
*/
- function parseFixture(fixtureConfig: object): object[];
+ function parseFixture(fixtureConfig: object): MatterJS.Body[];
/**
* Parses the "vertices" lists exported by PhysicsEditor.
* @param vertexSets The vertex lists to parse.
- * @param options Matter body options.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
*/
- function parseVertices(vertexSets: object, options: object): object[];
+ function parseVertices(vertexSets: any[], options?: Phaser.Types.Physics.Matter.MatterBodyConfig): MatterJS.Body[];
+
+ }
+
+ /**
+ * Creates a body using the supplied physics data, as provided by a JSON file.
+ *
+ * The data file should be loaded as JSON:
+ *
+ * ```javascript
+ * preload ()
+ * {
+ * this.load.json('ninjas', 'assets/ninjas.json);
+ * }
+ *
+ * create ()
+ * {
+ * const ninjaShapes = this.cache.json.get('ninjas');
+ *
+ * this.matter.add.fromJSON(400, 300, ninjaShapes.shinobi);
+ * }
+ * ```
+ *
+ * Do not pass the entire JSON file to this method, but instead pass one of the shapes contained within it.
+ *
+ * If you pas in an `options` object, any settings in there will override those in the config object.
+ *
+ * The structure of the JSON file is as follows:
+ *
+ * ```text
+ * {
+ * 'generator_info': // The name of the application that created the JSON data
+ * 'shapeName': {
+ * 'type': // The type of body
+ * 'label': // Optional body label
+ * 'vertices': // An array, or an array of arrays, containing the vertex data in x/y object pairs
+ * }
+ * }
+ * ```
+ *
+ * At the time of writing, only the Phaser Physics Tracer App exports in this format.
+ */
+ namespace PhysicsJSONParser {
+ /**
+ * Parses a body element from the given JSON data.
+ * @param x The horizontal world location of the body.
+ * @param y The vertical world location of the body.
+ * @param config The body configuration data.
+ * @param options An optional Body configuration object that is used to set initial Body properties on creation.
+ */
+ function parseBody(x: number, y: number, config: object, options?: Phaser.Types.Physics.Matter.MatterBodyConfig): MatterJS.Body;
}
@@ -70285,6 +72363,92 @@ declare namespace Phaser {
*/
getAllComposites(): MatterJS.Composite[];
+ /**
+ * Renders the Engine Broadphase Controller Grid to the given Graphics instance.
+ *
+ * The debug renderer calls this method if the `showBroadphase` config value is set.
+ *
+ * This method is used internally by the Matter Debug Renderer, but is also exposed publically should
+ * you wish to render the Grid to your own Graphics instance.
+ * @param grid The Matter Grid to be rendered.
+ * @param graphics The Graphics object to render to.
+ * @param lineColor The line color.
+ * @param lineOpacity The line opacity, between 0 and 1.
+ */
+ renderGrid(grid: MatterJS.Grid, graphics: Phaser.GameObjects.Graphics, lineColor: number, lineOpacity: number): this;
+
+ /**
+ * Renders the list of Pair separations to the given Graphics instance.
+ *
+ * The debug renderer calls this method if the `showSeparations` config value is set.
+ *
+ * This method is used internally by the Matter Debug Renderer, but is also exposed publically should
+ * you wish to render the Grid to your own Graphics instance.
+ * @param pairs An array of Matter Pairs to be rendered.
+ * @param graphics The Graphics object to render to.
+ * @param lineColor The line color.
+ */
+ renderSeparations(pairs: MatterJS.Pair[], graphics: Phaser.GameObjects.Graphics, lineColor: number): this;
+
+ /**
+ * Renders the list of collision points and normals to the given Graphics instance.
+ *
+ * The debug renderer calls this method if the `showCollisions` config value is set.
+ *
+ * This method is used internally by the Matter Debug Renderer, but is also exposed publically should
+ * you wish to render the Grid to your own Graphics instance.
+ * @param pairs An array of Matter Pairs to be rendered.
+ * @param graphics The Graphics object to render to.
+ * @param lineColor The line color.
+ */
+ renderCollisions(pairs: MatterJS.Pair[], graphics: Phaser.GameObjects.Graphics, lineColor: number): this;
+
+ /**
+ * Renders the bounds of an array of Bodies to the given Graphics instance.
+ *
+ * If the body is a compound body, it will render the bounds for the parent compound.
+ *
+ * The debug renderer calls this method if the `showBounds` config value is set.
+ *
+ * This method is used internally by the Matter Debug Renderer, but is also exposed publically should
+ * you wish to render bounds to your own Graphics instance.
+ * @param bodies An array of bodies from the localWorld.
+ * @param graphics The Graphics object to render to.
+ * @param lineColor The line color.
+ * @param lineOpacity The line opacity, between 0 and 1.
+ */
+ renderBodyBounds(bodies: any[], graphics: Phaser.GameObjects.Graphics, lineColor: number, lineOpacity: number): void;
+
+ /**
+ * Renders either all axes, or a single axis indicator, for an array of Bodies, to the given Graphics instance.
+ *
+ * The debug renderer calls this method if the `showAxes` or `showAngleIndicator` config values are set.
+ *
+ * This method is used internally by the Matter Debug Renderer, but is also exposed publically should
+ * you wish to render bounds to your own Graphics instance.
+ * @param bodies An array of bodies from the localWorld.
+ * @param graphics The Graphics object to render to.
+ * @param showAxes If `true` it will render all body axes. If `false` it will render a single axis indicator.
+ * @param lineColor The line color.
+ * @param lineOpacity The line opacity, between 0 and 1.
+ */
+ renderBodyAxes(bodies: any[], graphics: Phaser.GameObjects.Graphics, showAxes: boolean, lineColor: number, lineOpacity: number): void;
+
+ /**
+ * Renders a velocity indicator for an array of Bodies, to the given Graphics instance.
+ *
+ * The debug renderer calls this method if the `showVelocity` config value is set.
+ *
+ * This method is used internally by the Matter Debug Renderer, but is also exposed publically should
+ * you wish to render bounds to your own Graphics instance.
+ * @param bodies An array of bodies from the localWorld.
+ * @param graphics The Graphics object to render to.
+ * @param lineColor The line color.
+ * @param lineOpacity The line opacity, between 0 and 1.
+ * @param lineThickness The line thickness.
+ */
+ renderBodyVelocity(bodies: any[], graphics: Phaser.GameObjects.Graphics, lineColor: number, lineOpacity: number, lineThickness: number): void;
+
/**
* Renders a single Matter Body to the given Phaser Graphics Game Object.
*
@@ -70358,726 +72522,6 @@ declare namespace Phaser {
}
- namespace Components {
- /**
- * A component to set restitution on objects.
- */
- interface Bounce {
- /**
- * Sets the restitution on the physics object.
- * @param value A Number that defines the restitution (elasticity) of the body. The value is always positive and is in the range (0, 1). A value of 0 means collisions may be perfectly inelastic and no bouncing may occur. A value of 0.8 means the body may bounce back with approximately 80% of its kinetic energy. Note that collision response is based on pairs of bodies, and that restitution values are combined with the following formula: `Math.max(bodyA.restitution, bodyB.restitution)`
- */
- setBounce(value: number): Phaser.GameObjects.GameObject;
- }
-
- /**
- * Contains methods for changing the collision filter of a Matter Body. Should be used as a mixin and not called directly.
- */
- interface Collision {
- /**
- * Sets the collision category of this Game Object's Matter Body. This number must be a power of two between 2^0 (= 1) and 2^31.
- * Two bodies with different collision groups (see {@link #setCollisionGroup}) will only collide if their collision
- * categories are included in their collision masks (see {@link #setCollidesWith}).
- * @param value Unique category bitfield.
- */
- setCollisionCategory(value: number): Phaser.GameObjects.GameObject;
- /**
- * Sets the collision group of this Game Object's Matter Body. If this is zero or two Matter Bodies have different values,
- * they will collide according to the usual rules (see {@link #setCollisionCategory} and {@link #setCollisionGroup}).
- * If two Matter Bodies have the same positive value, they will always collide; if they have the same negative value,
- * they will never collide.
- * @param value Unique group index.
- */
- setCollisionGroup(value: number): Phaser.GameObjects.GameObject;
- /**
- * Sets the collision mask for this Game Object's Matter Body. Two Matter Bodies with different collision groups will only
- * collide if each one includes the other's category in its mask based on a bitwise AND, i.e. `(categoryA & maskB) !== 0`
- * and `(categoryB & maskA) !== 0` are both true.
- * @param categories A unique category bitfield, or an array of them.
- */
- setCollidesWith(categories: number | number[]): Phaser.GameObjects.GameObject;
- /**
- * The callback is sent a `Phaser.Types.Physics.Matter.MatterCollisionData` object.
- *
- * This does not change the bodies collision category, group or filter. Those must be set in addition
- * to the callback.
- * @param callback The callback to invoke when this body starts colliding with another.
- */
- setOnCollide(callback: Function): Phaser.GameObjects.GameObject;
- /**
- * The callback is sent a `Phaser.Types.Physics.Matter.MatterCollisionData` object.
- *
- * This does not change the bodies collision category, group or filter. Those must be set in addition
- * to the callback.
- * @param callback The callback to invoke when this body stops colliding with another.
- */
- setOnCollideEnd(callback: Function): Phaser.GameObjects.GameObject;
- /**
- * The callback is sent a `Phaser.Types.Physics.Matter.MatterCollisionData` object.
- *
- * This does not change the bodies collision category, group or filter. Those must be set in addition
- * to the callback.
- * @param callback The callback to invoke for the duration of this body colliding with another.
- */
- setOnCollideActive(callback: Function): Phaser.GameObjects.GameObject;
- /**
- * The callback is sent a reference to the other body, along with a `Phaser.Types.Physics.Matter.MatterCollisionData` object.
- *
- * This does not change the bodies collision category, group or filter. Those must be set in addition
- * to the callback.
- * @param body The body, or an array of bodies, to test for collisions with.
- * @param callback The callback to invoke when this body collides with the given body or bodies.
- */
- setOnCollideWith(body: MatterJS.Body | MatterJS.Body[], callback: Function): Phaser.GameObjects.GameObject;
- }
-
- /**
- * A component to apply force to Matter.js bodies.
- */
- interface Force {
- /**
- * Applies a force to a body.
- * @param force A Vector that specifies the force to apply.
- */
- applyForce(force: Phaser.Math.Vector2): Phaser.GameObjects.GameObject;
- /**
- * Applies a force to a body from a given position.
- * @param position The position in which the force comes from.
- * @param force A Vector that specifies the force to apply.
- */
- applyForceFrom(position: Phaser.Math.Vector2, force: Phaser.Math.Vector2): Phaser.GameObjects.GameObject;
- /**
- * Apply thrust to the forward position of the body.
- *
- * Use very small values, such as 0.1, depending on the mass and required speed.
- * @param speed A speed value to be applied to a directional force.
- */
- thrust(speed: number): Phaser.GameObjects.GameObject;
- /**
- * Apply thrust to the left position of the body.
- *
- * Use very small values, such as 0.1, depending on the mass and required speed.
- * @param speed A speed value to be applied to a directional force.
- */
- thrustLeft(speed: number): Phaser.GameObjects.GameObject;
- /**
- * Apply thrust to the right position of the body.
- *
- * Use very small values, such as 0.1, depending on the mass and required speed.
- * @param speed A speed value to be applied to a directional force.
- */
- thrustRight(speed: number): Phaser.GameObjects.GameObject;
- /**
- * Apply thrust to the back position of the body.
- *
- * Use very small values, such as 0.1, depending on the mass and required speed.
- * @param speed A speed value to be applied to a directional force.
- */
- thrustBack(speed: number): Phaser.GameObjects.GameObject;
- }
-
- /**
- * Contains methods for changing the friction of a Game Object's Matter Body. Should be used a mixin, not called directly.
- */
- interface Friction {
- /**
- * Sets new friction values for this Game Object's Matter Body.
- * @param value The new friction of the body, between 0 and 1, where 0 allows the Body to slide indefinitely, while 1 allows it to stop almost immediately after a force is applied.
- * @param air If provided, the new air resistance of the Body. The higher the value, the faster the Body will slow as it moves through space. 0 means the body has no air resistance.
- * @param fstatic If provided, the new static friction of the Body. The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary. 0 means the body will never "stick" when it is nearly stationary.
- */
- setFriction(value: number, air?: number, fstatic?: number): Phaser.GameObjects.GameObject;
- /**
- * Sets a new air resistance for this Game Object's Matter Body. A value of 0 means the Body will never slow as it moves through space. The higher the value, the faster a Body slows when moving through space.
- * @param value The new air resistance for the Body.
- */
- setFrictionAir(value: number): Phaser.GameObjects.GameObject;
- /**
- * Sets a new static friction for this Game Object's Matter Body. A value of 0 means the Body will never "stick" when it is nearly stationary. The higher the value (e.g. 10), the more force it will take to initially get the Body moving when it is nearly stationary.
- * @param value The new static friction for the Body.
- */
- setFrictionStatic(value: number): Phaser.GameObjects.GameObject;
- }
-
- /**
- * A component to manipulate world gravity for Matter.js bodies.
- */
- interface Gravity {
- /**
- * A togglable function for ignoring world gravity in real-time on the current body.
- * @param value Set to true to ignore the effect of world gravity, or false to not ignore it.
- */
- setIgnoreGravity(value: boolean): Phaser.GameObjects.GameObject;
- }
-
- /**
- * Allows accessing the mass, density, and center of mass of a Matter-enabled Game Object. Should be used as a mixin and not directly.
- */
- interface Mass {
- /**
- * Sets the mass of the Game Object's Matter Body.
- * @param value The new mass of the body.
- */
- setMass(value: number): Phaser.GameObjects.GameObject;
- /**
- * Sets density of the body.
- * @param value The new density of the body.
- */
- setDensity(value: number): Phaser.GameObjects.GameObject;
- /**
- * The body's center of mass.
- *
- * Calling this creates a new `Vector2 each time to avoid mutation.
- *
- * If you only need to read the value and won't change it, you can get it from `GameObject.body.centerOfMass`.
- */
- readonly centerOfMass: Phaser.Math.Vector2;
- }
-
- /**
- * [description]
- */
- interface Sensor {
- /**
- * [description]
- * @param value [description]
- */
- setSensor(value: boolean): Phaser.GameObjects.GameObject;
- /**
- * [description]
- */
- isSensor(): boolean;
- }
-
- /**
- * [description]
- */
- interface SetBody {
- /**
- * Set the body on a Game Object to a rectangle.
- * @param width Width of the rectangle.
- * @param height Height of the rectangle.
- * @param options [description]
- */
- setRectangle(width: number, height: number, options: object): Phaser.GameObjects.GameObject;
- /**
- * [description]
- * @param radius [description]
- * @param options [description]
- */
- setCircle(radius: number, options: object): Phaser.GameObjects.GameObject;
- /**
- * Set the body on the Game Object to a polygon shape.
- * @param radius The radius of the polygon.
- * @param sides The amount of sides creating the polygon.
- * @param options A matterjs config object.
- */
- setPolygon(radius: number, sides: number, options: object): Phaser.GameObjects.GameObject;
- /**
- * Creates a new matterjs trapezoid body.
- * @param width The width of the trapezoid.
- * @param height The height of the trapezoid.
- * @param slope The angle of slope for the trapezoid.
- * @param options A matterjs config object for the body.
- */
- setTrapezoid(width: number, height: number, slope: number, options: object): Phaser.GameObjects.GameObject;
- /**
- * [description]
- * @param body [description]
- * @param addToWorld Should the newly created body be immediately added to the World? Default true.
- */
- setExistingBody(body: MatterJS.Body, addToWorld?: boolean): Phaser.GameObjects.GameObject;
- /**
- * [description]
- * @param config [description]
- * @param options [description]
- */
- setBody(config: object, options: object): Phaser.GameObjects.GameObject;
- }
-
- /**
- * [description]
- */
- interface Sleep {
- /**
- * [description]
- * @param value [description] Default 60.
- */
- setSleepThreshold(value?: number): Phaser.GameObjects.GameObject;
- /**
- * [description]
- * @param start [description]
- * @param end [description]
- */
- setSleepEvents(start: boolean, end: boolean): Phaser.GameObjects.GameObject;
- /**
- * [description]
- * @param value [description]
- */
- setSleepStartEvent(value: boolean): Phaser.GameObjects.GameObject;
- /**
- * [description]
- * @param value [description]
- */
- setSleepEndEvent(value: boolean): Phaser.GameObjects.GameObject;
- }
-
- /**
- * Provides methods used for getting and setting the static state of a physics body.
- */
- interface Static {
- /**
- * Changes the physics body to be either static `true` or dynamic `false`.
- * @param value `true` to set the body as being static, or `false` to make it dynamic.
- */
- setStatic(value: boolean): Phaser.GameObjects.GameObject;
- /**
- * Returns `true` if the body is static, otherwise `false` for a dynamic body.
- */
- isStatic(): boolean;
- }
-
- /**
- * Provides methods used for getting and setting the position, scale and rotation of a Game Object.
- */
- interface Transform {
- /**
- * The x position of this Game Object.
- */
- x: number;
- /**
- * The y position of this Game Object.
- */
- y: number;
- /**
- * The horizontal scale of this Game Object.
- */
- scaleX: number;
- /**
- * The vertical scale of this Game Object.
- */
- scaleY: number;
- /**
- * Use `angle` to set or get rotation of the physics body associated to this GameObject.
- * Unlike rotation, when using set the value can be in degrees, which will be converted to radians internally.
- */
- angle: number;
- /**
- * Use `rotation` to set or get the rotation of the physics body associated with this GameObject.
- * The value when set must be in radians.
- */
- rotation: number;
- /**
- * Returns the center x offset of the Body this Game Object is using.
- *
- * This is calculated by taking the difference between the center of the frame and the center of
- * the physics body. If set, the `body.render.sprite.xOffset` value is then added to it.
- *
- * Use this when setting the Origin of a Physics Game Object post-creation, i.e.:
- *
- * `setOrigin(originX + centerOffsetX, originY + centerOffsetY)`
- */
- readonly centerOffsetX: number;
- /**
- * Returns the center y offset of the Body this Game Object is using.
- *
- * This is calculated by taking the difference between the center of the frame and the center of
- * the physics body. If set, the `body.render.sprite.yOffset` value is then added to it.
- *
- * Use this when setting the Origin of a Physics Game Object post-creation, i.e.:
- *
- * `setOrigin(originX + centerOffsetX, originY + centerOffsetY)`
- */
- readonly centerOffsetY: number;
- /**
- * Sets the position of the physics body along x and y axes.
- * Both the parameters to this function are optional and if not passed any they default to 0.
- * Velocity, angle, force etc. are unchanged.
- * @param x The horizontal position of the body. Default 0.
- * @param y The vertical position of the body. Default x.
- */
- setPosition(x?: number, y?: number): this;
- /**
- * Immediately sets the angle of the Body.
- * Angular velocity, position, force etc. are unchanged.
- * @param radians The angle of the body, in radians. Default 0.
- */
- setRotation(radians?: number): this;
- /**
- * Setting fixed rotation sets the Body inertia to Infinity, which stops it
- * from being able to rotate when forces are applied to it.
- */
- setFixedRotation(): this;
- /**
- * Immediately sets the angle of the Body.
- * Angular velocity, position, force etc. are unchanged.
- * @param degrees The angle to set, 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.
- * @param point The point (Vector2) from which scaling will occur.
- */
- setScale(x?: number, y?: number, point?: Phaser.Math.Vector2): this;
- }
-
- /**
- * [description]
- */
- interface Velocity {
- /**
- * [description]
- * @param value [description]
- */
- setAngularVelocity(value: number): Phaser.GameObjects.GameObject;
- /**
- * Sets the horizontal velocity of the physics body.
- * @param x The horizontal velocity value.
- */
- setVelocityX(x: number): Phaser.GameObjects.GameObject;
- /**
- * Sets vertical velocity of the physics body.
- * @param y The vertical velocity value.
- */
- setVelocityY(y: number): Phaser.GameObjects.GameObject;
- /**
- * Sets both the horizontal and vertical velocity of the physics body.
- * @param x The horizontal velocity value.
- * @param y The vertical velocity value, it can be either positive or negative. If not given, it will be the same as the `x` value. Default x.
- */
- setVelocity(x: number, y?: number): Phaser.GameObjects.GameObject;
- }
-
- }
-
- namespace Events {
- type AfterAddEvent = {
- /**
- * An array of the object(s) that have been added. May be a single body, constraint, composite or a mixture of these.
- */
- object: any[];
- /**
- * The source object of the event.
- */
- source: any;
- /**
- * The name of the event.
- */
- name: string;
- };
-
- /**
- * The Matter Physics After Add Event.
- *
- * This event is dispatched by a Matter Physics World instance at the end of the process when a new Body
- * or Constraint has just been added to the world.
- *
- * Listen to it from a Scene using: `this.matter.world.on('afteradd', listener)`.
- */
- const AFTER_ADD: any;
-
- type AfterRemoveEvent = {
- /**
- * An array of the object(s) that were removed. May be a single body, constraint, composite or a mixture of these.
- */
- object: any[];
- /**
- * The source object of the event.
- */
- source: any;
- /**
- * The name of the event.
- */
- name: string;
- };
-
- /**
- * The Matter Physics After Remove Event.
- *
- * This event is dispatched by a Matter Physics World instance at the end of the process when a
- * Body or Constraint was removed from the world.
- *
- * Listen to it from a Scene using: `this.matter.world.on('afterremove', listener)`.
- */
- const AFTER_REMOVE: any;
-
- type AfterUpdateEvent = {
- /**
- * The Matter Engine `timing.timestamp` value for the event.
- */
- timestamp: number;
- /**
- * The source object of the event.
- */
- source: any;
- /**
- * The name of the event.
- */
- name: string;
- };
-
- /**
- * The Matter Physics After Update Event.
- *
- * This event is dispatched by a Matter Physics World instance after the engine has updated and all collision events have resolved.
- *
- * Listen to it from a Scene using: `this.matter.world.on('afterupdate', listener)`.
- */
- const AFTER_UPDATE: any;
-
- type BeforeAddEvent = {
- /**
- * An array of the object(s) to be added. May be a single body, constraint, composite or a mixture of these.
- */
- object: any[];
- /**
- * The source object of the event.
- */
- source: any;
- /**
- * The name of the event.
- */
- name: string;
- };
-
- /**
- * The Matter Physics Before Add Event.
- *
- * This event is dispatched by a Matter Physics World instance at the start of the process when a new Body
- * or Constraint is being added to the world.
- *
- * Listen to it from a Scene using: `this.matter.world.on('beforeadd', listener)`.
- */
- const BEFORE_ADD: any;
-
- type BeforeRemoveEvent = {
- /**
- * An array of the object(s) to be removed. May be a single body, constraint, composite or a mixture of these.
- */
- object: any[];
- /**
- * The source object of the event.
- */
- source: any;
- /**
- * The name of the event.
- */
- name: string;
- };
-
- /**
- * The Matter Physics Before Remove Event.
- *
- * This event is dispatched by a Matter Physics World instance at the start of the process when a
- * Body or Constraint is being removed from the world.
- *
- * Listen to it from a Scene using: `this.matter.world.on('beforeremove', listener)`.
- */
- const BEFORE_REMOVE: any;
-
- type BeforeUpdateEvent = {
- /**
- * The Matter Engine `timing.timestamp` value for the event.
- */
- timestamp: number;
- /**
- * The source object of the event.
- */
- source: any;
- /**
- * The name of the event.
- */
- name: string;
- };
-
- /**
- * The Matter Physics Before Update Event.
- *
- * This event is dispatched by a Matter Physics World instance right before all the collision processing takes place.
- *
- * Listen to it from a Scene using: `this.matter.world.on('beforeupdate', listener)`.
- */
- const BEFORE_UPDATE: any;
-
- type CollisionActiveEvent = {
- /**
- * A list of all affected pairs in the collision.
- */
- pairs: Phaser.Types.Physics.Matter.MatterCollisionData[];
- /**
- * The Matter Engine `timing.timestamp` value for the event.
- */
- timestamp: number;
- /**
- * The source object of the event.
- */
- source: any;
- /**
- * The name of the event.
- */
- name: string;
- };
-
- /**
- * The Matter Physics Collision Active Event.
- *
- * This event is dispatched by a Matter Physics World instance after the engine has updated.
- * It provides a list of all pairs that are colliding in the current tick (if any).
- *
- * Listen to it from a Scene using: `this.matter.world.on('collisionactive', listener)`.
- */
- const COLLISION_ACTIVE: any;
-
- type CollisionEndEvent = {
- /**
- * A list of all affected pairs in the collision.
- */
- pairs: Phaser.Types.Physics.Matter.MatterCollisionData[];
- /**
- * The Matter Engine `timing.timestamp` value for the event.
- */
- timestamp: number;
- /**
- * The source object of the event.
- */
- source: any;
- /**
- * The name of the event.
- */
- name: string;
- };
-
- /**
- * The Matter Physics Collision End Event.
- *
- * This event is dispatched by a Matter Physics World instance after the engine has updated.
- * It provides a list of all pairs that have finished colliding in the current tick (if any).
- *
- * Listen to it from a Scene using: `this.matter.world.on('collisionend', listener)`.
- */
- const COLLISION_END: any;
-
- type CollisionStartEvent = {
- /**
- * A list of all affected pairs in the collision.
- */
- pairs: Phaser.Types.Physics.Matter.MatterCollisionData[];
- /**
- * The Matter Engine `timing.timestamp` value for the event.
- */
- timestamp: number;
- /**
- * The source object of the event.
- */
- source: any;
- /**
- * The name of the event.
- */
- name: string;
- };
-
- /**
- * The Matter Physics Collision Start Event.
- *
- * This event is dispatched by a Matter Physics World instance after the engine has updated.
- * It provides a list of all pairs that have started to collide in the current tick (if any).
- *
- * Listen to it from a Scene using: `this.matter.world.on('collisionstart', listener)`.
- */
- const COLLISION_START: any;
-
- /**
- * The Matter Physics Drag End Event.
- *
- * This event is dispatched by a Matter Physics World instance when a Pointer Constraint
- * stops dragging a body.
- *
- * Listen to it from a Scene using: `this.matter.world.on('dragend', listener)`.
- */
- const DRAG_END: any;
-
- /**
- * The Matter Physics Drag Event.
- *
- * This event is dispatched by a Matter Physics World instance when a Pointer Constraint
- * is actively dragging a body. It is emitted each time the pointer moves.
- *
- * Listen to it from a Scene using: `this.matter.world.on('drag', listener)`.
- */
- const DRAG: any;
-
- /**
- * The Matter Physics Drag Start Event.
- *
- * This event is dispatched by a Matter Physics World instance when a Pointer Constraint
- * starts dragging a body.
- *
- * Listen to it from a Scene using: `this.matter.world.on('dragstart', listener)`.
- */
- const DRAG_START: any;
-
- /**
- * The Matter Physics World Pause Event.
- *
- * This event is dispatched by an Matter Physics World instance when it is paused.
- *
- * Listen to it from a Scene using: `this.matter.world.on('pause', listener)`.
- */
- const PAUSE: any;
-
- /**
- * The Matter Physics World Resume Event.
- *
- * This event is dispatched by an Matter Physics World instance when it resumes from a paused state.
- *
- * Listen to it from a Scene using: `this.matter.world.on('resume', listener)`.
- */
- const RESUME: any;
-
- type SleepEndEvent = {
- /**
- * The source object of the event.
- */
- source: any;
- /**
- * The name of the event.
- */
- name: string;
- };
-
- /**
- * The Matter Physics Sleep End Event.
- *
- * This event is dispatched by a Matter Physics World instance when a Body stop sleeping.
- *
- * Listen to it from a Scene using: `this.matter.world.on('sleepend', listener)`.
- */
- const SLEEP_END: any;
-
- type SleepStartEvent = {
- /**
- * The source object of the event.
- */
- source: any;
- /**
- * The name of the event.
- */
- name: string;
- };
-
- /**
- * The Matter Physics Sleep Start Event.
- *
- * This event is dispatched by a Matter Physics World instance when a Body goes to sleep.
- *
- * Listen to it from a Scene using: `this.matter.world.on('sleepstart', listener)`.
- */
- const SLEEP_START: any;
-
- }
-
}
}
@@ -71780,24 +73224,6 @@ declare namespace Phaser {
XOR,
}
- /**
- * Phaser Scale Modes.
- */
- enum ScaleModes {
- /**
- * Default Scale Mode (Linear).
- */
- DEFAULT,
- /**
- * Linear Scale Mode.
- */
- LINEAR,
- /**
- * Nearest Scale Mode.
- */
- NEAREST,
- }
-
namespace Renderer {
namespace Canvas {
/**
@@ -72081,6 +73507,600 @@ declare namespace Phaser {
}
namespace WebGL {
+ namespace Pipelines {
+ /**
+ * BitmapMaskPipeline handles all bitmap masking rendering in WebGL. It works by using
+ * sampling two texture on the fragment shader and using the fragment's alpha to clip the region.
+ * The config properties are:
+ * - game: Current game instance.
+ * - renderer: Current WebGL renderer.
+ * - topology: This indicates how the primitives are rendered. The default value is GL_TRIANGLES.
+ * Here is the full list of rendering primitives (https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants).
+ * - vertShader: Source for vertex shader as a string.
+ * - fragShader: Source for fragment shader as a string.
+ * - vertexCapacity: The amount of vertices that shall be allocated
+ * - vertexSize: The size of a single vertex in bytes.
+ */
+ class BitmapMaskPipeline extends Phaser.Renderer.WebGL.WebGLPipeline {
+ /**
+ *
+ * @param config Used for overriding shader an pipeline properties if extending this pipeline.
+ */
+ constructor(config: object);
+
+ /**
+ * Float32 view of the array buffer containing the pipeline's vertices.
+ */
+ vertexViewF32: Float32Array;
+
+ /**
+ * Size of the batch.
+ */
+ maxQuads: number;
+
+ /**
+ * Dirty flag to check if resolution properties need to be updated on the
+ * masking shader.
+ */
+ resolutionDirty: boolean;
+
+ /**
+ * Called every time the pipeline needs to be used.
+ * It binds all necessary resources.
+ */
+ onBind(): this;
+
+ /**
+ * [description]
+ * @param width [description]
+ * @param height [description]
+ * @param resolution [description]
+ */
+ resize(width: number, height: number, resolution: number): this;
+
+ /**
+ * Binds necessary resources and renders the mask to a separated framebuffer.
+ * The framebuffer for the masked object is also bound for further use.
+ * @param mask GameObject used as mask.
+ * @param maskedObject GameObject masked by the mask GameObject.
+ * @param camera [description]
+ */
+ beginMask(mask: Phaser.GameObjects.GameObject, maskedObject: Phaser.GameObjects.GameObject, camera: Phaser.Cameras.Scene2D.Camera): void;
+
+ /**
+ * The masked game objects framebuffer is unbound and its texture
+ * is bound together with the mask texture and the mask shader and
+ * a draw call with a single quad is processed. Here is where the
+ * masking effect is applied.
+ * @param mask GameObject used as a mask.
+ */
+ endMask(mask: Phaser.GameObjects.GameObject): void;
+
+ }
+
+ /**
+ * Implements a model view projection matrices.
+ * Pipelines can implement this for doing 2D and 3D rendering.
+ */
+ interface ModelViewProjection {
+ /**
+ * Dirty flag for checking if model matrix needs to be updated on GPU.
+ */
+ modelMatrixDirty: boolean;
+ /**
+ * Dirty flag for checking if view matrix needs to be updated on GPU.
+ */
+ viewMatrixDirty: boolean;
+ /**
+ * Dirty flag for checking if projection matrix needs to be updated on GPU.
+ */
+ projectionMatrixDirty: boolean;
+ /**
+ * Model matrix
+ */
+ modelMatrix: Float32Array;
+ /**
+ * View matrix
+ */
+ viewMatrix: Float32Array;
+ /**
+ * Projection matrix
+ */
+ projectionMatrix: Float32Array;
+ /**
+ * Initializes MVP matrices with an identity matrix
+ */
+ mvpInit(): void;
+ /**
+ * If dirty flags are set then the matrices are uploaded to the GPU.
+ */
+ mvpUpdate(): void;
+ /**
+ * Loads an identity matrix to the model matrix
+ */
+ modelIdentity(): void;
+ /**
+ * Scale model matrix
+ * @param x The x component.
+ * @param y The y component.
+ * @param z The z component.
+ */
+ modelScale(x: number, y: number, z: number): this;
+ /**
+ * Translate model matrix
+ * @param x The x component.
+ * @param y The y component.
+ * @param z The z component.
+ */
+ modelTranslate(x: number, y: number, z: number): this;
+ /**
+ * Rotates the model matrix in the X axis.
+ * @param radians The amount to rotate by.
+ */
+ modelRotateX(radians: number): this;
+ /**
+ * Rotates the model matrix in the Y axis.
+ * @param radians The amount to rotate by.
+ */
+ modelRotateY(radians: number): this;
+ /**
+ * Rotates the model matrix in the Z axis.
+ * @param radians The amount to rotate by.
+ */
+ modelRotateZ(radians: number): this;
+ /**
+ * Loads identity matrix into the view matrix
+ */
+ viewIdentity(): this;
+ /**
+ * Scales view matrix
+ * @param x The x component.
+ * @param y The y component.
+ * @param z The z component.
+ */
+ viewScale(x: number, y: number, z: number): this;
+ /**
+ * Translates view matrix
+ * @param x The x component.
+ * @param y The y component.
+ * @param z The z component.
+ */
+ viewTranslate(x: number, y: number, z: number): this;
+ /**
+ * Rotates view matrix in the X axis.
+ * @param radians The amount to rotate by.
+ */
+ viewRotateX(radians: number): this;
+ /**
+ * Rotates view matrix in the Y axis.
+ * @param radians The amount to rotate by.
+ */
+ viewRotateY(radians: number): this;
+ /**
+ * Rotates view matrix in the Z axis.
+ * @param radians The amount to rotate by.
+ */
+ viewRotateZ(radians: number): this;
+ /**
+ * Loads a 2D view matrix (3x2 matrix) into a 4x4 view matrix
+ * @param matrix2D The Matrix2D.
+ */
+ viewLoad2D(matrix2D: Float32Array): this;
+ /**
+ * Copies a 4x4 matrix into the view matrix
+ * @param matrix The Matrix2D.
+ */
+ viewLoad(matrix: Float32Array): this;
+ /**
+ * Loads identity matrix into the projection matrix.
+ */
+ projIdentity(): this;
+ /**
+ * Sets up an orthographic projection matrix
+ * @param left The left value.
+ * @param right The right value.
+ * @param bottom The bottom value.
+ * @param top The top value.
+ * @param near The near value.
+ * @param far The far value.
+ */
+ projOrtho(left: number, right: number, bottom: number, top: number, near: number, far: number): this;
+ /**
+ * Sets up a perspective projection matrix
+ * @param fovY The fov value.
+ * @param aspectRatio The aspectRatio value.
+ * @param near The near value.
+ * @param far The far value.
+ */
+ projPersp(fovY: number, aspectRatio: number, near: number, far: number): this;
+ }
+
+ /**
+ * ForwardDiffuseLightPipeline implements a forward rendering approach for 2D lights.
+ * This pipeline extends TextureTintPipeline so it implements all it's rendering functions
+ * and batching system.
+ */
+ class ForwardDiffuseLightPipeline extends Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline {
+ /**
+ *
+ * @param config The configuration of the pipeline, same as the {@link Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline}. The fragment shader will be replaced with the lighting shader.
+ */
+ constructor(config: object);
+
+ /**
+ * This function sets all the needed resources for each camera pass.
+ * @param scene The Scene being rendered.
+ * @param camera The Scene Camera being rendered with.
+ */
+ onRender(scene: Phaser.Scene, camera: Phaser.Cameras.Scene2D.Camera): this;
+
+ /**
+ * Generic function for batching a textured quad
+ * @param gameObject Source GameObject
+ * @param texture Raw WebGLTexture associated with the quad
+ * @param textureWidth Real texture width
+ * @param textureHeight Real texture height
+ * @param srcX X coordinate of the quad
+ * @param srcY Y coordinate of the quad
+ * @param srcWidth Width of the quad
+ * @param srcHeight Height of the quad
+ * @param scaleX X component of scale
+ * @param scaleY Y component of scale
+ * @param rotation Rotation of the quad
+ * @param flipX Indicates if the quad is horizontally flipped
+ * @param flipY Indicates if the quad is vertically flipped
+ * @param scrollFactorX By which factor is the quad affected by the camera horizontal scroll
+ * @param scrollFactorY By which factor is the quad effected by the camera vertical scroll
+ * @param displayOriginX Horizontal origin in pixels
+ * @param displayOriginY Vertical origin in pixels
+ * @param frameX X coordinate of the texture frame
+ * @param frameY Y coordinate of the texture frame
+ * @param frameWidth Width of the texture frame
+ * @param frameHeight Height of the texture frame
+ * @param tintTL Tint for top left
+ * @param tintTR Tint for top right
+ * @param tintBL Tint for bottom left
+ * @param tintBR Tint for bottom right
+ * @param tintEffect The tint effect (0 for additive, 1 for replacement)
+ * @param uOffset Horizontal offset on texture coordinate
+ * @param vOffset Vertical offset on texture coordinate
+ * @param camera Current used camera
+ * @param parentTransformMatrix Parent container
+ */
+ batchTexture(gameObject: Phaser.GameObjects.GameObject, texture: WebGLTexture, textureWidth: integer, textureHeight: integer, srcX: number, srcY: number, srcWidth: number, srcHeight: number, scaleX: number, scaleY: number, rotation: number, flipX: boolean, flipY: boolean, scrollFactorX: number, scrollFactorY: number, displayOriginX: number, displayOriginY: number, frameX: number, frameY: number, frameWidth: number, frameHeight: number, tintTL: integer, tintTR: integer, tintBL: integer, tintBR: integer, tintEffect: number, uOffset: number, vOffset: number, camera: Phaser.Cameras.Scene2D.Camera, parentTransformMatrix: Phaser.GameObjects.Components.TransformMatrix): void;
+
+ /**
+ * Sets the Game Objects normal map as the active texture.
+ * @param gameObject The Game Object to update.
+ */
+ setNormalMap(gameObject: Phaser.GameObjects.GameObject): void;
+
+ /**
+ * Rotates the normal map vectors inversely by the given angle.
+ * Only works in 2D space.
+ * @param rotation The angle of rotation in radians.
+ */
+ setNormalMapRotation(rotation: number): void;
+
+ /**
+ * Takes a Sprite Game Object, or any object that extends it, which has a normal texture and adds it to the batch.
+ * @param sprite The texture-based Game Object to add to the batch.
+ * @param camera The Camera to use for the rendering transform.
+ * @param parentTransformMatrix The transform matrix of the parent container, if set.
+ */
+ batchSprite(sprite: Phaser.GameObjects.Sprite, camera: Phaser.Cameras.Scene2D.Camera, parentTransformMatrix: Phaser.GameObjects.Components.TransformMatrix): void;
+
+ }
+
+ /**
+ * TextureTintPipeline implements the rendering infrastructure
+ * for displaying textured objects
+ * The config properties are:
+ * - game: Current game instance.
+ * - renderer: Current WebGL renderer.
+ * - topology: This indicates how the primitives are rendered. The default value is GL_TRIANGLES.
+ * Here is the full list of rendering primitives (https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants).
+ * - vertShader: Source for vertex shader as a string.
+ * - fragShader: Source for fragment shader as a string.
+ * - vertexCapacity: The amount of vertices that shall be allocated
+ * - vertexSize: The size of a single vertex in bytes.
+ */
+ class TextureTintPipeline extends Phaser.Renderer.WebGL.WebGLPipeline {
+ /**
+ *
+ * @param config The configuration options for this Texture Tint Pipeline, as described above.
+ */
+ constructor(config: object);
+
+ /**
+ * Float32 view of the array buffer containing the pipeline's vertices.
+ */
+ vertexViewF32: Float32Array;
+
+ /**
+ * Uint32 view of the array buffer containing the pipeline's vertices.
+ */
+ vertexViewU32: Uint32Array;
+
+ /**
+ * Size of the batch.
+ */
+ maxQuads: integer;
+
+ /**
+ * Collection of batch information
+ */
+ batches: any[];
+
+ /**
+ * Called every time the pipeline needs to be used.
+ * It binds all necessary resources.
+ */
+ onBind(): this;
+
+ /**
+ * Resizes this pipeline and updates the projection.
+ * @param width The new width.
+ * @param height The new height.
+ * @param resolution The resolution.
+ */
+ resize(width: number, height: number, resolution: number): this;
+
+ /**
+ * Assigns a texture to the current batch. If a different texture is already set it creates a new batch object.
+ * @param texture WebGLTexture that will be assigned to the current batch. If not given uses blankTexture.
+ * @param unit Texture unit to which the texture needs to be bound. Default 0.
+ */
+ setTexture2D(texture?: WebGLTexture, unit?: integer): Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline;
+
+ /**
+ * Checks if the current batch has the same texture and texture unit, or if we need to create a new batch.
+ * @param texture WebGLTexture that will be assigned to the current batch. If not given uses blankTexture.
+ * @param unit Texture unit to which the texture needs to be bound.
+ */
+ requireTextureBatch(texture: WebGLTexture, unit: integer): boolean;
+
+ /**
+ * Creates a new batch object and pushes it to a batch array.
+ * The batch object contains information relevant to the current
+ * vertex batch like the offset in the vertex buffer, vertex count and
+ * the textures used by that batch.
+ * @param texture Optional WebGLTexture that will be assigned to the created batch.
+ * @param unit Texture unit to which the texture needs to be bound.
+ */
+ pushBatch(texture: WebGLTexture, unit: integer): void;
+
+ /**
+ * Uploads the vertex data and emits a draw call for the current batch of vertices.
+ */
+ flush(): this;
+
+ /**
+ * Takes a Sprite Game Object, or any object that extends it, and adds it to the batch.
+ * @param sprite The texture based Game Object to add to the batch.
+ * @param camera The Camera to use for the rendering transform.
+ * @param parentTransformMatrix The transform matrix of the parent container, if set.
+ */
+ batchSprite(sprite: Phaser.GameObjects.Image | Phaser.GameObjects.Sprite, camera: Phaser.Cameras.Scene2D.Camera, parentTransformMatrix?: Phaser.GameObjects.Components.TransformMatrix): void;
+
+ /**
+ * Adds the vertices data into the batch and flushes if full.
+ *
+ * Assumes 6 vertices in the following arrangement:
+ *
+ * ```
+ * 0----3
+ * |\ B|
+ * | \ |
+ * | \ |
+ * | A \|
+ * | \
+ * 1----2
+ * ```
+ *
+ * Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3
+ * @param x0 The top-left x position.
+ * @param y0 The top-left y position.
+ * @param x1 The bottom-left x position.
+ * @param y1 The bottom-left y position.
+ * @param x2 The bottom-right x position.
+ * @param y2 The bottom-right y position.
+ * @param x3 The top-right x position.
+ * @param y3 The top-right y position.
+ * @param u0 UV u0 value.
+ * @param v0 UV v0 value.
+ * @param u1 UV u1 value.
+ * @param v1 UV v1 value.
+ * @param tintTL The top-left tint color value.
+ * @param tintTR The top-right tint color value.
+ * @param tintBL The bottom-left tint color value.
+ * @param tintBR The bottom-right tint color value.
+ * @param tintEffect The tint effect for the shader to use.
+ * @param texture WebGLTexture that will be assigned to the current batch if a flush occurs.
+ * @param unit Texture unit to which the texture needs to be bound. Default 0.
+ */
+ batchQuad(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, u0: number, v0: number, u1: number, v1: number, tintTL: number, tintTR: number, tintBL: number, tintBR: number, tintEffect: number | boolean, texture?: WebGLTexture, unit?: integer): boolean;
+
+ /**
+ * Adds the vertices data into the batch and flushes if full.
+ *
+ * Assumes 3 vertices in the following arrangement:
+ *
+ * ```
+ * 0
+ * |\
+ * | \
+ * | \
+ * | \
+ * | \
+ * 1-----2
+ * ```
+ * @param x1 The bottom-left x position.
+ * @param y1 The bottom-left y position.
+ * @param x2 The bottom-right x position.
+ * @param y2 The bottom-right y position.
+ * @param x3 The top-right x position.
+ * @param y3 The top-right y position.
+ * @param u0 UV u0 value.
+ * @param v0 UV v0 value.
+ * @param u1 UV u1 value.
+ * @param v1 UV v1 value.
+ * @param tintTL The top-left tint color value.
+ * @param tintTR The top-right tint color value.
+ * @param tintBL The bottom-left tint color value.
+ * @param tintEffect The tint effect for the shader to use.
+ * @param texture WebGLTexture that will be assigned to the current batch if a flush occurs.
+ * @param unit Texture unit to which the texture needs to be bound. Default 0.
+ */
+ batchTri(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, u0: number, v0: number, u1: number, v1: number, tintTL: number, tintTR: number, tintBL: number, tintEffect: number | boolean, texture?: WebGLTexture, unit?: integer): boolean;
+
+ /**
+ * Generic function for batching a textured quad using argument values instead of a Game Object.
+ * @param gameObject Source GameObject.
+ * @param texture Raw WebGLTexture associated with the quad.
+ * @param textureWidth Real texture width.
+ * @param textureHeight Real texture height.
+ * @param srcX X coordinate of the quad.
+ * @param srcY Y coordinate of the quad.
+ * @param srcWidth Width of the quad.
+ * @param srcHeight Height of the quad.
+ * @param scaleX X component of scale.
+ * @param scaleY Y component of scale.
+ * @param rotation Rotation of the quad.
+ * @param flipX Indicates if the quad is horizontally flipped.
+ * @param flipY Indicates if the quad is vertically flipped.
+ * @param scrollFactorX By which factor is the quad affected by the camera horizontal scroll.
+ * @param scrollFactorY By which factor is the quad effected by the camera vertical scroll.
+ * @param displayOriginX Horizontal origin in pixels.
+ * @param displayOriginY Vertical origin in pixels.
+ * @param frameX X coordinate of the texture frame.
+ * @param frameY Y coordinate of the texture frame.
+ * @param frameWidth Width of the texture frame.
+ * @param frameHeight Height of the texture frame.
+ * @param tintTL Tint for top left.
+ * @param tintTR Tint for top right.
+ * @param tintBL Tint for bottom left.
+ * @param tintBR Tint for bottom right.
+ * @param tintEffect The tint effect.
+ * @param uOffset Horizontal offset on texture coordinate.
+ * @param vOffset Vertical offset on texture coordinate.
+ * @param camera Current used camera.
+ * @param parentTransformMatrix Parent container.
+ * @param skipFlip Skip the renderTexture check. Default false.
+ */
+ batchTexture(gameObject: Phaser.GameObjects.GameObject, texture: WebGLTexture, textureWidth: integer, textureHeight: integer, srcX: number, srcY: number, srcWidth: number, srcHeight: number, scaleX: number, scaleY: number, rotation: number, flipX: boolean, flipY: boolean, scrollFactorX: number, scrollFactorY: number, displayOriginX: number, displayOriginY: number, frameX: number, frameY: number, frameWidth: number, frameHeight: number, tintTL: integer, tintTR: integer, tintBL: integer, tintBR: integer, tintEffect: number, uOffset: number, vOffset: number, camera: Phaser.Cameras.Scene2D.Camera, parentTransformMatrix: Phaser.GameObjects.Components.TransformMatrix, skipFlip?: boolean): void;
+
+ /**
+ * Adds a Texture Frame into the batch for rendering.
+ * @param frame The Texture Frame to be rendered.
+ * @param x The horizontal position to render the texture at.
+ * @param y The vertical position to render the texture at.
+ * @param tint The tint color.
+ * @param alpha The alpha value.
+ * @param transformMatrix The Transform Matrix to use for the texture.
+ * @param parentTransformMatrix A parent Transform Matrix.
+ */
+ batchTextureFrame(frame: Phaser.Textures.Frame, x: number, y: number, tint: number, alpha: number, transformMatrix: Phaser.GameObjects.Components.TransformMatrix, parentTransformMatrix?: Phaser.GameObjects.Components.TransformMatrix): void;
+
+ /**
+ * Pushes a filled rectangle into the vertex batch.
+ * Rectangle has no transform values and isn't transformed into the local space.
+ * Used for directly batching untransformed rectangles, such as Camera background colors.
+ * @param x Horizontal top left coordinate of the rectangle.
+ * @param y Vertical top left coordinate of the rectangle.
+ * @param width Width of the rectangle.
+ * @param height Height of the rectangle.
+ * @param color Color of the rectangle to draw.
+ * @param alpha Alpha value of the rectangle to draw.
+ */
+ drawFillRect(x: number, y: number, width: number, height: number, color: number, alpha: number): void;
+
+ /**
+ * Pushes a filled rectangle into the vertex batch.
+ * Rectangle factors in the given transform matrices before adding to the batch.
+ * @param x Horizontal top left coordinate of the rectangle.
+ * @param y Vertical top left coordinate of the rectangle.
+ * @param width Width of the rectangle.
+ * @param height Height of the rectangle.
+ * @param currentMatrix The current transform.
+ * @param parentMatrix The parent transform.
+ */
+ batchFillRect(x: number, y: number, width: number, height: number, currentMatrix: Phaser.GameObjects.Components.TransformMatrix, parentMatrix: Phaser.GameObjects.Components.TransformMatrix): void;
+
+ /**
+ * Pushes a filled triangle into the vertex batch.
+ * Triangle factors in the given transform matrices before adding to the batch.
+ * @param x0 Point 0 x coordinate.
+ * @param y0 Point 0 y coordinate.
+ * @param x1 Point 1 x coordinate.
+ * @param y1 Point 1 y coordinate.
+ * @param x2 Point 2 x coordinate.
+ * @param y2 Point 2 y coordinate.
+ * @param currentMatrix The current transform.
+ * @param parentMatrix The parent transform.
+ */
+ batchFillTriangle(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, currentMatrix: Phaser.GameObjects.Components.TransformMatrix, parentMatrix: Phaser.GameObjects.Components.TransformMatrix): void;
+
+ /**
+ * Pushes a stroked triangle into the vertex batch.
+ * Triangle factors in the given transform matrices before adding to the batch.
+ * The triangle is created from 3 lines and drawn using the `batchStrokePath` method.
+ * @param x0 Point 0 x coordinate.
+ * @param y0 Point 0 y coordinate.
+ * @param x1 Point 1 x coordinate.
+ * @param y1 Point 1 y coordinate.
+ * @param x2 Point 2 x coordinate.
+ * @param y2 Point 2 y coordinate.
+ * @param lineWidth The width of the line in pixels.
+ * @param currentMatrix The current transform.
+ * @param parentMatrix The parent transform.
+ */
+ batchStrokeTriangle(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, lineWidth: number, currentMatrix: Phaser.GameObjects.Components.TransformMatrix, parentMatrix: Phaser.GameObjects.Components.TransformMatrix): void;
+
+ /**
+ * Adds the given path to the vertex batch for rendering.
+ *
+ * It works by taking the array of path data and then passing it through Earcut, which
+ * creates a list of polygons. Each polygon is then added to the batch.
+ *
+ * The path is always automatically closed because it's filled.
+ * @param path Collection of points that represent the path.
+ * @param currentMatrix The current transform.
+ * @param parentMatrix The parent transform.
+ */
+ batchFillPath(path: any[], currentMatrix: Phaser.GameObjects.Components.TransformMatrix, parentMatrix: Phaser.GameObjects.Components.TransformMatrix): void;
+
+ /**
+ * Adds the given path to the vertex batch for rendering.
+ *
+ * It works by taking the array of path data and calling `batchLine` for each section
+ * of the path.
+ *
+ * The path is optionally closed at the end.
+ * @param path Collection of points that represent the path.
+ * @param lineWidth The width of the line segments in pixels.
+ * @param pathOpen Indicates if the path should be closed or left open.
+ * @param currentMatrix The current transform.
+ * @param parentMatrix The parent transform.
+ */
+ batchStrokePath(path: any[], lineWidth: number, pathOpen: boolean, currentMatrix: Phaser.GameObjects.Components.TransformMatrix, parentMatrix: Phaser.GameObjects.Components.TransformMatrix): void;
+
+ /**
+ * Creates a quad and adds it to the vertex batch based on the given line values.
+ * @param ax X coordinate to the start of the line
+ * @param ay Y coordinate to the start of the line
+ * @param bx X coordinate to the end of the line
+ * @param by Y coordinate to the end of the line
+ * @param aLineWidth Width of the start of the line
+ * @param bLineWidth Width of the end of the line
+ * @param currentMatrix Parent matrix, generally used by containers
+ */
+ batchLine(ax: number, ay: number, bx: number, by: number, aLineWidth: number, bLineWidth: number, currentMatrix: Float32Array): void;
+
+ }
+
+ }
+
namespace Utils {
/**
* Packs four floats on a range from 0.0 to 1.0 into a single Uint32
@@ -73307,605 +75327,203 @@ declare namespace Phaser {
}
- namespace Pipelines {
- /**
- * BitmapMaskPipeline handles all bitmap masking rendering in WebGL. It works by using
- * sampling two texture on the fragment shader and using the fragment's alpha to clip the region.
- * The config properties are:
- * - game: Current game instance.
- * - renderer: Current WebGL renderer.
- * - topology: This indicates how the primitives are rendered. The default value is GL_TRIANGLES.
- * Here is the full list of rendering primitives (https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants).
- * - vertShader: Source for vertex shader as a string.
- * - fragShader: Source for fragment shader as a string.
- * - vertexCapacity: The amount of vertices that shall be allocated
- * - vertexSize: The size of a single vertex in bytes.
- */
- class BitmapMaskPipeline extends Phaser.Renderer.WebGL.WebGLPipeline {
- /**
- *
- * @param config Used for overriding shader an pipeline properties if extending this pipeline.
- */
- constructor(config: object);
-
- /**
- * Float32 view of the array buffer containing the pipeline's vertices.
- */
- vertexViewF32: Float32Array;
-
- /**
- * Size of the batch.
- */
- maxQuads: number;
-
- /**
- * Dirty flag to check if resolution properties need to be updated on the
- * masking shader.
- */
- resolutionDirty: boolean;
-
- /**
- * Called every time the pipeline needs to be used.
- * It binds all necessary resources.
- */
- onBind(): this;
-
- /**
- * [description]
- * @param width [description]
- * @param height [description]
- * @param resolution [description]
- */
- resize(width: number, height: number, resolution: number): this;
-
- /**
- * Binds necessary resources and renders the mask to a separated framebuffer.
- * The framebuffer for the masked object is also bound for further use.
- * @param mask GameObject used as mask.
- * @param maskedObject GameObject masked by the mask GameObject.
- * @param camera [description]
- */
- beginMask(mask: Phaser.GameObjects.GameObject, maskedObject: Phaser.GameObjects.GameObject, camera: Phaser.Cameras.Scene2D.Camera): void;
-
- /**
- * The masked game objects framebuffer is unbound and its texture
- * is bound together with the mask texture and the mask shader and
- * a draw call with a single quad is processed. Here is where the
- * masking effect is applied.
- * @param mask GameObject used as a mask.
- */
- endMask(mask: Phaser.GameObjects.GameObject): void;
-
- }
-
- /**
- * ForwardDiffuseLightPipeline implements a forward rendering approach for 2D lights.
- * This pipeline extends TextureTintPipeline so it implements all it's rendering functions
- * and batching system.
- */
- class ForwardDiffuseLightPipeline extends Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline {
- /**
- *
- * @param config The configuration of the pipeline, same as the {@link Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline}. The fragment shader will be replaced with the lighting shader.
- */
- constructor(config: object);
-
- /**
- * This function sets all the needed resources for each camera pass.
- * @param scene The Scene being rendered.
- * @param camera The Scene Camera being rendered with.
- */
- onRender(scene: Phaser.Scene, camera: Phaser.Cameras.Scene2D.Camera): this;
-
- /**
- * Generic function for batching a textured quad
- * @param gameObject Source GameObject
- * @param texture Raw WebGLTexture associated with the quad
- * @param textureWidth Real texture width
- * @param textureHeight Real texture height
- * @param srcX X coordinate of the quad
- * @param srcY Y coordinate of the quad
- * @param srcWidth Width of the quad
- * @param srcHeight Height of the quad
- * @param scaleX X component of scale
- * @param scaleY Y component of scale
- * @param rotation Rotation of the quad
- * @param flipX Indicates if the quad is horizontally flipped
- * @param flipY Indicates if the quad is vertically flipped
- * @param scrollFactorX By which factor is the quad affected by the camera horizontal scroll
- * @param scrollFactorY By which factor is the quad effected by the camera vertical scroll
- * @param displayOriginX Horizontal origin in pixels
- * @param displayOriginY Vertical origin in pixels
- * @param frameX X coordinate of the texture frame
- * @param frameY Y coordinate of the texture frame
- * @param frameWidth Width of the texture frame
- * @param frameHeight Height of the texture frame
- * @param tintTL Tint for top left
- * @param tintTR Tint for top right
- * @param tintBL Tint for bottom left
- * @param tintBR Tint for bottom right
- * @param tintEffect The tint effect (0 for additive, 1 for replacement)
- * @param uOffset Horizontal offset on texture coordinate
- * @param vOffset Vertical offset on texture coordinate
- * @param camera Current used camera
- * @param parentTransformMatrix Parent container
- */
- batchTexture(gameObject: Phaser.GameObjects.GameObject, texture: WebGLTexture, textureWidth: integer, textureHeight: integer, srcX: number, srcY: number, srcWidth: number, srcHeight: number, scaleX: number, scaleY: number, rotation: number, flipX: boolean, flipY: boolean, scrollFactorX: number, scrollFactorY: number, displayOriginX: number, displayOriginY: number, frameX: number, frameY: number, frameWidth: number, frameHeight: number, tintTL: integer, tintTR: integer, tintBL: integer, tintBR: integer, tintEffect: number, uOffset: number, vOffset: number, camera: Phaser.Cameras.Scene2D.Camera, parentTransformMatrix: Phaser.GameObjects.Components.TransformMatrix): void;
-
- /**
- * Sets the Game Objects normal map as the active texture.
- * @param gameObject The Game Object to update.
- */
- setNormalMap(gameObject: Phaser.GameObjects.GameObject): void;
-
- /**
- * Rotates the normal map vectors inversely by the given angle.
- * Only works in 2D space.
- * @param rotation The angle of rotation in radians.
- */
- setNormalMapRotation(rotation: number): void;
-
- /**
- * Takes a Sprite Game Object, or any object that extends it, which has a normal texture and adds it to the batch.
- * @param sprite The texture-based Game Object to add to the batch.
- * @param camera The Camera to use for the rendering transform.
- * @param parentTransformMatrix The transform matrix of the parent container, if set.
- */
- batchSprite(sprite: Phaser.GameObjects.Sprite, camera: Phaser.Cameras.Scene2D.Camera, parentTransformMatrix: Phaser.GameObjects.Components.TransformMatrix): void;
-
- }
-
- /**
- * TextureTintPipeline implements the rendering infrastructure
- * for displaying textured objects
- * The config properties are:
- * - game: Current game instance.
- * - renderer: Current WebGL renderer.
- * - topology: This indicates how the primitives are rendered. The default value is GL_TRIANGLES.
- * Here is the full list of rendering primitives (https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants).
- * - vertShader: Source for vertex shader as a string.
- * - fragShader: Source for fragment shader as a string.
- * - vertexCapacity: The amount of vertices that shall be allocated
- * - vertexSize: The size of a single vertex in bytes.
- */
- class TextureTintPipeline extends Phaser.Renderer.WebGL.WebGLPipeline {
- /**
- *
- * @param config The configuration options for this Texture Tint Pipeline, as described above.
- */
- constructor(config: object);
-
- /**
- * Float32 view of the array buffer containing the pipeline's vertices.
- */
- vertexViewF32: Float32Array;
-
- /**
- * Uint32 view of the array buffer containing the pipeline's vertices.
- */
- vertexViewU32: Uint32Array;
-
- /**
- * Size of the batch.
- */
- maxQuads: integer;
-
- /**
- * Collection of batch information
- */
- batches: any[];
-
- /**
- * Called every time the pipeline needs to be used.
- * It binds all necessary resources.
- */
- onBind(): this;
-
- /**
- * Resizes this pipeline and updates the projection.
- * @param width The new width.
- * @param height The new height.
- * @param resolution The resolution.
- */
- resize(width: number, height: number, resolution: number): this;
-
- /**
- * Assigns a texture to the current batch. If a different texture is already set it creates a new batch object.
- * @param texture WebGLTexture that will be assigned to the current batch. If not given uses blankTexture.
- * @param unit Texture unit to which the texture needs to be bound. Default 0.
- */
- setTexture2D(texture?: WebGLTexture, unit?: integer): Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline;
-
- /**
- * Checks if the current batch has the same texture and texture unit, or if we need to create a new batch.
- * @param texture WebGLTexture that will be assigned to the current batch. If not given uses blankTexture.
- * @param unit Texture unit to which the texture needs to be bound.
- */
- requireTextureBatch(texture: WebGLTexture, unit: integer): boolean;
-
- /**
- * Creates a new batch object and pushes it to a batch array.
- * The batch object contains information relevant to the current
- * vertex batch like the offset in the vertex buffer, vertex count and
- * the textures used by that batch.
- * @param texture Optional WebGLTexture that will be assigned to the created batch.
- * @param unit Texture unit to which the texture needs to be bound.
- */
- pushBatch(texture: WebGLTexture, unit: integer): void;
-
- /**
- * Uploads the vertex data and emits a draw call for the current batch of vertices.
- */
- flush(): this;
-
- /**
- * Takes a Sprite Game Object, or any object that extends it, and adds it to the batch.
- * @param sprite The texture based Game Object to add to the batch.
- * @param camera The Camera to use for the rendering transform.
- * @param parentTransformMatrix The transform matrix of the parent container, if set.
- */
- batchSprite(sprite: Phaser.GameObjects.Image | Phaser.GameObjects.Sprite, camera: Phaser.Cameras.Scene2D.Camera, parentTransformMatrix?: Phaser.GameObjects.Components.TransformMatrix): void;
-
- /**
- * Adds the vertices data into the batch and flushes if full.
- *
- * Assumes 6 vertices in the following arrangement:
- *
- * ```
- * 0----3
- * |\ B|
- * | \ |
- * | \ |
- * | A \|
- * | \
- * 1----2
- * ```
- *
- * Where tx0/ty0 = 0, tx1/ty1 = 1, tx2/ty2 = 2 and tx3/ty3 = 3
- * @param x0 The top-left x position.
- * @param y0 The top-left y position.
- * @param x1 The bottom-left x position.
- * @param y1 The bottom-left y position.
- * @param x2 The bottom-right x position.
- * @param y2 The bottom-right y position.
- * @param x3 The top-right x position.
- * @param y3 The top-right y position.
- * @param u0 UV u0 value.
- * @param v0 UV v0 value.
- * @param u1 UV u1 value.
- * @param v1 UV v1 value.
- * @param tintTL The top-left tint color value.
- * @param tintTR The top-right tint color value.
- * @param tintBL The bottom-left tint color value.
- * @param tintBR The bottom-right tint color value.
- * @param tintEffect The tint effect for the shader to use.
- * @param texture WebGLTexture that will be assigned to the current batch if a flush occurs.
- * @param unit Texture unit to which the texture needs to be bound. Default 0.
- */
- batchQuad(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, u0: number, v0: number, u1: number, v1: number, tintTL: number, tintTR: number, tintBL: number, tintBR: number, tintEffect: number | boolean, texture?: WebGLTexture, unit?: integer): boolean;
-
- /**
- * Adds the vertices data into the batch and flushes if full.
- *
- * Assumes 3 vertices in the following arrangement:
- *
- * ```
- * 0
- * |\
- * | \
- * | \
- * | \
- * | \
- * 1-----2
- * ```
- * @param x1 The bottom-left x position.
- * @param y1 The bottom-left y position.
- * @param x2 The bottom-right x position.
- * @param y2 The bottom-right y position.
- * @param x3 The top-right x position.
- * @param y3 The top-right y position.
- * @param u0 UV u0 value.
- * @param v0 UV v0 value.
- * @param u1 UV u1 value.
- * @param v1 UV v1 value.
- * @param tintTL The top-left tint color value.
- * @param tintTR The top-right tint color value.
- * @param tintBL The bottom-left tint color value.
- * @param tintEffect The tint effect for the shader to use.
- * @param texture WebGLTexture that will be assigned to the current batch if a flush occurs.
- * @param unit Texture unit to which the texture needs to be bound. Default 0.
- */
- batchTri(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, u0: number, v0: number, u1: number, v1: number, tintTL: number, tintTR: number, tintBL: number, tintEffect: number | boolean, texture?: WebGLTexture, unit?: integer): boolean;
-
- /**
- * Generic function for batching a textured quad using argument values instead of a Game Object.
- * @param gameObject Source GameObject.
- * @param texture Raw WebGLTexture associated with the quad.
- * @param textureWidth Real texture width.
- * @param textureHeight Real texture height.
- * @param srcX X coordinate of the quad.
- * @param srcY Y coordinate of the quad.
- * @param srcWidth Width of the quad.
- * @param srcHeight Height of the quad.
- * @param scaleX X component of scale.
- * @param scaleY Y component of scale.
- * @param rotation Rotation of the quad.
- * @param flipX Indicates if the quad is horizontally flipped.
- * @param flipY Indicates if the quad is vertically flipped.
- * @param scrollFactorX By which factor is the quad affected by the camera horizontal scroll.
- * @param scrollFactorY By which factor is the quad effected by the camera vertical scroll.
- * @param displayOriginX Horizontal origin in pixels.
- * @param displayOriginY Vertical origin in pixels.
- * @param frameX X coordinate of the texture frame.
- * @param frameY Y coordinate of the texture frame.
- * @param frameWidth Width of the texture frame.
- * @param frameHeight Height of the texture frame.
- * @param tintTL Tint for top left.
- * @param tintTR Tint for top right.
- * @param tintBL Tint for bottom left.
- * @param tintBR Tint for bottom right.
- * @param tintEffect The tint effect.
- * @param uOffset Horizontal offset on texture coordinate.
- * @param vOffset Vertical offset on texture coordinate.
- * @param camera Current used camera.
- * @param parentTransformMatrix Parent container.
- * @param skipFlip Skip the renderTexture check. Default false.
- */
- batchTexture(gameObject: Phaser.GameObjects.GameObject, texture: WebGLTexture, textureWidth: integer, textureHeight: integer, srcX: number, srcY: number, srcWidth: number, srcHeight: number, scaleX: number, scaleY: number, rotation: number, flipX: boolean, flipY: boolean, scrollFactorX: number, scrollFactorY: number, displayOriginX: number, displayOriginY: number, frameX: number, frameY: number, frameWidth: number, frameHeight: number, tintTL: integer, tintTR: integer, tintBL: integer, tintBR: integer, tintEffect: number, uOffset: number, vOffset: number, camera: Phaser.Cameras.Scene2D.Camera, parentTransformMatrix: Phaser.GameObjects.Components.TransformMatrix, skipFlip?: boolean): void;
-
- /**
- * Adds a Texture Frame into the batch for rendering.
- * @param frame The Texture Frame to be rendered.
- * @param x The horizontal position to render the texture at.
- * @param y The vertical position to render the texture at.
- * @param tint The tint color.
- * @param alpha The alpha value.
- * @param transformMatrix The Transform Matrix to use for the texture.
- * @param parentTransformMatrix A parent Transform Matrix.
- */
- batchTextureFrame(frame: Phaser.Textures.Frame, x: number, y: number, tint: number, alpha: number, transformMatrix: Phaser.GameObjects.Components.TransformMatrix, parentTransformMatrix?: Phaser.GameObjects.Components.TransformMatrix): void;
-
- /**
- * Pushes a filled rectangle into the vertex batch.
- * Rectangle has no transform values and isn't transformed into the local space.
- * Used for directly batching untransformed rectangles, such as Camera background colors.
- * @param x Horizontal top left coordinate of the rectangle.
- * @param y Vertical top left coordinate of the rectangle.
- * @param width Width of the rectangle.
- * @param height Height of the rectangle.
- * @param color Color of the rectangle to draw.
- * @param alpha Alpha value of the rectangle to draw.
- */
- drawFillRect(x: number, y: number, width: number, height: number, color: number, alpha: number): void;
-
- /**
- * Pushes a filled rectangle into the vertex batch.
- * Rectangle factors in the given transform matrices before adding to the batch.
- * @param x Horizontal top left coordinate of the rectangle.
- * @param y Vertical top left coordinate of the rectangle.
- * @param width Width of the rectangle.
- * @param height Height of the rectangle.
- * @param currentMatrix The current transform.
- * @param parentMatrix The parent transform.
- */
- batchFillRect(x: number, y: number, width: number, height: number, currentMatrix: Phaser.GameObjects.Components.TransformMatrix, parentMatrix: Phaser.GameObjects.Components.TransformMatrix): void;
-
- /**
- * Pushes a filled triangle into the vertex batch.
- * Triangle factors in the given transform matrices before adding to the batch.
- * @param x0 Point 0 x coordinate.
- * @param y0 Point 0 y coordinate.
- * @param x1 Point 1 x coordinate.
- * @param y1 Point 1 y coordinate.
- * @param x2 Point 2 x coordinate.
- * @param y2 Point 2 y coordinate.
- * @param currentMatrix The current transform.
- * @param parentMatrix The parent transform.
- */
- batchFillTriangle(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, currentMatrix: Phaser.GameObjects.Components.TransformMatrix, parentMatrix: Phaser.GameObjects.Components.TransformMatrix): void;
-
- /**
- * Pushes a stroked triangle into the vertex batch.
- * Triangle factors in the given transform matrices before adding to the batch.
- * The triangle is created from 3 lines and drawn using the `batchStrokePath` method.
- * @param x0 Point 0 x coordinate.
- * @param y0 Point 0 y coordinate.
- * @param x1 Point 1 x coordinate.
- * @param y1 Point 1 y coordinate.
- * @param x2 Point 2 x coordinate.
- * @param y2 Point 2 y coordinate.
- * @param lineWidth The width of the line in pixels.
- * @param currentMatrix The current transform.
- * @param parentMatrix The parent transform.
- */
- batchStrokeTriangle(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, lineWidth: number, currentMatrix: Phaser.GameObjects.Components.TransformMatrix, parentMatrix: Phaser.GameObjects.Components.TransformMatrix): void;
-
- /**
- * Adds the given path to the vertex batch for rendering.
- *
- * It works by taking the array of path data and then passing it through Earcut, which
- * creates a list of polygons. Each polygon is then added to the batch.
- *
- * The path is always automatically closed because it's filled.
- * @param path Collection of points that represent the path.
- * @param currentMatrix The current transform.
- * @param parentMatrix The parent transform.
- */
- batchFillPath(path: any[], currentMatrix: Phaser.GameObjects.Components.TransformMatrix, parentMatrix: Phaser.GameObjects.Components.TransformMatrix): void;
-
- /**
- * Adds the given path to the vertex batch for rendering.
- *
- * It works by taking the array of path data and calling `batchLine` for each section
- * of the path.
- *
- * The path is optionally closed at the end.
- * @param path Collection of points that represent the path.
- * @param lineWidth The width of the line segments in pixels.
- * @param pathOpen Indicates if the path should be closed or left open.
- * @param currentMatrix The current transform.
- * @param parentMatrix The parent transform.
- */
- batchStrokePath(path: any[], lineWidth: number, pathOpen: boolean, currentMatrix: Phaser.GameObjects.Components.TransformMatrix, parentMatrix: Phaser.GameObjects.Components.TransformMatrix): void;
-
- /**
- * Creates a quad and adds it to the vertex batch based on the given line values.
- * @param ax X coordinate to the start of the line
- * @param ay Y coordinate to the start of the line
- * @param bx X coordinate to the end of the line
- * @param by Y coordinate to the end of the line
- * @param aLineWidth Width of the start of the line
- * @param bLineWidth Width of the end of the line
- * @param currentMatrix Parent matrix, generally used by containers
- */
- batchLine(ax: number, ay: number, bx: number, by: number, aLineWidth: number, bLineWidth: number, currentMatrix: Float32Array): void;
-
- }
-
- /**
- * Implements a model view projection matrices.
- * Pipelines can implement this for doing 2D and 3D rendering.
- */
- interface ModelViewProjection {
- /**
- * Dirty flag for checking if model matrix needs to be updated on GPU.
- */
- modelMatrixDirty: boolean;
- /**
- * Dirty flag for checking if view matrix needs to be updated on GPU.
- */
- viewMatrixDirty: boolean;
- /**
- * Dirty flag for checking if projection matrix needs to be updated on GPU.
- */
- projectionMatrixDirty: boolean;
- /**
- * Model matrix
- */
- modelMatrix: Float32Array;
- /**
- * View matrix
- */
- viewMatrix: Float32Array;
- /**
- * Projection matrix
- */
- projectionMatrix: Float32Array;
- /**
- * Initializes MVP matrices with an identity matrix
- */
- mvpInit(): void;
- /**
- * If dirty flags are set then the matrices are uploaded to the GPU.
- */
- mvpUpdate(): void;
- /**
- * Loads an identity matrix to the model matrix
- */
- modelIdentity(): void;
- /**
- * Scale model matrix
- * @param x The x component.
- * @param y The y component.
- * @param z The z component.
- */
- modelScale(x: number, y: number, z: number): this;
- /**
- * Translate model matrix
- * @param x The x component.
- * @param y The y component.
- * @param z The z component.
- */
- modelTranslate(x: number, y: number, z: number): this;
- /**
- * Rotates the model matrix in the X axis.
- * @param radians The amount to rotate by.
- */
- modelRotateX(radians: number): this;
- /**
- * Rotates the model matrix in the Y axis.
- * @param radians The amount to rotate by.
- */
- modelRotateY(radians: number): this;
- /**
- * Rotates the model matrix in the Z axis.
- * @param radians The amount to rotate by.
- */
- modelRotateZ(radians: number): this;
- /**
- * Loads identity matrix into the view matrix
- */
- viewIdentity(): this;
- /**
- * Scales view matrix
- * @param x The x component.
- * @param y The y component.
- * @param z The z component.
- */
- viewScale(x: number, y: number, z: number): this;
- /**
- * Translates view matrix
- * @param x The x component.
- * @param y The y component.
- * @param z The z component.
- */
- viewTranslate(x: number, y: number, z: number): this;
- /**
- * Rotates view matrix in the X axis.
- * @param radians The amount to rotate by.
- */
- viewRotateX(radians: number): this;
- /**
- * Rotates view matrix in the Y axis.
- * @param radians The amount to rotate by.
- */
- viewRotateY(radians: number): this;
- /**
- * Rotates view matrix in the Z axis.
- * @param radians The amount to rotate by.
- */
- viewRotateZ(radians: number): this;
- /**
- * Loads a 2D view matrix (3x2 matrix) into a 4x4 view matrix
- * @param matrix2D The Matrix2D.
- */
- viewLoad2D(matrix2D: Float32Array): this;
- /**
- * Copies a 4x4 matrix into the view matrix
- * @param matrix The Matrix2D.
- */
- viewLoad(matrix: Float32Array): this;
- /**
- * Loads identity matrix into the projection matrix.
- */
- projIdentity(): this;
- /**
- * Sets up an orthographic projection matrix
- * @param left The left value.
- * @param right The right value.
- * @param bottom The bottom value.
- * @param top The top value.
- * @param near The near value.
- * @param far The far value.
- */
- projOrtho(left: number, right: number, bottom: number, top: number, near: number, far: number): this;
- /**
- * Sets up a perspective projection matrix
- * @param fovY The fov value.
- * @param aspectRatio The aspectRatio value.
- * @param near The near value.
- * @param far The far value.
- */
- projPersp(fovY: number, aspectRatio: number, near: number, far: number): this;
- }
-
- }
-
}
}
+ /**
+ * Phaser Scale Modes.
+ */
+ enum ScaleModes {
+ /**
+ * Default Scale Mode (Linear).
+ */
+ DEFAULT,
+ /**
+ * Linear Scale Mode.
+ */
+ LINEAR,
+ /**
+ * Nearest Scale Mode.
+ */
+ NEAREST,
+ }
+
namespace Scale {
+ /**
+ * Phaser Scale Manager constants for centering the game canvas.
+ */
+ enum Center {
+ /**
+ * The game canvas is not centered within the parent by Phaser.
+ * You can still center it yourself via CSS.
+ */
+ NO_CENTER,
+ /**
+ * The game canvas is centered both horizontally and vertically within the parent.
+ * To do this, the parent has to have a bounds that can be calculated and not be empty.
+ *
+ * Centering is achieved by setting the margin left and top properties of the
+ * game canvas, and does not factor in any other CSS styles you may have applied.
+ */
+ CENTER_BOTH,
+ /**
+ * The game canvas is centered horizontally within the parent.
+ * To do this, the parent has to have a bounds that can be calculated and not be empty.
+ *
+ * Centering is achieved by setting the margin left and top properties of the
+ * game canvas, and does not factor in any other CSS styles you may have applied.
+ */
+ CENTER_HORIZONTALLY,
+ /**
+ * The game canvas is centered both vertically within the parent.
+ * To do this, the parent has to have a bounds that can be calculated and not be empty.
+ *
+ * Centering is achieved by setting the margin left and top properties of the
+ * game canvas, and does not factor in any other CSS styles you may have applied.
+ */
+ CENTER_VERTICALLY,
+ }
+
+ /**
+ * Phaser Scale Manager constants for centering the game canvas.
+ *
+ * To find out what each mode does please see [Phaser.Scale.Center]{@link Phaser.Scale.Center}.
+ */
+ type CenterType = Phaser.Scale.Center;
+
+ /**
+ * Phaser Scale Manager constants for orientation.
+ */
+ enum Orientation {
+ /**
+ * A landscape orientation.
+ */
+ LANDSCAPE,
+ /**
+ * A portrait orientation.
+ */
+ PORTRAIT,
+ }
+
+ /**
+ * Phaser Scale Manager constants for orientation.
+ *
+ * To find out what each mode does please see [Phaser.Scale.Orientation]{@link Phaser.Scale.Orientation}.
+ */
+ type OrientationType = Phaser.Scale.Orientation;
+
+ /**
+ * Phaser Scale Manager constants for the different scale modes available.
+ */
+ enum ScaleModes {
+ /**
+ * No scaling happens at all. The canvas is set to the size given in the game config and Phaser doesn't change it
+ * again from that point on. If you change the canvas size, either via CSS, or directly via code, then you need
+ * to call the Scale Managers `resize` method to give the new dimensions, or input events will stop working.
+ */
+ NONE,
+ /**
+ * The height is automatically adjusted based on the width.
+ */
+ WIDTH_CONTROLS_HEIGHT,
+ /**
+ * The width is automatically adjusted based on the height.
+ */
+ HEIGHT_CONTROLS_WIDTH,
+ /**
+ * The width and height are automatically adjusted to fit inside the given target area,
+ * while keeping the aspect ratio. Depending on the aspect ratio there may be some space
+ * inside the area which is not covered.
+ */
+ FIT,
+ /**
+ * The width and height are automatically adjusted to make the size cover the entire target
+ * area while keeping the aspect ratio. This may extend further out than the target size.
+ */
+ ENVELOP,
+ /**
+ * The Canvas is resized to fit all available _parent_ space, regardless of aspect ratio.
+ */
+ RESIZE,
+ }
+
+ /**
+ * Phaser Scale Manager constants for the different scale modes available.
+ *
+ * To find out what each mode does please see [Phaser.Scale.ScaleModes]{@link Phaser.Scale.ScaleModes}.
+ */
+ type ScaleModeType = Phaser.Scale.ScaleModes;
+
+ /**
+ * Phaser Scale Manager constants for zoom modes.
+ */
+ enum Zoom {
+ /**
+ * The game canvas will not be zoomed by Phaser.
+ */
+ NO_ZOOM,
+ /**
+ * The game canvas will be 2x zoomed by Phaser.
+ */
+ ZOOM_2X,
+ /**
+ * The game canvas will be 4x zoomed by Phaser.
+ */
+ ZOOM_4X,
+ /**
+ * Calculate the zoom value based on the maximum multiplied game size that will
+ * fit into the parent, or browser window if no parent is set.
+ */
+ MAX_ZOOM,
+ }
+
+ /**
+ * Phaser Scale Manager constants for zoom modes.
+ *
+ * To find out what each mode does please see [Phaser.Scale.Zoom]{@link Phaser.Scale.Zoom}.
+ */
+ type ZoomType = Phaser.Scale.Zoom;
+
+ namespace Events {
+ /**
+ * The Scale Manager has successfully entered fullscreen mode.
+ */
+ const ENTER_FULLSCREEN: any;
+
+ /**
+ * The Scale Manager tried to enter fullscreen mode but failed.
+ */
+ const FULLSCREEN_FAILED: any;
+
+ /**
+ * The Scale Manager tried to enter fullscreen mode, but it is unsupported by the browser.
+ */
+ const FULLSCREEN_UNSUPPORTED: any;
+
+ /**
+ * The Scale Manager was in fullscreen mode, but has since left, either directly via game code,
+ * or via a user gestured, such as pressing the ESC key.
+ */
+ const LEAVE_FULLSCREEN: any;
+
+ /**
+ * The Scale Manager Orientation Change Event.
+ */
+ const ORIENTATION_CHANGE: any;
+
+ /**
+ * The Scale Manager Resize Event.
+ *
+ * This event is dispatched whenever the Scale Manager detects a resize event from the browser.
+ * It sends three parameters to the callback, each of them being Size components. You can read
+ * the `width`, `height`, `aspectRatio` and other properties of these components to help with
+ * scaling your own game content.
+ */
+ const RESIZE: any;
+
+ }
+
/**
* The Scale Manager handles the scaling, resizing and alignment of the game canvas.
*
@@ -74443,180 +76061,6 @@ declare namespace Phaser {
}
- /**
- * Phaser Scale Manager constants for centering the game canvas.
- */
- enum Center {
- /**
- * The game canvas is not centered within the parent by Phaser.
- * You can still center it yourself via CSS.
- */
- NO_CENTER,
- /**
- * The game canvas is centered both horizontally and vertically within the parent.
- * To do this, the parent has to have a bounds that can be calculated and not be empty.
- *
- * Centering is achieved by setting the margin left and top properties of the
- * game canvas, and does not factor in any other CSS styles you may have applied.
- */
- CENTER_BOTH,
- /**
- * The game canvas is centered horizontally within the parent.
- * To do this, the parent has to have a bounds that can be calculated and not be empty.
- *
- * Centering is achieved by setting the margin left and top properties of the
- * game canvas, and does not factor in any other CSS styles you may have applied.
- */
- CENTER_HORIZONTALLY,
- /**
- * The game canvas is centered both vertically within the parent.
- * To do this, the parent has to have a bounds that can be calculated and not be empty.
- *
- * Centering is achieved by setting the margin left and top properties of the
- * game canvas, and does not factor in any other CSS styles you may have applied.
- */
- CENTER_VERTICALLY,
- }
-
- /**
- * Phaser Scale Manager constants for centering the game canvas.
- *
- * To find out what each mode does please see [Phaser.Scale.Center]{@link Phaser.Scale.Center}.
- */
- type CenterType = Phaser.Scale.Center;
-
- /**
- * Phaser Scale Manager constants for orientation.
- */
- enum Orientation {
- /**
- * A landscape orientation.
- */
- LANDSCAPE,
- /**
- * A portrait orientation.
- */
- PORTRAIT,
- }
-
- /**
- * Phaser Scale Manager constants for orientation.
- *
- * To find out what each mode does please see [Phaser.Scale.Orientation]{@link Phaser.Scale.Orientation}.
- */
- type OrientationType = Phaser.Scale.Orientation;
-
- /**
- * Phaser Scale Manager constants for the different scale modes available.
- */
- enum ScaleModes {
- /**
- * No scaling happens at all. The canvas is set to the size given in the game config and Phaser doesn't change it
- * again from that point on. If you change the canvas size, either via CSS, or directly via code, then you need
- * to call the Scale Managers `resize` method to give the new dimensions, or input events will stop working.
- */
- NONE,
- /**
- * The height is automatically adjusted based on the width.
- */
- WIDTH_CONTROLS_HEIGHT,
- /**
- * The width is automatically adjusted based on the height.
- */
- HEIGHT_CONTROLS_WIDTH,
- /**
- * The width and height are automatically adjusted to fit inside the given target area,
- * while keeping the aspect ratio. Depending on the aspect ratio there may be some space
- * inside the area which is not covered.
- */
- FIT,
- /**
- * The width and height are automatically adjusted to make the size cover the entire target
- * area while keeping the aspect ratio. This may extend further out than the target size.
- */
- ENVELOP,
- /**
- * The Canvas is resized to fit all available _parent_ space, regardless of aspect ratio.
- */
- RESIZE,
- }
-
- /**
- * Phaser Scale Manager constants for the different scale modes available.
- *
- * To find out what each mode does please see [Phaser.Scale.ScaleModes]{@link Phaser.Scale.ScaleModes}.
- */
- type ScaleModeType = Phaser.Scale.ScaleModes;
-
- /**
- * Phaser Scale Manager constants for zoom modes.
- */
- enum Zoom {
- /**
- * The game canvas will not be zoomed by Phaser.
- */
- NO_ZOOM,
- /**
- * The game canvas will be 2x zoomed by Phaser.
- */
- ZOOM_2X,
- /**
- * The game canvas will be 4x zoomed by Phaser.
- */
- ZOOM_4X,
- /**
- * Calculate the zoom value based on the maximum multiplied game size that will
- * fit into the parent, or browser window if no parent is set.
- */
- MAX_ZOOM,
- }
-
- /**
- * Phaser Scale Manager constants for zoom modes.
- *
- * To find out what each mode does please see [Phaser.Scale.Zoom]{@link Phaser.Scale.Zoom}.
- */
- type ZoomType = Phaser.Scale.Zoom;
-
- namespace Events {
- /**
- * The Scale Manager has successfully entered fullscreen mode.
- */
- const ENTER_FULLSCREEN: any;
-
- /**
- * The Scale Manager tried to enter fullscreen mode but failed.
- */
- const FULLSCREEN_FAILED: any;
-
- /**
- * The Scale Manager tried to enter fullscreen mode, but it is unsupported by the browser.
- */
- const FULLSCREEN_UNSUPPORTED: any;
-
- /**
- * The Scale Manager was in fullscreen mode, but has since left, either directly via game code,
- * or via a user gestured, such as pressing the ESC key.
- */
- const LEAVE_FULLSCREEN: any;
-
- /**
- * The Scale Manager Orientation Change Event.
- */
- const ORIENTATION_CHANGE: any;
-
- /**
- * The Scale Manager Resize Event.
- *
- * This event is dispatched whenever the Scale Manager detects a resize event from the browser.
- * It sends three parameters to the callback, each of them being Size components. You can read
- * the `width`, `height`, `aspectRatio` and other properties of these components to help with
- * scaling your own game content.
- */
- const RESIZE: any;
-
- }
-
/**
* The game canvas is not centered within the parent by Phaser.
* You can still center it yourself via CSS.
@@ -74718,180 +76162,341 @@ declare namespace Phaser {
}
- /**
- * A base Phaser.Scene class which can be extended for your own use.
- *
- * You can also define the optional methods {@link Phaser.Types.Scenes.SceneInitCallback init()}, {@link Phaser.Types.Scenes.ScenePreloadCallback preload()}, and {@link Phaser.Types.Scenes.SceneCreateCallback create()}.
- */
- class Scene {
- /**
- *
- * @param config Scene specific configuration settings.
- */
- constructor(config: string | Phaser.Types.Scenes.SettingsConfig);
-
- /**
- * The Scene Systems. You must never overwrite this property, or all hell will break lose.
- */
- sys: Phaser.Scenes.Systems;
-
- /**
- * A reference to the Phaser.Game instance.
- * This property will only be available if defined in the Scene Injection Map.
- */
- game: Phaser.Game;
-
- /**
- * A reference to the global Animation Manager.
- * This property will only be available if defined in the Scene Injection Map.
- */
- anims: Phaser.Animations.AnimationManager;
-
- /**
- * A reference to the global Cache.
- * This property will only be available if defined in the Scene Injection Map.
- */
- cache: Phaser.Cache.CacheManager;
-
- /**
- * A reference to the game level Data Manager.
- * This property will only be available if defined in the Scene Injection Map.
- */
- registry: Phaser.Data.DataManager;
-
- /**
- * A reference to the Sound Manager.
- * This property will only be available if defined in the Scene Injection Map and the plugin is installed.
- */
- sound: Phaser.Sound.BaseSoundManager;
-
- /**
- * A reference to the Texture Manager.
- * This property will only be available if defined in the Scene Injection Map.
- */
- textures: Phaser.Textures.TextureManager;
-
- /**
- * A scene level Event Emitter.
- * This property will only be available if defined in the Scene Injection Map.
- */
- events: Phaser.Events.EventEmitter;
-
- /**
- * A scene level Camera System.
- * This property will only be available if defined in the Scene Injection Map.
- */
- cameras: Phaser.Cameras.Scene2D.CameraManager;
-
- /**
- * A scene level Game Object Factory.
- * This property will only be available if defined in the Scene Injection Map.
- */
- add: Phaser.GameObjects.GameObjectFactory;
-
- /**
- * A scene level Game Object Creator.
- * This property will only be available if defined in the Scene Injection Map.
- */
- make: Phaser.GameObjects.GameObjectCreator;
-
- /**
- * A reference to the Scene Manager Plugin.
- * This property will only be available if defined in the Scene Injection Map.
- */
- scene: Phaser.Scenes.ScenePlugin;
-
- /**
- * A scene level Game Object Display List.
- * This property will only be available if defined in the Scene Injection Map.
- */
- children: Phaser.GameObjects.DisplayList;
-
- /**
- * A scene level Lights Manager Plugin.
- * This property will only be available if defined in the Scene Injection Map and the plugin is installed.
- */
- lights: Phaser.GameObjects.LightsManager;
-
- /**
- * A scene level Data Manager Plugin.
- * This property will only be available if defined in the Scene Injection Map and the plugin is installed.
- */
- data: Phaser.Data.DataManager;
-
- /**
- * A scene level Input Manager Plugin.
- * This property will only be available if defined in the Scene Injection Map and the plugin is installed.
- */
- input: Phaser.Input.InputPlugin;
-
- /**
- * A scene level Loader Plugin.
- * This property will only be available if defined in the Scene Injection Map and the plugin is installed.
- */
- load: Phaser.Loader.LoaderPlugin;
-
- /**
- * A scene level Time and Clock Plugin.
- * This property will only be available if defined in the Scene Injection Map and the plugin is installed.
- */
- time: Phaser.Time.Clock;
-
- /**
- * A scene level Tween Manager Plugin.
- * This property will only be available if defined in the Scene Injection Map and the plugin is installed.
- */
- tweens: Phaser.Tweens.TweenManager;
-
- /**
- * A scene level Arcade Physics Plugin.
- * This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured.
- */
- physics: Phaser.Physics.Arcade.ArcadePhysics;
-
- /**
- * A scene level Impact Physics Plugin.
- * This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured.
- */
- impact: Phaser.Physics.Impact.ImpactPhysics;
-
- /**
- * A scene level Matter Physics Plugin.
- * This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured.
- */
- matter: Phaser.Physics.Matter.MatterPhysics;
-
- /**
- * A scene level Facebook Instant Games Plugin.
- * This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured.
- */
- facebook: Phaser.FacebookInstantGamesPlugin;
-
- /**
- * A reference to the global Scale Manager.
- * This property will only be available if defined in the Scene Injection Map.
- */
- scale: Phaser.Scale.ScaleManager;
-
- /**
- * A reference to the Plugin Manager.
- *
- * The Plugin Manager is a global system that allows plugins to register themselves with it, and can then install
- * those plugins into Scenes as required.
- */
- plugins: Phaser.Plugins.PluginManager;
-
- /**
- * Should be overridden by your own Scenes.
- * This method is called once per game step while the scene is running.
- * @param time The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
- * @param delta The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.
- */
- update(time: number, delta: number): void;
-
- }
-
namespace Scenes {
+ /**
+ * Scene state.
+ */
+ var PENDING: integer;
+
+ /**
+ * Scene state.
+ */
+ var INIT: integer;
+
+ /**
+ * Scene state.
+ */
+ var START: integer;
+
+ /**
+ * Scene state.
+ */
+ var LOADING: integer;
+
+ /**
+ * Scene state.
+ */
+ var CREATING: integer;
+
+ /**
+ * Scene state.
+ */
+ var RUNNING: integer;
+
+ /**
+ * Scene state.
+ */
+ var PAUSED: integer;
+
+ /**
+ * Scene state.
+ */
+ var SLEEPING: integer;
+
+ /**
+ * Scene state.
+ */
+ var SHUTDOWN: integer;
+
+ /**
+ * Scene state.
+ */
+ var DESTROYED: integer;
+
+ namespace Events {
+ /**
+ * The Scene Systems Boot Event.
+ *
+ * This event is dispatched by a Scene during the Scene Systems boot process. Primarily used by Scene Plugins.
+ *
+ * Listen to it from a Scene using `this.scene.events.on('boot', listener)`.
+ */
+ const BOOT: any;
+
+ /**
+ * The Scene Create Event.
+ *
+ * This event is dispatched by a Scene after it has been created by the Scene Manager.
+ *
+ * If a Scene has a `create` method then this event is emitted _after_ that has run.
+ *
+ * If there is a transition, this event will be fired after the `TRANSITION_START` event.
+ *
+ * Listen to it from a Scene using `this.scene.events.on('create', listener)`.
+ */
+ const CREATE: any;
+
+ /**
+ * The Scene Systems Destroy Event.
+ *
+ * This event is dispatched by a Scene during the Scene Systems destroy process.
+ *
+ * Listen to it from a Scene using `this.scene.events.on('destroy', listener)`.
+ *
+ * You should destroy any resources that may be in use by your Scene in this event handler.
+ */
+ const DESTROY: any;
+
+ /**
+ * The Scene Systems Pause Event.
+ *
+ * This event is dispatched by a Scene when it is paused, either directly via the `pause` method, or as an
+ * action from another Scene.
+ *
+ * Listen to it from a Scene using `this.scene.events.on('pause', listener)`.
+ */
+ const PAUSE: any;
+
+ /**
+ * The Scene Systems Post Update Event.
+ *
+ * This event is dispatched by a Scene during the main game loop step.
+ *
+ * The event flow for a single step of a Scene is as follows:
+ *
+ * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE}
+ * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE}
+ * 3. The `Scene.update` method is called, if it exists
+ * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE}
+ * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER}
+ *
+ * Listen to it from a Scene using `this.scene.events.on('postupdate', listener)`.
+ *
+ * A Scene will only run its step if it is active.
+ */
+ const POST_UPDATE: any;
+
+ /**
+ * The Scene Systems Pre Update Event.
+ *
+ * This event is dispatched by a Scene during the main game loop step.
+ *
+ * The event flow for a single step of a Scene is as follows:
+ *
+ * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE}
+ * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE}
+ * 3. The `Scene.update` method is called, if it exists
+ * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE}
+ * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER}
+ *
+ * Listen to it from a Scene using `this.scene.events.on('preupdate', listener)`.
+ *
+ * A Scene will only run its step if it is active.
+ */
+ const PRE_UPDATE: any;
+
+ /**
+ * The Scene Systems Ready Event.
+ *
+ * This event is dispatched by a Scene during the Scene Systems start process.
+ * By this point in the process the Scene is now fully active and rendering.
+ * This event is meant for your game code to use, as all plugins have responded to the earlier 'start' event.
+ *
+ * Listen to it from a Scene using `this.scene.events.on('ready', listener)`.
+ */
+ const READY: any;
+
+ /**
+ * The Scene Systems Render Event.
+ *
+ * This event is dispatched by a Scene during the main game loop step.
+ *
+ * The event flow for a single step of a Scene is as follows:
+ *
+ * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE}
+ * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE}
+ * 3. The `Scene.update` method is called, if it exists
+ * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE}
+ * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER}
+ *
+ * Listen to it from a Scene using `this.scene.events.on('render', listener)`.
+ *
+ * A Scene will only render if it is visible and active.
+ * By the time this event is dispatched, the Scene will have already been rendered.
+ */
+ const RENDER: any;
+
+ /**
+ * The Scene Systems Resume Event.
+ *
+ * This event is dispatched by a Scene when it is resumed from a paused state, either directly via the `resume` method,
+ * or as an action from another Scene.
+ *
+ * Listen to it from a Scene using `this.scene.events.on('resume', listener)`.
+ */
+ const RESUME: any;
+
+ /**
+ * The Scene Systems Shutdown Event.
+ *
+ * This event is dispatched by a Scene during the Scene Systems shutdown process.
+ *
+ * Listen to it from a Scene using `this.scene.events.on('shutdown', listener)`.
+ *
+ * You should free-up any resources that may be in use by your Scene in this event handler, on the understanding
+ * that the Scene may, at any time, become active again. A shutdown Scene is not 'destroyed', it's simply not
+ * currently active. Use the [DESTROY]{@linkcode Phaser.Scenes.Events#event:DESTROY} event to completely clear resources.
+ */
+ const SHUTDOWN: any;
+
+ /**
+ * The Scene Systems Sleep Event.
+ *
+ * This event is dispatched by a Scene when it is sent to sleep, either directly via the `sleep` method,
+ * or as an action from another Scene.
+ *
+ * Listen to it from a Scene using `this.scene.events.on('sleep', listener)`.
+ */
+ const SLEEP: any;
+
+ /**
+ * The Scene Systems Start Event.
+ *
+ * This event is dispatched by a Scene during the Scene Systems start process. Primarily used by Scene Plugins.
+ *
+ * Listen to it from a Scene using `this.scene.events.on('start', listener)`.
+ */
+ const START: any;
+
+ /**
+ * The Scene Transition Complete Event.
+ *
+ * This event is dispatched by the Target Scene of a transition.
+ *
+ * It happens when the transition process has completed. This occurs when the duration timer equals or exceeds the duration
+ * of the transition.
+ *
+ * Listen to it from a Scene using `this.scene.events.on('transitioncomplete', listener)`.
+ *
+ * The Scene Transition event flow is as follows:
+ *
+ * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event.
+ * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method.
+ * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ...
+ * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to.
+ * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes.
+ */
+ const TRANSITION_COMPLETE: any;
+
+ /**
+ * The Scene Transition Init Event.
+ *
+ * This event is dispatched by the Target Scene of a transition.
+ *
+ * It happens immediately after the `Scene.init` method is called. If the Scene does not have an `init` method,
+ * this event is not dispatched.
+ *
+ * Listen to it from a Scene using `this.scene.events.on('transitioninit', listener)`.
+ *
+ * The Scene Transition event flow is as follows:
+ *
+ * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event.
+ * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method.
+ * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ...
+ * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to.
+ * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes.
+ */
+ const TRANSITION_INIT: any;
+
+ /**
+ * The Scene Transition Out Event.
+ *
+ * This event is dispatched by a Scene when it initiates a transition to another Scene.
+ *
+ * Listen to it from a Scene using `this.scene.events.on('transitionout', listener)`.
+ *
+ * The Scene Transition event flow is as follows:
+ *
+ * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event.
+ * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method.
+ * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ...
+ * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to.
+ * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes.
+ */
+ const TRANSITION_OUT: any;
+
+ /**
+ * The Scene Transition Start Event.
+ *
+ * This event is dispatched by the Target Scene of a transition, only if that Scene was not asleep.
+ *
+ * It happens immediately after the `Scene.create` method is called. If the Scene does not have a `create` method,
+ * this event is dispatched anyway.
+ *
+ * If the Target Scene was sleeping then the [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} event is
+ * dispatched instead of this event.
+ *
+ * Listen to it from a Scene using `this.scene.events.on('transitionstart', listener)`.
+ *
+ * The Scene Transition event flow is as follows:
+ *
+ * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event.
+ * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method.
+ * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ...
+ * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to.
+ * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes.
+ */
+ const TRANSITION_START: any;
+
+ /**
+ * The Scene Transition Wake Event.
+ *
+ * This event is dispatched by the Target Scene of a transition, only if that Scene was asleep before
+ * the transition began. If the Scene was not asleep the [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} event is dispatched instead.
+ *
+ * Listen to it from a Scene using `this.scene.events.on('transitionwake', listener)`.
+ *
+ * The Scene Transition event flow is as follows:
+ *
+ * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event.
+ * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method.
+ * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ...
+ * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to.
+ * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes.
+ */
+ const TRANSITION_WAKE: any;
+
+ /**
+ * The Scene Systems Update Event.
+ *
+ * This event is dispatched by a Scene during the main game loop step.
+ *
+ * The event flow for a single step of a Scene is as follows:
+ *
+ * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE}
+ * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE}
+ * 3. The `Scene.update` method is called, if it exists
+ * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE}
+ * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER}
+ *
+ * Listen to it from a Scene using `this.scene.events.on('update', listener)`.
+ *
+ * A Scene will only run its step if it is active.
+ */
+ const UPDATE: any;
+
+ /**
+ * The Scene Systems Wake Event.
+ *
+ * This event is dispatched by a Scene when it is woken from sleep, either directly via the `wake` method,
+ * or as an action from another Scene.
+ *
+ * Listen to it from a Scene using `this.scene.events.on('wake', listener)`.
+ */
+ const WAKE: any;
+
+ }
+
/**
* Builds an array of which physics plugins should be activated for the given Scene.
* @param sys The scene system to get the physics systems of.
@@ -75221,6 +76826,8 @@ declare namespace Phaser {
/**
* Shutdown this Scene and run the given one.
+ *
+ * This will happen at the next Scene Manager update, not immediately.
* @param key The Scene to start.
* @param data The Scene data.
*/
@@ -75228,6 +76835,8 @@ declare namespace Phaser {
/**
* Restarts this Scene.
+ *
+ * This will happen at the next Scene Manager update, not immediately.
* @param data The Scene data.
*/
restart(data?: object): Phaser.Scenes.ScenePlugin;
@@ -75276,6 +76885,8 @@ declare namespace Phaser {
/**
* Launch the given Scene and run it in parallel with this one.
+ *
+ * This will happen at the next Scene Manager update, not immediately.
* @param key The Scene to launch.
* @param data The Scene data.
*/
@@ -75284,6 +76895,8 @@ declare namespace Phaser {
/**
* Runs the given Scene, but does not change the state of this Scene.
*
+ * This will happen at the next Scene Manager update, not immediately.
+ *
* If the given Scene is paused, it will resume it. If sleeping, it will wake it.
* If not running at all, it will be started.
*
@@ -75296,6 +76909,8 @@ declare namespace Phaser {
/**
* Pause the Scene - this stops the update step from happening but it still renders.
+ *
+ * This will happen at the next Scene Manager update, not immediately.
* @param key The Scene to pause.
* @param data An optional data object that will be passed to the Scene and emitted in its pause event.
*/
@@ -75303,6 +76918,8 @@ declare namespace Phaser {
/**
* Resume the Scene - starts the update loop again.
+ *
+ * This will happen at the next Scene Manager update, not immediately.
* @param key The Scene to resume.
* @param data An optional data object that will be passed to the Scene and emitted in its resume event.
*/
@@ -75310,6 +76927,8 @@ declare namespace Phaser {
/**
* Makes the Scene sleep (no update, no render) but doesn't shutdown.
+ *
+ * This will happen at the next Scene Manager update, not immediately.
* @param key The Scene to put to sleep.
* @param data An optional data object that will be passed to the Scene and emitted in its sleep event.
*/
@@ -75317,6 +76936,8 @@ declare namespace Phaser {
/**
* Makes the Scene wake-up (starts update and render)
+ *
+ * This will happen at the next Scene Manager update, not immediately.
* @param key The Scene to wake up.
* @param data An optional data object that will be passed to the Scene and emitted in its wake event.
*/
@@ -75325,16 +76946,15 @@ declare namespace Phaser {
/**
* Makes this Scene sleep then starts the Scene given.
*
- * No checks are made to see if an instance of the given Scene is already running.
- * Because Scenes in Phaser are non-exclusive, you are allowed to run multiple
- * instances of them _at the same time_. This means, calling this function
- * may launch another instance of the requested Scene if it's already running.
+ * This will happen at the next Scene Manager update, not immediately.
* @param key The Scene to start.
*/
switch(key: string): Phaser.Scenes.ScenePlugin;
/**
* Shutdown the Scene, clearing display list, timers, etc.
+ *
+ * This happens at the next Scene Manager update, not immediately.
* @param key The Scene to stop.
* @param data Optional data object to pass to Scene.Systems.shutdown.
*/
@@ -75412,7 +77032,7 @@ declare namespace Phaser {
* The Scene is removed from the local scenes array, it's key is cleared from the keys
* cache and Scene.Systems.destroy is then called on it.
*
- * If the SceneManager is processing the Scenes when this method is called it wil
+ * If the SceneManager is processing the Scenes when this method is called it will
* queue the operation for the next update sequence.
* @param key The Scene to be removed.
*/
@@ -75777,339 +77397,178 @@ declare namespace Phaser {
}
+ }
+
+ /**
+ * A base Phaser.Scene class which can be extended for your own use.
+ *
+ * You can also define the optional methods {@link Phaser.Types.Scenes.SceneInitCallback init()}, {@link Phaser.Types.Scenes.ScenePreloadCallback preload()}, and {@link Phaser.Types.Scenes.SceneCreateCallback create()}.
+ */
+ class Scene {
/**
- * Scene state.
+ *
+ * @param config Scene specific configuration settings.
*/
- var PENDING: integer;
+ constructor(config: string | Phaser.Types.Scenes.SettingsConfig);
/**
- * Scene state.
+ * The Scene Systems. You must never overwrite this property, or all hell will break lose.
*/
- var INIT: integer;
+ sys: Phaser.Scenes.Systems;
/**
- * Scene state.
+ * A reference to the Phaser.Game instance.
+ * This property will only be available if defined in the Scene Injection Map.
*/
- var START: integer;
+ game: Phaser.Game;
/**
- * Scene state.
+ * A reference to the global Animation Manager.
+ * This property will only be available if defined in the Scene Injection Map.
*/
- var LOADING: integer;
+ anims: Phaser.Animations.AnimationManager;
/**
- * Scene state.
+ * A reference to the global Cache.
+ * This property will only be available if defined in the Scene Injection Map.
*/
- var CREATING: integer;
+ cache: Phaser.Cache.CacheManager;
/**
- * Scene state.
+ * A reference to the game level Data Manager.
+ * This property will only be available if defined in the Scene Injection Map.
*/
- var RUNNING: integer;
+ registry: Phaser.Data.DataManager;
/**
- * Scene state.
+ * A reference to the Sound Manager.
+ * This property will only be available if defined in the Scene Injection Map and the plugin is installed.
*/
- var PAUSED: integer;
+ sound: Phaser.Sound.BaseSoundManager;
/**
- * Scene state.
+ * A reference to the Texture Manager.
+ * This property will only be available if defined in the Scene Injection Map.
*/
- var SLEEPING: integer;
+ textures: Phaser.Textures.TextureManager;
/**
- * Scene state.
+ * A scene level Event Emitter.
+ * This property will only be available if defined in the Scene Injection Map.
*/
- var SHUTDOWN: integer;
+ events: Phaser.Events.EventEmitter;
/**
- * Scene state.
+ * A scene level Camera System.
+ * This property will only be available if defined in the Scene Injection Map.
*/
- var DESTROYED: integer;
+ cameras: Phaser.Cameras.Scene2D.CameraManager;
- namespace Events {
- /**
- * The Scene Systems Boot Event.
- *
- * This event is dispatched by a Scene during the Scene Systems boot process. Primarily used by Scene Plugins.
- *
- * Listen to it from a Scene using `this.scene.events.on('boot', listener)`.
- */
- const BOOT: any;
+ /**
+ * A scene level Game Object Factory.
+ * This property will only be available if defined in the Scene Injection Map.
+ */
+ add: Phaser.GameObjects.GameObjectFactory;
- /**
- * The Scene Create Event.
- *
- * This event is dispatched by a Scene after it has been created by the Scene Manager.
- *
- * If a Scene has a `create` method then this event is emitted _after_ that has run.
- *
- * If there is a transition, this event will be fired after the `TRANSITION_START` event.
- *
- * Listen to it from a Scene using `this.scene.events.on('create', listener)`.
- */
- const CREATE: any;
+ /**
+ * A scene level Game Object Creator.
+ * This property will only be available if defined in the Scene Injection Map.
+ */
+ make: Phaser.GameObjects.GameObjectCreator;
- /**
- * The Scene Systems Destroy Event.
- *
- * This event is dispatched by a Scene during the Scene Systems destroy process.
- *
- * Listen to it from a Scene using `this.scene.events.on('destroy', listener)`.
- *
- * You should destroy any resources that may be in use by your Scene in this event handler.
- */
- const DESTROY: any;
+ /**
+ * A reference to the Scene Manager Plugin.
+ * This property will only be available if defined in the Scene Injection Map.
+ */
+ scene: Phaser.Scenes.ScenePlugin;
- /**
- * The Scene Systems Pause Event.
- *
- * This event is dispatched by a Scene when it is paused, either directly via the `pause` method, or as an
- * action from another Scene.
- *
- * Listen to it from a Scene using `this.scene.events.on('pause', listener)`.
- */
- const PAUSE: any;
+ /**
+ * A scene level Game Object Display List.
+ * This property will only be available if defined in the Scene Injection Map.
+ */
+ children: Phaser.GameObjects.DisplayList;
- /**
- * The Scene Systems Post Update Event.
- *
- * This event is dispatched by a Scene during the main game loop step.
- *
- * The event flow for a single step of a Scene is as follows:
- *
- * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE}
- * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE}
- * 3. The `Scene.update` method is called, if it exists
- * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE}
- * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER}
- *
- * Listen to it from a Scene using `this.scene.events.on('postupdate', listener)`.
- *
- * A Scene will only run its step if it is active.
- */
- const POST_UPDATE: any;
+ /**
+ * A scene level Lights Manager Plugin.
+ * This property will only be available if defined in the Scene Injection Map and the plugin is installed.
+ */
+ lights: Phaser.GameObjects.LightsManager;
- /**
- * The Scene Systems Pre Update Event.
- *
- * This event is dispatched by a Scene during the main game loop step.
- *
- * The event flow for a single step of a Scene is as follows:
- *
- * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE}
- * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE}
- * 3. The `Scene.update` method is called, if it exists
- * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE}
- * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER}
- *
- * Listen to it from a Scene using `this.scene.events.on('preupdate', listener)`.
- *
- * A Scene will only run its step if it is active.
- */
- const PRE_UPDATE: any;
+ /**
+ * A scene level Data Manager Plugin.
+ * This property will only be available if defined in the Scene Injection Map and the plugin is installed.
+ */
+ data: Phaser.Data.DataManager;
- /**
- * The Scene Systems Ready Event.
- *
- * This event is dispatched by a Scene during the Scene Systems start process.
- * By this point in the process the Scene is now fully active and rendering.
- * This event is meant for your game code to use, as all plugins have responded to the earlier 'start' event.
- *
- * Listen to it from a Scene using `this.scene.events.on('ready', listener)`.
- */
- const READY: any;
+ /**
+ * A scene level Input Manager Plugin.
+ * This property will only be available if defined in the Scene Injection Map and the plugin is installed.
+ */
+ input: Phaser.Input.InputPlugin;
- /**
- * The Scene Systems Render Event.
- *
- * This event is dispatched by a Scene during the main game loop step.
- *
- * The event flow for a single step of a Scene is as follows:
- *
- * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE}
- * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE}
- * 3. The `Scene.update` method is called, if it exists
- * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE}
- * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER}
- *
- * Listen to it from a Scene using `this.scene.events.on('render', listener)`.
- *
- * A Scene will only render if it is visible and active.
- * By the time this event is dispatched, the Scene will have already been rendered.
- */
- const RENDER: any;
+ /**
+ * A scene level Loader Plugin.
+ * This property will only be available if defined in the Scene Injection Map and the plugin is installed.
+ */
+ load: Phaser.Loader.LoaderPlugin;
- /**
- * The Scene Systems Resume Event.
- *
- * This event is dispatched by a Scene when it is resumed from a paused state, either directly via the `resume` method,
- * or as an action from another Scene.
- *
- * Listen to it from a Scene using `this.scene.events.on('resume', listener)`.
- */
- const RESUME: any;
+ /**
+ * A scene level Time and Clock Plugin.
+ * This property will only be available if defined in the Scene Injection Map and the plugin is installed.
+ */
+ time: Phaser.Time.Clock;
- /**
- * The Scene Systems Shutdown Event.
- *
- * This event is dispatched by a Scene during the Scene Systems shutdown process.
- *
- * Listen to it from a Scene using `this.scene.events.on('shutdown', listener)`.
- *
- * You should free-up any resources that may be in use by your Scene in this event handler, on the understanding
- * that the Scene may, at any time, become active again. A shutdown Scene is not 'destroyed', it's simply not
- * currently active. Use the [DESTROY]{@linkcode Phaser.Scenes.Events#event:DESTROY} event to completely clear resources.
- */
- const SHUTDOWN: any;
+ /**
+ * A scene level Tween Manager Plugin.
+ * This property will only be available if defined in the Scene Injection Map and the plugin is installed.
+ */
+ tweens: Phaser.Tweens.TweenManager;
- /**
- * The Scene Systems Sleep Event.
- *
- * This event is dispatched by a Scene when it is sent to sleep, either directly via the `sleep` method,
- * or as an action from another Scene.
- *
- * Listen to it from a Scene using `this.scene.events.on('sleep', listener)`.
- */
- const SLEEP: any;
+ /**
+ * A scene level Arcade Physics Plugin.
+ * This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured.
+ */
+ physics: Phaser.Physics.Arcade.ArcadePhysics;
- /**
- * The Scene Systems Start Event.
- *
- * This event is dispatched by a Scene during the Scene Systems start process. Primarily used by Scene Plugins.
- *
- * Listen to it from a Scene using `this.scene.events.on('start', listener)`.
- */
- const START: any;
+ /**
+ * A scene level Impact Physics Plugin.
+ * This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured.
+ */
+ impact: Phaser.Physics.Impact.ImpactPhysics;
- /**
- * The Scene Transition Complete Event.
- *
- * This event is dispatched by the Target Scene of a transition.
- *
- * It happens when the transition process has completed. This occurs when the duration timer equals or exceeds the duration
- * of the transition.
- *
- * Listen to it from a Scene using `this.scene.events.on('transitioncomplete', listener)`.
- *
- * The Scene Transition event flow is as follows:
- *
- * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event.
- * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method.
- * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ...
- * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to.
- * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes.
- */
- const TRANSITION_COMPLETE: any;
+ /**
+ * A scene level Matter Physics Plugin.
+ * This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured.
+ */
+ matter: Phaser.Physics.Matter.MatterPhysics;
- /**
- * The Scene Transition Init Event.
- *
- * This event is dispatched by the Target Scene of a transition.
- *
- * It happens immediately after the `Scene.init` method is called. If the Scene does not have an `init` method,
- * this event is not dispatched.
- *
- * Listen to it from a Scene using `this.scene.events.on('transitioninit', listener)`.
- *
- * The Scene Transition event flow is as follows:
- *
- * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event.
- * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method.
- * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ...
- * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to.
- * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes.
- */
- const TRANSITION_INIT: any;
+ /**
+ * A scene level Facebook Instant Games Plugin.
+ * This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured.
+ */
+ facebook: Phaser.FacebookInstantGamesPlugin;
- /**
- * The Scene Transition Out Event.
- *
- * This event is dispatched by a Scene when it initiates a transition to another Scene.
- *
- * Listen to it from a Scene using `this.scene.events.on('transitionout', listener)`.
- *
- * The Scene Transition event flow is as follows:
- *
- * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event.
- * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method.
- * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ...
- * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to.
- * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes.
- */
- const TRANSITION_OUT: any;
+ /**
+ * A reference to the global Scale Manager.
+ * This property will only be available if defined in the Scene Injection Map.
+ */
+ scale: Phaser.Scale.ScaleManager;
- /**
- * The Scene Transition Start Event.
- *
- * This event is dispatched by the Target Scene of a transition, only if that Scene was not asleep.
- *
- * It happens immediately after the `Scene.create` method is called. If the Scene does not have a `create` method,
- * this event is dispatched anyway.
- *
- * If the Target Scene was sleeping then the [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} event is
- * dispatched instead of this event.
- *
- * Listen to it from a Scene using `this.scene.events.on('transitionstart', listener)`.
- *
- * The Scene Transition event flow is as follows:
- *
- * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event.
- * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method.
- * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ...
- * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to.
- * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes.
- */
- const TRANSITION_START: any;
+ /**
+ * A reference to the Plugin Manager.
+ *
+ * The Plugin Manager is a global system that allows plugins to register themselves with it, and can then install
+ * those plugins into Scenes as required.
+ */
+ plugins: Phaser.Plugins.PluginManager;
- /**
- * The Scene Transition Wake Event.
- *
- * This event is dispatched by the Target Scene of a transition, only if that Scene was asleep before
- * the transition began. If the Scene was not asleep the [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} event is dispatched instead.
- *
- * Listen to it from a Scene using `this.scene.events.on('transitionwake', listener)`.
- *
- * The Scene Transition event flow is as follows:
- *
- * 1. [TRANSITION_OUT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_OUT} - the Scene that started the transition will emit this event.
- * 2. [TRANSITION_INIT]{@linkcode Phaser.Scenes.Events#event:TRANSITION_INIT} - the Target Scene will emit this event if it has an `init` method.
- * 3. [TRANSITION_START]{@linkcode Phaser.Scenes.Events#event:TRANSITION_START} - the Target Scene will emit this event after its `create` method is called, OR ...
- * 4. [TRANSITION_WAKE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_WAKE} - the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to.
- * 5. [TRANSITION_COMPLETE]{@linkcode Phaser.Scenes.Events#event:TRANSITION_COMPLETE} - the Target Scene will emit this event when the transition finishes.
- */
- const TRANSITION_WAKE: any;
-
- /**
- * The Scene Systems Update Event.
- *
- * This event is dispatched by a Scene during the main game loop step.
- *
- * The event flow for a single step of a Scene is as follows:
- *
- * 1. [PRE_UPDATE]{@linkcode Phaser.Scenes.Events#event:PRE_UPDATE}
- * 2. [UPDATE]{@linkcode Phaser.Scenes.Events#event:UPDATE}
- * 3. The `Scene.update` method is called, if it exists
- * 4. [POST_UPDATE]{@linkcode Phaser.Scenes.Events#event:POST_UPDATE}
- * 5. [RENDER]{@linkcode Phaser.Scenes.Events#event:RENDER}
- *
- * Listen to it from a Scene using `this.scene.events.on('update', listener)`.
- *
- * A Scene will only run its step if it is active.
- */
- const UPDATE: any;
-
- /**
- * The Scene Systems Wake Event.
- *
- * This event is dispatched by a Scene when it is woken from sleep, either directly via the `wake` method,
- * or as an action from another Scene.
- *
- * Listen to it from a Scene using `this.scene.events.on('wake', listener)`.
- */
- const WAKE: any;
-
- }
+ /**
+ * Should be overridden by your own Scenes.
+ * This method is called once per game step while the scene is running.
+ * @param time The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
+ * @param delta The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.
+ */
+ update(time: number, delta: number): void;
}
@@ -76307,8 +77766,9 @@ declare namespace Phaser {
addAudioSprite(key: string, config?: Phaser.Types.Sound.SoundConfig): Phaser.Sound.HTML5AudioSound | Phaser.Sound.WebAudioSound;
/**
- * Enables playing sound on the fly without the need to keep a reference to it.
- * Sound will auto destroy once its playback ends.
+ * Adds a new sound to the sound manager and plays it.
+ * The sound will be automatically removed (destroyed) once playback ends.
+ * This lets you play a new sound on the fly without the need to keep a reference to it.
* @param key Asset key for the sound.
* @param extra An optional additional object containing settings to be applied to the sound. It could be either config or marker object.
*/
@@ -76416,14 +77876,6 @@ declare namespace Phaser {
}
- /**
- * Creates a Web Audio, HTML5 Audio or No Audio Sound Manager based on config and device settings.
- *
- * Be aware of https://developers.google.com/web/updates/2017/09/autoplay-policy-changes
- * @param game Reference to the current game instance.
- */
- function SoundManagerCreator(game: Phaser.Game): void;
-
namespace Events {
/**
* The Sound Complete Event.
@@ -77021,6 +78473,14 @@ declare namespace Phaser {
}
+ /**
+ * Creates a Web Audio, HTML5 Audio or No Audio Sound Manager based on config and device settings.
+ *
+ * Be aware of https://developers.google.com/web/updates/2017/09/autoplay-policy-changes
+ * @param game Reference to the current game instance.
+ */
+ function SoundManagerCreator(game: Phaser.Game): void;
+
/**
* Web Audio API implementation of the sound.
*/
@@ -77251,6 +78711,31 @@ declare namespace Phaser {
}
namespace Structs {
+ namespace Events {
+ /**
+ * The Process Queue Add Event.
+ *
+ * This event is dispatched by a Process Queue when a new item is successfully moved to its active list.
+ *
+ * You will most commonly see this used by a Scene's Update List when a new Game Object has been added.
+ *
+ * In that instance, listen to this event from within a Scene using: `this.sys.updateList.on('add', listener)`.
+ */
+ const PROCESS_QUEUE_ADD: any;
+
+ /**
+ * The Process Queue Remove Event.
+ *
+ * This event is dispatched by a Process Queue when a new item is successfully removed from its active list.
+ *
+ * You will most commonly see this used by a Scene's Update List when a Game Object has been removed.
+ *
+ * In that instance, listen to this event from within a Scene using: `this.sys.updateList.on('remove', listener)`.
+ */
+ const PROCESS_QUEUE_REMOVE: any;
+
+ }
+
/**
* List is a generic implementation of an ordered list which contains utility methods for retrieving, manipulating, and iterating items.
*/
@@ -78141,31 +79626,6 @@ declare namespace Phaser {
}
- namespace Events {
- /**
- * The Process Queue Add Event.
- *
- * This event is dispatched by a Process Queue when a new item is successfully moved to its active list.
- *
- * You will most commonly see this used by a Scene's Update List when a new Game Object has been added.
- *
- * In that instance, listen to this event from within a Scene using: `this.sys.updateList.on('add', listener)`.
- */
- const PROCESS_QUEUE_ADD: any;
-
- /**
- * The Process Queue Remove Event.
- *
- * This event is dispatched by a Process Queue when a new item is successfully removed from its active list.
- *
- * You will most commonly see this used by a Scene's Update List when a Game Object has been removed.
- *
- * In that instance, listen to this event from within a Scene using: `this.sys.updateList.on('remove', listener)`.
- */
- const PROCESS_QUEUE_REMOVE: any;
-
- }
-
}
namespace Textures {
@@ -78385,6 +79845,75 @@ declare namespace Phaser {
}
+ /**
+ * Filter Types.
+ */
+ enum FilterMode {
+ /**
+ * Linear filter type.
+ */
+ LINEAR,
+ /**
+ * Nearest neighbor filter type.
+ */
+ NEAREST,
+ }
+
+ namespace Events {
+ /**
+ * The Texture Add Event.
+ *
+ * This event is dispatched by the Texture Manager when a texture is added to it.
+ *
+ * Listen to this event from within a Scene using: `this.textures.on('addtexture', listener)`.
+ */
+ const ADD: any;
+
+ /**
+ * The Texture Load Error Event.
+ *
+ * This event is dispatched by the Texture Manager when a texture it requested to load failed.
+ * This only happens when base64 encoded textures fail. All other texture types are loaded via the Loader Plugin.
+ *
+ * Listen to this event from within a Scene using: `this.textures.on('onerror', listener)`.
+ */
+ const ERROR: any;
+
+ /**
+ * The Texture Load Event.
+ *
+ * This event is dispatched by the Texture Manager when a texture has finished loading on it.
+ * This only happens for base64 encoded textures. All other texture types are loaded via the Loader Plugin.
+ *
+ * Listen to this event from within a Scene using: `this.textures.on('onload', listener)`.
+ *
+ * This event is dispatched after the [ADD]{@linkcode Phaser.Textures.Events#event:ADD} event.
+ */
+ const LOAD: any;
+
+ /**
+ * This internal event signifies that the Texture Manager is now ready and the Game can continue booting.
+ *
+ * When a Phaser Game instance is booting for the first time, the Texture Manager has to wait on a couple of non-blocking
+ * async events before it's fully ready to carry on. When those complete the Texture Manager emits this event via the Game
+ * instance, which tells the Game to carry on booting.
+ */
+ const READY: any;
+
+ /**
+ * The Texture Remove Event.
+ *
+ * This event is dispatched by the Texture Manager when a texture is removed from it.
+ *
+ * Listen to this event from within a Scene using: `this.textures.on('removetexture', listener)`.
+ *
+ * If you have any Game Objects still using the removed texture, they will start throwing
+ * errors the next time they try to render. Be sure to clear all use of the texture in this event handler.
+ */
+ const REMOVE: any;
+
+ }
+
/**
* A Frame is a section of a Texture.
*/
@@ -78643,6 +80172,19 @@ declare namespace Phaser {
}
+ /**
+ * Linear filter type.
+ */
+ const LINEAR: integer;
+
+ /**
+ * Nearest Neighbor filter type.
+ */
+ const NEAREST: integer;
+
+ namespace Parsers {
+ }
+
/**
* A Texture consists of a source, usually an Image from the Cache, and a collection of Frames.
* The Frames represent the different areas of the Texture. For example a texture atlas
@@ -79279,91 +80821,1290 @@ declare namespace Phaser {
}
- /**
- * Filter Types.
- */
- enum FilterMode {
- /**
- * Linear filter type.
- */
- LINEAR,
- /**
- * Nearest neighbor filter type.
- */
- NEAREST,
- }
-
- namespace Events {
- /**
- * The Texture Add Event.
- *
- * This event is dispatched by the Texture Manager when a texture is added to it.
- *
- * Listen to this event from within a Scene using: `this.textures.on('addtexture', listener)`.
- */
- const ADD: any;
-
- /**
- * The Texture Load Error Event.
- *
- * This event is dispatched by the Texture Manager when a texture it requested to load failed.
- * This only happens when base64 encoded textures fail. All other texture types are loaded via the Loader Plugin.
- *
- * Listen to this event from within a Scene using: `this.textures.on('onerror', listener)`.
- */
- const ERROR: any;
-
- /**
- * The Texture Load Event.
- *
- * This event is dispatched by the Texture Manager when a texture has finished loading on it.
- * This only happens for base64 encoded textures. All other texture types are loaded via the Loader Plugin.
- *
- * Listen to this event from within a Scene using: `this.textures.on('onload', listener)`.
- *
- * This event is dispatched after the [ADD]{@linkcode Phaser.Textures.Events#event:ADD} event.
- */
- const LOAD: any;
-
- /**
- * This internal event signifies that the Texture Manager is now ready and the Game can continue booting.
- *
- * When a Phaser Game instance is booting for the first time, the Texture Manager has to wait on a couple of non-blocking
- * async events before it's fully ready to carry on. When those complete the Texture Manager emits this event via the Game
- * instance, which tells the Game to carry on booting.
- */
- const READY: any;
-
- /**
- * The Texture Remove Event.
- *
- * This event is dispatched by the Texture Manager when a texture is removed from it.
- *
- * Listen to this event from within a Scene using: `this.textures.on('removetexture', listener)`.
- *
- * If you have any Game Objects still using the removed texture, they will start throwing
- * errors the next time they try to render. Be sure to clear all use of the texture in this event handler.
- */
- const REMOVE: any;
-
- }
-
- /**
- * Linear filter type.
- */
- const LINEAR: integer;
-
- /**
- * Nearest Neighbor filter type.
- */
- const NEAREST: integer;
-
- namespace Parsers {
- }
-
}
namespace Tilemaps {
+ namespace Components {
+ }
+
+ /**
+ * A Dynamic Tilemap Layer is a Game Object that renders LayerData from a Tilemap when used in combination
+ * with one, or more, Tilesets.
+ *
+ * A Dynamic Tilemap Layer trades some speed for being able to apply powerful effects. Unlike a
+ * Static Tilemap Layer, you can apply per-tile effects like tint or alpha, and you can change the
+ * tiles in a DynamicTilemapLayer.
+ *
+ * Use this over a Static Tilemap Layer when you need those features.
+ */
+ class DynamicTilemapLayer extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.Alpha, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.ComputedSize, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Flip, Phaser.GameObjects.Components.GetBounds, Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible {
+ /**
+ *
+ * @param scene The Scene to which this Game Object belongs.
+ * @param tilemap The Tilemap this layer is a part of.
+ * @param layerIndex The index of the LayerData associated with this layer.
+ * @param tileset The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object.
+ * @param x The world x position where the top left of this layer will be placed. Default 0.
+ * @param y The world y position where the top left of this layer will be placed. Default 0.
+ */
+ constructor(scene: Phaser.Scene, tilemap: Phaser.Tilemaps.Tilemap, layerIndex: integer, tileset: string | string[] | Phaser.Tilemaps.Tileset | Phaser.Tilemaps.Tileset[], x?: number, y?: number);
+
+ /**
+ * Used internally by physics system to perform fast type checks.
+ */
+ readonly isTilemap: boolean;
+
+ /**
+ * The Tilemap that this layer is a part of.
+ */
+ tilemap: Phaser.Tilemaps.Tilemap;
+
+ /**
+ * The index of the LayerData associated with this layer.
+ */
+ layerIndex: integer;
+
+ /**
+ * The LayerData associated with this layer. LayerData can only be associated with one
+ * tilemap layer.
+ */
+ layer: Phaser.Tilemaps.LayerData;
+
+ /**
+ * The Tileset/s associated with this layer.
+ *
+ * As of Phaser 3.14 this property is now an array of Tileset objects, previously it was a single reference.
+ */
+ tileset: Phaser.Tilemaps.Tileset[];
+
+ /**
+ * Used internally with the canvas render. This holds the tiles that are visible within the
+ * camera.
+ */
+ culledTiles: any[];
+
+ /**
+ * You can control if the Cameras should cull tiles before rendering them or not.
+ * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer.
+ *
+ * However, there are some instances when you may wish to disable this, and toggling this flag allows
+ * you to do so. Also see `setSkipCull` for a chainable method that does the same thing.
+ */
+ skipCull: boolean;
+
+ /**
+ * The total number of tiles drawn by the renderer in the last frame.
+ */
+ readonly tilesDrawn: integer;
+
+ /**
+ * The total number of tiles in this layer. Updated every frame.
+ */
+ readonly tilesTotal: integer;
+
+ /**
+ * The amount of extra tiles to add into the cull rectangle when calculating its horizontal size.
+ *
+ * See the method `setCullPadding` for more details.
+ */
+ cullPaddingX: integer;
+
+ /**
+ * The amount of extra tiles to add into the cull rectangle when calculating its vertical size.
+ *
+ * See the method `setCullPadding` for more details.
+ */
+ cullPaddingY: integer;
+
+ /**
+ * The callback that is invoked when the tiles are culled.
+ *
+ * By default it will call `TilemapComponents.CullTiles` but you can override this to call any function you like.
+ *
+ * It will be sent 3 arguments:
+ *
+ * 1. The Phaser.Tilemaps.LayerData object for this Layer
+ * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull.
+ * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered.
+ *
+ * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system.
+ */
+ cullCallback: Function;
+
+ /**
+ * An array holding the mapping between the tile indexes and the tileset they belong to.
+ */
+ gidMap: Phaser.Tilemaps.Tileset[];
+
+ /**
+ * Sets the rendering (draw) order of the tiles in this layer.
+ *
+ * The default is 'right-down', meaning it will order the tiles starting from the top-left,
+ * drawing to the right and then moving down to the next row.
+ *
+ * The draw orders are:
+ *
+ * 0 = right-down
+ * 1 = left-down
+ * 2 = right-up
+ * 3 = left-up
+ *
+ * Setting the render order does not change the tiles or how they are stored in the layer,
+ * it purely impacts the order in which they are rendered.
+ *
+ * You can provide either an integer (0 to 3), or the string version of the order.
+ * @param renderOrder The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'.
+ */
+ setRenderOrder(renderOrder: integer | string): this;
+
+ /**
+ * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting
+ * faces are used internally for optimizing collisions against tiles. This method is mostly used
+ * internally to optimize recalculating faces when only one tile has been changed.
+ * @param tileX The x coordinate.
+ * @param tileY The y coordinate.
+ */
+ calculateFacesAt(tileX: integer, tileY: integer): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the
+ * layer. Interesting faces are used internally for optimizing collisions against tiles. This method
+ * is mostly used internally.
+ * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ */
+ calculateFacesWithin(tileX?: integer, tileY?: integer, width?: integer, height?: integer): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Creates a Sprite for every object matching the given tile indexes in the layer. You can
+ * optionally specify if each tile will be replaced with a new tile after the Sprite has been
+ * created. This is useful if you want to lay down special tiles in a level that are converted to
+ * Sprites, but want to replace the tile itself with a floor tile or similar once converted.
+ * @param indexes The tile index, or array of indexes, to create Sprites from.
+ * @param replacements The tile index, or array of indexes, to change a converted
+ * tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a
+ * one-to-one mapping with the indexes array.
+ * @param spriteConfig The config object to pass into the Sprite creator (i.e.
+ * scene.make.sprite).
+ * @param scene The Scene to create the Sprites within. Default scene the map is within.
+ * @param camera The Camera to use when determining the world XY Default main camera.
+ */
+ createFromTiles(indexes: integer | any[], replacements: integer | any[], spriteConfig: Phaser.Types.GameObjects.Sprite.SpriteConfig, scene?: Phaser.Scene, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.GameObjects.Sprite[];
+
+ /**
+ * Returns the tiles in the given layer that are within the cameras viewport.
+ * This is used internally.
+ * @param camera The Camera to run the cull check against.
+ */
+ cull(camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile[];
+
+ /**
+ * Copies the tiles in the source rectangular area to a new destination (all specified in tile
+ * coordinates) within the layer. This copies all tile properties & recalculates collision
+ * information in the destination region.
+ * @param srcTileX The x coordinate of the area to copy from, in tiles, not pixels.
+ * @param srcTileY The y coordinate of the area to copy from, in tiles, not pixels.
+ * @param width The width of the area to copy, in tiles, not pixels.
+ * @param height The height of the area to copy, in tiles, not pixels.
+ * @param destTileX The x coordinate of the area to copy to, in tiles, not pixels.
+ * @param destTileY The y coordinate of the area to copy to, in tiles, not pixels.
+ * @param recalculateFaces `true` if the faces data should be recalculated. Default true.
+ */
+ copy(srcTileX: integer, srcTileY: integer, width: integer, height: integer, destTileX: integer, destTileY: integer, recalculateFaces?: boolean): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Destroys this DynamicTilemapLayer and removes its link to the associated LayerData.
+ * @param removeFromTilemap Remove this layer from the parent Tilemap? Default true.
+ */
+ destroy(removeFromTilemap?: boolean): void;
+
+ /**
+ * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the
+ * specified index. Tiles will be set to collide if the given index is a colliding index.
+ * Collision information in the region will be recalculated.
+ * @param index The tile index to fill the area with.
+ * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ * @param recalculateFaces `true` if the faces data should be recalculated. Default true.
+ */
+ fill(index: integer, tileX?: integer, tileY?: integer, width?: integer, height?: integer, recalculateFaces?: boolean): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given
+ * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns
+ * true) will returned as a new array. Similar to Array.prototype.Filter in vanilla JS.
+ * @param callback The callback. Each tile in the given area will be passed to this
+ * callback as the first and only parameter. The callback should return true for tiles that pass the
+ * filter.
+ * @param context The context under which the callback should be run.
+ * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
+ * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ * @param filteringOptions Optional filters to apply when getting the tiles.
+ */
+ filterTiles(callback: Function, context?: object, tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.Tile[];
+
+ /**
+ * Searches the entire map layer for the first tile matching the given index, then returns that Tile
+ * object. If no match is found, it returns null. The search starts from the top-left tile and
+ * continues horizontally until it hits the end of the row, then it drops down to the next column.
+ * If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to
+ * the top-left.
+ * @param index The tile index value to search for.
+ * @param skip The number of times to skip a matching tile before returning. Default 0.
+ * @param reverse If true it will scan the layer in reverse, starting at the
+ * bottom-right. Otherwise it scans from the top-left. Default false.
+ */
+ findByIndex(index: integer, skip?: integer, reverse?: boolean): Phaser.Tilemaps.Tile;
+
+ /**
+ * Find the first tile in the given rectangular area (in tile coordinates) of the layer that
+ * satisfies the provided testing function. I.e. finds the first tile for which `callback` returns
+ * true. Similar to Array.prototype.find in vanilla JS.
+ * @param callback The callback. Each tile in the given area will be passed to this callback as the first and only parameter.
+ * @param context The context under which the callback should be run.
+ * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area to search. Default 0.
+ * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area to search. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ * @param filteringOptions Optional filters to apply when getting the tiles.
+ */
+ findTile(callback: FindTileCallback, context?: object, tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.Tile;
+
+ /**
+ * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given
+ * callback. Similar to Array.prototype.forEach in vanilla JS.
+ * @param callback The callback. Each tile in the given area will be passed to this callback as the first and only parameter.
+ * @param context The context under which the callback should be run.
+ * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area to search. Default 0.
+ * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area to search. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ * @param filteringOptions Optional filters to apply when getting the tiles.
+ */
+ forEachTile(callback: EachTileCallback, context?: object, tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Gets a tile at the given tile coordinates from the given layer.
+ * @param tileX X position to get the tile from (given in tile units, not pixels).
+ * @param tileY Y position to get the tile from (given in tile units, not pixels).
+ * @param nonNull If true getTile won't return null for empty tiles, but a Tile object with an index of -1. Default false.
+ */
+ getTileAt(tileX: integer, tileY: integer, nonNull?: boolean): Phaser.Tilemaps.Tile;
+
+ /**
+ * Gets a tile at the given world coordinates from the given layer.
+ * @param worldX X position to get the tile from (given in pixels)
+ * @param worldY Y position to get the tile from (given in pixels)
+ * @param nonNull If true, function won't return null for empty tiles, but a Tile object with an index of -1. Default false.
+ * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
+ */
+ getTileAtWorldXY(worldX: number, worldY: number, nonNull?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile;
+
+ /**
+ * Gets the tiles in the given rectangular area (in tile coordinates) of the layer.
+ * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ * @param filteringOptions Optional filters to apply when getting the tiles.
+ */
+ getTilesWithin(tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.Tile[];
+
+ /**
+ * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle,
+ * Line, Rectangle or Triangle. The shape should be in world coordinates.
+ * @param shape A shape in world (pixel) coordinates
+ * @param filteringOptions Optional filters to apply when getting the tiles.
+ * @param camera The Camera to use when factoring in which tiles to return. Default main camera.
+ */
+ getTilesWithinShape(shape: Phaser.Geom.Circle | Phaser.Geom.Line | Phaser.Geom.Rectangle | Phaser.Geom.Triangle, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile[];
+
+ /**
+ * Gets the tiles in the given rectangular area (in world coordinates) of the layer.
+ * @param worldX The world x coordinate for the top-left of the area.
+ * @param worldY The world y coordinate for the top-left of the area.
+ * @param width The width of the area.
+ * @param height The height of the area.
+ * @param filteringOptions Optional filters to apply when getting the tiles.
+ * @param camera The Camera to use when factoring in which tiles to return. Default main camera.
+ */
+ getTilesWithinWorldXY(worldX: number, worldY: number, width: number, height: number, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile[];
+
+ /**
+ * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns
+ * false if there is no tile or if the tile at that location has an index of -1.
+ * @param tileX The x coordinate, in tiles, not pixels.
+ * @param tileY The y coordinate, in tiles, not pixels.
+ */
+ hasTileAt(tileX: integer, tileY: integer): boolean;
+
+ /**
+ * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns
+ * false if there is no tile or if the tile at that location has an index of -1.
+ * @param worldX The x coordinate, in pixels.
+ * @param worldY The y coordinate, in pixels.
+ * @param camera The Camera to use when factoring in which tiles to return. Default main camera.
+ */
+ hasTileAtWorldXY(worldX: number, worldY: number, camera?: Phaser.Cameras.Scene2D.Camera): boolean;
+
+ /**
+ * Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index
+ * or a Tile object. If you pass in a Tile, all attributes will be copied over to the specified
+ * location. If you pass in an index, only the index at the specified location will be changed.
+ * Collision information will be recalculated at the specified location.
+ * @param tile The index of this tile to set or a Tile object.
+ * @param tileX The x coordinate, in tiles, not pixels.
+ * @param tileY The y coordinate, in tiles, not pixels.
+ * @param recalculateFaces `true` if the faces data should be recalculated. Default true.
+ */
+ putTileAt(tile: integer | Phaser.Tilemaps.Tile, tileX: integer, tileY: integer, recalculateFaces?: boolean): Phaser.Tilemaps.Tile;
+
+ /**
+ * Puts a tile at the given world coordinates (pixels) in the specified layer. You can pass in either
+ * an index or a Tile object. If you pass in a Tile, all attributes will be copied over to the
+ * specified location. If you pass in an index, only the index at the specified location will be
+ * changed. Collision information will be recalculated at the specified location.
+ * @param tile The index of this tile to set or a Tile object.
+ * @param worldX The x coordinate, in pixels.
+ * @param worldY The y coordinate, in pixels.
+ * @param recalculateFaces `true` if the faces data should be recalculated. Default true.
+ * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
+ */
+ putTileAtWorldXY(tile: integer | Phaser.Tilemaps.Tile, worldX: number, worldY: number, recalculateFaces?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile;
+
+ /**
+ * Puts an array of tiles or a 2D array of tiles at the given tile coordinates in the specified
+ * layer. The array can be composed of either tile indexes or Tile objects. If you pass in a Tile,
+ * all attributes will be copied over to the specified location. If you pass in an index, only the
+ * index at the specified location will be changed. Collision information will be recalculated
+ * within the region tiles were changed.
+ * @param tile A row (array) or grid (2D array) of Tiles or tile indexes to place.
+ * @param tileX The x coordinate, in tiles, not pixels.
+ * @param tileY The y coordinate, in tiles, not pixels.
+ * @param recalculateFaces `true` if the faces data should be recalculated. Default true.
+ */
+ putTilesAt(tile: integer[] | integer[][] | Phaser.Tilemaps.Tile[] | Phaser.Tilemaps.Tile[][], tileX: integer, tileY: integer, recalculateFaces?: boolean): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the
+ * specified layer. Each tile will receive a new index. If an array of indexes is passed in, then
+ * those will be used for randomly assigning new tile indexes. If an array is not provided, the
+ * indexes found within the region (excluding -1) will be used for randomly assigning new tile
+ * indexes. This method only modifies tile indexes and does not change collision information.
+ * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ * @param indexes An array of indexes to randomly draw from during randomization.
+ */
+ randomize(tileX?: integer, tileY?: integer, width?: integer, height?: integer, indexes?: integer[]): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Removes the tile at the given tile coordinates in the specified layer and updates the layer's
+ * collision information.
+ * @param tileX The x coordinate, in tiles, not pixels.
+ * @param tileY The y coordinate, in tiles, not pixels.
+ * @param replaceWithNull If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. Default true.
+ * @param recalculateFaces `true` if the faces data should be recalculated. Default true.
+ */
+ removeTileAt(tileX: integer, tileY: integer, replaceWithNull?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.Tile;
+
+ /**
+ * Removes the tile at the given world coordinates in the specified layer and updates the layer's
+ * collision information.
+ * @param worldX The x coordinate, in pixels.
+ * @param worldY The y coordinate, in pixels.
+ * @param replaceWithNull If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. Default true.
+ * @param recalculateFaces `true` if the faces data should be recalculated. Default true.
+ * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
+ */
+ removeTileAtWorldXY(worldX: number, worldY: number, replaceWithNull?: boolean, recalculateFaces?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile;
+
+ /**
+ * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to
+ * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles
+ * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation
+ * wherever you want on the screen.
+ * @param graphics The target Graphics object to draw upon.
+ * @param styleConfig An object specifying the colors to use for the debug drawing.
+ */
+ renderDebug(graphics: Phaser.GameObjects.Graphics, styleConfig: Phaser.Types.Tilemaps.StyleConfig): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching
+ * `findIndex` and updates their index to match `newIndex`. This only modifies the index and does
+ * not change collision information.
+ * @param findIndex The index of the tile to search for.
+ * @param newIndex The index of the tile to replace it with.
+ * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ */
+ replaceByIndex(findIndex: integer, newIndex: integer, tileX?: integer, tileY?: integer, width?: integer, height?: integer): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * You can control if the Cameras should cull tiles before rendering them or not.
+ * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer.
+ *
+ * However, there are some instances when you may wish to disable this.
+ * @param value Set to `true` to stop culling tiles. Set to `false` to enable culling again. Default true.
+ */
+ setSkipCull(value?: boolean): this;
+
+ /**
+ * When a Camera culls the tiles in this layer it does so using its view into the world, building up a
+ * rectangle inside which the tiles must exist or they will be culled. Sometimes you may need to expand the size
+ * of this 'cull rectangle', especially if you plan on rotating the Camera viewing the layer. Do so
+ * by providing the padding values. The values given are in tiles, not pixels. So if the tile width was 32px
+ * and you set `paddingX` to be 4, it would add 32px x 4 to the cull rectangle (adjusted for scale)
+ * @param paddingX The amount of extra horizontal tiles to add to the cull check padding. Default 1.
+ * @param paddingY The amount of extra vertical tiles to add to the cull check padding. Default 1.
+ */
+ setCullPadding(paddingX?: integer, paddingY?: integer): this;
+
+ /**
+ * Sets collision on the given tile or tiles within a layer by index. You can pass in either a
+ * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if
+ * collision will be enabled (true) or disabled (false).
+ *
+ * If no layer specified, the map's current layer is used.
+ * @param indexes Either a single tile index, or an array of tile indexes.
+ * @param collides If true it will enable collision. If false it will clear collision. Default true.
+ * @param recalculateFaces Whether or not to recalculate the tile faces after the update. Default true.
+ * @param updateLayer If true, updates the current tiles on the layer. Set to
+ * false if no tiles have been placed for significant performance boost. Default true.
+ */
+ setCollision(indexes: integer | any[], collides?: boolean, recalculateFaces?: boolean, updateLayer?: boolean): Phaser.Tilemaps.Tilemap;
+
+ /**
+ * Sets collision on a range of tiles in a layer whose index is between the specified `start` and
+ * `stop` (inclusive). Calling this with a start value of 10 and a stop value of 14 would set
+ * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be
+ * enabled (true) or disabled (false).
+ * @param start The first index of the tile to be set for collision.
+ * @param stop The last index of the tile to be set for collision.
+ * @param collides If true it will enable collision. If false it will clear collision. Default true.
+ * @param recalculateFaces Whether or not to recalculate the tile faces after the update. Default true.
+ */
+ setCollisionBetween(start: integer, stop: integer, collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property
+ * that matches the given properties object, its collision flag will be set. The `collides`
+ * parameter controls if collision will be enabled (true) or disabled (false). Passing in
+ * `{ collides: true }` would update the collision flag on any tiles with a "collides" property that
+ * has a value of true. Any tile that doesn't have "collides" set to true will be ignored. You can
+ * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a
+ * "types" property that matches any of those values, its collision flag will be updated.
+ * @param properties An object with tile properties and corresponding values that should be checked.
+ * @param collides If true it will enable collision. If false it will clear collision. Default true.
+ * @param recalculateFaces Whether or not to recalculate the tile faces after the update. Default true.
+ */
+ setCollisionByProperty(properties: object, collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Sets collision on all tiles in the given layer, except for tiles that have an index specified in
+ * the given array. The `collides` parameter controls if collision will be enabled (true) or
+ * disabled (false).
+ * @param indexes An array of the tile indexes to not be counted for collision.
+ * @param collides If true it will enable collision. If false it will clear collision. Default true.
+ * @param recalculateFaces Whether or not to recalculate the tile faces after the update. Default true.
+ */
+ setCollisionByExclusion(indexes: integer[], collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Sets collision on the tiles within a layer by checking each tiles collision group data
+ * (typically defined in Tiled within the tileset collision editor). If any objects are found within
+ * a tiles collision group, the tile's colliding information will be set. The `collides` parameter
+ * controls if collision will be enabled (true) or disabled (false).
+ * @param collides If true it will enable collision. If false it will clear collision. Default true.
+ * @param recalculateFaces Whether or not to recalculate the tile faces after the update. Default true.
+ */
+ setCollisionFromCollisionGroup(collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Sets a global collision callback for the given tile index within the layer. This will affect all
+ * tiles on this layer that have the same index. If a callback is already set for the tile index it
+ * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile
+ * at a specific location on the map then see setTileLocationCallback.
+ * @param indexes Either a single tile index, or an array of tile indexes to have a collision callback set for.
+ * @param callback The callback that will be invoked when the tile is collided with.
+ * @param callbackContext The context under which the callback is called.
+ */
+ setTileIndexCallback(indexes: integer | integer[], callback: Function, callbackContext: object): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer.
+ * If a callback is already set for the tile index it will be replaced. Set the callback to null to
+ * remove it.
+ * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ * @param callback The callback that will be invoked when the tile is collided with.
+ * @param callbackContext The context under which the callback is called.
+ */
+ setTileLocationCallback(tileX?: integer, tileY?: integer, width?: integer, height?: integer, callback?: Function, callbackContext?: object): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Shuffles the tiles in a rectangular region (specified in tile coordinates) within the given
+ * layer. It will only randomize the tiles in that area, so if they're all the same nothing will
+ * appear to have changed! This method only modifies tile indexes and does not change collision
+ * information.
+ * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ */
+ shuffle(tileX?: integer, tileY?: integer, width?: integer, height?: integer): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching
+ * `indexA` and swaps then with `indexB`. This only modifies the index and does not change collision
+ * information.
+ * @param tileA First tile index.
+ * @param tileB Second tile index.
+ * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ */
+ swapByIndex(tileA: integer, tileB: integer, tileX?: integer, tileY?: integer, width?: integer, height?: integer): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the
+ * layers position, scale and scroll.
+ * @param tileX The x coordinate, in tiles, not pixels.
+ * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
+ */
+ tileToWorldX(tileX: integer, camera?: Phaser.Cameras.Scene2D.Camera): number;
+
+ /**
+ * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the
+ * layers position, scale and scroll.
+ * @param tileY The y coordinate, in tiles, not pixels.
+ * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
+ */
+ tileToWorldY(tileY: integer, camera?: Phaser.Cameras.Scene2D.Camera): number;
+
+ /**
+ * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the
+ * layers position, scale and scroll. This will return a new Vector2 object or update the given
+ * `point` object.
+ * @param tileX The x coordinate, in tiles, not pixels.
+ * @param tileY The y coordinate, in tiles, not pixels.
+ * @param point A Vector2 to store the coordinates in. If not given a new Vector2 is created.
+ * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
+ */
+ tileToWorldXY(tileX: integer, tileY: integer, point?: Phaser.Math.Vector2, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Math.Vector2;
+
+ /**
+ * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the
+ * specified layer. Each tile will receive a new index. New indexes are drawn from the given
+ * weightedIndexes array. An example weighted array:
+ *
+ * [
+ * { index: 6, weight: 4 }, // Probability of index 6 is 4 / 8
+ * { index: 7, weight: 2 }, // Probability of index 7 would be 2 / 8
+ * { index: 8, weight: 1.5 }, // Probability of index 8 would be 1.5 / 8
+ * { index: 26, weight: 0.5 } // Probability of index 27 would be 0.5 / 8
+ * ]
+ *
+ * The probability of any index being choose is (the index's weight) / (sum of all weights). This
+ * method only modifies tile indexes and does not change collision information.
+ * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ * @param weightedIndexes An array of objects to randomly draw from during
+ * randomization. They should be in the form: { index: 0, weight: 4 } or
+ * { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes.
+ */
+ weightedRandomize(tileX?: integer, tileY?: integer, width?: integer, height?: integer, weightedIndexes?: object[]): Phaser.Tilemaps.DynamicTilemapLayer;
+
+ /**
+ * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the
+ * layers position, scale and scroll.
+ * @param worldX The x coordinate to be converted, in pixels, not tiles.
+ * @param snapToFloor Whether or not to round the tile coordinate down to the nearest integer. Default true.
+ * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
+ */
+ worldToTileX(worldX: number, snapToFloor?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): number;
+
+ /**
+ * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the
+ * layers position, scale and scroll.
+ * @param worldY The y coordinate to be converted, in pixels, not tiles.
+ * @param snapToFloor Whether or not to round the tile coordinate down to the nearest integer. Default true.
+ * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
+ */
+ worldToTileY(worldY: number, snapToFloor?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): number;
+
+ /**
+ * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the
+ * layers position, scale and scroll. This will return a new Vector2 object or update the given
+ * `point` object.
+ * @param worldX The x coordinate to be converted, in pixels, not tiles.
+ * @param worldY The y coordinate to be converted, in pixels, not tiles.
+ * @param snapToFloor Whether or not to round the tile coordinate down to the nearest integer. Default true.
+ * @param point A Vector2 to store the coordinates in. If not given a new Vector2 is created.
+ * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
+ */
+ worldToTileXY(worldX: number, worldY: number, snapToFloor?: boolean, point?: Phaser.Math.Vector2, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Math.Vector2;
+
+ /**
+ * 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:
+ *
+ * * 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;
+
+ /**
+ * 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:
+ *
+ * * 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 or a CONST.
+ */
+ setBlendMode(value: string | Phaser.BlendModes): 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 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 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 depth starts from zero (the default value) and increases from that point. 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 depth starts from zero (the default value) and increases from that point. 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.
+ */
+ setDepth(value: integer): 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
+ * @param output An object to store the values in. If not provided a new Vector2 will be created.
+ */
+ getCenter(output?: O): 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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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 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;
+
+ /**
+ * 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.
+ */
+ defaultPipeline: Phaser.Renderer.WebGL.WebGLPipeline;
+
+ /**
+ * The current WebGL pipeline of this Game Object.
+ */
+ pipeline: Phaser.Renderer.WebGL.WebGLPipeline;
+
+ /**
+ * Sets the initial WebGL Pipeline of this Game Object.
+ * This should only be called during the instantiation of the Game Object.
+ * @param pipelineName The name of the pipeline to set on this Game Object. Defaults to the Texture Tint Pipeline. Default TextureTintPipeline.
+ */
+ initPipeline(pipelineName?: string): boolean;
+
+ /**
+ * Sets the active WebGL Pipeline of this Game Object.
+ * @param pipelineName The name of the pipeline to set on this Game Object.
+ */
+ setPipeline(pipelineName: string): this;
+
+ /**
+ * Resets the WebGL Pipeline of this Game Object back to the default it was created with.
+ */
+ resetPipeline(): boolean;
+
+ /**
+ * Gets the name of the WebGL Pipeline this Game Object is currently using.
+ */
+ getPipelineName(): string;
+
+ /**
+ * 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 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: integer;
+
+ /**
+ * The angle of this Game Object in radians.
+ *
+ * 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 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;
+
+ /**
+ * 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.
+ * @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;
+
+ /**
+ * 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 Formats {
/**
* CSV Map Type
@@ -79468,6 +82209,473 @@ declare namespace Phaser {
}
+ /**
+ * A class for representing data about about a layer in a map. Maps are parsed from CSV, Tiled,
+ * etc. into this format. Tilemap, StaticTilemapLayer and DynamicTilemapLayer have a reference
+ * to this data and use it to look up and perform operations on tiles.
+ */
+ class LayerData {
+ /**
+ *
+ * @param config [description]
+ */
+ constructor(config?: object);
+
+ /**
+ * The name of the layer, if specified in Tiled.
+ */
+ name: string;
+
+ /**
+ * The x offset of where to draw from the top left
+ */
+ x: number;
+
+ /**
+ * The y offset of where to draw from the top left
+ */
+ y: number;
+
+ /**
+ * The width in tile of the layer.
+ */
+ width: number;
+
+ /**
+ * The height in tiles of the layer.
+ */
+ height: number;
+
+ /**
+ * The pixel width of the tiles.
+ */
+ tileWidth: number;
+
+ /**
+ * The pixel height of the tiles.
+ */
+ tileHeight: number;
+
+ /**
+ * [description]
+ */
+ baseTileWidth: number;
+
+ /**
+ * [description]
+ */
+ baseTileHeight: number;
+
+ /**
+ * The width in pixels of the entire layer.
+ */
+ widthInPixels: number;
+
+ /**
+ * The height in pixels of the entire layer.
+ */
+ heightInPixels: number;
+
+ /**
+ * [description]
+ */
+ alpha: number;
+
+ /**
+ * [description]
+ */
+ visible: boolean;
+
+ /**
+ * Layer specific properties (can be specified in Tiled)
+ */
+ properties: object;
+
+ /**
+ * [description]
+ */
+ indexes: any[];
+
+ /**
+ * [description]
+ */
+ collideIndexes: any[];
+
+ /**
+ * [description]
+ */
+ callbacks: any[];
+
+ /**
+ * [description]
+ */
+ bodies: any[];
+
+ /**
+ * An array of the tile indexes
+ */
+ data: Phaser.Tilemaps.Tile[][];
+
+ /**
+ * [description]
+ */
+ tilemapLayer: Phaser.Tilemaps.DynamicTilemapLayer | Phaser.Tilemaps.StaticTilemapLayer;
+
+ }
+
+ /**
+ * A class for representing data about a map. Maps are parsed from CSV, Tiled, etc. into this
+ * format. A Tilemap object get a copy of this data and then unpacks the needed properties into
+ * itself.
+ */
+ class MapData {
+ /**
+ *
+ * @param config The Map configuration object.
+ */
+ constructor(config?: Phaser.Types.Tilemaps.MapDataConfig);
+
+ /**
+ * The key in the Phaser cache that corresponds to the loaded tilemap data.
+ */
+ name: string;
+
+ /**
+ * The width of the entire tilemap.
+ */
+ width: number;
+
+ /**
+ * The height of the entire tilemap.
+ */
+ height: number;
+
+ /**
+ * If the map is infinite or not.
+ */
+ infinite: boolean;
+
+ /**
+ * The width of the tiles.
+ */
+ tileWidth: number;
+
+ /**
+ * The height of the tiles.
+ */
+ tileHeight: number;
+
+ /**
+ * The width in pixels of the entire tilemap.
+ */
+ widthInPixels: number;
+
+ /**
+ * The height in pixels of the entire tilemap.
+ */
+ heightInPixels: number;
+
+ /**
+ * [description]
+ */
+ format: integer;
+
+ /**
+ * The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'.
+ */
+ orientation: string;
+
+ /**
+ * Determines the draw order of tilemap. Default is right-down
+ *
+ * 0, or 'right-down'
+ * 1, or 'left-down'
+ * 2, or 'right-up'
+ * 3, or 'left-up'
+ */
+ renderOrder: string;
+
+ /**
+ * The version of the map data (as specified in Tiled).
+ */
+ version: string;
+
+ /**
+ * Map specific properties (can be specified in Tiled)
+ */
+ properties: object;
+
+ /**
+ * An array with all the layers configured to the MapData.
+ */
+ layers: Phaser.Tilemaps.LayerData[] | Phaser.Tilemaps.ObjectLayer;
+
+ /**
+ * An array of Tiled Image Layers.
+ */
+ images: any[];
+
+ /**
+ * An object of Tiled Object Layers.
+ */
+ objects: object;
+
+ /**
+ * An object of collision data. Must be created as physics object or will return undefined.
+ */
+ collision: object;
+
+ /**
+ * An array of Tilesets.
+ */
+ tilesets: Phaser.Tilemaps.Tileset[];
+
+ /**
+ * The collection of images the map uses(specified in Tiled)
+ */
+ imageCollections: any[];
+
+ /**
+ * [description]
+ */
+ tiles: any[];
+
+ }
+
+ /**
+ * A class for representing a Tiled object layer in a map. This mirrors the structure of a Tiled
+ * object layer, except:
+ * - "x" & "y" properties are ignored since these cannot be changed in Tiled.
+ * - "offsetx" & "offsety" are applied to the individual object coordinates directly, so they
+ * are ignored as well.
+ * - "draworder" is ignored.
+ */
+ class ObjectLayer {
+ /**
+ *
+ * @param config The data for the layer from the Tiled JSON object.
+ */
+ constructor(config?: Phaser.Types.Tilemaps.ObjectLayerConfig);
+
+ /**
+ * The name of the Object Layer.
+ */
+ name: string;
+
+ /**
+ * The opacity of the layer, between 0 and 1.
+ */
+ opacity: number;
+
+ /**
+ * The custom properties defined on the Object Layer, keyed by their name.
+ */
+ properties: object;
+
+ /**
+ * The type of each custom property defined on the Object Layer, keyed by its name.
+ */
+ propertyTypes: object;
+
+ /**
+ * The type of the layer, which should be `objectgroup`.
+ */
+ type: string;
+
+ /**
+ * Whether the layer is shown (`true`) or hidden (`false`).
+ */
+ visible: boolean;
+
+ /**
+ * An array of all objects on this Object Layer.
+ *
+ * Each Tiled object corresponds to a JavaScript object in this array. It has an `id` (unique),
+ * `name` (as assigned in Tiled), `type` (as assigned in Tiled), `rotation` (in clockwise degrees),
+ * `properties` (if any), `visible` state (`true` if visible, `false` otherwise),
+ * `x` and `y` coordinates (in pixels, relative to the tilemap), and a `width` and `height` (in pixels).
+ *
+ * An object tile has a `gid` property (GID of the represented tile), a `flippedHorizontal` property,
+ * a `flippedVertical` property, and `flippedAntiDiagonal` property.
+ * The {@link http://docs.mapeditor.org/en/latest/reference/tmx-map-format/|Tiled documentation} contains
+ * information on flipping and rotation.
+ *
+ * Polylines have a `polyline` property, which is an array of objects corresponding to points,
+ * where each point has an `x` property and a `y` property. Polygons have an identically structured
+ * array in their `polygon` property. Text objects have a `text` property with the text's properties.
+ *
+ * Rectangles and ellipses have a `rectangle` or `ellipse` property set to `true`.
+ */
+ objects: Phaser.Types.Tilemaps.TiledObject[];
+
+ }
+
+ namespace Parsers {
+ namespace Impact {
+ /**
+ * [description]
+ * @param json [description]
+ * @param insertNull [description]
+ */
+ function ParseTileLayers(json: object, insertNull: boolean): any[];
+
+ /**
+ * [description]
+ * @param json [description]
+ */
+ function ParseTilesets(json: object): any[];
+
+ /**
+ * Parses a Weltmeister JSON object into a new MapData object.
+ * @param name The name of the tilemap, used to set the name on the MapData.
+ * @param json The Weltmeister JSON object.
+ * @param insertNull Controls how empty tiles, tiles with an index of -1, in the map
+ * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty
+ * location will get a Tile object with an index of -1. If you've a large sparsely populated map and
+ * the tile data doesn't need to change then setting this value to `true` will help with memory
+ * consumption. However if your map is small or you need to update the tiles dynamically, then leave
+ * the default value set.
+ */
+ function ParseWeltmeister(name: string, json: object, insertNull: boolean): object;
+
+ }
+
+ /**
+ * Parses raw data of a given Tilemap format into a new MapData object. If no recognized data format
+ * is found, returns `null`. When loading from CSV or a 2D array, you should specify the tileWidth &
+ * tileHeight. When parsing from a map from Tiled, the tileWidth & tileHeight will be pulled from
+ * the map data.
+ * @param name The name of the tilemap, used to set the name on the MapData.
+ * @param mapFormat See ../Formats.js.
+ * @param data 2D array, CSV string or Tiled JSON object.
+ * @param tileWidth The width of a tile in pixels. Required for 2D array and CSV, but
+ * ignored for Tiled JSON.
+ * @param tileHeight The height of a tile in pixels. Required for 2D array and CSV, but
+ * ignored for Tiled JSON.
+ * @param insertNull Controls how empty tiles, tiles with an index of -1, in the map
+ * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty
+ * location will get a Tile object with an index of -1. If you've a large sparsely populated map and
+ * the tile data doesn't need to change then setting this value to `true` will help with memory
+ * consumption. However if your map is small or you need to update the tiles dynamically, then leave
+ * the default value set.
+ */
+ function Parse(name: string, mapFormat: integer, data: integer[][] | string | object, tileWidth: integer, tileHeight: integer, insertNull: boolean): Phaser.Tilemaps.MapData;
+
+ /**
+ * Parses a 2D array of tile indexes into a new MapData object with a single layer.
+ * @param name The name of the tilemap, used to set the name on the MapData.
+ * @param data 2D array, CSV string or Tiled JSON object.
+ * @param tileWidth The width of a tile in pixels.
+ * @param tileHeight The height of a tile in pixels.
+ * @param insertNull Controls how empty tiles, tiles with an index of -1, in the map
+ * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty
+ * location will get a Tile object with an index of -1. If you've a large sparsely populated map and
+ * the tile data doesn't need to change then setting this value to `true` will help with memory
+ * consumption. However if your map is small or you need to update the tiles dynamically, then leave
+ * the default value set.
+ */
+ function Parse2DArray(name: string, data: integer[][], tileWidth: integer, tileHeight: integer, insertNull: boolean): Phaser.Tilemaps.MapData;
+
+ /**
+ * Parses a CSV string of tile indexes into a new MapData object with a single layer.
+ * @param name The name of the tilemap, used to set the name on the MapData.
+ * @param data CSV string of tile indexes.
+ * @param tileWidth The width of a tile in pixels.
+ * @param tileHeight The height of a tile in pixels.
+ * @param insertNull Controls how empty tiles, tiles with an index of -1, in the map
+ * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty
+ * location will get a Tile object with an index of -1. If you've a large sparsely populated map and
+ * the tile data doesn't need to change then setting this value to `true` will help with memory
+ * consumption. However if your map is small or you need to update the tiles dynamically, then leave
+ * the default value set.
+ */
+ function ParseCSV(name: string, data: string, tileWidth: integer, tileHeight: integer, insertNull: boolean): Phaser.Tilemaps.MapData;
+
+ namespace Tiled {
+ /**
+ * Copy properties from tileset to tiles.
+ * @param mapData [description]
+ */
+ function AssignTileProperties(mapData: Phaser.Tilemaps.MapData): void;
+
+ /**
+ * Decode base-64 encoded data, for example as exported by Tiled.
+ * @param data Base-64 encoded data to decode.
+ */
+ function Base64Decode(data: object): any[];
+
+ /**
+ * Master list of tiles -> x, y, index in tileset.
+ * @param mapData [description]
+ */
+ function BuildTilesetIndex(mapData: Phaser.Tilemaps.MapData): any[];
+
+ /**
+ * Parse a Tiled group layer and create a state object for inheriting.
+ * @param json The Tiled JSON object.
+ * @param currentl The current group layer from the Tiled JSON file.
+ * @param parentstate The state of the parent group (if any).
+ */
+ function CreateGroupLayer(json: object, currentl?: object, parentstate?: object): object;
+
+ /**
+ * See Tiled documentation on tile flipping:
+ * http://docs.mapeditor.org/en/latest/reference/tmx-map-format/
+ * @param gid [description]
+ */
+ function ParseGID(gid: number): object;
+
+ /**
+ * Parses a Tiled JSON object into an array of objects with details about the image layers.
+ * @param json The Tiled JSON object.
+ */
+ function ParseImageLayers(json: object): any[];
+
+ /**
+ * Parses a Tiled JSON object into a new MapData object.
+ * @param name The name of the tilemap, used to set the name on the MapData.
+ * @param json The Tiled JSON object.
+ * @param insertNull Controls how empty tiles, tiles with an index of -1, in the map
+ * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty
+ * location will get a Tile object with an index of -1. If you've a large sparsely populated map and
+ * the tile data doesn't need to change then setting this value to `true` will help with memory
+ * consumption. However if your map is small or you need to update the tiles dynamically, then leave
+ * the default value set.
+ */
+ function ParseJSONTiled(name: string, json: object, insertNull: boolean): Phaser.Tilemaps.MapData;
+
+ /**
+ * Convert a Tiled object to an internal parsed object normalising and copying properties over, while applying optional x and y offsets. The parsed object will always have the properties `id`, `name`, `type`, `rotation`, `properties`, `visible`, `x`, `y`, `width` and `height`. Other properties will be added according to the object type (such as text, polyline, gid etc.)
+ * @param tiledObject Tiled object to convert to an internal parsed object normalising and copying properties over.
+ * @param offsetX Optional additional offset to apply to the object's x property. Defaults to 0. Default 0.
+ * @param offsetY Optional additional offset to apply to the object's y property. Defaults to 0. Default 0.
+ */
+ function ParseObject(tiledObject: object, offsetX?: number, offsetY?: number): object;
+
+ /**
+ * Parses a Tiled JSON object into an array of ObjectLayer objects.
+ * @param json The Tiled JSON object.
+ */
+ function ParseObjectLayers(json: object): any[];
+
+ /**
+ * Parses all tilemap layers in a Tiled JSON object into new LayerData objects.
+ * @param json The Tiled JSON object.
+ * @param insertNull Controls how empty tiles, tiles with an index of -1, in the map
+ * data are handled (see {@link Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled}).
+ */
+ function ParseTileLayers(json: object, insertNull: boolean): Phaser.Tilemaps.LayerData[];
+
+ /**
+ * Tilesets and Image Collections
+ * @param json [description]
+ */
+ function ParseTilesets(json: object): object;
+
+ }
+
+ }
+
/**
* Create a Tilemap from the given key or data. If neither is given, make a blank Tilemap. When
* loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing from
@@ -79490,6 +82698,1163 @@ declare namespace Phaser {
*/
function ParseToTilemap(scene: Phaser.Scene, key?: string, tileWidth?: integer, tileHeight?: integer, width?: integer, height?: integer, data?: integer[][], insertNull?: boolean): Phaser.Tilemaps.Tilemap;
+ /**
+ * A Static Tilemap Layer is a Game Object that renders LayerData from a Tilemap when used in combination
+ * with one, or more, Tilesets.
+ *
+ * A Static Tilemap Layer is optimized for rendering speed over flexibility. You cannot apply per-tile
+ * effects like tint or alpha, or change the tiles or tilesets the layer uses.
+ *
+ * Use a Static Tilemap Layer instead of a Dynamic Tilemap Layer when you don't need tile manipulation features.
+ */
+ class StaticTilemapLayer extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.Alpha, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.ComputedSize, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Flip, Phaser.GameObjects.Components.GetBounds, Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible, Phaser.GameObjects.Components.ScrollFactor {
+ /**
+ *
+ * @param scene The Scene to which this Game Object belongs.
+ * @param tilemap The Tilemap this layer is a part of.
+ * @param layerIndex The index of the LayerData associated with this layer.
+ * @param tileset The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object.
+ * @param x The world x position where the top left of this layer will be placed. Default 0.
+ * @param y The world y position where the top left of this layer will be placed. Default 0.
+ */
+ constructor(scene: Phaser.Scene, tilemap: Phaser.Tilemaps.Tilemap, layerIndex: integer, tileset: string | string[] | Phaser.Tilemaps.Tileset | Phaser.Tilemaps.Tileset[], x?: number, y?: number);
+
+ /**
+ * Used internally by physics system to perform fast type checks.
+ */
+ readonly isTilemap: boolean;
+
+ /**
+ * The Tilemap that this layer is a part of.
+ */
+ tilemap: Phaser.Tilemaps.Tilemap;
+
+ /**
+ * The index of the LayerData associated with this layer.
+ */
+ layerIndex: integer;
+
+ /**
+ * The LayerData associated with this layer. LayerData can only be associated with one
+ * tilemap layer.
+ */
+ layer: Phaser.Tilemaps.LayerData;
+
+ /**
+ * The Tileset/s associated with this layer.
+ *
+ * As of Phaser 3.14 this property is now an array of Tileset objects, previously it was a single reference.
+ */
+ tileset: Phaser.Tilemaps.Tileset[];
+
+ /**
+ * Used internally by the Canvas renderer.
+ * This holds the tiles that are visible within the camera in the last frame.
+ */
+ culledTiles: any[];
+
+ /**
+ * Canvas only.
+ *
+ * You can control if the Cameras should cull tiles before rendering them or not.
+ * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer.
+ *
+ * However, there are some instances when you may wish to disable this, and toggling this flag allows
+ * you to do so. Also see `setSkipCull` for a chainable method that does the same thing.
+ */
+ skipCull: boolean;
+
+ /**
+ * Canvas only.
+ *
+ * The total number of tiles drawn by the renderer in the last frame.
+ *
+ * This only works when rending with Canvas.
+ */
+ readonly tilesDrawn: integer;
+
+ /**
+ * Canvas only.
+ *
+ * The total number of tiles in this layer. Updated every frame.
+ */
+ readonly tilesTotal: integer;
+
+ /**
+ * Canvas only.
+ *
+ * The amount of extra tiles to add into the cull rectangle when calculating its horizontal size.
+ *
+ * See the method `setCullPadding` for more details.
+ */
+ cullPaddingX: integer;
+
+ /**
+ * Canvas only.
+ *
+ * The amount of extra tiles to add into the cull rectangle when calculating its vertical size.
+ *
+ * See the method `setCullPadding` for more details.
+ */
+ cullPaddingY: integer;
+
+ /**
+ * Canvas only.
+ *
+ * The callback that is invoked when the tiles are culled.
+ *
+ * By default it will call `TilemapComponents.CullTiles` but you can override this to call any function you like.
+ *
+ * It will be sent 3 arguments:
+ *
+ * 1. The Phaser.Tilemaps.LayerData object for this Layer
+ * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull.
+ * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered.
+ *
+ * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system.
+ */
+ cullCallback: Function;
+
+ /**
+ * An array holding the mapping between the tile indexes and the tileset they belong to.
+ */
+ gidMap: Phaser.Tilemaps.Tileset[];
+
+ /**
+ * Upload the tile data to a VBO.
+ * @param camera The camera to render to.
+ * @param tilesetIndex The tileset index.
+ */
+ upload(camera: Phaser.Cameras.Scene2D.Camera, tilesetIndex: integer): Phaser.Tilemaps.StaticTilemapLayer;
+
+ /**
+ * Sets the rendering (draw) order of the tiles in this layer.
+ *
+ * The default is 'right-down', meaning it will order the tiles starting from the top-left,
+ * drawing to the right and then moving down to the next row.
+ *
+ * The draw orders are:
+ *
+ * 0 = right-down
+ * 1 = left-down
+ * 2 = right-up
+ * 3 = left-up
+ *
+ * Setting the render order does not change the tiles or how they are stored in the layer,
+ * it purely impacts the order in which they are rendered.
+ *
+ * You can provide either an integer (0 to 3), or the string version of the order.
+ * @param renderOrder The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'.
+ */
+ setRenderOrder(renderOrder: integer | string): this;
+
+ /**
+ * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting
+ * faces are used internally for optimizing collisions against tiles. This method is mostly used
+ * internally to optimize recalculating faces when only one tile has been changed.
+ * @param tileX The x coordinate.
+ * @param tileY The y coordinate.
+ */
+ calculateFacesAt(tileX: integer, tileY: integer): Phaser.Tilemaps.StaticTilemapLayer;
+
+ /**
+ * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the
+ * layer. Interesting faces are used internally for optimizing collisions against tiles. This method
+ * is mostly used internally.
+ * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ */
+ calculateFacesWithin(tileX?: integer, tileY?: integer, width?: integer, height?: integer): Phaser.Tilemaps.StaticTilemapLayer;
+
+ /**
+ * Creates a Sprite for every object matching the given tile indexes in the layer. You can
+ * optionally specify if each tile will be replaced with a new tile after the Sprite has been
+ * created. This is useful if you want to lay down special tiles in a level that are converted to
+ * Sprites, but want to replace the tile itself with a floor tile or similar once converted.
+ * @param indexes The tile index, or array of indexes, to create Sprites from.
+ * @param replacements The tile index, or array of indexes, to change a converted
+ * tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a
+ * one-to-one mapping with the indexes array.
+ * @param spriteConfig The config object to pass into the Sprite creator (i.e.
+ * scene.make.sprite).
+ * @param scene The Scene to create the Sprites within. Default scene the map is within.
+ * @param camera The Camera to use when determining the world XY Default main camera.
+ */
+ createFromTiles(indexes: integer | any[], replacements: integer | any[], spriteConfig: Phaser.Types.GameObjects.Sprite.SpriteConfig, scene?: Phaser.Scene, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.GameObjects.Sprite[];
+
+ /**
+ * Returns the tiles in the given layer that are within the cameras viewport.
+ * This is used internally.
+ * @param camera The Camera to run the cull check against.
+ */
+ cull(camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile[];
+
+ /**
+ * Canvas only.
+ *
+ * You can control if the Cameras should cull tiles before rendering them or not.
+ * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer.
+ *
+ * However, there are some instances when you may wish to disable this.
+ * @param value Set to `true` to stop culling tiles. Set to `false` to enable culling again. Default true.
+ */
+ setSkipCull(value?: boolean): this;
+
+ /**
+ * Canvas only.
+ *
+ * When a Camera culls the tiles in this layer it does so using its view into the world, building up a
+ * rectangle inside which the tiles must exist or they will be culled. Sometimes you may need to expand the size
+ * of this 'cull rectangle', especially if you plan on rotating the Camera viewing the layer. Do so
+ * by providing the padding values. The values given are in tiles, not pixels. So if the tile width was 32px
+ * and you set `paddingX` to be 4, it would add 32px x 4 to the cull rectangle (adjusted for scale)
+ * @param paddingX The amount of extra horizontal tiles to add to the cull check padding. Default 1.
+ * @param paddingY The amount of extra vertical tiles to add to the cull check padding. Default 1.
+ */
+ setCullPadding(paddingX?: integer, paddingY?: integer): this;
+
+ /**
+ * Searches the entire map layer for the first tile matching the given index, then returns that Tile
+ * object. If no match is found, it returns null. The search starts from the top-left tile and
+ * continues horizontally until it hits the end of the row, then it drops down to the next column.
+ * If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to
+ * the top-left.
+ * @param index The tile index value to search for.
+ * @param skip The number of times to skip a matching tile before returning. Default 0.
+ * @param reverse If true it will scan the layer in reverse, starting at the
+ * bottom-right. Otherwise it scans from the top-left. Default false.
+ */
+ findByIndex(index: integer, skip?: integer, reverse?: boolean): Phaser.Tilemaps.Tile;
+
+ /**
+ * Find the first tile in the given rectangular area (in tile coordinates) of the layer that
+ * satisfies the provided testing function. I.e. finds the first tile for which `callback` returns
+ * true. Similar to Array.prototype.find in vanilla JS.
+ * @param callback The callback. Each tile in the given area will be passed to this
+ * callback as the first and only parameter.
+ * @param context The context under which the callback should be run.
+ * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
+ * @param tileY The topmost tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ * @param filteringOptions Optional filters to apply when getting the tiles.
+ */
+ findTile(callback: Function, context?: object, tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.Tile;
+
+ /**
+ * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given
+ * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns
+ * true) will returned as a new array. Similar to Array.prototype.Filter in vanilla JS.
+ * @param callback The callback. Each tile in the given area will be passed to this
+ * callback as the first and only parameter. The callback should return true for tiles that pass the
+ * filter.
+ * @param context The context under which the callback should be run.
+ * @param tileX The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
+ * @param tileY The topmost tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ * @param filteringOptions Optional filters to apply when getting the tiles.
+ */
+ filterTiles(callback: Function, context?: object, tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.Tile[];
+
+ /**
+ * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given
+ * callback. Similar to Array.prototype.forEach in vanilla JS.
+ * @param callback The callback. Each tile in the given area will be passed to this
+ * callback as the first and only parameter.
+ * @param context The context under which the callback should be run.
+ * @param tileX The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
+ * @param tileY The topmost tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ * @param filteringOptions Optional filters to apply when getting the tiles.
+ */
+ forEachTile(callback: Function, context?: object, tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.StaticTilemapLayer;
+
+ /**
+ * Gets a tile at the given tile coordinates from the given layer.
+ * @param tileX X position to get the tile from (given in tile units, not pixels).
+ * @param tileY Y position to get the tile from (given in tile units, not pixels).
+ * @param nonNull If true getTile won't return null for empty tiles, but a Tile
+ * object with an index of -1. Default false.
+ */
+ getTileAt(tileX: integer, tileY: integer, nonNull?: boolean): Phaser.Tilemaps.Tile;
+
+ /**
+ * Gets a tile at the given world coordinates from the given layer.
+ * @param worldX X position to get the tile from (given in pixels)
+ * @param worldY Y position to get the tile from (given in pixels)
+ * @param nonNull If true, function won't return null for empty tiles, but a Tile
+ * object with an index of -1. Default false.
+ * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
+ */
+ getTileAtWorldXY(worldX: number, worldY: number, nonNull?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile;
+
+ /**
+ * Gets the tiles in the given rectangular area (in tile coordinates) of the layer.
+ * @param tileX The leftmost tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param tileY The topmost tile index (in tile coordinates) to use as the origin of the area. Default 0.
+ * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
+ * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
+ * @param filteringOptions Optional filters to apply when getting the tiles.
+ */
+ getTilesWithin(tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.Tile[];
+
+ /**
+ * Gets the tiles in the given rectangular area (in world coordinates) of the layer.
+ * @param worldX The leftmost tile index (in tile coordinates) to use as the origin of the area to filter.
+ * @param worldY The topmost tile index (in tile coordinates) to use as the origin of the area to filter.
+ * @param width How many tiles wide from the `tileX` index the area will be.
+ * @param height How many tiles high from the `tileY` index the area will be.
+ * @param filteringOptions Optional filters to apply when getting the tiles.
+ * @param camera The Camera to use when factoring in which tiles to return. Default main camera.
+ */
+ getTilesWithinWorldXY(worldX: number, worldY: number, width: number, height: number, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile[];
+
+ /**
+ * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle,
+ * Line, Rectangle or Triangle. The shape should be in world coordinates.
+ * @param shape A shape in world (pixel) coordinates
+ * @param filteringOptions Optional filters to apply when getting the tiles.
+ * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
+ */
+ getTilesWithinShape(shape: Phaser.Geom.Circle | Phaser.Geom.Line | Phaser.Geom.Rectangle | Phaser.Geom.Triangle, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile[];
+
+ /**
+ * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns
+ * false if there is no tile or if the tile at that location has an index of -1.
+ * @param tileX X position to get the tile from in tile coordinates.
+ * @param tileY Y position to get the tile from in tile coordinates.
+ */
+ hasTileAt(tileX: integer, tileY: integer): boolean;
+
+ /**
+ * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns
+ * false if there is no tile or if the tile at that location has an index of -1.
+ * @param worldX The X coordinate of the world position.
+ * @param worldY The Y coordinate of the world position.
+ * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
+ */
+ hasTileAtWorldXY(worldX: number, worldY: number, camera?: Phaser.Cameras.Scene2D.Camera): boolean;
+
+ /**
+ * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to
+ * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles
+ * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation
+ * wherever you want on the screen.
+ * @param graphics The target Graphics object to draw upon.
+ * @param styleConfig An object specifying the colors to use for the debug drawing.
+ */
+ renderDebug(graphics: Phaser.GameObjects.Graphics, styleConfig: Phaser.Types.Tilemaps.StyleConfig): Phaser.Tilemaps.StaticTilemapLayer;
+
+ /**
+ * Sets collision on the given tile or tiles within a layer by index. You can pass in either a
+ * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if
+ * collision will be enabled (true) or disabled (false).
+ * @param indexes Either a single tile index, or an array of tile indexes.
+ * @param collides If true it will enable collision. If false it will clear
+ * collision. Default true.
+ * @param recalculateFaces Whether or not to recalculate the tile faces after the
+ * update. Default true.
+ * @param updateLayer If true, updates the current tiles on the layer. Set to
+ * false if no tiles have been placed for significant performance boost. Default true.
+ */
+ setCollision(indexes: integer | any[], collides?: boolean, recalculateFaces?: boolean, updateLayer?: boolean): Phaser.Tilemaps.StaticTilemapLayer;
+
+ /**
+ * Sets collision on a range of tiles in a layer whose index is between the specified `start` and
+ * `stop` (inclusive). Calling this with a start value of 10 and a stop value of 14 would set
+ * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be
+ * enabled (true) or disabled (false).
+ * @param start The first index of the tile to be set for collision.
+ * @param stop The last index of the tile to be set for collision.
+ * @param collides If true it will enable collision. If false it will clear
+ * collision. Default true.
+ * @param recalculateFaces Whether or not to recalculate the tile faces after the
+ * update. Default true.
+ */
+ setCollisionBetween(start: integer, stop: integer, collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.StaticTilemapLayer;
+
+ /**
+ * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property
+ * that matches the given properties object, its collision flag will be set. The `collides`
+ * parameter controls if collision will be enabled (true) or disabled (false). Passing in
+ * `{ collides: true }` would update the collision flag on any tiles with a "collides" property that
+ * has a value of true. Any tile that doesn't have "collides" set to true will be ignored. You can
+ * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a
+ * "types" property that matches any of those values, its collision flag will be updated.
+ * @param properties An object with tile properties and corresponding values that should
+ * be checked.
+ * @param collides If true it will enable collision. If false it will clear
+ * collision. Default true.
+ * @param recalculateFaces Whether or not to recalculate the tile faces after the
+ * update. Default true.
+ */
+ setCollisionByProperty(properties: object, collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.StaticTilemapLayer;
+
+ /**
+ * Sets collision on all tiles in the given layer, except for tiles that have an index specified in
+ * the given array. The `collides` parameter controls if collision will be enabled (true) or
+ * disabled (false).
+ * @param indexes An array of the tile indexes to not be counted for collision.
+ * @param collides If true it will enable collision. If false it will clear
+ * collision. Default true.
+ * @param recalculateFaces Whether or not to recalculate the tile faces after the
+ * update. Default true.
+ */
+ setCollisionByExclusion(indexes: integer[], collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.StaticTilemapLayer;
+
+ /**
+ * Sets a global collision callback for the given tile index within the layer. This will affect all
+ * tiles on this layer that have the same index. If a callback is already set for the tile index it
+ * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile
+ * at a specific location on the map then see setTileLocationCallback.
+ * @param indexes Either a single tile index, or an array of tile indexes to have a
+ * collision callback set for.
+ * @param callback The callback that will be invoked when the tile is collided with.
+ * @param callbackContext The context under which the callback is called.
+ */
+ setTileIndexCallback(indexes: integer | any[], callback: Function, callbackContext: object): Phaser.Tilemaps.StaticTilemapLayer;
+
+ /**
+ * Sets collision on the tiles within a layer by checking each tiles collision group data
+ * (typically defined in Tiled within the tileset collision editor). If any objects are found within
+ * a tiles collision group, the tile's colliding information will be set. The `collides` parameter
+ * controls if collision will be enabled (true) or disabled (false).
+ * @param collides If true it will enable collision. If false it will clear
+ * collision. Default true.
+ * @param recalculateFaces Whether or not to recalculate the tile faces after the
+ * update. Default true.
+ */
+ setCollisionFromCollisionGroup(collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.StaticTilemapLayer;
+
+ /**
+ * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer.
+ * If a callback is already set for the tile index it will be replaced. Set the callback to null to
+ * remove it.
+ * @param tileX The leftmost tile index (in tile coordinates) to use as the origin of the area.
+ * @param tileY The topmost tile index (in tile coordinates) to use as the origin of the area.
+ * @param width How many tiles wide from the `tileX` index the area will be.
+ * @param height How many tiles tall from the `tileY` index the area will be.
+ * @param callback The callback that will be invoked when the tile is collided with.
+ * @param callbackContext The context under which the callback is called.
+ */
+ setTileLocationCallback(tileX: integer, tileY: integer, width: integer, height: integer, callback: Function, callbackContext?: object): Phaser.Tilemaps.StaticTilemapLayer;
+
+ /**
+ * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the
+ * layers position, scale and scroll.
+ * @param tileX The X coordinate, in tile coordinates.
+ * @param camera The Camera to use when calculating the world values from the tile index. Default main camera.
+ */
+ tileToWorldX(tileX: integer, camera?: Phaser.Cameras.Scene2D.Camera): number;
+
+ /**
+ * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the
+ * layers position, scale and scroll.
+ * @param tileY The Y coordinate, in tile coordinates.
+ * @param camera The Camera to use when calculating the world values from the tile index. Default main camera.
+ */
+ tileToWorldY(tileY: integer, camera?: Phaser.Cameras.Scene2D.Camera): number;
+
+ /**
+ * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the
+ * layers position, scale and scroll. This will return a new Vector2 object or update the given
+ * `point` object.
+ * @param tileX The X coordinate, in tile coordinates.
+ * @param tileY The Y coordinate, in tile coordinates.
+ * @param point A Vector2 to store the coordinates in. If not given, a new Vector2 is created.
+ * @param camera The Camera to use when calculating the world values from the tile index. Default main camera.
+ */
+ tileToWorldXY(tileX: integer, tileY: integer, point?: Phaser.Math.Vector2, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Math.Vector2;
+
+ /**
+ * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the
+ * layers position, scale and scroll.
+ * @param worldX The X coordinate, in world pixels.
+ * @param snapToFloor Whether or not to round the tile coordinate down to the
+ * nearest integer. Default true.
+ * @param camera The Camera to use when calculating the tile index from the world values.] Default main camera.
+ */
+ worldToTileX(worldX: number, snapToFloor?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): number;
+
+ /**
+ * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the
+ * layers position, scale and scroll.
+ * @param worldY The Y coordinate, in world pixels.
+ * @param snapToFloor Whether or not to round the tile coordinate down to the
+ * nearest integer. Default true.
+ * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
+ */
+ worldToTileY(worldY: number, snapToFloor?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): number;
+
+ /**
+ * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the
+ * layers position, scale and scroll. This will return a new Vector2 object or update the given
+ * `point` object.
+ * @param worldX The X coordinate, in world pixels.
+ * @param worldY The Y coordinate, in world pixels.
+ * @param snapToFloor Whether or not to round the tile coordinate down to the
+ * nearest integer. Default true.
+ * @param point A Vector2 to store the coordinates in. If not given, a new Vector2 is created.
+ * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
+ */
+ worldToTileXY(worldX: number, worldY: number, snapToFloor?: boolean, point?: Phaser.Math.Vector2, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Math.Vector2;
+
+ /**
+ * Destroys this StaticTilemapLayer and removes its link to the associated LayerData.
+ * @param removeFromTilemap Remove this layer from the parent Tilemap? Default true.
+ */
+ destroy(removeFromTilemap?: 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.
+ *
+ * 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:
+ *
+ * * 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;
+
+ /**
+ * 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:
+ *
+ * * 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 or a CONST.
+ */
+ setBlendMode(value: string | Phaser.BlendModes): 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 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 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 depth starts from zero (the default value) and increases from that point. 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 depth starts from zero (the default value) and increases from that point. 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.
+ */
+ setDepth(value: integer): 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
+ * @param output An object to store the values in. If not provided a new Vector2 will be created.
+ */
+ getCenter(output?: O): 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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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
+ * @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 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;
+
+ /**
+ * 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.
+ */
+ defaultPipeline: Phaser.Renderer.WebGL.WebGLPipeline;
+
+ /**
+ * The current WebGL pipeline of this Game Object.
+ */
+ pipeline: Phaser.Renderer.WebGL.WebGLPipeline;
+
+ /**
+ * Sets the initial WebGL Pipeline of this Game Object.
+ * This should only be called during the instantiation of the Game Object.
+ * @param pipelineName The name of the pipeline to set on this Game Object. Defaults to the Texture Tint Pipeline. Default TextureTintPipeline.
+ */
+ initPipeline(pipelineName?: string): boolean;
+
+ /**
+ * Sets the active WebGL Pipeline of this Game Object.
+ * @param pipelineName The name of the pipeline to set on this Game Object.
+ */
+ setPipeline(pipelineName: string): this;
+
+ /**
+ * Resets the WebGL Pipeline of this Game Object back to the default it was created with.
+ */
+ resetPipeline(): boolean;
+
+ /**
+ * Gets the name of the WebGL Pipeline this Game Object is currently using.
+ */
+ getPipelineName(): string;
+
+ /**
+ * 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: integer;
+
+ /**
+ * The angle of this Game Object in radians.
+ *
+ * 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 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;
+
+ /**
+ * 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.
+ * @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;
+
+ /**
+ * 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 Tile is a representation of a single tile within the Tilemap. This is a lightweight data
* representation, so its position information is stored without factoring in scroll, layer
@@ -81136,2911 +85501,6 @@ declare namespace Phaser {
}
- namespace Components {
- }
-
- /**
- * A Dynamic Tilemap Layer is a Game Object that renders LayerData from a Tilemap when used in combination
- * with one, or more, Tilesets.
- *
- * A Dynamic Tilemap Layer trades some speed for being able to apply powerful effects. Unlike a
- * Static Tilemap Layer, you can apply per-tile effects like tint or alpha, and you can change the
- * tiles in a DynamicTilemapLayer.
- *
- * Use this over a Static Tilemap Layer when you need those features.
- */
- class DynamicTilemapLayer extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.Alpha, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.ComputedSize, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Flip, Phaser.GameObjects.Components.GetBounds, Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible {
- /**
- *
- * @param scene The Scene to which this Game Object belongs.
- * @param tilemap The Tilemap this layer is a part of.
- * @param layerIndex The index of the LayerData associated with this layer.
- * @param tileset The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object.
- * @param x The world x position where the top left of this layer will be placed. Default 0.
- * @param y The world y position where the top left of this layer will be placed. Default 0.
- */
- constructor(scene: Phaser.Scene, tilemap: Phaser.Tilemaps.Tilemap, layerIndex: integer, tileset: string | string[] | Phaser.Tilemaps.Tileset | Phaser.Tilemaps.Tileset[], x?: number, y?: number);
-
- /**
- * Used internally by physics system to perform fast type checks.
- */
- readonly isTilemap: boolean;
-
- /**
- * The Tilemap that this layer is a part of.
- */
- tilemap: Phaser.Tilemaps.Tilemap;
-
- /**
- * The index of the LayerData associated with this layer.
- */
- layerIndex: integer;
-
- /**
- * The LayerData associated with this layer. LayerData can only be associated with one
- * tilemap layer.
- */
- layer: Phaser.Tilemaps.LayerData;
-
- /**
- * The Tileset/s associated with this layer.
- *
- * As of Phaser 3.14 this property is now an array of Tileset objects, previously it was a single reference.
- */
- tileset: Phaser.Tilemaps.Tileset[];
-
- /**
- * Used internally with the canvas render. This holds the tiles that are visible within the
- * camera.
- */
- culledTiles: any[];
-
- /**
- * You can control if the Cameras should cull tiles before rendering them or not.
- * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer.
- *
- * However, there are some instances when you may wish to disable this, and toggling this flag allows
- * you to do so. Also see `setSkipCull` for a chainable method that does the same thing.
- */
- skipCull: boolean;
-
- /**
- * The total number of tiles drawn by the renderer in the last frame.
- */
- readonly tilesDrawn: integer;
-
- /**
- * The total number of tiles in this layer. Updated every frame.
- */
- readonly tilesTotal: integer;
-
- /**
- * The amount of extra tiles to add into the cull rectangle when calculating its horizontal size.
- *
- * See the method `setCullPadding` for more details.
- */
- cullPaddingX: integer;
-
- /**
- * The amount of extra tiles to add into the cull rectangle when calculating its vertical size.
- *
- * See the method `setCullPadding` for more details.
- */
- cullPaddingY: integer;
-
- /**
- * The callback that is invoked when the tiles are culled.
- *
- * By default it will call `TilemapComponents.CullTiles` but you can override this to call any function you like.
- *
- * It will be sent 3 arguments:
- *
- * 1. The Phaser.Tilemaps.LayerData object for this Layer
- * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull.
- * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered.
- *
- * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system.
- */
- cullCallback: Function;
-
- /**
- * An array holding the mapping between the tile indexes and the tileset they belong to.
- */
- gidMap: Phaser.Tilemaps.Tileset[];
-
- /**
- * Sets the rendering (draw) order of the tiles in this layer.
- *
- * The default is 'right-down', meaning it will order the tiles starting from the top-left,
- * drawing to the right and then moving down to the next row.
- *
- * The draw orders are:
- *
- * 0 = right-down
- * 1 = left-down
- * 2 = right-up
- * 3 = left-up
- *
- * Setting the render order does not change the tiles or how they are stored in the layer,
- * it purely impacts the order in which they are rendered.
- *
- * You can provide either an integer (0 to 3), or the string version of the order.
- * @param renderOrder The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'.
- */
- setRenderOrder(renderOrder: integer | string): this;
-
- /**
- * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting
- * faces are used internally for optimizing collisions against tiles. This method is mostly used
- * internally to optimize recalculating faces when only one tile has been changed.
- * @param tileX The x coordinate.
- * @param tileY The y coordinate.
- */
- calculateFacesAt(tileX: integer, tileY: integer): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the
- * layer. Interesting faces are used internally for optimizing collisions against tiles. This method
- * is mostly used internally.
- * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- */
- calculateFacesWithin(tileX?: integer, tileY?: integer, width?: integer, height?: integer): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Creates a Sprite for every object matching the given tile indexes in the layer. You can
- * optionally specify if each tile will be replaced with a new tile after the Sprite has been
- * created. This is useful if you want to lay down special tiles in a level that are converted to
- * Sprites, but want to replace the tile itself with a floor tile or similar once converted.
- * @param indexes The tile index, or array of indexes, to create Sprites from.
- * @param replacements The tile index, or array of indexes, to change a converted
- * tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a
- * one-to-one mapping with the indexes array.
- * @param spriteConfig The config object to pass into the Sprite creator (i.e.
- * scene.make.sprite).
- * @param scene The Scene to create the Sprites within. Default scene the map is within.
- * @param camera The Camera to use when determining the world XY Default main camera.
- */
- createFromTiles(indexes: integer | any[], replacements: integer | any[], spriteConfig: Phaser.Types.GameObjects.Sprite.SpriteConfig, scene?: Phaser.Scene, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.GameObjects.Sprite[];
-
- /**
- * Returns the tiles in the given layer that are within the cameras viewport.
- * This is used internally.
- * @param camera The Camera to run the cull check against.
- */
- cull(camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile[];
-
- /**
- * Copies the tiles in the source rectangular area to a new destination (all specified in tile
- * coordinates) within the layer. This copies all tile properties & recalculates collision
- * information in the destination region.
- * @param srcTileX The x coordinate of the area to copy from, in tiles, not pixels.
- * @param srcTileY The y coordinate of the area to copy from, in tiles, not pixels.
- * @param width The width of the area to copy, in tiles, not pixels.
- * @param height The height of the area to copy, in tiles, not pixels.
- * @param destTileX The x coordinate of the area to copy to, in tiles, not pixels.
- * @param destTileY The y coordinate of the area to copy to, in tiles, not pixels.
- * @param recalculateFaces `true` if the faces data should be recalculated. Default true.
- */
- copy(srcTileX: integer, srcTileY: integer, width: integer, height: integer, destTileX: integer, destTileY: integer, recalculateFaces?: boolean): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Destroys this DynamicTilemapLayer and removes its link to the associated LayerData.
- * @param removeFromTilemap Remove this layer from the parent Tilemap? Default true.
- */
- destroy(removeFromTilemap?: boolean): void;
-
- /**
- * Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the
- * specified index. Tiles will be set to collide if the given index is a colliding index.
- * Collision information in the region will be recalculated.
- * @param index The tile index to fill the area with.
- * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- * @param recalculateFaces `true` if the faces data should be recalculated. Default true.
- */
- fill(index: integer, tileX?: integer, tileY?: integer, width?: integer, height?: integer, recalculateFaces?: boolean): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given
- * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns
- * true) will returned as a new array. Similar to Array.prototype.Filter in vanilla JS.
- * @param callback The callback. Each tile in the given area will be passed to this
- * callback as the first and only parameter. The callback should return true for tiles that pass the
- * filter.
- * @param context The context under which the callback should be run.
- * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
- * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- * @param filteringOptions Optional filters to apply when getting the tiles.
- */
- filterTiles(callback: Function, context?: object, tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.Tile[];
-
- /**
- * Searches the entire map layer for the first tile matching the given index, then returns that Tile
- * object. If no match is found, it returns null. The search starts from the top-left tile and
- * continues horizontally until it hits the end of the row, then it drops down to the next column.
- * If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to
- * the top-left.
- * @param index The tile index value to search for.
- * @param skip The number of times to skip a matching tile before returning. Default 0.
- * @param reverse If true it will scan the layer in reverse, starting at the
- * bottom-right. Otherwise it scans from the top-left. Default false.
- */
- findByIndex(index: integer, skip?: integer, reverse?: boolean): Phaser.Tilemaps.Tile;
-
- /**
- * Find the first tile in the given rectangular area (in tile coordinates) of the layer that
- * satisfies the provided testing function. I.e. finds the first tile for which `callback` returns
- * true. Similar to Array.prototype.find in vanilla JS.
- * @param callback The callback. Each tile in the given area will be passed to this callback as the first and only parameter.
- * @param context The context under which the callback should be run.
- * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area to search. Default 0.
- * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area to search. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- * @param filteringOptions Optional filters to apply when getting the tiles.
- */
- findTile(callback: FindTileCallback, context?: object, tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.Tile;
-
- /**
- * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given
- * callback. Similar to Array.prototype.forEach in vanilla JS.
- * @param callback The callback. Each tile in the given area will be passed to this callback as the first and only parameter.
- * @param context The context under which the callback should be run.
- * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area to search. Default 0.
- * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area to search. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- * @param filteringOptions Optional filters to apply when getting the tiles.
- */
- forEachTile(callback: EachTileCallback, context?: object, tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Gets a tile at the given tile coordinates from the given layer.
- * @param tileX X position to get the tile from (given in tile units, not pixels).
- * @param tileY Y position to get the tile from (given in tile units, not pixels).
- * @param nonNull If true getTile won't return null for empty tiles, but a Tile object with an index of -1. Default false.
- */
- getTileAt(tileX: integer, tileY: integer, nonNull?: boolean): Phaser.Tilemaps.Tile;
-
- /**
- * Gets a tile at the given world coordinates from the given layer.
- * @param worldX X position to get the tile from (given in pixels)
- * @param worldY Y position to get the tile from (given in pixels)
- * @param nonNull If true, function won't return null for empty tiles, but a Tile object with an index of -1. Default false.
- * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
- */
- getTileAtWorldXY(worldX: number, worldY: number, nonNull?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile;
-
- /**
- * Gets the tiles in the given rectangular area (in tile coordinates) of the layer.
- * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- * @param filteringOptions Optional filters to apply when getting the tiles.
- */
- getTilesWithin(tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.Tile[];
-
- /**
- * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle,
- * Line, Rectangle or Triangle. The shape should be in world coordinates.
- * @param shape A shape in world (pixel) coordinates
- * @param filteringOptions Optional filters to apply when getting the tiles.
- * @param camera The Camera to use when factoring in which tiles to return. Default main camera.
- */
- getTilesWithinShape(shape: Phaser.Geom.Circle | Phaser.Geom.Line | Phaser.Geom.Rectangle | Phaser.Geom.Triangle, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile[];
-
- /**
- * Gets the tiles in the given rectangular area (in world coordinates) of the layer.
- * @param worldX The world x coordinate for the top-left of the area.
- * @param worldY The world y coordinate for the top-left of the area.
- * @param width The width of the area.
- * @param height The height of the area.
- * @param filteringOptions Optional filters to apply when getting the tiles.
- * @param camera The Camera to use when factoring in which tiles to return. Default main camera.
- */
- getTilesWithinWorldXY(worldX: number, worldY: number, width: number, height: number, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile[];
-
- /**
- * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns
- * false if there is no tile or if the tile at that location has an index of -1.
- * @param tileX The x coordinate, in tiles, not pixels.
- * @param tileY The y coordinate, in tiles, not pixels.
- */
- hasTileAt(tileX: integer, tileY: integer): boolean;
-
- /**
- * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns
- * false if there is no tile or if the tile at that location has an index of -1.
- * @param worldX The x coordinate, in pixels.
- * @param worldY The y coordinate, in pixels.
- * @param camera The Camera to use when factoring in which tiles to return. Default main camera.
- */
- hasTileAtWorldXY(worldX: number, worldY: number, camera?: Phaser.Cameras.Scene2D.Camera): boolean;
-
- /**
- * Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index
- * or a Tile object. If you pass in a Tile, all attributes will be copied over to the specified
- * location. If you pass in an index, only the index at the specified location will be changed.
- * Collision information will be recalculated at the specified location.
- * @param tile The index of this tile to set or a Tile object.
- * @param tileX The x coordinate, in tiles, not pixels.
- * @param tileY The y coordinate, in tiles, not pixels.
- * @param recalculateFaces `true` if the faces data should be recalculated. Default true.
- */
- putTileAt(tile: integer | Phaser.Tilemaps.Tile, tileX: integer, tileY: integer, recalculateFaces?: boolean): Phaser.Tilemaps.Tile;
-
- /**
- * Puts a tile at the given world coordinates (pixels) in the specified layer. You can pass in either
- * an index or a Tile object. If you pass in a Tile, all attributes will be copied over to the
- * specified location. If you pass in an index, only the index at the specified location will be
- * changed. Collision information will be recalculated at the specified location.
- * @param tile The index of this tile to set or a Tile object.
- * @param worldX The x coordinate, in pixels.
- * @param worldY The y coordinate, in pixels.
- * @param recalculateFaces `true` if the faces data should be recalculated. Default true.
- * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
- */
- putTileAtWorldXY(tile: integer | Phaser.Tilemaps.Tile, worldX: number, worldY: number, recalculateFaces?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile;
-
- /**
- * Puts an array of tiles or a 2D array of tiles at the given tile coordinates in the specified
- * layer. The array can be composed of either tile indexes or Tile objects. If you pass in a Tile,
- * all attributes will be copied over to the specified location. If you pass in an index, only the
- * index at the specified location will be changed. Collision information will be recalculated
- * within the region tiles were changed.
- * @param tile A row (array) or grid (2D array) of Tiles or tile indexes to place.
- * @param tileX The x coordinate, in tiles, not pixels.
- * @param tileY The y coordinate, in tiles, not pixels.
- * @param recalculateFaces `true` if the faces data should be recalculated. Default true.
- */
- putTilesAt(tile: integer[] | integer[][] | Phaser.Tilemaps.Tile[] | Phaser.Tilemaps.Tile[][], tileX: integer, tileY: integer, recalculateFaces?: boolean): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the
- * specified layer. Each tile will receive a new index. If an array of indexes is passed in, then
- * those will be used for randomly assigning new tile indexes. If an array is not provided, the
- * indexes found within the region (excluding -1) will be used for randomly assigning new tile
- * indexes. This method only modifies tile indexes and does not change collision information.
- * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- * @param indexes An array of indexes to randomly draw from during randomization.
- */
- randomize(tileX?: integer, tileY?: integer, width?: integer, height?: integer, indexes?: integer[]): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Removes the tile at the given tile coordinates in the specified layer and updates the layer's
- * collision information.
- * @param tileX The x coordinate, in tiles, not pixels.
- * @param tileY The y coordinate, in tiles, not pixels.
- * @param replaceWithNull If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. Default true.
- * @param recalculateFaces `true` if the faces data should be recalculated. Default true.
- */
- removeTileAt(tileX: integer, tileY: integer, replaceWithNull?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.Tile;
-
- /**
- * Removes the tile at the given world coordinates in the specified layer and updates the layer's
- * collision information.
- * @param worldX The x coordinate, in pixels.
- * @param worldY The y coordinate, in pixels.
- * @param replaceWithNull If true, this will replace the tile at the specified location with null instead of a Tile with an index of -1. Default true.
- * @param recalculateFaces `true` if the faces data should be recalculated. Default true.
- * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
- */
- removeTileAtWorldXY(worldX: number, worldY: number, replaceWithNull?: boolean, recalculateFaces?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile;
-
- /**
- * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to
- * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles
- * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation
- * wherever you want on the screen.
- * @param graphics The target Graphics object to draw upon.
- * @param styleConfig An object specifying the colors to use for the debug drawing.
- */
- renderDebug(graphics: Phaser.GameObjects.Graphics, styleConfig: Phaser.Types.Tilemaps.StyleConfig): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching
- * `findIndex` and updates their index to match `newIndex`. This only modifies the index and does
- * not change collision information.
- * @param findIndex The index of the tile to search for.
- * @param newIndex The index of the tile to replace it with.
- * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- */
- replaceByIndex(findIndex: integer, newIndex: integer, tileX?: integer, tileY?: integer, width?: integer, height?: integer): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * You can control if the Cameras should cull tiles before rendering them or not.
- * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer.
- *
- * However, there are some instances when you may wish to disable this.
- * @param value Set to `true` to stop culling tiles. Set to `false` to enable culling again. Default true.
- */
- setSkipCull(value?: boolean): this;
-
- /**
- * When a Camera culls the tiles in this layer it does so using its view into the world, building up a
- * rectangle inside which the tiles must exist or they will be culled. Sometimes you may need to expand the size
- * of this 'cull rectangle', especially if you plan on rotating the Camera viewing the layer. Do so
- * by providing the padding values. The values given are in tiles, not pixels. So if the tile width was 32px
- * and you set `paddingX` to be 4, it would add 32px x 4 to the cull rectangle (adjusted for scale)
- * @param paddingX The amount of extra horizontal tiles to add to the cull check padding. Default 1.
- * @param paddingY The amount of extra vertical tiles to add to the cull check padding. Default 1.
- */
- setCullPadding(paddingX?: integer, paddingY?: integer): this;
-
- /**
- * Sets collision on the given tile or tiles within a layer by index. You can pass in either a
- * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if
- * collision will be enabled (true) or disabled (false).
- *
- * If no layer specified, the map's current layer is used.
- * @param indexes Either a single tile index, or an array of tile indexes.
- * @param collides If true it will enable collision. If false it will clear collision. Default true.
- * @param recalculateFaces Whether or not to recalculate the tile faces after the update. Default true.
- * @param updateLayer If true, updates the current tiles on the layer. Set to
- * false if no tiles have been placed for significant performance boost. Default true.
- */
- setCollision(indexes: integer | any[], collides?: boolean, recalculateFaces?: boolean, updateLayer?: boolean): Phaser.Tilemaps.Tilemap;
-
- /**
- * Sets collision on a range of tiles in a layer whose index is between the specified `start` and
- * `stop` (inclusive). Calling this with a start value of 10 and a stop value of 14 would set
- * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be
- * enabled (true) or disabled (false).
- * @param start The first index of the tile to be set for collision.
- * @param stop The last index of the tile to be set for collision.
- * @param collides If true it will enable collision. If false it will clear collision. Default true.
- * @param recalculateFaces Whether or not to recalculate the tile faces after the update. Default true.
- */
- setCollisionBetween(start: integer, stop: integer, collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property
- * that matches the given properties object, its collision flag will be set. The `collides`
- * parameter controls if collision will be enabled (true) or disabled (false). Passing in
- * `{ collides: true }` would update the collision flag on any tiles with a "collides" property that
- * has a value of true. Any tile that doesn't have "collides" set to true will be ignored. You can
- * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a
- * "types" property that matches any of those values, its collision flag will be updated.
- * @param properties An object with tile properties and corresponding values that should be checked.
- * @param collides If true it will enable collision. If false it will clear collision. Default true.
- * @param recalculateFaces Whether or not to recalculate the tile faces after the update. Default true.
- */
- setCollisionByProperty(properties: object, collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Sets collision on all tiles in the given layer, except for tiles that have an index specified in
- * the given array. The `collides` parameter controls if collision will be enabled (true) or
- * disabled (false).
- * @param indexes An array of the tile indexes to not be counted for collision.
- * @param collides If true it will enable collision. If false it will clear collision. Default true.
- * @param recalculateFaces Whether or not to recalculate the tile faces after the update. Default true.
- */
- setCollisionByExclusion(indexes: integer[], collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Sets collision on the tiles within a layer by checking each tiles collision group data
- * (typically defined in Tiled within the tileset collision editor). If any objects are found within
- * a tiles collision group, the tile's colliding information will be set. The `collides` parameter
- * controls if collision will be enabled (true) or disabled (false).
- * @param collides If true it will enable collision. If false it will clear collision. Default true.
- * @param recalculateFaces Whether or not to recalculate the tile faces after the update. Default true.
- */
- setCollisionFromCollisionGroup(collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Sets a global collision callback for the given tile index within the layer. This will affect all
- * tiles on this layer that have the same index. If a callback is already set for the tile index it
- * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile
- * at a specific location on the map then see setTileLocationCallback.
- * @param indexes Either a single tile index, or an array of tile indexes to have a collision callback set for.
- * @param callback The callback that will be invoked when the tile is collided with.
- * @param callbackContext The context under which the callback is called.
- */
- setTileIndexCallback(indexes: integer | integer[], callback: Function, callbackContext: object): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer.
- * If a callback is already set for the tile index it will be replaced. Set the callback to null to
- * remove it.
- * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- * @param callback The callback that will be invoked when the tile is collided with.
- * @param callbackContext The context under which the callback is called.
- */
- setTileLocationCallback(tileX?: integer, tileY?: integer, width?: integer, height?: integer, callback?: Function, callbackContext?: object): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Shuffles the tiles in a rectangular region (specified in tile coordinates) within the given
- * layer. It will only randomize the tiles in that area, so if they're all the same nothing will
- * appear to have changed! This method only modifies tile indexes and does not change collision
- * information.
- * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- */
- shuffle(tileX?: integer, tileY?: integer, width?: integer, height?: integer): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Scans the given rectangular area (given in tile coordinates) for tiles with an index matching
- * `indexA` and swaps then with `indexB`. This only modifies the index and does not change collision
- * information.
- * @param tileA First tile index.
- * @param tileB Second tile index.
- * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- */
- swapByIndex(tileA: integer, tileB: integer, tileX?: integer, tileY?: integer, width?: integer, height?: integer): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the
- * layers position, scale and scroll.
- * @param tileX The x coordinate, in tiles, not pixels.
- * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
- */
- tileToWorldX(tileX: integer, camera?: Phaser.Cameras.Scene2D.Camera): number;
-
- /**
- * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the
- * layers position, scale and scroll.
- * @param tileY The y coordinate, in tiles, not pixels.
- * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
- */
- tileToWorldY(tileY: integer, camera?: Phaser.Cameras.Scene2D.Camera): number;
-
- /**
- * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the
- * layers position, scale and scroll. This will return a new Vector2 object or update the given
- * `point` object.
- * @param tileX The x coordinate, in tiles, not pixels.
- * @param tileY The y coordinate, in tiles, not pixels.
- * @param point A Vector2 to store the coordinates in. If not given a new Vector2 is created.
- * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
- */
- tileToWorldXY(tileX: integer, tileY: integer, point?: Phaser.Math.Vector2, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Math.Vector2;
-
- /**
- * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the
- * specified layer. Each tile will receive a new index. New indexes are drawn from the given
- * weightedIndexes array. An example weighted array:
- *
- * [
- * { index: 6, weight: 4 }, // Probability of index 6 is 4 / 8
- * { index: 7, weight: 2 }, // Probability of index 7 would be 2 / 8
- * { index: 8, weight: 1.5 }, // Probability of index 8 would be 1.5 / 8
- * { index: 26, weight: 0.5 } // Probability of index 27 would be 0.5 / 8
- * ]
- *
- * The probability of any index being choose is (the index's weight) / (sum of all weights). This
- * method only modifies tile indexes and does not change collision information.
- * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- * @param weightedIndexes An array of objects to randomly draw from during
- * randomization. They should be in the form: { index: 0, weight: 4 } or
- * { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes.
- */
- weightedRandomize(tileX?: integer, tileY?: integer, width?: integer, height?: integer, weightedIndexes?: object[]): Phaser.Tilemaps.DynamicTilemapLayer;
-
- /**
- * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the
- * layers position, scale and scroll.
- * @param worldX The x coordinate to be converted, in pixels, not tiles.
- * @param snapToFloor Whether or not to round the tile coordinate down to the nearest integer. Default true.
- * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
- */
- worldToTileX(worldX: number, snapToFloor?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): number;
-
- /**
- * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the
- * layers position, scale and scroll.
- * @param worldY The y coordinate to be converted, in pixels, not tiles.
- * @param snapToFloor Whether or not to round the tile coordinate down to the nearest integer. Default true.
- * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
- */
- worldToTileY(worldY: number, snapToFloor?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): number;
-
- /**
- * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the
- * layers position, scale and scroll. This will return a new Vector2 object or update the given
- * `point` object.
- * @param worldX The x coordinate to be converted, in pixels, not tiles.
- * @param worldY The y coordinate to be converted, in pixels, not tiles.
- * @param snapToFloor Whether or not to round the tile coordinate down to the nearest integer. Default true.
- * @param point A Vector2 to store the coordinates in. If not given a new Vector2 is created.
- * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
- */
- worldToTileXY(worldX: number, worldY: number, snapToFloor?: boolean, point?: Phaser.Math.Vector2, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Math.Vector2;
-
- /**
- * 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:
- *
- * * 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;
-
- /**
- * 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:
- *
- * * 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 or a CONST.
- */
- setBlendMode(value: string | Phaser.BlendModes): 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 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 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 depth starts from zero (the default value) and increases from that point. 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 depth starts from zero (the default value) and increases from that point. 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.
- */
- setDepth(value: integer): 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
- * @param output An object to store the values in. If not provided a new Vector2 will be created.
- */
- getCenter(output?: O): 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
- * @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
- * @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
- * @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
- * @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
- * @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
- * @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
- * @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
- * @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 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;
-
- /**
- * 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.
- */
- defaultPipeline: Phaser.Renderer.WebGL.WebGLPipeline;
-
- /**
- * The current WebGL pipeline of this Game Object.
- */
- pipeline: Phaser.Renderer.WebGL.WebGLPipeline;
-
- /**
- * Sets the initial WebGL Pipeline of this Game Object.
- * This should only be called during the instantiation of the Game Object.
- * @param pipelineName The name of the pipeline to set on this Game Object. Defaults to the Texture Tint Pipeline. Default TextureTintPipeline.
- */
- initPipeline(pipelineName?: string): boolean;
-
- /**
- * Sets the active WebGL Pipeline of this Game Object.
- * @param pipelineName The name of the pipeline to set on this Game Object.
- */
- setPipeline(pipelineName: string): this;
-
- /**
- * Resets the WebGL Pipeline of this Game Object back to the default it was created with.
- */
- resetPipeline(): boolean;
-
- /**
- * Gets the name of the WebGL Pipeline this Game Object is currently using.
- */
- getPipelineName(): string;
-
- /**
- * 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 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: integer;
-
- /**
- * The angle of this Game Object in radians.
- *
- * 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 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;
-
- /**
- * 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.
- * @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;
-
- /**
- * 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 class for representing data about about a layer in a map. Maps are parsed from CSV, Tiled,
- * etc. into this format. Tilemap, StaticTilemapLayer and DynamicTilemapLayer have a reference
- * to this data and use it to look up and perform operations on tiles.
- */
- class LayerData {
- /**
- *
- * @param config [description]
- */
- constructor(config?: object);
-
- /**
- * The name of the layer, if specified in Tiled.
- */
- name: string;
-
- /**
- * The x offset of where to draw from the top left
- */
- x: number;
-
- /**
- * The y offset of where to draw from the top left
- */
- y: number;
-
- /**
- * The width in tile of the layer.
- */
- width: number;
-
- /**
- * The height in tiles of the layer.
- */
- height: number;
-
- /**
- * The pixel width of the tiles.
- */
- tileWidth: number;
-
- /**
- * The pixel height of the tiles.
- */
- tileHeight: number;
-
- /**
- * [description]
- */
- baseTileWidth: number;
-
- /**
- * [description]
- */
- baseTileHeight: number;
-
- /**
- * The width in pixels of the entire layer.
- */
- widthInPixels: number;
-
- /**
- * The height in pixels of the entire layer.
- */
- heightInPixels: number;
-
- /**
- * [description]
- */
- alpha: number;
-
- /**
- * [description]
- */
- visible: boolean;
-
- /**
- * Layer specific properties (can be specified in Tiled)
- */
- properties: object;
-
- /**
- * [description]
- */
- indexes: any[];
-
- /**
- * [description]
- */
- collideIndexes: any[];
-
- /**
- * [description]
- */
- callbacks: any[];
-
- /**
- * [description]
- */
- bodies: any[];
-
- /**
- * An array of the tile indexes
- */
- data: Phaser.Tilemaps.Tile[][];
-
- /**
- * [description]
- */
- tilemapLayer: Phaser.Tilemaps.DynamicTilemapLayer | Phaser.Tilemaps.StaticTilemapLayer;
-
- }
-
- /**
- * A class for representing data about a map. Maps are parsed from CSV, Tiled, etc. into this
- * format. A Tilemap object get a copy of this data and then unpacks the needed properties into
- * itself.
- */
- class MapData {
- /**
- *
- * @param config The Map configuration object.
- */
- constructor(config?: Phaser.Types.Tilemaps.MapDataConfig);
-
- /**
- * The key in the Phaser cache that corresponds to the loaded tilemap data.
- */
- name: string;
-
- /**
- * The width of the entire tilemap.
- */
- width: number;
-
- /**
- * The height of the entire tilemap.
- */
- height: number;
-
- /**
- * If the map is infinite or not.
- */
- infinite: boolean;
-
- /**
- * The width of the tiles.
- */
- tileWidth: number;
-
- /**
- * The height of the tiles.
- */
- tileHeight: number;
-
- /**
- * The width in pixels of the entire tilemap.
- */
- widthInPixels: number;
-
- /**
- * The height in pixels of the entire tilemap.
- */
- heightInPixels: number;
-
- /**
- * [description]
- */
- format: integer;
-
- /**
- * The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'.
- */
- orientation: string;
-
- /**
- * Determines the draw order of tilemap. Default is right-down
- *
- * 0, or 'right-down'
- * 1, or 'left-down'
- * 2, or 'right-up'
- * 3, or 'left-up'
- */
- renderOrder: string;
-
- /**
- * The version of the map data (as specified in Tiled).
- */
- version: string;
-
- /**
- * Map specific properties (can be specified in Tiled)
- */
- properties: object;
-
- /**
- * An array with all the layers configured to the MapData.
- */
- layers: Phaser.Tilemaps.LayerData[] | Phaser.Tilemaps.ObjectLayer;
-
- /**
- * An array of Tiled Image Layers.
- */
- images: any[];
-
- /**
- * An object of Tiled Object Layers.
- */
- objects: object;
-
- /**
- * An object of collision data. Must be created as physics object or will return undefined.
- */
- collision: object;
-
- /**
- * An array of Tilesets.
- */
- tilesets: Phaser.Tilemaps.Tileset[];
-
- /**
- * The collection of images the map uses(specified in Tiled)
- */
- imageCollections: any[];
-
- /**
- * [description]
- */
- tiles: any[];
-
- }
-
- /**
- * A class for representing a Tiled object layer in a map. This mirrors the structure of a Tiled
- * object layer, except:
- * - "x" & "y" properties are ignored since these cannot be changed in Tiled.
- * - "offsetx" & "offsety" are applied to the individual object coordinates directly, so they
- * are ignored as well.
- * - "draworder" is ignored.
- */
- class ObjectLayer {
- /**
- *
- * @param config The data for the layer from the Tiled JSON object.
- */
- constructor(config?: Phaser.Types.Tilemaps.ObjectLayerConfig);
-
- /**
- * The name of the Object Layer.
- */
- name: string;
-
- /**
- * The opacity of the layer, between 0 and 1.
- */
- opacity: number;
-
- /**
- * The custom properties defined on the Object Layer, keyed by their name.
- */
- properties: object;
-
- /**
- * The type of each custom property defined on the Object Layer, keyed by its name.
- */
- propertyTypes: object;
-
- /**
- * The type of the layer, which should be `objectgroup`.
- */
- type: string;
-
- /**
- * Whether the layer is shown (`true`) or hidden (`false`).
- */
- visible: boolean;
-
- /**
- * An array of all objects on this Object Layer.
- *
- * Each Tiled object corresponds to a JavaScript object in this array. It has an `id` (unique),
- * `name` (as assigned in Tiled), `type` (as assigned in Tiled), `rotation` (in clockwise degrees),
- * `properties` (if any), `visible` state (`true` if visible, `false` otherwise),
- * `x` and `y` coordinates (in pixels, relative to the tilemap), and a `width` and `height` (in pixels).
- *
- * An object tile has a `gid` property (GID of the represented tile), a `flippedHorizontal` property,
- * a `flippedVertical` property, and `flippedAntiDiagonal` property.
- * The {@link http://docs.mapeditor.org/en/latest/reference/tmx-map-format/|Tiled documentation} contains
- * information on flipping and rotation.
- *
- * Polylines have a `polyline` property, which is an array of objects corresponding to points,
- * where each point has an `x` property and a `y` property. Polygons have an identically structured
- * array in their `polygon` property. Text objects have a `text` property with the text's properties.
- *
- * Rectangles and ellipses have a `rectangle` or `ellipse` property set to `true`.
- */
- objects: Phaser.Types.Tilemaps.TiledObject[];
-
- }
-
- namespace Parsers {
- /**
- * Parses raw data of a given Tilemap format into a new MapData object. If no recognized data format
- * is found, returns `null`. When loading from CSV or a 2D array, you should specify the tileWidth &
- * tileHeight. When parsing from a map from Tiled, the tileWidth & tileHeight will be pulled from
- * the map data.
- * @param name The name of the tilemap, used to set the name on the MapData.
- * @param mapFormat See ../Formats.js.
- * @param data 2D array, CSV string or Tiled JSON object.
- * @param tileWidth The width of a tile in pixels. Required for 2D array and CSV, but
- * ignored for Tiled JSON.
- * @param tileHeight The height of a tile in pixels. Required for 2D array and CSV, but
- * ignored for Tiled JSON.
- * @param insertNull Controls how empty tiles, tiles with an index of -1, in the map
- * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty
- * location will get a Tile object with an index of -1. If you've a large sparsely populated map and
- * the tile data doesn't need to change then setting this value to `true` will help with memory
- * consumption. However if your map is small or you need to update the tiles dynamically, then leave
- * the default value set.
- */
- function Parse(name: string, mapFormat: integer, data: integer[][] | string | object, tileWidth: integer, tileHeight: integer, insertNull: boolean): Phaser.Tilemaps.MapData;
-
- /**
- * Parses a 2D array of tile indexes into a new MapData object with a single layer.
- * @param name The name of the tilemap, used to set the name on the MapData.
- * @param data 2D array, CSV string or Tiled JSON object.
- * @param tileWidth The width of a tile in pixels.
- * @param tileHeight The height of a tile in pixels.
- * @param insertNull Controls how empty tiles, tiles with an index of -1, in the map
- * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty
- * location will get a Tile object with an index of -1. If you've a large sparsely populated map and
- * the tile data doesn't need to change then setting this value to `true` will help with memory
- * consumption. However if your map is small or you need to update the tiles dynamically, then leave
- * the default value set.
- */
- function Parse2DArray(name: string, data: integer[][], tileWidth: integer, tileHeight: integer, insertNull: boolean): Phaser.Tilemaps.MapData;
-
- /**
- * Parses a CSV string of tile indexes into a new MapData object with a single layer.
- * @param name The name of the tilemap, used to set the name on the MapData.
- * @param data CSV string of tile indexes.
- * @param tileWidth The width of a tile in pixels.
- * @param tileHeight The height of a tile in pixels.
- * @param insertNull Controls how empty tiles, tiles with an index of -1, in the map
- * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty
- * location will get a Tile object with an index of -1. If you've a large sparsely populated map and
- * the tile data doesn't need to change then setting this value to `true` will help with memory
- * consumption. However if your map is small or you need to update the tiles dynamically, then leave
- * the default value set.
- */
- function ParseCSV(name: string, data: string, tileWidth: integer, tileHeight: integer, insertNull: boolean): Phaser.Tilemaps.MapData;
-
- namespace Impact {
- /**
- * [description]
- * @param json [description]
- * @param insertNull [description]
- */
- function ParseTileLayers(json: object, insertNull: boolean): any[];
-
- /**
- * [description]
- * @param json [description]
- */
- function ParseTilesets(json: object): any[];
-
- /**
- * Parses a Weltmeister JSON object into a new MapData object.
- * @param name The name of the tilemap, used to set the name on the MapData.
- * @param json The Weltmeister JSON object.
- * @param insertNull Controls how empty tiles, tiles with an index of -1, in the map
- * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty
- * location will get a Tile object with an index of -1. If you've a large sparsely populated map and
- * the tile data doesn't need to change then setting this value to `true` will help with memory
- * consumption. However if your map is small or you need to update the tiles dynamically, then leave
- * the default value set.
- */
- function ParseWeltmeister(name: string, json: object, insertNull: boolean): object;
-
- }
-
- namespace Tiled {
- /**
- * Copy properties from tileset to tiles.
- * @param mapData [description]
- */
- function AssignTileProperties(mapData: Phaser.Tilemaps.MapData): void;
-
- /**
- * Decode base-64 encoded data, for example as exported by Tiled.
- * @param data Base-64 encoded data to decode.
- */
- function Base64Decode(data: object): any[];
-
- /**
- * Master list of tiles -> x, y, index in tileset.
- * @param mapData [description]
- */
- function BuildTilesetIndex(mapData: Phaser.Tilemaps.MapData): any[];
-
- /**
- * Parse a Tiled group layer and create a state object for inheriting.
- * @param json The Tiled JSON object.
- * @param currentl The current group layer from the Tiled JSON file.
- * @param parentstate The state of the parent group (if any).
- */
- function CreateGroupLayer(json: object, currentl?: object, parentstate?: object): object;
-
- /**
- * See Tiled documentation on tile flipping:
- * http://docs.mapeditor.org/en/latest/reference/tmx-map-format/
- * @param gid [description]
- */
- function ParseGID(gid: number): object;
-
- /**
- * Parses a Tiled JSON object into an array of objects with details about the image layers.
- * @param json The Tiled JSON object.
- */
- function ParseImageLayers(json: object): any[];
-
- /**
- * Parses a Tiled JSON object into a new MapData object.
- * @param name The name of the tilemap, used to set the name on the MapData.
- * @param json The Tiled JSON object.
- * @param insertNull Controls how empty tiles, tiles with an index of -1, in the map
- * data are handled. If `true`, empty locations will get a value of `null`. If `false`, empty
- * location will get a Tile object with an index of -1. If you've a large sparsely populated map and
- * the tile data doesn't need to change then setting this value to `true` will help with memory
- * consumption. However if your map is small or you need to update the tiles dynamically, then leave
- * the default value set.
- */
- function ParseJSONTiled(name: string, json: object, insertNull: boolean): Phaser.Tilemaps.MapData;
-
- /**
- * Convert a Tiled object to an internal parsed object normalising and copying properties over, while applying optional x and y offsets. The parsed object will always have the properties `id`, `name`, `type`, `rotation`, `properties`, `visible`, `x`, `y`, `width` and `height`. Other properties will be added according to the object type (such as text, polyline, gid etc.)
- * @param tiledObject Tiled object to convert to an internal parsed object normalising and copying properties over.
- * @param offsetX Optional additional offset to apply to the object's x property. Defaults to 0. Default 0.
- * @param offsetY Optional additional offset to apply to the object's y property. Defaults to 0. Default 0.
- */
- function ParseObject(tiledObject: object, offsetX?: number, offsetY?: number): object;
-
- /**
- * Parses a Tiled JSON object into an array of ObjectLayer objects.
- * @param json The Tiled JSON object.
- */
- function ParseObjectLayers(json: object): any[];
-
- /**
- * Parses all tilemap layers in a Tiled JSON object into new LayerData objects.
- * @param json The Tiled JSON object.
- * @param insertNull Controls how empty tiles, tiles with an index of -1, in the map
- * data are handled (see {@link Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled}).
- */
- function ParseTileLayers(json: object, insertNull: boolean): Phaser.Tilemaps.LayerData[];
-
- /**
- * Tilesets and Image Collections
- * @param json [description]
- */
- function ParseTilesets(json: object): object;
-
- }
-
- }
-
- /**
- * A Static Tilemap Layer is a Game Object that renders LayerData from a Tilemap when used in combination
- * with one, or more, Tilesets.
- *
- * A Static Tilemap Layer is optimized for rendering speed over flexibility. You cannot apply per-tile
- * effects like tint or alpha, or change the tiles or tilesets the layer uses.
- *
- * Use a Static Tilemap Layer instead of a Dynamic Tilemap Layer when you don't need tile manipulation features.
- */
- class StaticTilemapLayer extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.Alpha, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.ComputedSize, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Flip, Phaser.GameObjects.Components.GetBounds, Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible, Phaser.GameObjects.Components.ScrollFactor {
- /**
- *
- * @param scene The Scene to which this Game Object belongs.
- * @param tilemap The Tilemap this layer is a part of.
- * @param layerIndex The index of the LayerData associated with this layer.
- * @param tileset The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object.
- * @param x The world x position where the top left of this layer will be placed. Default 0.
- * @param y The world y position where the top left of this layer will be placed. Default 0.
- */
- constructor(scene: Phaser.Scene, tilemap: Phaser.Tilemaps.Tilemap, layerIndex: integer, tileset: string | string[] | Phaser.Tilemaps.Tileset | Phaser.Tilemaps.Tileset[], x?: number, y?: number);
-
- /**
- * Used internally by physics system to perform fast type checks.
- */
- readonly isTilemap: boolean;
-
- /**
- * The Tilemap that this layer is a part of.
- */
- tilemap: Phaser.Tilemaps.Tilemap;
-
- /**
- * The index of the LayerData associated with this layer.
- */
- layerIndex: integer;
-
- /**
- * The LayerData associated with this layer. LayerData can only be associated with one
- * tilemap layer.
- */
- layer: Phaser.Tilemaps.LayerData;
-
- /**
- * The Tileset/s associated with this layer.
- *
- * As of Phaser 3.14 this property is now an array of Tileset objects, previously it was a single reference.
- */
- tileset: Phaser.Tilemaps.Tileset[];
-
- /**
- * Used internally by the Canvas renderer.
- * This holds the tiles that are visible within the camera in the last frame.
- */
- culledTiles: any[];
-
- /**
- * Canvas only.
- *
- * You can control if the Cameras should cull tiles before rendering them or not.
- * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer.
- *
- * However, there are some instances when you may wish to disable this, and toggling this flag allows
- * you to do so. Also see `setSkipCull` for a chainable method that does the same thing.
- */
- skipCull: boolean;
-
- /**
- * Canvas only.
- *
- * The total number of tiles drawn by the renderer in the last frame.
- *
- * This only works when rending with Canvas.
- */
- readonly tilesDrawn: integer;
-
- /**
- * Canvas only.
- *
- * The total number of tiles in this layer. Updated every frame.
- */
- readonly tilesTotal: integer;
-
- /**
- * Canvas only.
- *
- * The amount of extra tiles to add into the cull rectangle when calculating its horizontal size.
- *
- * See the method `setCullPadding` for more details.
- */
- cullPaddingX: integer;
-
- /**
- * Canvas only.
- *
- * The amount of extra tiles to add into the cull rectangle when calculating its vertical size.
- *
- * See the method `setCullPadding` for more details.
- */
- cullPaddingY: integer;
-
- /**
- * Canvas only.
- *
- * The callback that is invoked when the tiles are culled.
- *
- * By default it will call `TilemapComponents.CullTiles` but you can override this to call any function you like.
- *
- * It will be sent 3 arguments:
- *
- * 1. The Phaser.Tilemaps.LayerData object for this Layer
- * 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull.
- * 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered.
- *
- * See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system.
- */
- cullCallback: Function;
-
- /**
- * An array holding the mapping between the tile indexes and the tileset they belong to.
- */
- gidMap: Phaser.Tilemaps.Tileset[];
-
- /**
- * Upload the tile data to a VBO.
- * @param camera The camera to render to.
- * @param tilesetIndex The tileset index.
- */
- upload(camera: Phaser.Cameras.Scene2D.Camera, tilesetIndex: integer): Phaser.Tilemaps.StaticTilemapLayer;
-
- /**
- * Sets the rendering (draw) order of the tiles in this layer.
- *
- * The default is 'right-down', meaning it will order the tiles starting from the top-left,
- * drawing to the right and then moving down to the next row.
- *
- * The draw orders are:
- *
- * 0 = right-down
- * 1 = left-down
- * 2 = right-up
- * 3 = left-up
- *
- * Setting the render order does not change the tiles or how they are stored in the layer,
- * it purely impacts the order in which they are rendered.
- *
- * You can provide either an integer (0 to 3), or the string version of the order.
- * @param renderOrder The render (draw) order value. Either an integer between 0 and 3, or a string: 'right-down', 'left-down', 'right-up' or 'left-up'.
- */
- setRenderOrder(renderOrder: integer | string): this;
-
- /**
- * Calculates interesting faces at the given tile coordinates of the specified layer. Interesting
- * faces are used internally for optimizing collisions against tiles. This method is mostly used
- * internally to optimize recalculating faces when only one tile has been changed.
- * @param tileX The x coordinate.
- * @param tileY The y coordinate.
- */
- calculateFacesAt(tileX: integer, tileY: integer): Phaser.Tilemaps.StaticTilemapLayer;
-
- /**
- * Calculates interesting faces within the rectangular area specified (in tile coordinates) of the
- * layer. Interesting faces are used internally for optimizing collisions against tiles. This method
- * is mostly used internally.
- * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- */
- calculateFacesWithin(tileX?: integer, tileY?: integer, width?: integer, height?: integer): Phaser.Tilemaps.StaticTilemapLayer;
-
- /**
- * Creates a Sprite for every object matching the given tile indexes in the layer. You can
- * optionally specify if each tile will be replaced with a new tile after the Sprite has been
- * created. This is useful if you want to lay down special tiles in a level that are converted to
- * Sprites, but want to replace the tile itself with a floor tile or similar once converted.
- * @param indexes The tile index, or array of indexes, to create Sprites from.
- * @param replacements The tile index, or array of indexes, to change a converted
- * tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a
- * one-to-one mapping with the indexes array.
- * @param spriteConfig The config object to pass into the Sprite creator (i.e.
- * scene.make.sprite).
- * @param scene The Scene to create the Sprites within. Default scene the map is within.
- * @param camera The Camera to use when determining the world XY Default main camera.
- */
- createFromTiles(indexes: integer | any[], replacements: integer | any[], spriteConfig: Phaser.Types.GameObjects.Sprite.SpriteConfig, scene?: Phaser.Scene, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.GameObjects.Sprite[];
-
- /**
- * Returns the tiles in the given layer that are within the cameras viewport.
- * This is used internally.
- * @param camera The Camera to run the cull check against.
- */
- cull(camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile[];
-
- /**
- * Canvas only.
- *
- * You can control if the Cameras should cull tiles before rendering them or not.
- * By default the camera will try to cull the tiles in this layer, to avoid over-drawing to the renderer.
- *
- * However, there are some instances when you may wish to disable this.
- * @param value Set to `true` to stop culling tiles. Set to `false` to enable culling again. Default true.
- */
- setSkipCull(value?: boolean): this;
-
- /**
- * Canvas only.
- *
- * When a Camera culls the tiles in this layer it does so using its view into the world, building up a
- * rectangle inside which the tiles must exist or they will be culled. Sometimes you may need to expand the size
- * of this 'cull rectangle', especially if you plan on rotating the Camera viewing the layer. Do so
- * by providing the padding values. The values given are in tiles, not pixels. So if the tile width was 32px
- * and you set `paddingX` to be 4, it would add 32px x 4 to the cull rectangle (adjusted for scale)
- * @param paddingX The amount of extra horizontal tiles to add to the cull check padding. Default 1.
- * @param paddingY The amount of extra vertical tiles to add to the cull check padding. Default 1.
- */
- setCullPadding(paddingX?: integer, paddingY?: integer): this;
-
- /**
- * Searches the entire map layer for the first tile matching the given index, then returns that Tile
- * object. If no match is found, it returns null. The search starts from the top-left tile and
- * continues horizontally until it hits the end of the row, then it drops down to the next column.
- * If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to
- * the top-left.
- * @param index The tile index value to search for.
- * @param skip The number of times to skip a matching tile before returning. Default 0.
- * @param reverse If true it will scan the layer in reverse, starting at the
- * bottom-right. Otherwise it scans from the top-left. Default false.
- */
- findByIndex(index: integer, skip?: integer, reverse?: boolean): Phaser.Tilemaps.Tile;
-
- /**
- * Find the first tile in the given rectangular area (in tile coordinates) of the layer that
- * satisfies the provided testing function. I.e. finds the first tile for which `callback` returns
- * true. Similar to Array.prototype.find in vanilla JS.
- * @param callback The callback. Each tile in the given area will be passed to this
- * callback as the first and only parameter.
- * @param context The context under which the callback should be run.
- * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
- * @param tileY The topmost tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- * @param filteringOptions Optional filters to apply when getting the tiles.
- */
- findTile(callback: Function, context?: object, tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.Tile;
-
- /**
- * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given
- * filter callback function. Any tiles that pass the filter test (i.e. where the callback returns
- * true) will returned as a new array. Similar to Array.prototype.Filter in vanilla JS.
- * @param callback The callback. Each tile in the given area will be passed to this
- * callback as the first and only parameter. The callback should return true for tiles that pass the
- * filter.
- * @param context The context under which the callback should be run.
- * @param tileX The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
- * @param tileY The topmost tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- * @param filteringOptions Optional filters to apply when getting the tiles.
- */
- filterTiles(callback: Function, context?: object, tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.Tile[];
-
- /**
- * For each tile in the given rectangular area (in tile coordinates) of the layer, run the given
- * callback. Similar to Array.prototype.forEach in vanilla JS.
- * @param callback The callback. Each tile in the given area will be passed to this
- * callback as the first and only parameter.
- * @param context The context under which the callback should be run.
- * @param tileX The leftmost tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
- * @param tileY The topmost tile index (in tile coordinates) to use as the origin of the area to filter. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- * @param filteringOptions Optional filters to apply when getting the tiles.
- */
- forEachTile(callback: Function, context?: object, tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.StaticTilemapLayer;
-
- /**
- * Gets a tile at the given tile coordinates from the given layer.
- * @param tileX X position to get the tile from (given in tile units, not pixels).
- * @param tileY Y position to get the tile from (given in tile units, not pixels).
- * @param nonNull If true getTile won't return null for empty tiles, but a Tile
- * object with an index of -1. Default false.
- */
- getTileAt(tileX: integer, tileY: integer, nonNull?: boolean): Phaser.Tilemaps.Tile;
-
- /**
- * Gets a tile at the given world coordinates from the given layer.
- * @param worldX X position to get the tile from (given in pixels)
- * @param worldY Y position to get the tile from (given in pixels)
- * @param nonNull If true, function won't return null for empty tiles, but a Tile
- * object with an index of -1. Default false.
- * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
- */
- getTileAtWorldXY(worldX: number, worldY: number, nonNull?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile;
-
- /**
- * Gets the tiles in the given rectangular area (in tile coordinates) of the layer.
- * @param tileX The leftmost tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param tileY The topmost tile index (in tile coordinates) to use as the origin of the area. Default 0.
- * @param width How many tiles wide from the `tileX` index the area will be. Default max width based on tileX.
- * @param height How many tiles tall from the `tileY` index the area will be. Default max height based on tileY.
- * @param filteringOptions Optional filters to apply when getting the tiles.
- */
- getTilesWithin(tileX?: integer, tileY?: integer, width?: integer, height?: integer, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): Phaser.Tilemaps.Tile[];
-
- /**
- * Gets the tiles in the given rectangular area (in world coordinates) of the layer.
- * @param worldX The leftmost tile index (in tile coordinates) to use as the origin of the area to filter.
- * @param worldY The topmost tile index (in tile coordinates) to use as the origin of the area to filter.
- * @param width How many tiles wide from the `tileX` index the area will be.
- * @param height How many tiles high from the `tileY` index the area will be.
- * @param filteringOptions Optional filters to apply when getting the tiles.
- * @param camera The Camera to use when factoring in which tiles to return. Default main camera.
- */
- getTilesWithinWorldXY(worldX: number, worldY: number, width: number, height: number, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile[];
-
- /**
- * Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle,
- * Line, Rectangle or Triangle. The shape should be in world coordinates.
- * @param shape A shape in world (pixel) coordinates
- * @param filteringOptions Optional filters to apply when getting the tiles.
- * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
- */
- getTilesWithinShape(shape: Phaser.Geom.Circle | Phaser.Geom.Line | Phaser.Geom.Rectangle | Phaser.Geom.Triangle, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Tilemaps.Tile[];
-
- /**
- * Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns
- * false if there is no tile or if the tile at that location has an index of -1.
- * @param tileX X position to get the tile from in tile coordinates.
- * @param tileY Y position to get the tile from in tile coordinates.
- */
- hasTileAt(tileX: integer, tileY: integer): boolean;
-
- /**
- * Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns
- * false if there is no tile or if the tile at that location has an index of -1.
- * @param worldX The X coordinate of the world position.
- * @param worldY The Y coordinate of the world position.
- * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
- */
- hasTileAtWorldXY(worldX: number, worldY: number, camera?: Phaser.Cameras.Scene2D.Camera): boolean;
-
- /**
- * Draws a debug representation of the layer to the given Graphics. This is helpful when you want to
- * get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles
- * are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation
- * wherever you want on the screen.
- * @param graphics The target Graphics object to draw upon.
- * @param styleConfig An object specifying the colors to use for the debug drawing.
- */
- renderDebug(graphics: Phaser.GameObjects.Graphics, styleConfig: Phaser.Types.Tilemaps.StyleConfig): Phaser.Tilemaps.StaticTilemapLayer;
-
- /**
- * Sets collision on the given tile or tiles within a layer by index. You can pass in either a
- * single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if
- * collision will be enabled (true) or disabled (false).
- * @param indexes Either a single tile index, or an array of tile indexes.
- * @param collides If true it will enable collision. If false it will clear
- * collision. Default true.
- * @param recalculateFaces Whether or not to recalculate the tile faces after the
- * update. Default true.
- * @param updateLayer If true, updates the current tiles on the layer. Set to
- * false if no tiles have been placed for significant performance boost. Default true.
- */
- setCollision(indexes: integer | any[], collides?: boolean, recalculateFaces?: boolean, updateLayer?: boolean): Phaser.Tilemaps.StaticTilemapLayer;
-
- /**
- * Sets collision on a range of tiles in a layer whose index is between the specified `start` and
- * `stop` (inclusive). Calling this with a start value of 10 and a stop value of 14 would set
- * collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be
- * enabled (true) or disabled (false).
- * @param start The first index of the tile to be set for collision.
- * @param stop The last index of the tile to be set for collision.
- * @param collides If true it will enable collision. If false it will clear
- * collision. Default true.
- * @param recalculateFaces Whether or not to recalculate the tile faces after the
- * update. Default true.
- */
- setCollisionBetween(start: integer, stop: integer, collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.StaticTilemapLayer;
-
- /**
- * Sets collision on the tiles within a layer by checking tile properties. If a tile has a property
- * that matches the given properties object, its collision flag will be set. The `collides`
- * parameter controls if collision will be enabled (true) or disabled (false). Passing in
- * `{ collides: true }` would update the collision flag on any tiles with a "collides" property that
- * has a value of true. Any tile that doesn't have "collides" set to true will be ignored. You can
- * also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a
- * "types" property that matches any of those values, its collision flag will be updated.
- * @param properties An object with tile properties and corresponding values that should
- * be checked.
- * @param collides If true it will enable collision. If false it will clear
- * collision. Default true.
- * @param recalculateFaces Whether or not to recalculate the tile faces after the
- * update. Default true.
- */
- setCollisionByProperty(properties: object, collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.StaticTilemapLayer;
-
- /**
- * Sets collision on all tiles in the given layer, except for tiles that have an index specified in
- * the given array. The `collides` parameter controls if collision will be enabled (true) or
- * disabled (false).
- * @param indexes An array of the tile indexes to not be counted for collision.
- * @param collides If true it will enable collision. If false it will clear
- * collision. Default true.
- * @param recalculateFaces Whether or not to recalculate the tile faces after the
- * update. Default true.
- */
- setCollisionByExclusion(indexes: integer[], collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.StaticTilemapLayer;
-
- /**
- * Sets a global collision callback for the given tile index within the layer. This will affect all
- * tiles on this layer that have the same index. If a callback is already set for the tile index it
- * will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile
- * at a specific location on the map then see setTileLocationCallback.
- * @param indexes Either a single tile index, or an array of tile indexes to have a
- * collision callback set for.
- * @param callback The callback that will be invoked when the tile is collided with.
- * @param callbackContext The context under which the callback is called.
- */
- setTileIndexCallback(indexes: integer | any[], callback: Function, callbackContext: object): Phaser.Tilemaps.StaticTilemapLayer;
-
- /**
- * Sets collision on the tiles within a layer by checking each tiles collision group data
- * (typically defined in Tiled within the tileset collision editor). If any objects are found within
- * a tiles collision group, the tile's colliding information will be set. The `collides` parameter
- * controls if collision will be enabled (true) or disabled (false).
- * @param collides If true it will enable collision. If false it will clear
- * collision. Default true.
- * @param recalculateFaces Whether or not to recalculate the tile faces after the
- * update. Default true.
- */
- setCollisionFromCollisionGroup(collides?: boolean, recalculateFaces?: boolean): Phaser.Tilemaps.StaticTilemapLayer;
-
- /**
- * Sets a collision callback for the given rectangular area (in tile coordinates) within the layer.
- * If a callback is already set for the tile index it will be replaced. Set the callback to null to
- * remove it.
- * @param tileX The leftmost tile index (in tile coordinates) to use as the origin of the area.
- * @param tileY The topmost tile index (in tile coordinates) to use as the origin of the area.
- * @param width How many tiles wide from the `tileX` index the area will be.
- * @param height How many tiles tall from the `tileY` index the area will be.
- * @param callback The callback that will be invoked when the tile is collided with.
- * @param callbackContext The context under which the callback is called.
- */
- setTileLocationCallback(tileX: integer, tileY: integer, width: integer, height: integer, callback: Function, callbackContext?: object): Phaser.Tilemaps.StaticTilemapLayer;
-
- /**
- * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the
- * layers position, scale and scroll.
- * @param tileX The X coordinate, in tile coordinates.
- * @param camera The Camera to use when calculating the world values from the tile index. Default main camera.
- */
- tileToWorldX(tileX: integer, camera?: Phaser.Cameras.Scene2D.Camera): number;
-
- /**
- * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the
- * layers position, scale and scroll.
- * @param tileY The Y coordinate, in tile coordinates.
- * @param camera The Camera to use when calculating the world values from the tile index. Default main camera.
- */
- tileToWorldY(tileY: integer, camera?: Phaser.Cameras.Scene2D.Camera): number;
-
- /**
- * Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the
- * layers position, scale and scroll. This will return a new Vector2 object or update the given
- * `point` object.
- * @param tileX The X coordinate, in tile coordinates.
- * @param tileY The Y coordinate, in tile coordinates.
- * @param point A Vector2 to store the coordinates in. If not given, a new Vector2 is created.
- * @param camera The Camera to use when calculating the world values from the tile index. Default main camera.
- */
- tileToWorldXY(tileX: integer, tileY: integer, point?: Phaser.Math.Vector2, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Math.Vector2;
-
- /**
- * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the
- * layers position, scale and scroll.
- * @param worldX The X coordinate, in world pixels.
- * @param snapToFloor Whether or not to round the tile coordinate down to the
- * nearest integer. Default true.
- * @param camera The Camera to use when calculating the tile index from the world values.] Default main camera.
- */
- worldToTileX(worldX: number, snapToFloor?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): number;
-
- /**
- * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the
- * layers position, scale and scroll.
- * @param worldY The Y coordinate, in world pixels.
- * @param snapToFloor Whether or not to round the tile coordinate down to the
- * nearest integer. Default true.
- * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
- */
- worldToTileY(worldY: number, snapToFloor?: boolean, camera?: Phaser.Cameras.Scene2D.Camera): number;
-
- /**
- * Converts from world XY coordinates (pixels) to tile XY coordinates (tile units), factoring in the
- * layers position, scale and scroll. This will return a new Vector2 object or update the given
- * `point` object.
- * @param worldX The X coordinate, in world pixels.
- * @param worldY The Y coordinate, in world pixels.
- * @param snapToFloor Whether or not to round the tile coordinate down to the
- * nearest integer. Default true.
- * @param point A Vector2 to store the coordinates in. If not given, a new Vector2 is created.
- * @param camera The Camera to use when calculating the tile index from the world values. Default main camera.
- */
- worldToTileXY(worldX: number, worldY: number, snapToFloor?: boolean, point?: Phaser.Math.Vector2, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Math.Vector2;
-
- /**
- * Destroys this StaticTilemapLayer and removes its link to the associated LayerData.
- * @param removeFromTilemap Remove this layer from the parent Tilemap? Default true.
- */
- destroy(removeFromTilemap?: 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.
- *
- * 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:
- *
- * * 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;
-
- /**
- * 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:
- *
- * * 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 or a CONST.
- */
- setBlendMode(value: string | Phaser.BlendModes): 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 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 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 depth starts from zero (the default value) and increases from that point. 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 depth starts from zero (the default value) and increases from that point. 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.
- */
- setDepth(value: integer): 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
- * @param output An object to store the values in. If not provided a new Vector2 will be created.
- */
- getCenter(output?: O): 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
- * @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
- * @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
- * @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
- * @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
- * @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
- * @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
- * @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
- * @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 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;
-
- /**
- * 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.
- */
- defaultPipeline: Phaser.Renderer.WebGL.WebGLPipeline;
-
- /**
- * The current WebGL pipeline of this Game Object.
- */
- pipeline: Phaser.Renderer.WebGL.WebGLPipeline;
-
- /**
- * Sets the initial WebGL Pipeline of this Game Object.
- * This should only be called during the instantiation of the Game Object.
- * @param pipelineName The name of the pipeline to set on this Game Object. Defaults to the Texture Tint Pipeline. Default TextureTintPipeline.
- */
- initPipeline(pipelineName?: string): boolean;
-
- /**
- * Sets the active WebGL Pipeline of this Game Object.
- * @param pipelineName The name of the pipeline to set on this Game Object.
- */
- setPipeline(pipelineName: string): this;
-
- /**
- * Resets the WebGL Pipeline of this Game Object back to the default it was created with.
- */
- resetPipeline(): boolean;
-
- /**
- * Gets the name of the WebGL Pipeline this Game Object is currently using.
- */
- getPipelineName(): string;
-
- /**
- * 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: integer;
-
- /**
- * The angle of this Game Object in radians.
- *
- * 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 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;
-
- /**
- * 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.
- * @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;
-
- /**
- * 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;
-
- }
-
}
namespace Time {
@@ -84255,487 +85715,6 @@ declare namespace Phaser {
}
namespace Tweens {
- /**
- * A Timeline combines multiple Tweens into one. Its overall behavior is otherwise similar to a single Tween.
- *
- * The Timeline updates all of its Tweens simultaneously. Its methods allow you to easily build a sequence
- * of Tweens (each one starting after the previous one) or run multiple Tweens at once during given parts of the Timeline.
- */
- class Timeline extends Phaser.Events.EventEmitter {
- /**
- *
- * @param manager The Tween Manager which owns this Timeline.
- */
- constructor(manager: Phaser.Tweens.TweenManager);
-
- /**
- * The Tween Manager which owns this Timeline.
- */
- manager: Phaser.Tweens.TweenManager;
-
- /**
- * A constant value which allows this Timeline to be easily identified as one.
- */
- isTimeline: boolean;
-
- /**
- * An array of Tween objects, each containing a unique property and target being tweened.
- */
- data: any[];
-
- /**
- * The cached size of the data array.
- */
- totalData: number;
-
- /**
- * If true then duration, delay, etc values are all frame totals, rather than ms.
- */
- useFrames: boolean;
-
- /**
- * Scales the time applied to this Timeline. A value of 1 runs in real-time. A value of 0.5 runs 50% slower, and so on.
- * Value isn't used when calculating total duration of the Timeline, it's a run-time delta adjustment only.
- */
- timeScale: number;
-
- /**
- * Loop this Timeline? Can be -1 for an infinite loop, or an integer.
- * When enabled it will play through ALL Tweens again (use Tween.repeat to loop a single tween)
- */
- loop: number;
-
- /**
- * Time in ms/frames before this Timeline loops.
- */
- loopDelay: number;
-
- /**
- * How many loops are left to run?
- */
- loopCounter: number;
-
- /**
- * Time in ms/frames before the 'onComplete' event fires. This never fires if loop = true (as it never completes)
- */
- completeDelay: number;
-
- /**
- * Countdown timer value, as used by `loopDelay` and `completeDelay`.
- */
- countdown: number;
-
- /**
- * The current state of the Timeline.
- */
- state: integer;
-
- /**
- * Does the Timeline start off paused? (if so it needs to be started with Timeline.play)
- */
- paused: boolean;
-
- /**
- * Elapsed time in ms/frames of this run through of the Timeline.
- */
- elapsed: number;
-
- /**
- * Total elapsed time in ms/frames of the entire Timeline, including looping.
- */
- totalElapsed: number;
-
- /**
- * Time in ms/frames for the whole Timeline to play through once, excluding loop amounts and loop delays.
- */
- duration: number;
-
- /**
- * Value between 0 and 1. The amount of progress through the Timeline, _excluding loops_.
- */
- progress: number;
-
- /**
- * Time in ms/frames for all Tweens in this Timeline to complete (including looping)
- */
- totalDuration: number;
-
- /**
- * Value between 0 and 1. The amount through the entire Timeline, including looping.
- */
- totalProgress: number;
-
- /**
- * An object containing the different Tween callback functions.
- *
- * You can either set these in the Tween config, or by calling the `Tween.setCallback` method.
- *
- * `onComplete` When the Timeline finishes playback fully or `Timeline.stop` is called. Never invoked if timeline is set to repeat infinitely.
- * `onLoop` When a Timeline loops.
- * `onStart` When the Timeline starts playing.
- * `onUpdate` When a Timeline updates a child Tween.
- * `onYoyo` When a Timeline starts a yoyo.
- */
- callbacks: object;
-
- /**
- * The context in which all callbacks are invoked.
- */
- callbackScope: any;
-
- /**
- * Internal method that will emit a Timeline based Event and invoke the given callback.
- * @param event The Event to be dispatched.
- * @param callback The callback to be invoked. Can be `null` or `undefined` to skip invocation.
- */
- dispatchTimelineEvent(event: Phaser.Types.Tweens.Event, callback: Function): void;
-
- /**
- * Sets the value of the time scale applied to this Timeline. A value of 1 runs in real-time.
- * A value of 0.5 runs 50% slower, and so on.
- *
- * The value isn't used when calculating total duration of the tween, it's a run-time delta adjustment only.
- * @param value The time scale value to set.
- */
- setTimeScale(value: number): this;
-
- /**
- * Gets the value of the time scale applied to this Timeline. A value of 1 runs in real-time.
- * A value of 0.5 runs 50% slower, and so on.
- */
- getTimeScale(): number;
-
- /**
- * Check whether or not the Timeline is playing.
- */
- isPlaying(): boolean;
-
- /**
- * Creates a new Tween, based on the given Tween Config, and adds it to this Timeline.
- * @param config The configuration object for the Tween.
- */
- add(config: Phaser.Types.Tweens.TweenBuilderConfig | object): this;
-
- /**
- * Adds an existing Tween to this Timeline.
- * @param tween The Tween to be added to this Timeline.
- */
- queue(tween: Phaser.Tweens.Tween): this;
-
- /**
- * Checks whether a Tween has an offset value.
- * @param tween The Tween to check.
- */
- hasOffset(tween: Phaser.Tweens.Tween): boolean;
-
- /**
- * Checks whether the offset value is a number or a directive that is relative to previous tweens.
- * @param value The offset value to be evaluated.
- */
- isOffsetAbsolute(value: number): boolean;
-
- /**
- * Checks if the offset is a relative value rather than an absolute one.
- * If the value is just a number, this returns false.
- * @param value The offset value to be evaluated.
- */
- isOffsetRelative(value: string): boolean;
-
- /**
- * Parses the relative offset value, returning a positive or negative number.
- * @param value The relative offset, in the format of '-=500', for example. The first character determines whether it will be a positive or negative number. Spacing matters here.
- * @param base The value to use as the offset.
- */
- getRelativeOffset(value: string, base: number): number;
-
- /**
- * Calculates the total duration of the timeline.
- *
- * Computes all tween durations and returns the full duration of the timeline.
- *
- * The resulting number is stored in the timeline, not as a return value.
- */
- calcDuration(): void;
-
- /**
- * Initializes the timeline, which means all Tweens get their init() called, and the total duration will be computed.
- * Returns a boolean indicating whether the timeline is auto-started or not.
- */
- init(): boolean;
-
- /**
- * Resets all of the timeline's tweens back to their initial states.
- * The boolean parameter indicates whether tweens that are looping should reset as well, or not.
- * @param resetFromLoop If `true`, resets all looping tweens to their initial values.
- */
- resetTweens(resetFromLoop: boolean): void;
-
- /**
- * Sets a callback for the Timeline.
- * @param type The internal type of callback to set.
- * @param callback Timeline allows multiple tweens to be linked together to create a streaming sequence.
- * @param params The parameters to pass to the callback.
- * @param scope The context scope of the callback.
- */
- setCallback(type: string, callback: Function, params?: any[], scope?: object): this;
-
- /**
- * Passed a Tween to the Tween Manager and requests it be made active.
- * @param tween The tween object to make active.
- */
- makeActive(tween: Phaser.Tweens.Tween): Phaser.Tweens.TweenManager;
-
- /**
- * Starts playing the Timeline.
- */
- play(): void;
-
- /**
- * Updates the Timeline's `state` and fires callbacks and events.
- */
- nextState(): void;
-
- /**
- * Returns 'true' if this Timeline has finished and should be removed from the Tween Manager.
- * Otherwise, returns false.
- * @param timestamp The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
- * @param delta The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.
- */
- update(timestamp: number, delta: number): boolean;
-
- /**
- * Stops the Timeline immediately, whatever stage of progress it is at and flags it for removal by the TweenManager.
- */
- stop(): void;
-
- /**
- * Pauses the Timeline, retaining its internal state.
- *
- * Calling this on a Timeline that is already paused has no effect and fires no event.
- */
- pause(): this;
-
- /**
- * Resumes a paused Timeline from where it was when it was paused.
- *
- * Calling this on a Timeline that isn't paused has no effect and fires no event.
- */
- resume(): this;
-
- /**
- * Checks if any of the Tweens in this Timeline as operating on the target object.
- *
- * Returns `false` if no Tweens operate on the target object.
- * @param target The target to check all Tweens against.
- */
- hasTarget(target: object): boolean;
-
- /**
- * Stops all the Tweens in the Timeline immediately, whatever stage of progress they are at and flags
- * them for removal by the TweenManager.
- */
- destroy(): void;
-
- }
-
- /**
- * The Tween Manager is a default Scene Plugin which controls and updates Tweens and Timelines.
- */
- class TweenManager {
- /**
- *
- * @param scene The Scene which owns this Tween Manager.
- */
- constructor(scene: Phaser.Scene);
-
- /**
- * The Scene which owns this Tween Manager.
- */
- scene: Phaser.Scene;
-
- /**
- * The Systems object of the Scene which owns this Tween Manager.
- */
- systems: Phaser.Scenes.Systems;
-
- /**
- * The time scale of the Tween Manager.
- *
- * This value scales the time delta between two frames, thus influencing the speed of time for all Tweens owned by this Tween Manager.
- */
- timeScale: number;
-
- /**
- * Create a Tween Timeline and return it, but do NOT add it to the active or pending Tween lists.
- * @param config The configuration object for the Timeline and its Tweens.
- */
- createTimeline(config?: Phaser.Types.Tweens.TimelineBuilderConfig): Phaser.Tweens.Timeline;
-
- /**
- * Create a Tween Timeline and add it to the active Tween list/
- * @param config The configuration object for the Timeline and its Tweens.
- */
- timeline(config?: Phaser.Types.Tweens.TimelineBuilderConfig): Phaser.Tweens.Timeline;
-
- /**
- * Create a Tween and return it, but do NOT add it to the active or pending Tween lists.
- * @param config The configuration object for the Tween.
- */
- create(config: Phaser.Types.Tweens.TweenBuilderConfig | object): Phaser.Tweens.Tween;
-
- /**
- * Create a Tween and add it to the active Tween list.
- * @param config The configuration object for the Tween.
- */
- add(config: Phaser.Types.Tweens.TweenBuilderConfig | object): Phaser.Tweens.Tween;
-
- /**
- * Add an existing tween into the active Tween list.
- * @param tween The Tween to add.
- */
- existing(tween: Phaser.Tweens.Tween): Phaser.Tweens.TweenManager;
-
- /**
- * Create a Number Tween and add it to the active Tween list.
- * @param config The configuration object for the Number Tween.
- */
- addCounter(config: Phaser.Types.Tweens.NumberTweenBuilderConfig): Phaser.Tweens.Tween;
-
- /**
- * Creates a Stagger function to be used by a Tween property.
- *
- * The stagger function will allow you to stagger changes to the value of the property across all targets of the tween.
- *
- * This is only worth using if the tween has multiple targets.
- *
- * The following will stagger the delay by 100ms across all targets of the tween, causing them to scale down to 0.2
- * over the duration specified:
- *
- * ```javascript
- * this.tweens.add({
- * targets: [ ... ],
- * scale: 0.2,
- * ease: 'linear',
- * duration: 1000,
- * delay: this.tweens.stagger(100)
- * });
- * ```
- *
- * The following will stagger the delay by 500ms across all targets of the tween using a 10 x 6 grid, staggering
- * from the center out, using a cubic ease.
- *
- * ```javascript
- * this.tweens.add({
- * targets: [ ... ],
- * scale: 0.2,
- * ease: 'linear',
- * duration: 1000,
- * delay: this.tweens.stagger(500, { grid: [ 10, 6 ], from: 'center', ease: 'cubic.out' })
- * });
- * ```
- * @param config The configuration object for the Stagger function.
- */
- stagger(config: Phaser.Types.Tweens.StaggerConfig): Function;
-
- /**
- * Updates the Tween Manager's internal lists at the start of the frame.
- *
- * This method will return immediately if no changes have been indicated.
- */
- preUpdate(): void;
-
- /**
- * Updates all Tweens and Timelines of the Tween Manager.
- * @param timestamp The current time in milliseconds.
- * @param delta The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.
- */
- update(timestamp: number, delta: number): void;
-
- /**
- * Removes the given tween from the Tween Manager, regardless of its state (pending or active).
- * @param tween The Tween to be removed.
- */
- remove(tween: Phaser.Tweens.Tween): Phaser.Tweens.TweenManager;
-
- /**
- * Checks if a Tween or Timeline is active and adds it to the Tween Manager at the start of the frame if it isn't.
- * @param tween The Tween to check.
- */
- makeActive(tween: Phaser.Tweens.Tween): Phaser.Tweens.TweenManager;
-
- /**
- * Passes all Tweens to the given callback.
- * @param callback The function to call.
- * @param scope The scope (`this` object) to call the function with.
- * @param args The arguments to pass into the function. Its first argument will always be the Tween currently being iterated.
- */
- each(callback: Function, scope?: object, ...args: any[]): void;
-
- /**
- * Returns an array of all active Tweens and Timelines in the Tween Manager.
- */
- getAllTweens(): Phaser.Tweens.Tween[];
-
- /**
- * Returns the scale of the time delta for all Tweens and Timelines owned by this Tween Manager.
- */
- getGlobalTimeScale(): number;
-
- /**
- * Returns an array of all Tweens or Timelines in the Tween Manager which affect the given target or array of targets.
- * @param target The target to look for. Provide an array to look for multiple targets.
- */
- getTweensOf(target: object | any[]): Phaser.Tweens.Tween[];
-
- /**
- * Checks if the given object is being affected by a playing Tween.
- * @param target target Phaser.Tweens.Tween object
- */
- isTweening(target: object): boolean;
-
- /**
- * Stops all Tweens in this Tween Manager. They will be removed at the start of the frame.
- */
- killAll(): Phaser.Tweens.TweenManager;
-
- /**
- * Stops all Tweens which affect the given target or array of targets. The Tweens will be removed from the Tween Manager at the start of the frame.
- * @param target The target to look for. Provide an array to look for multiple targets.
- */
- killTweensOf(target: object | any[]): Phaser.Tweens.TweenManager;
-
- /**
- * Pauses all Tweens in this Tween Manager.
- */
- pauseAll(): Phaser.Tweens.TweenManager;
-
- /**
- * Resumes all Tweens in this Tween Manager.
- */
- resumeAll(): Phaser.Tweens.TweenManager;
-
- /**
- * Sets a new scale of the time delta for this Tween Manager.
- *
- * The time delta is the time elapsed between two consecutive frames and influences the speed of time for this Tween Manager and all Tweens it owns. Values higher than 1 increase the speed of time, while values smaller than 1 decrease it. A value of 0 freezes time and is effectively equivalent to pausing all Tweens.
- * @param value The new scale of the time delta, where 1 is the normal speed.
- */
- setGlobalTimeScale(value: number): Phaser.Tweens.TweenManager;
-
- /**
- * The Scene that owns this plugin is shutting down.
- * We need to kill and reset all internal properties as well as stop listening to Scene events.
- */
- shutdown(): void;
-
- /**
- * The Scene that owns this plugin is being destroyed.
- * We need to shutdown and then kill off all external references.
- */
- destroy(): void;
-
- }
-
namespace Builders {
/**
* Retrieves the value of the given key from an object.
@@ -85176,6 +86155,374 @@ declare namespace Phaser {
}
+ /**
+ * A Timeline combines multiple Tweens into one. Its overall behavior is otherwise similar to a single Tween.
+ *
+ * The Timeline updates all of its Tweens simultaneously. Its methods allow you to easily build a sequence
+ * of Tweens (each one starting after the previous one) or run multiple Tweens at once during given parts of the Timeline.
+ */
+ class Timeline extends Phaser.Events.EventEmitter {
+ /**
+ *
+ * @param manager The Tween Manager which owns this Timeline.
+ */
+ constructor(manager: Phaser.Tweens.TweenManager);
+
+ /**
+ * The Tween Manager which owns this Timeline.
+ */
+ manager: Phaser.Tweens.TweenManager;
+
+ /**
+ * A constant value which allows this Timeline to be easily identified as one.
+ */
+ isTimeline: boolean;
+
+ /**
+ * An array of Tween objects, each containing a unique property and target being tweened.
+ */
+ data: any[];
+
+ /**
+ * The cached size of the data array.
+ */
+ totalData: number;
+
+ /**
+ * If true then duration, delay, etc values are all frame totals, rather than ms.
+ */
+ useFrames: boolean;
+
+ /**
+ * Scales the time applied to this Timeline. A value of 1 runs in real-time. A value of 0.5 runs 50% slower, and so on.
+ * Value isn't used when calculating total duration of the Timeline, it's a run-time delta adjustment only.
+ */
+ timeScale: number;
+
+ /**
+ * Loop this Timeline? Can be -1 for an infinite loop, or an integer.
+ * When enabled it will play through ALL Tweens again (use Tween.repeat to loop a single tween)
+ */
+ loop: number;
+
+ /**
+ * Time in ms/frames before this Timeline loops.
+ */
+ loopDelay: number;
+
+ /**
+ * How many loops are left to run?
+ */
+ loopCounter: number;
+
+ /**
+ * Time in ms/frames before the 'onComplete' event fires. This never fires if loop = true (as it never completes)
+ */
+ completeDelay: number;
+
+ /**
+ * Countdown timer value, as used by `loopDelay` and `completeDelay`.
+ */
+ countdown: number;
+
+ /**
+ * The current state of the Timeline.
+ */
+ state: integer;
+
+ /**
+ * Does the Timeline start off paused? (if so it needs to be started with Timeline.play)
+ */
+ paused: boolean;
+
+ /**
+ * Elapsed time in ms/frames of this run through of the Timeline.
+ */
+ elapsed: number;
+
+ /**
+ * Total elapsed time in ms/frames of the entire Timeline, including looping.
+ */
+ totalElapsed: number;
+
+ /**
+ * Time in ms/frames for the whole Timeline to play through once, excluding loop amounts and loop delays.
+ */
+ duration: number;
+
+ /**
+ * Value between 0 and 1. The amount of progress through the Timeline, _excluding loops_.
+ */
+ progress: number;
+
+ /**
+ * Time in ms/frames for all Tweens in this Timeline to complete (including looping)
+ */
+ totalDuration: number;
+
+ /**
+ * Value between 0 and 1. The amount through the entire Timeline, including looping.
+ */
+ totalProgress: number;
+
+ /**
+ * An object containing the different Tween callback functions.
+ *
+ * You can either set these in the Tween config, or by calling the `Tween.setCallback` method.
+ *
+ * `onComplete` When the Timeline finishes playback fully or `Timeline.stop` is called. Never invoked if timeline is set to repeat infinitely.
+ * `onLoop` When a Timeline loops.
+ * `onStart` When the Timeline starts playing.
+ * `onUpdate` When a Timeline updates a child Tween.
+ * `onYoyo` When a Timeline starts a yoyo.
+ */
+ callbacks: object;
+
+ /**
+ * The context in which all callbacks are invoked.
+ */
+ callbackScope: any;
+
+ /**
+ * Internal method that will emit a Timeline based Event and invoke the given callback.
+ * @param event The Event to be dispatched.
+ * @param callback The callback to be invoked. Can be `null` or `undefined` to skip invocation.
+ */
+ dispatchTimelineEvent(event: Phaser.Types.Tweens.Event, callback: Function): void;
+
+ /**
+ * Sets the value of the time scale applied to this Timeline. A value of 1 runs in real-time.
+ * A value of 0.5 runs 50% slower, and so on.
+ *
+ * The value isn't used when calculating total duration of the tween, it's a run-time delta adjustment only.
+ * @param value The time scale value to set.
+ */
+ setTimeScale(value: number): this;
+
+ /**
+ * Gets the value of the time scale applied to this Timeline. A value of 1 runs in real-time.
+ * A value of 0.5 runs 50% slower, and so on.
+ */
+ getTimeScale(): number;
+
+ /**
+ * Check whether or not the Timeline is playing.
+ */
+ isPlaying(): boolean;
+
+ /**
+ * Creates a new Tween, based on the given Tween Config, and adds it to this Timeline.
+ * @param config The configuration object for the Tween.
+ */
+ add(config: Phaser.Types.Tweens.TweenBuilderConfig | object): this;
+
+ /**
+ * Adds an existing Tween to this Timeline.
+ * @param tween The Tween to be added to this Timeline.
+ */
+ queue(tween: Phaser.Tweens.Tween): this;
+
+ /**
+ * Checks whether a Tween has an offset value.
+ * @param tween The Tween to check.
+ */
+ hasOffset(tween: Phaser.Tweens.Tween): boolean;
+
+ /**
+ * Checks whether the offset value is a number or a directive that is relative to previous tweens.
+ * @param value The offset value to be evaluated.
+ */
+ isOffsetAbsolute(value: number): boolean;
+
+ /**
+ * Checks if the offset is a relative value rather than an absolute one.
+ * If the value is just a number, this returns false.
+ * @param value The offset value to be evaluated.
+ */
+ isOffsetRelative(value: string): boolean;
+
+ /**
+ * Parses the relative offset value, returning a positive or negative number.
+ * @param value The relative offset, in the format of '-=500', for example. The first character determines whether it will be a positive or negative number. Spacing matters here.
+ * @param base The value to use as the offset.
+ */
+ getRelativeOffset(value: string, base: number): number;
+
+ /**
+ * Calculates the total duration of the timeline.
+ *
+ * Computes all tween durations and returns the full duration of the timeline.
+ *
+ * The resulting number is stored in the timeline, not as a return value.
+ */
+ calcDuration(): void;
+
+ /**
+ * Initializes the timeline, which means all Tweens get their init() called, and the total duration will be computed.
+ * Returns a boolean indicating whether the timeline is auto-started or not.
+ */
+ init(): boolean;
+
+ /**
+ * Resets all of the timeline's tweens back to their initial states.
+ * The boolean parameter indicates whether tweens that are looping should reset as well, or not.
+ * @param resetFromLoop If `true`, resets all looping tweens to their initial values.
+ */
+ resetTweens(resetFromLoop: boolean): void;
+
+ /**
+ * Sets a callback for the Timeline.
+ * @param type The internal type of callback to set.
+ * @param callback Timeline allows multiple tweens to be linked together to create a streaming sequence.
+ * @param params The parameters to pass to the callback.
+ * @param scope The context scope of the callback.
+ */
+ setCallback(type: string, callback: Function, params?: any[], scope?: object): this;
+
+ /**
+ * Passed a Tween to the Tween Manager and requests it be made active.
+ * @param tween The tween object to make active.
+ */
+ makeActive(tween: Phaser.Tweens.Tween): Phaser.Tweens.TweenManager;
+
+ /**
+ * Starts playing the Timeline.
+ */
+ play(): void;
+
+ /**
+ * Updates the Timeline's `state` and fires callbacks and events.
+ */
+ nextState(): void;
+
+ /**
+ * Returns 'true' if this Timeline has finished and should be removed from the Tween Manager.
+ * Otherwise, returns false.
+ * @param timestamp The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
+ * @param delta The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.
+ */
+ update(timestamp: number, delta: number): boolean;
+
+ /**
+ * Stops the Timeline immediately, whatever stage of progress it is at and flags it for removal by the TweenManager.
+ */
+ stop(): void;
+
+ /**
+ * Pauses the Timeline, retaining its internal state.
+ *
+ * Calling this on a Timeline that is already paused has no effect and fires no event.
+ */
+ pause(): this;
+
+ /**
+ * Resumes a paused Timeline from where it was when it was paused.
+ *
+ * Calling this on a Timeline that isn't paused has no effect and fires no event.
+ */
+ resume(): this;
+
+ /**
+ * Checks if any of the Tweens in this Timeline as operating on the target object.
+ *
+ * Returns `false` if no Tweens operate on the target object.
+ * @param target The target to check all Tweens against.
+ */
+ hasTarget(target: object): boolean;
+
+ /**
+ * Stops all the Tweens in the Timeline immediately, whatever stage of progress they are at and flags
+ * them for removal by the TweenManager.
+ */
+ destroy(): void;
+
+ }
+
+ /**
+ * TweenData state.
+ */
+ var CREATED: integer;
+
+ /**
+ * TweenData state.
+ */
+ var INIT: integer;
+
+ /**
+ * TweenData state.
+ */
+ var DELAY: integer;
+
+ /**
+ * TweenData state.
+ */
+ var OFFSET_DELAY: integer;
+
+ /**
+ * TweenData state.
+ */
+ var PENDING_RENDER: integer;
+
+ /**
+ * TweenData state.
+ */
+ var PLAYING_FORWARD: integer;
+
+ /**
+ * TweenData state.
+ */
+ var PLAYING_BACKWARD: integer;
+
+ /**
+ * TweenData state.
+ */
+ var HOLD_DELAY: integer;
+
+ /**
+ * TweenData state.
+ */
+ var REPEAT_DELAY: integer;
+
+ /**
+ * TweenData state.
+ */
+ var COMPLETE: integer;
+
+ /**
+ * Tween state.
+ */
+ var PENDING_ADD: integer;
+
+ /**
+ * Tween state.
+ */
+ var PAUSED: integer;
+
+ /**
+ * Tween state.
+ */
+ var LOOP_DELAY: integer;
+
+ /**
+ * Tween state.
+ */
+ var ACTIVE: integer;
+
+ /**
+ * Tween state.
+ */
+ var COMPLETE_DELAY: integer;
+
+ /**
+ * Tween state.
+ */
+ var PENDING_REMOVE: integer;
+
+ /**
+ * Tween state.
+ */
+ var REMOVED: integer;
+
/**
* A Tween is able to manipulate the properties of one or more objects to any given value, based
* on a duration and type of ease. They are rarely instantiated directly and instead should be
@@ -85588,101 +86935,206 @@ declare namespace Phaser {
function TweenData(target: any, index: integer, key: string, getEnd: Function, getStart: Function, getActive: Function, ease: Function, delay: number, duration: number, yoyo: boolean, hold: number, repeat: number, repeatDelay: number, flipX: boolean, flipY: boolean): Phaser.Types.Tweens.TweenDataConfig;
/**
- * TweenData state.
+ * The Tween Manager is a default Scene Plugin which controls and updates Tweens and Timelines.
*/
- var CREATED: integer;
+ class TweenManager {
+ /**
+ *
+ * @param scene The Scene which owns this Tween Manager.
+ */
+ constructor(scene: Phaser.Scene);
- /**
- * TweenData state.
- */
- var INIT: integer;
+ /**
+ * The Scene which owns this Tween Manager.
+ */
+ scene: Phaser.Scene;
- /**
- * TweenData state.
- */
- var DELAY: integer;
+ /**
+ * The Systems object of the Scene which owns this Tween Manager.
+ */
+ systems: Phaser.Scenes.Systems;
- /**
- * TweenData state.
- */
- var OFFSET_DELAY: integer;
+ /**
+ * The time scale of the Tween Manager.
+ *
+ * This value scales the time delta between two frames, thus influencing the speed of time for all Tweens owned by this Tween Manager.
+ */
+ timeScale: number;
- /**
- * TweenData state.
- */
- var PENDING_RENDER: integer;
+ /**
+ * Create a Tween Timeline and return it, but do NOT add it to the active or pending Tween lists.
+ * @param config The configuration object for the Timeline and its Tweens.
+ */
+ createTimeline(config?: Phaser.Types.Tweens.TimelineBuilderConfig): Phaser.Tweens.Timeline;
- /**
- * TweenData state.
- */
- var PLAYING_FORWARD: integer;
+ /**
+ * Create a Tween Timeline and add it to the active Tween list/
+ * @param config The configuration object for the Timeline and its Tweens.
+ */
+ timeline(config?: Phaser.Types.Tweens.TimelineBuilderConfig): Phaser.Tweens.Timeline;
- /**
- * TweenData state.
- */
- var PLAYING_BACKWARD: integer;
+ /**
+ * Create a Tween and return it, but do NOT add it to the active or pending Tween lists.
+ * @param config The configuration object for the Tween.
+ */
+ create(config: Phaser.Types.Tweens.TweenBuilderConfig | object): Phaser.Tweens.Tween;
- /**
- * TweenData state.
- */
- var HOLD_DELAY: integer;
+ /**
+ * Create a Tween and add it to the active Tween list.
+ * @param config The configuration object for the Tween.
+ */
+ add(config: Phaser.Types.Tweens.TweenBuilderConfig | object): Phaser.Tweens.Tween;
- /**
- * TweenData state.
- */
- var REPEAT_DELAY: integer;
+ /**
+ * Add an existing tween into the active Tween list.
+ * @param tween The Tween to add.
+ */
+ existing(tween: Phaser.Tweens.Tween): Phaser.Tweens.TweenManager;
- /**
- * TweenData state.
- */
- var COMPLETE: integer;
+ /**
+ * Create a Number Tween and add it to the active Tween list.
+ * @param config The configuration object for the Number Tween.
+ */
+ addCounter(config: Phaser.Types.Tweens.NumberTweenBuilderConfig): Phaser.Tweens.Tween;
- /**
- * Tween state.
- */
- var PENDING_ADD: integer;
+ /**
+ * Creates a Stagger function to be used by a Tween property.
+ *
+ * The stagger function will allow you to stagger changes to the value of the property across all targets of the tween.
+ *
+ * This is only worth using if the tween has multiple targets.
+ *
+ * The following will stagger the delay by 100ms across all targets of the tween, causing them to scale down to 0.2
+ * over the duration specified:
+ *
+ * ```javascript
+ * this.tweens.add({
+ * targets: [ ... ],
+ * scale: 0.2,
+ * ease: 'linear',
+ * duration: 1000,
+ * delay: this.tweens.stagger(100)
+ * });
+ * ```
+ *
+ * The following will stagger the delay by 500ms across all targets of the tween using a 10 x 6 grid, staggering
+ * from the center out, using a cubic ease.
+ *
+ * ```javascript
+ * this.tweens.add({
+ * targets: [ ... ],
+ * scale: 0.2,
+ * ease: 'linear',
+ * duration: 1000,
+ * delay: this.tweens.stagger(500, { grid: [ 10, 6 ], from: 'center', ease: 'cubic.out' })
+ * });
+ * ```
+ * @param config The configuration object for the Stagger function.
+ */
+ stagger(config: Phaser.Types.Tweens.StaggerConfig): Function;
- /**
- * Tween state.
- */
- var PAUSED: integer;
+ /**
+ * Updates the Tween Manager's internal lists at the start of the frame.
+ *
+ * This method will return immediately if no changes have been indicated.
+ */
+ preUpdate(): void;
- /**
- * Tween state.
- */
- var LOOP_DELAY: integer;
+ /**
+ * Updates all Tweens and Timelines of the Tween Manager.
+ * @param timestamp The current time in milliseconds.
+ * @param delta The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.
+ */
+ update(timestamp: number, delta: number): void;
- /**
- * Tween state.
- */
- var ACTIVE: integer;
+ /**
+ * Removes the given tween from the Tween Manager, regardless of its state (pending or active).
+ * @param tween The Tween to be removed.
+ */
+ remove(tween: Phaser.Tweens.Tween): Phaser.Tweens.TweenManager;
- /**
- * Tween state.
- */
- var COMPLETE_DELAY: integer;
+ /**
+ * Checks if a Tween or Timeline is active and adds it to the Tween Manager at the start of the frame if it isn't.
+ * @param tween The Tween to check.
+ */
+ makeActive(tween: Phaser.Tweens.Tween): Phaser.Tweens.TweenManager;
- /**
- * Tween state.
- */
- var PENDING_REMOVE: integer;
+ /**
+ * Passes all Tweens to the given callback.
+ * @param callback The function to call.
+ * @param scope The scope (`this` object) to call the function with.
+ * @param args The arguments to pass into the function. Its first argument will always be the Tween currently being iterated.
+ */
+ each(callback: Function, scope?: object, ...args: any[]): void;
- /**
- * Tween state.
- */
- var REMOVED: integer;
+ /**
+ * Returns an array of all active Tweens and Timelines in the Tween Manager.
+ */
+ getAllTweens(): Phaser.Tweens.Tween[];
+
+ /**
+ * Returns the scale of the time delta for all Tweens and Timelines owned by this Tween Manager.
+ */
+ getGlobalTimeScale(): number;
+
+ /**
+ * Returns an array of all Tweens or Timelines in the Tween Manager which affect the given target or array of targets.
+ * @param target The target to look for. Provide an array to look for multiple targets.
+ */
+ getTweensOf(target: object | any[]): Phaser.Tweens.Tween[];
+
+ /**
+ * Checks if the given object is being affected by a playing Tween.
+ * @param target target Phaser.Tweens.Tween object
+ */
+ isTweening(target: object): boolean;
+
+ /**
+ * Stops all Tweens in this Tween Manager. They will be removed at the start of the frame.
+ */
+ killAll(): Phaser.Tweens.TweenManager;
+
+ /**
+ * Stops all Tweens which affect the given target or array of targets. The Tweens will be removed from the Tween Manager at the start of the frame.
+ * @param target The target to look for. Provide an array to look for multiple targets.
+ */
+ killTweensOf(target: object | any[]): Phaser.Tweens.TweenManager;
+
+ /**
+ * Pauses all Tweens in this Tween Manager.
+ */
+ pauseAll(): Phaser.Tweens.TweenManager;
+
+ /**
+ * Resumes all Tweens in this Tween Manager.
+ */
+ resumeAll(): Phaser.Tweens.TweenManager;
+
+ /**
+ * Sets a new scale of the time delta for this Tween Manager.
+ *
+ * The time delta is the time elapsed between two consecutive frames and influences the speed of time for this Tween Manager and all Tweens it owns. Values higher than 1 increase the speed of time, while values smaller than 1 decrease it. A value of 0 freezes time and is effectively equivalent to pausing all Tweens.
+ * @param value The new scale of the time delta, where 1 is the normal speed.
+ */
+ setGlobalTimeScale(value: number): Phaser.Tweens.TweenManager;
+
+ /**
+ * The Scene that owns this plugin is shutting down.
+ * We need to kill and reset all internal properties as well as stop listening to Scene events.
+ */
+ shutdown(): void;
+
+ /**
+ * The Scene that owns this plugin is being destroyed.
+ * We need to shutdown and then kill off all external references.
+ */
+ destroy(): void;
+
+ }
}
namespace Utils {
- /**
- * A NOOP (No Operation) callback function.
- *
- * Used internally by Phaser when it's more expensive to determine if a callback exists
- * than it is to just invoke an empty function.
- */
- function NOOP(): void;
-
namespace Array {
/**
* Adds the given item, or array of items, to the array.
@@ -85817,6 +87269,84 @@ declare namespace Phaser {
*/
function GetRandom(array: any[], startIndex?: integer, length?: integer): any;
+ namespace Matrix {
+ /**
+ * Checks if an array can be used as a matrix.
+ *
+ * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) have the same length. There must be at least two rows:
+ *
+ * ```
+ * [
+ * [ 1, 1, 1, 1, 1, 1 ],
+ * [ 2, 0, 0, 0, 0, 4 ],
+ * [ 2, 0, 1, 2, 0, 4 ],
+ * [ 2, 0, 3, 4, 0, 4 ],
+ * [ 2, 0, 0, 0, 0, 4 ],
+ * [ 3, 3, 3, 3, 3, 3 ]
+ * ]
+ * ```
+ * @param matrix The array to check.
+ */
+ function CheckMatrix(matrix?: T[][]): boolean;
+
+ /**
+ * Generates a string (which you can pass to console.log) from the given Array Matrix.
+ * @param matrix A 2-dimensional array.
+ */
+ function MatrixToString(matrix?: T[][]): string;
+
+ /**
+ * Reverses the columns in the given Array Matrix.
+ * @param matrix The array matrix to reverse the columns for.
+ */
+ function ReverseColumns(matrix?: T[][]): T[][];
+
+ /**
+ * Reverses the rows in the given Array Matrix.
+ * @param matrix The array matrix to reverse the rows for.
+ */
+ function ReverseRows(matrix?: T[][]): T[][];
+
+ /**
+ * Rotates the array matrix 180 degrees.
+ * @param matrix The array to rotate.
+ */
+ function Rotate180(matrix?: T[][]): T[][];
+
+ /**
+ * Rotates the array matrix to the left (or 90 degrees)
+ * @param matrix The array to rotate.
+ */
+ function RotateLeft(matrix?: T[][]): T[][];
+
+ /**
+ * Rotates the array matrix based on the given rotation value.
+ *
+ * The value can be given in degrees: 90, -90, 270, -270 or 180,
+ * or a string command: `rotateLeft`, `rotateRight` or `rotate180`.
+ *
+ * Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}.
+ * @param matrix The array to rotate.
+ * @param direction The amount to rotate the matrix by. Default 90.
+ */
+ function RotateMatrix(matrix?: T[][], direction?: number | string): T[][];
+
+ /**
+ * Rotates the array matrix to the left (or -90 degrees)
+ * @param matrix The array to rotate.
+ */
+ function RotateRight(matrix?: T[][]): T[][];
+
+ /**
+ * Transposes the elements of the given matrix (array of arrays).
+ *
+ * The transpose of a matrix is a new matrix whose rows are the columns of the original.
+ * @param array The array matrix to transpose.
+ */
+ function TransposeMatrix(array?: T[][]): T[][];
+
+ }
+
/**
* Moves the given array element down one place in the array.
* The array is modified in-place.
@@ -86081,84 +87611,6 @@ declare namespace Phaser {
*/
function Swap(array: any[], item1: any, item2: any): any[];
- namespace Matrix {
- /**
- * Checks if an array can be used as a matrix.
- *
- * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) have the same length. There must be at least two rows:
- *
- * ```
- * [
- * [ 1, 1, 1, 1, 1, 1 ],
- * [ 2, 0, 0, 0, 0, 4 ],
- * [ 2, 0, 1, 2, 0, 4 ],
- * [ 2, 0, 3, 4, 0, 4 ],
- * [ 2, 0, 0, 0, 0, 4 ],
- * [ 3, 3, 3, 3, 3, 3 ]
- * ]
- * ```
- * @param matrix The array to check.
- */
- function CheckMatrix(matrix?: T[][]): boolean;
-
- /**
- * Generates a string (which you can pass to console.log) from the given Array Matrix.
- * @param matrix A 2-dimensional array.
- */
- function MatrixToString(matrix?: T[][]): string;
-
- /**
- * Reverses the columns in the given Array Matrix.
- * @param matrix The array matrix to reverse the columns for.
- */
- function ReverseColumns(matrix?: T[][]): T[][];
-
- /**
- * Reverses the rows in the given Array Matrix.
- * @param matrix The array matrix to reverse the rows for.
- */
- function ReverseRows(matrix?: T[][]): T[][];
-
- /**
- * Rotates the array matrix 180 degrees.
- * @param matrix The array to rotate.
- */
- function Rotate180(matrix?: T[][]): T[][];
-
- /**
- * Rotates the array matrix to the left (or 90 degrees)
- * @param matrix The array to rotate.
- */
- function RotateLeft(matrix?: T[][]): T[][];
-
- /**
- * Rotates the array matrix based on the given rotation value.
- *
- * The value can be given in degrees: 90, -90, 270, -270 or 180,
- * or a string command: `rotateLeft`, `rotateRight` or `rotate180`.
- *
- * Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}.
- * @param matrix The array to rotate.
- * @param direction The amount to rotate the matrix by. Default 90.
- */
- function RotateMatrix(matrix?: T[][], direction?: number | string): T[][];
-
- /**
- * Rotates the array matrix to the left (or -90 degrees)
- * @param matrix The array to rotate.
- */
- function RotateRight(matrix?: T[][]): T[][];
-
- /**
- * Transposes the elements of the given matrix (array of arrays).
- *
- * The transpose of a matrix is a new matrix whose rows are the columns of the original.
- * @param array The array matrix to transpose.
- */
- function TransposeMatrix(array?: T[][]): T[][];
-
- }
-
}
namespace Base64 {
@@ -86181,6 +87633,14 @@ declare namespace Phaser {
}
+ /**
+ * A NOOP (No Operation) callback function.
+ *
+ * Used internally by Phaser when it's more expensive to determine if a callback exists
+ * than it is to just invoke an empty function.
+ */
+ function NOOP(): void;
+
namespace Objects {
/**
* Shallow Object Clone. Will not clone nested objects.
@@ -86381,6 +87841,12 @@ declare namespace Phaser {
*/
function Reverse(string: string): string;
+ /**
+ * Capitalizes the first letter of a string if there is one.
+ * @param str The string to capitalize.
+ */
+ function UppercaseFirst(str: string): string;
+
/**
* Creates and returns an RFC4122 version 4 compliant UUID.
*
@@ -86389,12 +87855,6 @@ declare namespace Phaser {
*/
function UUID(): string;
- /**
- * Capitalizes the first letter of a string if there is one.
- * @param str The string to capitalize.
- */
- function UppercaseFirst(str: string): string;
-
}
}
@@ -87296,66 +88756,6 @@ declare type ArcadePhysicsCallback = (object1: Phaser.GameObjects.GameObject, ob
declare type CollideCallback = (body: Phaser.Physics.Impact.Body, other: Phaser.Physics.Impact.Body, axis: string)=>void;
-declare namespace MatterJS {
- /**
- * The `Matter.Body` module contains methods for creating and manipulating body models.
- * A `Matter.Body` is a rigid body that can be simulated by a `Matter.Engine`.
- * Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the module `Matter.Bodies`.
- */
- class Body {
- }
-
- /**
- * The `Matter.Bodies` module contains factory methods for creating rigid body models
- * with commonly used body configurations (such as rectangles, circles and other polygons).
- */
- class Bodies {
- }
-
- /**
- * The `Matter.Composite` module contains methods for creating and manipulating composite bodies.
- * A composite body is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`, therefore composites form a tree structure.
- * It is important to use the functions in this module to modify composites, rather than directly modifying their properties.
- * Note that the `Matter.World` object is also a type of `Matter.Composite` and as such all composite methods here can also operate on a `Matter.World`.
- */
- class Composite {
- }
-
- /**
- * The `Matter.World` module contains methods for creating and manipulating the world composite.
- * A `Matter.World` is a `Matter.Composite` body, which is a collection of `Matter.Body`, `Matter.Constraint` and other `Matter.Composite`.
- * A `Matter.World` has a few additional properties including `gravity` and `bounds`.
- * It is important to use the functions in the `Matter.Composite` module to modify the world composite, rather than directly modifying its properties.
- * There are also a few methods here that alias those in `Matter.Composite` for easier readability.
- */
- class World extends MatterJS.Composite {
- }
-
- /**
- * The `Matter.Constraint` module contains methods for creating and manipulating constraints.
- * Constraints are used for specifying that a fixed distance must be maintained between two bodies (or a body and a fixed world-space position).
- * The stiffness of constraints can be modified to create springs or elastic.
- */
- class Constraint {
- }
-
- /**
- * The `Matter.Engine` module contains methods for creating and manipulating engines.
- * An engine is a controller that manages updating the simulation of the world.
- */
- class Engine {
- }
-
- /**
- * The `Matter.Vertices` module contains methods for creating and manipulating sets of vertices.
- * A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`.
- * A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull).
- */
- class Vertices {
- }
-
-}
-
declare type WebGLContextCallback = (renderer: Phaser.Renderer.WebGL.WebGLRenderer)=>void;
declare type EachListCallback = (item: I, ...args: any[])=>void;
@@ -87366,14 +88766,14 @@ declare type EachSetCallback = (entry: E, index: number)=>void;
declare type EachTextureCallback = (texture: Phaser.Textures.Texture, ...args: any[])=>void;
-declare type TilemapFilterCallback = (value: Phaser.GameObjects.GameObject, index: number, array: Phaser.GameObjects.GameObject[])=>void;
-
-declare type TilemapFindCallback = (value: Phaser.GameObjects.GameObject, index: number, array: Phaser.GameObjects.GameObject[])=>void;
-
declare type FindTileCallback = (value: Phaser.Tilemaps.Tile, index: integer, array: Phaser.Tilemaps.Tile[])=>void;
declare type EachTileCallback = (value: Phaser.Tilemaps.Tile, index: integer, array: Phaser.Tilemaps.Tile[])=>void;
+declare type TilemapFilterCallback = (value: Phaser.GameObjects.GameObject, index: number, array: Phaser.GameObjects.GameObject[])=>void;
+
+declare type TilemapFindCallback = (value: Phaser.GameObjects.GameObject, index: number, array: Phaser.GameObjects.GameObject[])=>void;
+
/**
* Extends the given `myClass` object's prototype with the properties of `definition`.
* @param ctor The constructor object to mix into.