diff --git a/.eslintignore b/.eslintignore
index e1bf90151..1b84fb0bf 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -8,3 +8,12 @@ src/geom/polygon/Earcut.js
src/utils/array/StableSort.js
src/utils/object/Extend.js
src/structs/RTree.js
+src/dom/_ScaleManager.js
+src/dom/VisualBounds.js
+plugins/spine/src/spine-canvas.js
+plugins/spine/src/spine-webgl.js
+webpack.*
+webpack.config.js
+webpack.dist.config.js
+webpack.fb.config.js
+webpack.fb.dist.config.js
diff --git a/.eslintrc.json b/.eslintrc.json
index d0b2f6f52..f0680fd43 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -16,7 +16,8 @@
"CANVAS_RENDERER": true,
"Phaser": true,
"process": true,
- "ActiveXObject": true
+ "ActiveXObject": true,
+ "FBInstant": true
},
"rules": {
@@ -71,7 +72,8 @@
"eol-last": [ "error" ],
"func-call-spacing": [ "error", "never" ],
"indent": [ "error", 4, { "SwitchCase": 1 } ],
- "key-spacing": [ "error", { "beforeColon": false, "afterColon": true }],
+ "key-spacing": [ "error", { "beforeColon": false, "afterColon": true } ],
+ "keyword-spacing": [ "error", { "after": true } ],
"linebreak-style": [ "off" ],
"lines-around-comment": [ "error", { "beforeBlockComment": true, "afterBlockComment": false, "beforeLineComment": true, "afterLineComment": false, "allowBlockStart": true, "allowBlockEnd": false, "allowObjectStart": true, "allowArrayStart": true }],
"new-parens": "error",
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
deleted file mode 100644
index e49c20e2f..000000000
--- a/.github/ISSUE_TEMPLATE.md
+++ /dev/null
@@ -1,9 +0,0 @@
-This repo is for Phaser 3 related issues only. If you've found an issue with Phaser 2 please see the [Phaser CE (Community Edition)](https://github.com/photonstorm/phaser-ce) repo instead.
-
-This should not be used for technical support. If you're struggling trying to use Phaser then post your question to the [forum](http://www.html5gamedevs.com/forum/33-phaser-3/), [Slack](https://phaser.io/community/slack) or [Discord](https://phaser.io/community/discord) channels. GitHub Issues are for bugs and feature requests only.
-
-API errors must include example code showing what happens, and why you don't believe this is the expected behavior. Issues posted without code take _far_ longer to get resolved, _if ever_. Feel free to use a site such as jsBin or [CodePen](https://codepen.io/pen?template=YeEWom) to demo the problem. If we can run it, and see the error, we can usually fix it.
-
-If your Issue contains _any_ form of hostility it will be instantly closed and you will be blocked from access to all our repos.
-
-**Be nice. We do this for free.**
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 000000000..c49b33b07
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,59 @@
+---
+name: "\U0001F41B Bug Report"
+about: Report a bug found while using Phaser 3
+
+---
+
+
+
+
+## Version
+
+* Phaser Version:
+
+* Operating system:
+
+* Browser:
+
+
+## Description
+
+
+
+
+## Example Test Code
+
+
+
+
+## Additional Information
+
+
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 000000000..1c8b87f18
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,15 @@
+---
+name: "\U0001F389 Feature Request"
+about: Share an idea about a feature you'd like to see in Phaser
+
+---
+
+**We're constantly trying to make Phaser 3 better**
+
+So we'd love to hear about feature requests for the v3 API. Screenshots, example code or links to blog posts / other APIs are encouraged.
+
+Please try and keep the requests sensible. We will only keep those we feel are within our abilities to add to Phaser, or that are a good fit for our API.
+
+**[Optional] Do you want to help provide this feature?**
+
+If you would like to get involved in helping build the feature, please let us know. We can then discuss implementation with you and the best way to approach it. Again, screenshots or mockups are really useful.
diff --git a/.github/no-response.yml b/.github/no-response.yml
new file mode 100644
index 000000000..cfbe92445
--- /dev/null
+++ b/.github/no-response.yml
@@ -0,0 +1,14 @@
+# Configuration for no-response - https://github.com/probot/no-response
+
+# Number of days of inactivity before an Issue is closed for lack of response
+daysUntilClose: 30
+# Label requiring a response
+# TODO: also close `needs-reproduction` issues (blocked by https://github.com/probot/no-response/issues/11)
+responseRequiredLabel: 🤷♂️ More info needed
+# Comment to post when closing an issue due to lack of response.
+closeComment: >
+Thank you for taking time to open this issue.
+
+We haven’t gotten a response to our questions above. With the details currently given in the issue we don’t have enough information to take action.
+
+So we’re going to close this issue. We can re-open it if you find the time to provide the information we need.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ea4dddb42..c31b8a6df 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,10 +1,842 @@
# Change Log
-## Version 3.11.0 - Leafa - in development
+## Version 3.16.0 - Ishikawa - in development
+
+### Facebook Instant Games Updates and Fixes
+
+* Added the `Leaderboard.getConnectedScores` method, to get a list of scores from player connected entries.
+* The `loadPlayerPhoto` function in the Instant Games plugin now listens for the updated Loader event correctly, causing the `photocomplete` event to fire properly.
+* `Leaderboard.setScore` now emits the LeaderboardScore object with the `setscore` event, as the documentation said it did.
+* `Leaderboard.getPlayerScore` now only populates the `playerScore` property if the entry isn't `null`.
+* If the `setScore` or `getPlayerScore` calls fail, it will return `null` as the score instance, instead of causing a run-time error.
+* You can now pass an object or a string to `setScore` and objects will be automatically stringified.
+* The `preloadAds` method will now only create an AdInstance object if the interstitial `loadSync` promise resolves.
+* The `preloadVideoAds` method will now only create an AdInstance object if the interstitial `loadSync` promise resolves.
+* The `preloadAds` method will now emit the `adsnofill` event, if there are no ads in the inventory to load.
+* The `preloadVideoAds` method will now emit the `adsnofill` event, if there are no ads in the inventory to load.
+* The `showAd` method will now emit the `adsnotloaded` event, if there are no ads loaded matching the given Placement ID.
+* The `showVideo` method will now emit the `adsnotloaded` event, if there are no ads loaded matching the given Placement ID.
+* Showing an ad will emit the `adfinished` event when the ad is closed, previously this event was called `showad` but the new name better reflects what has happened.
+* The Facebook Plugin is now available in the `Phaser.Scene` class template under the `facebook` property (thanks @bryanwood)
+
+### Keyboard Input - New Features
+
+The specificity of the Keyboard events has been changed to allow you more control over event handling. Previously, the Keyboard Plugin would emit the global `keydown_CODE` event first (where CODE was a keycode string, like `keydown_A`), then it would emit the global `keydown` event. In previous versions, `Key` objects, created via `this.input.keyboard.addKey()`, didn't emit events.
+
+The `Key` class now extends EventEmitter and emits two new events directly: `down` and `up`. This means you can listen for an event from a Key you've created, i.e.: `yourKey.on('up', handler)`.
+
+The order has also now changed. If it exists, the Key object will dispatch its `down` event first. Then the Keyboard Plugin will dispatch `keydown_CODE` and finally the least specific of them all, `keydown` will be dispatched.
+
+You also now have the ability to cancel this at any stage either on a local or global level. All events handlers are sent an event object which you can call `event.stopImmediatePropagation()` on. This will immediately stop any further listeners from being invoked in the current Scene. Therefore, if you call `stopImmediatePropagation()` in the `Key.on` handler, then the Keyboard Plugin will not emit either the `keydown_CODE` or `keydown` global events. You can also call `stopImmediatePropagation()` during the `keydown_CODE` handler, to stop it reaching the global `keydown` handler. As `keydown` is last, calling it there has no effect.
+
+There is also the `stopPropagation()` function. This works in the same way as `stopImmediatePropagation` but instead of being local, it works across all of the Scenes in your game. For example, if you had 3 active Scenes (A, B and C, with A at the top of the Scene list), all listening for the same key, calling `stopPropagation()` in Scene A would stop the event from reaching any handlers in Scenes B or C. Remember that events flow down the Scene list from top to bottom. So, the top-most rendering Scene in the Scene list has priority over any Scene below it.
+
+All the above also works for `keyup` events.
+
+New in 3.16 is the ability to receive a global `keydown` or `keyup` event from any key on the keyboard. Previously, it would only emit the event if it came from one of the keys listed in the KeyCodes file. Now, those global events will fire for any key, regardless of location.
+
+#### Keyboard Captures
+
+Key capturing is the way in which you stop a keyboard DOM event from activating anything else in the browser by calling `preventDefault` on it. For example, in tall web pages, pressing the SPACE BAR causes the page to scroll down. Obviously, if this is also the fire or jump button in your game, you don't want this to happen. So the key needs to be 'captured' to prevent it. Equally, you may wish to also capture the arrow keys, for similar reasons. Key capturing is done on a global level. If you set-up the capture of a key in one Scene, it will be captured globally across the whole game.
+
+In 3.16 you now do this using the new `KeyboardPlugin.addCapture` method. This takes keycodes as its argument. You can either pass in a single key code (i.e. 32 for the Space Bar), an array of key codes, or a comma-delimited string - in which case the string is parsed and each code it can work out is captured.
+
+To remove a capture you can use the `KeyboardPlugin.removeCapture` method, which takes the same style arguments as adding captures. To clear all captures call `KeyboardPlugin.clearCaptures`. Again, remember that these actions are global.
+
+You can also temporarily enable and disable capturing using `KeyboardPlugin.enableGlobalCapture` and `KeyboardPlugin.disableGlobalCapture`. This means if you set-up a bunch of key captures, but then need to disable them all for a while (perhaps you swap focus to a DOM text field), you can call `disableGlobalCapture` to do this, and when finished in the DOM you can enable captures again with `enableGlobalCapture`, without having to clear and re-create them all.
+
+Default captures can be defined in the Game Config in the `input.keyboard.captures` object. The captures are actually stored in the `KeyboardManager` class. The `KeyboardPlugin` is just a proxy to methods in the Keyboard Manager, but is how you should interface with it.
+
+* `KeyboardPlugin.addCapture` is a new method that allows you to define a set of keycodes to have the default browser behaviors disabled on.
+* `KeyboardPlugin.removeCapture` is a new method that removes specific previously set key captures.
+* `KeyboardPlugin.clearCaptures` is a new method that removes all key captures.
+* `KeyboardPlugin.getCaptures` is a new method that returns an array of all current key captures.
+* `KeyboardPlugin.enableGlobalCapture` is a new method that enables any key captures that have been created.
+* `KeyboardPlugin.disableGlobalCapture` is a new method that disables any key captures that have been created, without removing them from the captures list.
+* `KeyboardPlugin.addKey` has a new boolean argument `enableCapture`, which is true by default, that will add a key capture for the Key being created.
+* `KeyboardPlugin.addKeys` has a new boolean argument `enableCapture`, which is true by default, that will add a key capture for any Key created by the method.
+
+#### Other Keyboard Updates and Fixes
+
+* There is a new class called `KeyboardManager`. This class is created by the global Input Manager, if keyboard access has been enabled in the Game config. It's responsible for handling all browser keyboard events. Previously, the `KeyboardPlugin` did this. Which meant that every Scene that had its own Keyboard Plugin was binding more native keyboard events. This was causing problems with parallel Scenes when needing to capture keys. the `KeyboardPlugin` class still exists, and is still the main point of interface when you call `this.input.keyboard` in a Scene, but DOM event handling responsibility has been taken away from it. This means there's no only
+one set of bindings ever created, which makes things a lot cleaner.
+* There is a new Game and Scene Config setting `input.keyboard.capture` which is an array of KeyCodes that the Keyboard Plugin will capture all non-modified key events on. By default it is empty. You can populate it in the config, or use the new capture methods.
+* The Keyboard Manager will now call `preventDefault` only on non-modified key presses, stopping the keyboard event from hitting the browser. Previously, capturing the R key, for example, would block a CTRL+R page reload, but it now ignores it because of the key modifier.
+* `Key.emitOnRepeat` is a new boolean property that controls if the Key will continuously emit a `down` event while being held down (true), or emit the event just once, on first press, and then skip future events (false).
+* `Key.setEmitOnRepeat` is a new chainable method for setting the `emitOnRepeat` property.
+* The `KeyboardPlugin.addKeys` method has a new optional boolean `emitOnRepeat` which sets that property on all Key objects it creates as part of the call. It defaults to `false`.
+* The `KeyboardPlugin.addKey` method has a new optional boolean `emitOnRepeat` which sets that property on the Key object it creates. It defaults to `false`.
+* The `Key` class now extends EventEmitter and emits two events directly: `down` and `up`. This means you can listen for an event from a Key you've created, i.e.: `yourKey.on('up', handler)`.
+* The following Key Codes have been added, which include some missing alphabet letters in Persian and Arabic: `SEMICOLON_FIREFOX`, `COLON`, `COMMA_FIREFOX_WINDOWS`, `COMMA_FIREFOX`, `BRACKET_RIGHT_FIREFOX` and `BRACKET_LEFT_FIREFOX` (thanks @wmateam)
+* `Key.onDown` is a new method that handles the Key being pressed down, including down repeats.
+* `Key.onUp` is a new method that handles the Key being released.
+* `Key.destroy` is a new method that handles Key instance destruction. It is called automatically in `KeyboardPlugin.destroy`.
+* The `Key.preventDefault` property has been removed. This is now handled by the global keyboard capture methods.
+* `Key.metaKey` is a new boolean property which indicates if the Meta Key was held down when the Key was pressed. On a Mac the Meta Key is Command. On a Windows keyboard, it's the Windows key.
+* `InputManager.keyboard` is a new property that instantiates the global Keyboard Manager, if enabled in the game config.
+* The `KeyboardPlugin.addKey` method has a new boolean property `enableCapture` which automatically prevents default on the Key being created.
+* The `KeyboardPlugin.addKeys` method has a new boolean property `enableCapture` which automatically prevents default on Keys being created.
+* `Phaser.Input.Keyboard.ProcessKeyDown` has been removed as it's no longer required, `Key.onDown` handles it instead.
+* `Phaser.Input.Keyboard.ProcessKeyUp` has been removed as it's no longer required, `Key.onUp` handles it instead.
+* The Keyboard Manager has a property called `captures` which is an array of keycodes, as populated by the Game Config. Any key code in the array will have `preventDefault` called on it if pressed.
+* `KeyboardPlugin.manager` is a new property that references the Keyboard Manager and is used internally.
+* `KeyboardPlugin.target` has been removed as it's no longer used by the class.
+* `KeyboardPlugin.queue` has been removed as it's no longer used by the class.
+* `KeyboardPlugin.onKeyHandler` has been removed as it's no longer used by the class.
+
+### Mouse and Touch Input - New Features, Updates and Fixes
+
+* The Mouse Manager class has been updated to remove some commented out code and refine the `startListeners` method.
+* When enabling a Game Object for input it will now use the `width` and `height` properties of the Game Object first, falling back to the frame size if not found. This stops a bug when enabling BitmapText objects for input and it using the font texture as the hit area size, rather than the text itself.
+* `Pointer.smoothFactor` is a float-value that allows you to automatically apply smoothing to the Pointer position as it moves. This is ideal when you want something smoothly tracking a pointer in a game, or are need a smooth drawing motion for an art package. The default value is zero, meaning disabled. Set to a small number, such as 0.2, to enable.
+* `Config.inputSmoothFactor` is a new property that allows you to set the smoothing factor for all Pointers the game creators. The default value is zero, which is disabled. Set in the game config as `input: { smoothFactor: value }`.
+* `InputManager.transformPointer` has a new boolean argument `wasMove`, which controls if the pointer is being transformed after a move or up/down event.
+* `Pointer.velocity` is a new Vector2 that contains the velocity of the Pointer, based on the current and previous positions. The velocity is smoothed out each frame, according to the `Pointer.motionFactor` property. This is done for more accurate gesture recognition. The velocity is updated based on Pointer movement, it doesn't require a button to be pressed first.
+* `Pointer.angle` is a new property that contains the angle of the Pointer, in radians, based on the current and previous positions. The angle is smoothed out each frame, according to the `Pointer.motionFactor` property. This is done for more accurate gesture recognition. The angle is updated based on Pointer movement, it doesn't require a button to be pressed first.
+* `Pointer.distance` is a new property that contains the distance of the Pointer, in radians, based on the current and previous positions. The distance is smoothed out each frame, according to the `Pointer.motionFactor` property. This is done for more accurate gesture recognition. The distance is updated based on Pointer movement, it doesn't require a button to be pressed first.
+* `Pointer.motionFactor` is a new property that controls how much smoothing to apply to the Pointer positions 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. The default value is 0.2.
+* The Input Plugin was emitting a `preUpdate` event, with the capital U, instead of `preupdate`. This has now been corrected. Fix #4185 (thanks @gadelan)
+* `Pointer.updateMotion` is a new method that is called automatically, each step, by the Input Manager. It's responsible for calculating the Pointer velocity, angle and distance properties.
+* `Pointer.time` is a new property that holds the time the Pointer was last updated by the Game step.
+* `Pointer.getDistance` has been updated. If called while a button is being held down, it will return the distance between the Pointer's current position and it's down position. If called when a Pointer doesn't have a button down, it will return the historic distance between the up and down positions.
+* `Pointer.getDistanceX` is a new method that will return the horizontal distance between the Pointer's previous and current coordinates. If called while a button is being held down, it will return the distance between the Pointer's current position and it's down position. If called when a Pointer doesn't have a button down, it will return the historic distance between the up and down positions.
+* `Pointer.getDistanceY` is a new method that will return the horizontal distance between the Pointer's previous and current coordinates. If called while a button is being held down, it will return the distance between the Pointer's current position and it's down position. If called when a Pointer doesn't have a button down, it will return the historic distance between the up and down positions.
+* `Pointer.getDuration` is a new method that will return the duration the Pointer was held down for. If the Pointer has a button pressed down at the time this method is called, it will return the duration since the Pointer's 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.
+* `Pointer.getAngle` is a new method that will return the angle between the Pointer coordinates. 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.
+* In previous versions, the VisibilityHandler would create a `mousedown` listener for the game canvas and then call `window.focus` when detected (assuming the game config `autoFocus` property was `true`). Responsibility for this has now been handled to the Mouse Manager `onMouseDown` handler.
+* In previous versions, the VisibilityHandler would create a `mouseout` listener for the game canvas and then set `game.isOver` when detected. Responsibility for this has now been handled to the Mouse Manager, which sets the new Input Manager `isOver` property directly.
+* In previous versions, the VisibilityHandler would create a `mouseover` listener for the game canvas and then set `game.isOver` when detected. Responsibility for this has now been handled to the Mouse Manager, which sets the new Input Manager `isOver` property directly.
+* The `Phaser.Game.isOver` property has been moved. You can now find it in the Input Manager and it's also accessible via the Input Plugin, which means you can do `this.input.isOver` from within a Scene. This makes more sense as it's input related and not a game level property.
+* The Input Plugin has a new event you can listen to: `gameover`, which is triggered whenever the mouse or a pointer is moved over the Game canvas. Listen to it with `this.input.on('gameover')` from within a Scene.
+* The Input Plugin has a new event you can listen to: `gameout`, which is triggered whenever the mouse or a pointer leaves the Game canvas. Listen to it with `this.input.on('gameout')` from within a Scene.
+* The Game used to emit a `mouseover` event when the mouse entered the game canvas. This is no longer emitted by the Game itself and can instead be listened for using the new Input Plugin event `gameover`.
+* The Game used to emit a `mouseout` event when the mouse left the game canvas. This is no longer emitted by the Game itself and can instead be listened for using the new Input Plugin event `gameout`.
+* If the `window` object exists (which it will in normal browser environments) new `mouseup` and `touchend` event listeners are bound to it and trigger the normal `mouseup` or `touchend` events within the internal input system. This means if you will now get a `pointerup` event from the Input Plugin even if the pointer is released outside of the game canvas. Pointers will also no longer think they are still 'down' if released outside the canvas and then moved inside again in their new state.
+* The window will now have focus called on it by the Touch Manager, as well as the Mouse Manager, is the `autoFocus` game config property is enabled.
+* The Input Plugin has a new event you can listen to: `pointerdownoutside`, which is triggered whenever the mouse or a pointer is pressed down while outside of the Game canvas. Listen to it with `this.input.on('pointerdownoutside')` from within a Scene.
+* The Input Plugin has a new event you can listen to: `pointerupoutside`, which is triggered whenever the mouse or a pointer is released while outside of the Game canvas. Listen to it with `this.input.on('pointerupoutside')` from within a Scene.
+* `Pointer.downElement` is a new property that holds the target of the DOM Event that triggered when the Pointer was pressed down. If this is within the game, this will be the game canvas element.
+* `Pointer.upElement` is a new property that holds the target of the DOM Event that triggered when the Pointer was released. If this is within the game, this will be the game canvas element.
+
+### New Features
+
+* You can now load external Scene files using the new `load.sceneFile` method. This allows you to dynamically load a Scene into the Scene Manager of your game, and swap to it at will. Please see the documentation and examples for further details.
+* The data object being sent to the Dynamic Bitmap Text callback now has a new property `parent`, which is a reference to the Bitmap Text instance that owns the data object (thanks ornyth)
+* The WebGL Renderer has a new method `clearPipeline`, which will clear down the current pipeline and reset the blend mode, ready for the context to be passed to a 3rd party library.
+* The WebGL Renderer has a new method `rebindPipeline`, which will rebind the given pipeline instance, reset the blank texture and reset the blend mode. Which is useful for recovering from 3rd party libs that have modified the gl context.
+* Game Objects have a new property called `state`. Use this to track the state of a Game Object during its lifetime. For example, it could move from a state of 'moving', to 'attacking', to 'dead'. Phaser itself will never set this property, although plugins are allowed to.
+* Game Objects have a new method called `setState` which will set the state property in a chainable call.
+* `BlendModes.ERASE` is a new blend mode that will erase the object being drawn. When used in conjunction with a Render Texture it allows for effects that let you erase parts of the texture, in either Canvas or WebGL. When used with a transparent game canvas, it allows you to erase parts of the canvas, showing the web page background through.
+* `BlendModes.SOURCE_IN` is a new Canvas-only blend mode, that allows you to use the `source-in` composite operation when rendering Game Objects.
+* `BlendModes.SOURCE_OUT` is a new Canvas-only blend mode, that allows you to use the `source-out` composite operation when rendering Game Objects.
+* `BlendModes.SOURCE_ATOP` is a new Canvas-only blend mode, that allows you to use the `source-atop` composite operation when rendering Game Objects.
+* `BlendModes.DESTINATION_OVER` is a new Canvas-only blend mode, that allows you to use the `destination-over` composite operation when rendering Game Objects.
+* `BlendModes.DESTINATION_IN` is a new Canvas-only blend mode, that allows you to use the `destination-in` composite operation when rendering Game Objects.
+* `BlendModes.DESTINATION_OUT` is a new Canvas-only blend mode, that allows you to use the `destination-out` composite operation when rendering Game Objects.
+* `BlendModes.DESTINATION_ATOP` is a new Canvas-only blend mode, that allows you to use the `destination-atop` composite operation when rendering Game Objects.
+* `BlendModes.LIGHTER` is a new Canvas-only blend mode, that allows you to use the `lighter` composite operation when rendering Game Objects.
+* `BlendModes.COPY` is a new Canvas-only blend mode, that allows you to use the `copy` composite operation when rendering Game Objects.
+* `BlendModes.XOR` is a new Canvas-only blend mode, that allows you to use the `xor` composite operation when rendering Game Objects.
+* `RenderTexture.erase` is a new method that will take an object, or array of objects, and draw them to the Render Texture using an ERASE blend mode, resulting in them being removed from the Render Texture. This is really handy for making a bitmap masked texture in Canvas or WebGL (without using an actual mask), or for 'cutting away' part of a texture.
+* There is a new boolean Game Config property called `customEnvironment`. If set to `true` it will skip the internal Feature checks when working out which type of renderer to create, allowing you to run Phaser under non-native web environments. If using this value, you _must_ set an explicit `renderType` of either CANVAS or WEBGL. It cannot be left as AUTO. Fix #4166 (thanks @jcyuan)
+* `Animation.nextFrame` will advance an animation to the next frame in the sequence instantly, regardless of the animation time or state. You can call this on a Sprite: `sprite.anims.nextFrame()` (thanks rgk25)
+* `Animation.previousFrame` will set an animation to the previous frame in the sequence instantly, regardless of the animation time or state. You can call this on a Sprite: `sprite.anims.previousFrame()` (thanks rgk25)
+* `Geom.Intersects.PointToLine` has a new optional argument `lineThickness` (which defaults to 1). This allows you to determine if the point intersects a line of a given thickness, where the line-ends are circular (not square).
+* `Geom.Line.GetNearestPoint` is a new static method that will return the nearest point on a line to the given point.
+* `Geom.Line.GetShortestDistance` is a new static method that will return the shortest distance from a line to the given point.
+* `Camera.getBounds` is a new method that will return a rectangle containing the bounds of the camera.
+* `Camera.centerOnX` will move the camera horizontally to be centered on the given coordinate, without changing its vertical placement.
+* `Camera.centerOnY` will move the camera vertically to be centered on the given coordinate, without changing its horizontally placement.
+* `AnimationManager.exists` is a new method that will check to see if an Animation using the given key already exists or not and returns a boolean.
+* `animationstart-key` is a new Animation key specific event emitted by a Game Object. For example, if you had an animation with a key of 'explode' you can now listen for `animationstart-explode`.
+* `animationrestart-key` is a new Animation key specific event emitted by a Game Object. For example, if you had an animation with a key of 'explode' you can now listen for `animationrestart-explode`.
+* `animationcomplete-key` is a new Animation key specific event emitted by a Game Object. For example, if you had an animation with a key of 'explode' you can now listen for `animationcomplete-explode`.
+* `animationupdate-key` is a new Animation key specific event emitted by a Game Object. For example, if you had an animation with a key of 'explode' you can now listen for `animationupdate-explode`.
+* The Animation class now extends the Event Emitter and dispatches events itself. This allows you to listen for events from a specific Animation, rather than via a Game Object. This is handy, for example, if you had an explosion animation that you wanted to trigger a sound effect when it started. You can now listen for the events from the Animation object directly.
+* The Animation class now emits the `start` event when played (either forward, or in reverse) by any Game Object.
+* The Animation class now emits the `restart` event when it restarts playing on any Game Object.
+* The Animation class now emits the `complete` event when it finishes playing on any Game Object.
+* The Animation Component has a new method called `chain` which allows you to line-up another animation to start playing as soon as the current one stops, no matter how it stops (either by reaching its natural end, or directly by having stop called on it). You can chain a new animation at any point, including before the current one starts playing, during it, or when it ends (via its `animationcomplete` callback). Chained animations are specific to a Game Object, meaning different Game Objects can have different chained animations without impacting the global animation they're playing.
+* `CanvasTexture.drawFrame` is a new method that allows you to draw a texture frame to the CanvasTexture based on the texture key and frame given.
+* `CanvasTexture.getIndex` is a new method that will take an x/y coordinate and return the Image Data index offset used to retrieve the pixel values.
+* `CanvasTexture.getPixels` is a new method that will take a region as an x/y and width/height and return all of the pixels in that region from the CanvasTexture.
+* `CanvasTexture.setPixel` is a new method that sets the given pixel in the CanvasTexture to the color and alpha values provided.
+* `CanvasTexture.getData` is a new method that will extract an ImageData block from the CanvasTexture from the region given.
+* `CanvasTexture.putData` is a new method that will put an ImageData block at the given coordinates in a CanvasTexture.
+
+### Updates
+
+* You can now modify `this.physics.world.debugGraphic.defaultStrokeWidth` to set the stroke width of any debug drawn body, previously it was always 1 (thanks @samme)
+* `TextStyle.setFont` has a new optional argument `updateText` which will sets if the text should be automatically updated or not (thanks @DotTheGreat)
+* `ProcessQueue.destroy` now sets the internal `toProcess` counter to zero.
+* The `PathFollower.pathRotationVerticalAdjust` property has been removed. It was supposed to flipY a follower when it reversed path direction, but after some testing it appears it has never worked and it's easier to do this using events, so the property and associated config value are removed. The `verticalAdjust` argument from the `setRotateToPath` method has been removed as well.
+* The config value `preserveDrawingBuffer` has been removed as it has never been used by the WebGL Renderer.
+* `PluginManager.install` returns `null` if the plugin failed to install in all cases.
+* `PluginFile` will now install the plugin into the _current_ Scene as long as the `start` or `mapping` arguments are provided.
+* MATH_CONST no longer requires or sets the Random Data Generator, this is now done in the Game Config, allowing you to require the math constants without pulling in a whole copy of the RNG with it.
+* The Dynamic Bitmap Text Canvas Renderer was creating a new data object every frame for the callback. It now uses the `callbackData` object instead, like the WebGL renderer does.
+* `WebGLRenderer.setBlendMode` has a new optional argument `force`, which will force the given blend mode to be set, regardless of the current settings.
+* The method `DisplayList.sortGameObjects` has been removed. It has thrown a runtime error since v3.3.0! which no-one even spotted, a good indication of how little the method is used. The display list is automatically sorted anyway, so if you need to sort a small section of it, just use the standard JavaScript Array sort method (thanks ornyth)
+* The method `DisplayList.getTopGameObject` has been removed. It has thrown a runtime error since v3.3.0! which no-one even spotted, a good indication of how little the method is used (thanks ornyth)
+* `WebGLRenderer.setFramebuffer` has a new optional boolean argument `updateScissor`, which will reset the scissor to match the framebuffer size, or clear it.
+* `WebAudioSoundManager.onFocus` will not try to resume the Audio Context if it's still locked.
+* `WebAudioSoundManager.onBlur` will not try to suspend the Audio Context if it's still locked.
+* When using `ScenePlugin.add`, to add a new Scene to the Scene Manager, it didn't allow you to include the optional Scene data object. You can now pass this in the call (thanks @kainage)
+* `Graphics.stroke` is a new alias for the `strokePath` method, to keep the calls consistent with the Canvas Rendering Context API.
+* `Graphics.fill` is a new alias for the `fillPath` method, to keep the calls consistent with the Canvas Rendering Context API.
+* `LoaderPlugin.sceneManager` is a new property that is a reference to the global Scene Manager, useful for Plugins.
+* Whenever `Camera.roundPixels` was enabled it would use a bitwise operation to truncate the float (`x |= 0`) - this has been replaced across all files that used it, with a call to `Math.round` instead. This gives far better results when zooming cameras both in and out of a Scene, stopping thin gaps appearing between closely packed Game Objects.
+* `AnimationManager.create` will now return a boolean `false` if the given key is invalid (i.e. undefined or falsey).
+* `AnimationManager.create` will no longer raise a console warning if the animation key is already in use. Instead, it will return the animation belonging to that key. A brand new animation will only be created if the key isn't already in use. When this happens, the `add` event is emitted by the Animation Manager. If no event is emitted, the animation already existed.
+* `ArcadePhysics.Body.destroy` will now only add itself to the World `pendingDestroy` list if the world property exists. This prevents `Cannot read property 'pendingDestroy' of undefined` errors if you try to delete a physics body in a callback and then immediately change Scene (which tells the physics work to also delete all bodies)
+* The Animation Component `restart` method has had is sole `key` argument removed. Previously, you had to pass in the key of the animation you wished to reverse, but now you can just call the method directly, and as long as there is an animation playing, it will automatically start playing in reverse, without the nee for a key (the way it should have been originally)
+* `Animation.play` and `playReverse` will now accept either a string-based key of the animation to play (like before), or you can pass in an Animation instance, and it will play that animation.
+* `CanvasTexture.clear` now has 4 new optional arguments: `x, y, width, height` which allow you to define the region of the texture to be cleared. If not provided it will clear the whole texture, which is the same behavior as before.
+* EarCut, the polygon triangulation library used by the Graphics and WebGL classes, has been upgraded from 2.1.1 to 2.1.4. 2.1.2 fixed a few race conditions where bad input would cause an error. 2.1.3 improved performance for bigger inputs (5-12%) and 2.1.4 fixed a race condition that could lead to a freeze on degenerate input.
+* `TextureTintPipeline.batchQuad` and `batchTri` have two new optional arguments `texture` and `unit` which are used to re-set the batch texture should the method cause a batch flush.
+* `TextureTintPipeline.requireTextureBatch` is a new internal method that helps speed-up the creation of texture batches. It is used in conjunction with `setTexture2D` and `pushBatch`.
+* `TextureTintPipeline.flush` and `TextureTintPipeline.pushBatch` have been optimized to handle zero based texture units as priority. They've also been refactored to avoid creation of empty texture batches.
+* The `WebGLRenderer.setTexture2D` method has a new optional argument `flush` which controls if the pipeline is flushed if the given texture is new, or not. This is used internally to skip flushing during an existing flush.
+* The Tilemap Layer `width` and `height` properties are now based on the tilemap tile sizes multiplied by the layer dimensions. This corrects an issue with layer sizes being wrong if you called `setBaseTileSize` on a Map.
+* The WebGLRenderer will now clear the framebuffer at the start of every render.
+* `WebGLRenderer.setScissor` now has a new optional argument `drawingBufferHeight` which allows you to specify the drawing buffer height, rather than use the renderers default value.
+* `WebGLRenderer.pushScissor` now has a new optional argument `drawingBufferHeight` which allows you to specify the drawing buffer height, rather than use the renderers default value.
+* `WebGLRenderer.preRender` now calls `gl.clearColor` in order to restore the background clear color in case something, like a Render Texture, has changed it.
+
+### Bug Fixes
+
+* The Rectangle Shape object wouldn't render if it didn't have a stroke, or any other objects on the display list (thanks mliko)
+* When using a font string instead of setting `fontFamily`, `fontSize` and `fontStyle` in either `Text.setStyle` or `setFont`, the style properties wouldn't get set. This isn't a problem while creating the text object, only if modifying it later (thanks @DotTheGreat)
+* `Text.toJSON` wasn't saving the font style when using the "font" shorthand to create it. It now saves it correctly. Fix #4141 (thanks @divillysausages)
+* Disabling camera bounds and then moving the camera to an area in a Tilemap that did not have any tile information would throw an `Uncaught Reference error` as it tried to access tiles that did not exist (thanks @Siyalatas)
+* Fixed an issue where Sprite Sheets being extracted from a texture atlas would fail if the sheet was either just a single column or single row of sprites. Fix #4096 (thanks @Cirras)
+* If you created an Arcade Physics Group without passing a configuration object, and passing an array of non-standard children, it would throw a classType runtime error. It now creates a default config object correctly (thanks @pierpo)
+* The `Camera.cull` method has been restructured so it now calculates if a Game Object is correctly in view or not, before culling it. Although not used internally, if you need to cull objects for a camera, you can now safely use this method. Fix #4092 (thanks @Cirras)
+* The Tiled Parser would ignore animated tile data if it was in the new Tiled 1.2 format. This is now accounted for, as well as 1.0 (thanks @nkholski)
+* `Array.Matrix.ReverseRows` was actually reversing the columns, but now reverses the rows.
+* `Array.Matrix.ReverseColumns` was actually reversing the rows, but now reverses the columns.
+* UnityAtlas now sets the correct file type key if using a config file object.
+* Starting with version 3.13 in the Canvas Renderer, it was possible for long-running scripts to start to get bogged-down in `fillRect` calls if the game had a background color set. The context is now saved properly to avoid this. Fix #4056 (thanks @Aveyder)
+* Render Textures created larger than the size of the default canvas would be automatically clipped when drawn to in WebGL. They now reset the gl scissor and drawing height property in order to draw to their full size, regardless of the canvas size. Fix #4139 (thanks @chaoyang805 @iamchristopher)
+* The `cameraFilter` property of a Game Object will now allow full bitmasks to be set (a value of -1), instead of just those > 0 (thanks @stuartkeith)
+* The `PathFollower.startFollow` method now properly uses the `startAt` argument to the method, so you can start a follower off at any point along the path. Fix #3688 (thanks @DannyT @diteix)
+* Static Circular Arcade Physics Bodies now render as circles in the debug display, instead of showing their rectangle bounds (thanks @maikthomas)
+* Changing the mute flag on an `HTML5AudioSound` instance, via the `mute` setter, now works, as it does via the Sound Manager (thanks @Waclaw-I @neon-dev)
+* Changing the volume on an `HTML5AudioSound` instance, via the `volume` setter, now works, as it does via the Sound Manager (thanks @Waclaw-I)
+* The Dynamic Tilemap Layer WebGL renderer was drawing tiles at the incorrect position if the layer was scaled. Fix #4104 (thanks @the-realest-stu)
+* `Tile.tileset` now returns the specific Tileset associated with the tile, rather than an array of them. Fix #4095 (thanks @quadrupleslap)
+* `Tile.getCollisionGroup` wouldn't return the correct Group after the change to support multiple Tilesets. It now returns the group properly (thanks @jbpuryear)
+* `Tile.getTileData` wouldn't return the correct data after the change to support multiple Tilesets. It now returns the tile data properly (thanks @jbpuryear)
+* The `GetTileAt` and `RemoveTileAt` components would error with "Cannot read property 'index' of undefined" if the tile was undefined rather than null. It now handles both cases (thanks @WaSa42)
+* Changing `TileSprite.width` or `TileSprite.height` will now flag the texture as dirty and call `updateDisplayOrigin`, allowing you to resize TileSprites dynamically in both Canvas and WebGL.
+* `RandomDataGenerator.shuffle` has been fixed to use the proper modifier in the calculation, allowing for a more even distribution (thanks wayfinder)
+* The Particle Emitter was not recycling dead particles correctly, so it was creating new objects every time it emitted (the old particles were then left to the browsers gc to clear up). This has now been recoded, so the emitter will properly keep track of dead particles and re-use them (thanks @Waclaw-I for the initial PR)
+* `ParticleEmitter.indexSortCallback` has been removed as it's no longer required.
+* `Particle.index` has been removed, as it's no longer required. Particles don't need to keep track of their index any more.
+* The Particle Emitter no longer needs to call the StableSort.inplace during its preUpdate, saving cpu.
+* `Particle.resetPosition` is a new method that is called when a particle dies, preparing it ready for firing again in the future.
+* The Canvas `SetTransform` method would save the context state, but it wasn't restored at the end in the following Game Objects: Dynamic Bitmap Text, Graphics, Arc, Curve, Ellipse, Grid, IsoBox, IsoTriangle, Line, Polygon, Rectangle, Star and Triangle. These now all restore the context, meaning if you're using non-canvas sized cameras in Canvas mode, it will now render beyond just the first custom camera.
+* `Utils.Array.MoveUp` wouldn't let you move an array element to the top-most index in the array. This also impacted `Container.moveUp`.
+* The Texture Tint Pipeline had a logic error that would cause every 2001st quad to either be invisible, or pick-up the texture of the 2000th quad by mistake. The `batchQuad` and `batchTri` methods how handle re-assigning the batch texture if they cause a batch flush as part of their process.
+* Rotating Sprites that used a Normal Map wouldn't rotate the normal map with it, causing the lighting effects to become irregular. The normal map vectors are now rotated correctly (thanks @sercant for the PR and @fazzamatazz and @ysraelJMM for the report)
+* Changing `scaleX` or `scaleY` on a `MatterImage` or `MatterSprite` would cause the body scale to become distorted as the setters didn't use the correct factor when resetting the initial scale. Fix #4206 (thanks @YannCaron)
+* `StaticBody.reset` in Arcade Physics would ignore the `x` and `y` values given to it. If given, they're now used to reset the parent Game Object before the body is updated. Fix #4224 (thanks @samme)
+* Static Tilemap Layers wouldn't render correctly if the layer used a tileset with a different size to the base map data (set via `setBaseTileSize`). They now render correctly in WebGL and Canvas, regardless of the base tile size.
+* When using `RenderTexture.fill`, the `alpha` argument would be ignored in Canvas mode. It's now used when filling the RenderTexture.
+* Fixed an issue in `WebGLRenderer.setScissor` where it was possible to try and compare the scissor size to a non-current scissor, if called outside of the render loop (i.e. from `RenderTexture.fill`) (thanks @hackhat)
+* `RenderTexture.fill` in WebGL would use `gl.clear` and a clear color to try and fill the Render Texture. This only worked for full-canvas sized RenderTextures that didn't have a camera zoom applied. It has now been swapped to use the `drawFillRect` method of the Texture Tint Pipeline, allowing it to work properly regardless of camera zoom or size.
+* `Container.getFirst` was using an incorrect Array Utils function `GetFirstElement`, when it should have been using `GetFirst`. It now uses the correct function. Fix #4244 (thanks @miran248)
+* `List.getFirst` was using an incorrect Array Utils function `GetFirstElement`, when it should have been using `GetFirst`. It now uses the correct function. Fix #4244 (thanks @miran248)
+* Fixed an issue where changing the viewport or size of a Camera belonging to a RenderTexture, it wouldn't impact the rendering and objects will still render outside of the viewport range. It's now converted to a proper gl scissor rect by the renderer, meaning you can limit the area rendered to by adjusting the internal Render Texture cameras viewport. Fix #4243 (thanks @hackhat)
+* `CanvasTexture.destroy` is a new method that specifically handles the destruction of the CanvasTexture and all of its associated typed arrays. This prevents a memory leak when creating and destroying lots of RenderTextures (which are CanvasTexture backed). Fix #4239 (thanks @sjb933)
+* The Alpha, Flip and Origin components have been removed from the Mesh Game Object (and by extension, Quad as well) as they are not used in the renderer and should be manipulated via the Mesh properties. Fix #4188 (thanks @enriqueto)
+
+### Examples and TypeScript
+
+Thanks to the following for helping with the Phaser 3 Examples and TypeScript definitions, either by reporting errors, or even better, fixing them:
+
+@guilhermehto @samvieten @darkwebdev @RoryO @snowbillr @slothyrulez @jcyuan
+
+### Phaser Doc Jam
+
+The Phaser Doc Jam was a community-backed effort to try and get the Phaser 3 API documentation to 100% coverage. The Doc Jam is now over and I offer my thanks to the following who helped with docs in this release:
+
+16patsle - @gurungrahul2 - @icbat - @samme - @telinc1 - anandu pavanan - blackhawx - candelibas - Diego Romero - doronlinder - Elliott Wallace - eric - Georges Gabereau - Haobo Zhang - henriacle - jak6jak - Jake Jensen - James Van Roose - JamesSkemp - joelahoover - Joey - madclaws - marc136 - Mihail Ilinov - naum303 - NicolasRoehm - nuane - rejacobson - Robert Kowalski - rodri042 - rootasjey - sawamara - scottwestover - sir13tommy - stetso - therealsamf - Tigran - willblackmore - zenwaichi
+
+Also, the following helped with the docs outside of the Doc Jam:
+
+@bryanwood @jestarray @matosummer @tfelix @imilo
+
+## Version 3.15.1 - Batou - 16th October 2018
+
+* Re-enabled Input Manager resizing, which had been left disabled by mistake.
+
+## Version 3.15.0 - Batou - 16th October 2018
+
+Note: We are releasing this version ahead of schedule in order to make some very important iOS performance and input related fixes available. It does not contain the new Scale Manager or Spine support, both of which have been moved to 3.16 as they require a few more weeks of development.
+
+### New Features
+
+* You can now set the `maxLights` value in the Game Config, which controls the total number of lights the Light2D shader can render in a single pass. The default is 10. Be careful about pushing this too far. More lights = less performance. Close #4081 (thanks @FrancescoNegri)
+* `Rectangle.SameDimensions` determines if the two objects (either Rectangles or Rectangle-like) have the same width and height values under strict equality.
+* An ArcadePhysics Group can now pass `{ enable: false }`` in its config to disable all the member bodies (thanks @samme)
+* `Body.setEnable` is a new chainable method that allows you to toggle the enable state of an Arcade Physics Body (thanks @samme)
+* `KeyboardPlugin.resetKeys` is a new method that will reset the state of any Key object created by a Scene's Keyboard Plugin.
+* `Pointer.wasCanceled` is a new boolean property that allows you to tell if a Pointer was cleared due to a `touchcancel` event. This flag is reset during the next `touchstart` event for the Pointer.
+* `Pointer.touchcancel` is a new internal method specifically for handling touch cancel events. It has the same result as `touchend` without setting any of the up properties, to avoid triggering up event handlers. It will also set the `wasCanceled` property to `true`.
+
+### Updates
+
+* `WebGLRenderer.deleteTexture` will check to see if the texture it is being asked to delete is the currently bound texture or not. If it is, it'll set the blank texture to be bound after deletion. This should stop `RENDER WARNING: there is no texture bound to the unit 0` errors if you destroy a Game Object, such as Text or TileSprite, from an async or timed process (thanks jamespierce)
+* The `RequestAnimationFrame.step` and `stepTimeout` functions have been updated so that the new Frame is requested from raf before the main game step is called. This allows you to now stop the raf callback from within the game update or render loop. Fix #3952 (thanks @tolimeh)
+* If you pass zero as the width or height when creating a TileSprite it will now use the dimensions of the texture frame as the size of the TileSprite. Fix #4073 (thanks @jcyuan)
+* `TileSprite.setFrame` has had both the `updateSize` and `updateOrigin` arguments removed as they didn't do anything for TileSprites and were misleading.
+* `CameraManager.remove` has a new argument `runDestroy` which, if set, will automatically call `Camera.destroy` on the Cameras removed from the Camera Manager. You should nearly always allow this to happen (thanks jamespierce)
+* Device.OS has been restructured to allow fake UAs from Chrome dev tools to register iOS devices.
+* Texture batching during the batch flush has been implemented in the TextureTintPipeline which resolves the issues of very low frame rates, especially on iOS devices, when using non-batched textures such as those used by Text or TileSprites. Fix #4110 #4086 (thanks @ivanpopelyshev @sachinhosmani @maximtsai @alexeymolchan)
+* The WebGLRenderer method `canvasToTexture` has a new optional argument `noRepeat` which will stop it from using `gl.REPEAT` entirely. This is now used by the Text object to avoid it potentially switching between a REPEAT and CLAMP texture, causing texture black-outs (thanks @ivanpopelyshev)
+* `KeyboardPlugin.resetKeys` is now called automatically as part of the Keyboard Plugin `shutdown` method. This means, when the plugin shuts down, such as when stopping a Scene, it will reset the state of any key held in the plugin. It will also clear the queue of any pending events.
+* The `Touch Manager` has been rewritten to use declared functions for all touch event handlers, rather than bound functions. This means they will now clear properly when the TouchManager is shut down.
+* There is a new Input constant `TOUCH_CANCEL` which represents canceled touch events.
+
+### Bug Fixes
+
+* Fixed a bug in the canvas rendering of both the Static and Dynamic Tilemap Layers where the camera matrix was being multiplied twice with the layer, causing the scale and placement to be off (thanks galerijanamar)
+* If you set `pixelArt` to true in your game config (or `antialias` to false) then TileSprites will now respect this when using the Canvas Renderer and disable smoothing on the internal fill canvas.
+* TileSprites that were set to be interactive before they had rendered once wouldn't receive a valid input hit area, causing input to fail. They now define their size immediately, allowing them to be made interactive without having rendered. Fix #4085 (thanks @DotTheGreat)
+* The Particle Emitter Manager has been given a NOOP method called `setBlendMode` to stop warnings from being thrown if you added an emitter to a Container in the Canvas renderer. Fix #4083 (thanks @maximtsai)
+* The `game.context` property would be incorrectly set to `null` after the WebGLRenderer instance was created (thanks @samme)
+* The Touch Manager, Input Manager and Pointer classes all now handle the `touchcancel` event, such as triggered on iOS when activating an out of browser UI gesture, or in Facebook Instant Games when displaying an overlay ad. This should prevent issues with touch input becoming locked on iOS specifically. Fix #3756 (thanks @sftsk @sachinhosmani @kooappsdevs)
+
+## Version 3.14.0 - Tachikoma - 1st October 2018
+
+### Tilemap New Features, Updates and Fixes
+
+* Both Static and Dynamic Tilemap layers now support rendering multiple tilesets per layer in both Canvas and WebGL. To use multiple tilesets pass in an array of Tileset objects, or strings, to the `createStaticLayer` and `createDynamicLayer` methods respectively.
+* `Tilemap.createStaticLayer` now supports passing either a Tileset reference, or a string, or an array of them as the 2nd argument. If strings, the string should be the Tileset name (usually defined in Tiled).
+* `Tilemap.createDynamicLayer` now supports passing either a Tileset reference, or a string, or an array of them as the 2nd argument. If strings, the string should be the Tileset name (usually defined in Tiled).
+* `Tilemap.createBlankDynamicLayer` now supports passing either a Tileset reference, or a string, or an array of them as the 2nd argument. If strings, the string should be the Tileset name (usually defined in Tiled).
+* Static Tilemap Layers now support tile rotation and flipping. Previously this was a feature only for Dynamic Tilemap Layers, but now both have it. Close #4037 (thanks @thisredone)
+* `Tilemap.getTileset` is a new method that will return a Tileset based on its name.
+* `ParseTilesets` has been rewritten so it will convert the new data structures of Tiled 1.2 into the format expected by Phaser, allowing you to use either Tiled 1.2.x or Tiled 1.1 JSON exports. Fix #3998 (thanks @martin-pabst @halgorithm)
+* `Tilemap.setBaseTileSize` now sets the size into the LayerData `baseTileWidth` and `baseTileHeight` properties accordingly. Fix #4057 (thanks @imilo)
+* Calling `Tilemap.renderDebug` ignored the layer world position when drawing to the Graphics object. It will now translate to the layer position before drawing. Fix #4061 (thanks @Zax37)
+* Calling `Tilemap.renderDebug` ignored the layer scale when drawing to the Graphics object. It will now scale the layer before drawing. Fix #4026 (thanks @JasonHK)
+* The Static Tilemap Layer would stop drawing all tiles from that point on, if it encountered a tile which had invalid texture coordinates (such as a tile from another tileset). It now skips invalid tiles properly again. Fix #4002 (thanks @jdotrjs)
+* If you used a RenderTexture as a tileset then Dynamic Tilemap Layers would render the tiles inversed on the y-axis in WebGL. Fix #4017 (thanks @s-s)
+* If you used a scaled Dynamic Tilemap Layer and rotated or flipped tiles, the tiles that were rotated or flipped would be positioned incorrectly in WebGL. Fix #3778 (thanks @nkholski)
+* `StaticTilemapLayer.tileset` is now an array of Tileset objects, where-as before it was a single reference.
+* `StaticTilemapLayer.vertexBuffer` is now an array of WebGLBuffer objects, where-as before it was a single instance.
+* `StaticTilemapLayer.bufferData` is now an array of ArrayBuffer objects, where-as before it was a single instance.
+* `StaticTilemapLayer.vertexViewF32` is now an array of Float3Array objects, where-as before it was a single instance.
+* `StaticTilemapLayer.vertexViewU32` is now an array of Uint32Array objects, where-as before it was a single instance.
+* `StaticTilemapLayer.dirty` is now an array of booleans, where-as before it was a single boolean.
+* `StaticTilemapLayer.vertextCount` is now an array of integers, where-as before it was a single integer.
+* `StaticTilemapLayer.updateVBOData()` is a new private method that creates the internal VBO data arrays for the WebGL renderer.
+* The `StaticTilemapLayer.upload()` method has a new parameter `tilesetIndex` which controls which tileset to prepare the VBO data for.
+* The `StaticTilemapLayer.batchTile()` method has a new parameter `tilesetIndex` which controls which tileset to batch the tile for.
+* `StaticTilemapLayer.setTilesets()` is a new private method that creates the internal tileset references array.
+* `DynamicTilemapLayer.tileset` is now an array of Tileset objects, where-as before it was a single reference.
+* `DynamicTilemapLayer.setTilesets()` is a new private method that creates the internal tileset references array.
+
+### New Features
+
+* `bodyDebugFillColor` is a new Matter Physics debug option that allows you to set a color used when drawing filled bodies to the debug Graphic.
+* `debugWireframes` is a new Matter Physics debug option that allows you to control if the wireframes of the bodies are used when drawing to the debug Graphic. The default is `true`. If enabled bodies are not filled.
+* `debugShowInternalEdges` is a new Matter Physics debug option that allows you to set if the internal edges of a body are rendered to the debug Graphic.
+* `debugShowConvexHulls` is a new Matter Physics debug option that allows you to control if the convex hull of a body is drawn to the debug Graphic. The default is `false`.
+* `debugConvexHullColor` is a new Matter Physics debug option that lets you set the color of the convex hull, if being drawn to the debug Graphic.
+* `debugShowSleeping` is a new Matter Physics debug option that lets you draw sleeping bodies at 50% opacity.
+* `Curves.Ellipse.angle` is a new getter / setter that handles the rotation of the curve in degrees instead of radians.
+
+### Updates
+
+* The Loader has been updated to handle the impact of you destroying the game instance while still processing files. It will no longer throw cache and texture related errors. Fix #4049 (thanks @pantoninho)
+* `Polygon.setTo` can now take a string of space separated numbers when creating the polygon data, i.e.: `'40 0 40 20 100 20 100 80 40 80 40 100 0 50'`. This update also impacts the Polygon Shape object, which can now also take this format as well.
+* The `poly-decomp` library, as used by Matter.js, has been updated to 0.3.0.
+* `Matter.verts`, available via `this.matter.verts` from within a Scene, is a quick way of accessing the Matter Vertices functions.
+* You can now specify the vertices for a Matter `fromVerts` body as a string.
+* `TextureTintPipeline.batchTexture` has a new optional argument `skipFlip` which allows you to control the internal render texture flip Y check.
+* The Device.OS check for `node` will now do a `typeof` first to avoid issues with rollup packaged builds needing to shim the variable out. Fix #4058 (thanks @hollowdoor)
+* Arcade Physics Bodies will now sync the display origin of the parent Game Object to the body properties as part of the `updateBounds` call. This means if you change the origin of an AP enabled Game Object, after creation of the body, it will be reflected in the body position. This may or may not be a breaking change for your game. Previously it was expected that the origin should always be 0.5 and you adjust the body using `setOffset`, but this change makes a bit more sense logically. If you find that your bodies are offset after upgrading to this version then this is likely why. Close #4052 (thanks @SolarOmni)
+* The `Texture.getFramesFromTextureSource` method has a new boolean argument `includeBase`, which defaults to `false` and allows you to set if the base frame should be returned into the array or not.
+* There is a new Animation Event that is dispatched when an animation restarts. Listen for it via `Sprite.on('animationrestart')`.
+* All of the Animation Events now pass the Game Object as the final argument, this includes `animationstart`, `animationrestart`, `animationrepeat`, `animationupdate` and `animationcomplete`.
+* `Curves.Ellipse.rotation` is a getter / setter that holds the rotation of the curve. Previously it expected the value in degrees and when getting it returned the value in radians. It now expects the value in radians and returns radians to keep it logical.
+* `Set.size` will now only set the new size if the value is smaller than the current size, truncating the Set in the process. Values larger than the current size are ignored.
+* Arcade Physics `shutdown` will check to see if the world instance still exists and only try removing it if so. This prevents errors when stopping a world and then destroying it at a later date.
+* `Text.setFont`, `Text.setFontFamily`, `Text.setFontStyle` and `Text.setStroke` will no longer re-measure the parent Text object if their values have not changed.
+
+### Bug Fixes
+
+* GameObjects added to and removed from Containers no longer listen for the `shutdown` event at all (thanks Vitali)
+* Sprites now have `preDestroy` method, which is called automatically by `destroy`. The method destroys the Animation component, unregistering the `remove` event in the process and freeing-up resources. Fix #4051 (thanks @Aveyder)
+* `UpdateList.shutdown` wasn't correctly iterating over the pending lists (thanks @felipeprov)
+* Input detection was known to be broken when the game resolution was !== 1 and the Camera zoom level was !== 1. Fix #4010 (thanks @s-s)
+* The `Shape.Line` object was missing a `lineWidth` property unless you called the `setLineWidth` method, causing the line to not render in Canvas only. Fix #4068 (thanks @netgfx)
+* All parts of Matter Body now have the `gameObject` property set correctly. Previously only the first part of the Body did.
+* When using `MatterGameObject` and `fromVerts` as the shape type it wouldn't pass the values to `Bodies.fromVertices` because of a previous conditional. It now passes them over correctly and the body is only set if the result is valid.
+* The `Texture.getFramesFromTextureSource` method was returning an array of Frame names by mistake, instead of Frame references. It now returns the Frames themselves.
+* When using `CanvasTexture.refresh` or `Graphics.generateTexture` it would throw WebGL warnings like 'bindTexture: Attempt to bind a deleted texture'. This was due to the Frames losing sync with the glTexture reference used by their TextureSource. Fix #4050 (thanks @kanthi0802)
+* Fixed an error in the `batchSprite` methods in the Canvas and WebGL Renderers that would incorrectly set the frame dimensions on Sprites with the crop component. This was particularly noticeable on Sprites with trimmed animation frames (thanks @sergeod9)
+* Fixed a bug where the gl scissor wasn't being reset during a renderer resize, causing it to appear as if the canvas didn't resize properly when `autoResize` was set to `true` in the game config. Fix #4066 (thanks @Quinten @hsan999)
+* If a Game instance is destroyed without using the `removeCanvas` argument, it would throw exceptions in the `MouseManager` after the destroy process has run, as the event listeners were not unbound. They're not unbound, regardless of if the parent canvas is removed or not. Fix #4015 (thanks @garethwhittaker)
+
+### Examples and TypeScript
+
+A huge thanks to @presidenten for his work on the Phaser 3 Examples. You'll notice they now have a lovely screen shots for every example and the scripts generate them automatically :)
+
+Also, thanks to the following for helping with the Phaser 3 Examples and TypeScript definitions, either by reporting errors, or even better, fixing them:
+
+@madanus @truncs @samme
+
+### Phaser Doc Jam
+
+The [Phaser Doc Jam](http://docjam.phaser.io) is an on-going effort to ensure that the Phaser 3 API has 100% documentation coverage. Thanks to the monumental effort of myself and the following people we're now really close to that goal! My thanks to:
+
+31826615 - @16patsle - @bobonthenet - @rgk - @samme - @shaneMLK - @wemyss - ajmetal - andiCR - Arian Fornaris - bsparks - Carl - cyantree - DannyT - Elliott Wallace - felixnemis - griga - Hardylr - henriacle - Hsaka - icbat - Kanthi - Kyle - Lee - Nathaniel Foldan - Peter Pedersen - rootasjey - Sam Frantz - SBCGames - snowbillr - Stephen Hamilton - STuFF - TadejZupancic - telinc1
+
+If you'd like to help finish off the last parts of documentation then take a look at the [Doc Jam site](http://docjam.phaser.io).
+
+## Version 3.13.0 - Yuuki - 20th September 2018
+
+### Facebook Instant Games Plugin
+
+Phaser 3.13 introduces the new Facebook Instant Games Plugin. The plugin provides a seamless bridge between Phaser and version 6.2 of the Facebook Instant Games SDK. Every single SDK function is available via the plugin and we will keep track of the official SDK to make sure they stay in sync.
+
+The plugin offers the following features:
+
+* Easy integration with the Phaser Loader so load events update the Facebook progress circle.
+* Events for every plugin method, allowing the async calls of the SDK to be correctly inserted into the Phaser game flow. When SDK calls resolve they will surface naturally as a Phaser event and you'll know you can safely act upon them without potentially doing something mid-way through the game step.
+* All Plugin methods check if the call is part of the supported APIs available in the SDK, without needing to launch an async request first.
+* Instant access to platform, player and locale data.
+* Easily load player photos directly into the Texture Manager, ready for use with a Game Object.
+* Subscribe to game bots.
+* The plugin has a built-in Data Manager which makes dealing with data stored on Facebook seamless. Just create whatever data properties you need and they are automatically synced.
+* Support for FB stats, to retrieve, store and increment stats into cloud storage.
+* Save Session data with built-in session length validation.
+* Easy context switching, to swap between game instances and session data retrieval.
+* Easily open a Facebook share, invite, request or game challenge window and populate the text and image content using any image stored in the Texture cache.
+* Full Leaderboard support. Retrieve, scan and update leaderboard entries, as well as player matching.
+* Support for in-app purchases, with product catalogs, the ability to handle purchases, get past purchases and consume previously unlocked purchases.
+* Easily preload a set of interstitial ads, in both banner and video form, then display the ad at any point in your game, with in-built tracking of ads displayed and inventory available.
+* Plus other features, such as logging to FB Analytics, creating short cuts, switching games, etc.
+
+The plugin is fully documented and official tutorials and project templates will follow shortly.
+
+### New Shape Game Objects
+
+Phaser 3.13 has a new Game Object called `Shape`, which by itself isn't much use because it's a base class. However, extending that class are 11 different types of Shape (with more to come) and you can use it to create your own custom Shapes as well. Shapes are added to the display list in the exact same way as any other Game Object. For example:
+
+```
+this.add.rectangle(400, 300, 500, 120, 0x00ff00);
+```
+
+Here we're creating a new Rectangle shape. It's positioned at 400 x 300 in the Scene and has a size of 500 x 120 pixels. The final value is the fill color.
+
+The thing to remember is that you can treat this Shape just like you'd treat any other Game Object. You can scale it, rotate it, alpha it, blend mode it, change its origin, give it a Camera scroll factor, put it inside a Container or Group, give it input abilities or even give it a physics body. It is, to all intents and purposes, a normal Game Object. The only difference is that when rendering it uses its own special bit of display code.
+
+The shapes available are as follows:
+
+* `GameObject.Arc` - The arc allows you to draw either a circle, or part of a circle. You can set the start and end angle, if the rotation is clockwise or not, and even set the number of iterations the arc will use during rendering.
+* `GameObject.Curve` - The Curve Shape can take any Phaser Curve object, such as a Spline or Bezier Curve, and add it to the display list.
+* `GameObject.Ellipse` - An ellipse shape, which is essentially a circle with a differing width and height. It can be filled or stroked (or both!) and as with the arc you can set the 'smoothness' of it, allowing you to decrease the number of points used when creating its polygon data.
+* `GameObject.Grid` - The Grid Shape object allows you to generate them. You can set the width and height of the grid itself, as well as for the grid cells. The grid can either have a single color, or alternating cell colors and even have outline spacing between the cells, or not.
+* `GameObject.Line` - Create a Line Shape drawn between any two points, with a color and thickness. In WebGL you can also specify a different thickness for the start and end of the line.
+* `GameObject.Polygon` - A Polygon is effectively a list of points that is drawn between. The points can be provided in a number of different ways (as Vec2 objects, as an array, etc) and then you can either fill or stroke the resulting shape, or both.
+* `GameObject.Rectangle` - Simple, but powerful and endlessly useful. Set a width and height and it'll display a Rectangle, with control over the size, fill color and stroke color.
+* `GameObject.Star` - The Star shape does as its name suggests: it displays a star. You can control the number of points in the star as well as the inner and outer radius of it.
+* `GameObject.Triangle` - A Triangular shape with full control over the points used to make it and its fill and stroke colors. Internally it uses the `batchFillTriangle` method in WebGL, making it actually faster to draw than a Quad! Use them happily for bullets or abstract space ships, or anything else you feel like.
+* `GameObject.IsoTriangle` - This draws an isometric triangle, like a pyramid. You can control the colors of each face, if the pyramid is upside down or not and the width and height of it.
+* `GameObject.IsoBox` - This draws an isometric box. You can set the colors for each face of the box, as well as the projection angle and also which of the 3 faces are drawn.
+
+All of the Shape objects render in both Canvas and WebGL and are available via the Game Object Factory.
+
+### Pointer and Input Event Updates
+
+The specificity if the input events has been changed to allow you more control over event handling. Previously, the InputPlugin would emit the global `pointerdown` event first, and then the Game Object itself would emit the `pointerdown` event and finally the InputPlugin would emit the `gameobjectdown` event.
+
+The order has now changed. The Game Object will dispatch its `pointerdown` event first. The InputPlugin will then dispatch `gameobjectdown` and finally the less specific of them all, `pointerdown` will be dispatched.
+
+New in 3.13 is the ability to cancel this at any stage. All events are now sent an event object which you can call `event.stopPropagation()` on. This will immediately stop any further listeners from being invoked. If you call `stopPropagation()` after the first Game Object `pointerdown` event, then no more Game Object's will receive their callbacks and the InputPlugin will not dispatch either of its events.
+
+This change has been introduced for `pointerdown`, `pointerup`, `pointermove`, `pointerover` and `pointerout`. No other data is included in the `event` object in this release.
+
+* The Game Object `pointerdown` callback signature has changed. It used to send `pointer, x, y, camera` to the listener. It now sends `pointer, x, y, event` to the listener. If you still need the `camera` property you can get it from `pointer.camera`.
+* The Game Object `gameobjectdown` callback signature has a new argument. It now sends `event` as the 3rd argument.
+* The `pointerdown` event, as dispatched by the InputPlugin, is now sent _after_ the Game Object specific events (`GameObject.pointerdown` and `gameobjectdown`). This gives you the chance to cancel the event before the global listener receives it.
+* The Game Object `pointerup` callback signature has a new argument. It now sends the `event` as the 4th argument.
+* The Game Object `gameobjectup` callback signature has a new argument. It now sends `event` as the 3rd argument.
+* The `pointerup` event, as dispatched by the InputPlugin, is now sent _after_ the Game Object specific events (`GameObject.pointerup` and `gameobjectup`). This gives you the chance to cancel the event before the global listener receives it.
+* The Game Object `pointermove` callback signature has a new argument. It now sends the `event` as the 4th argument.
+* The Game Object `gameobjectmove` callback signature has a new argument. It now sends `event` as the 3rd argument.
+* The `pointermove` event, as dispatched by the InputPlugin, is now sent _after_ the Game Object specific events (`GameObject.pointermove` and `gameobjectmove`). This gives you the chance to cancel the event before the global listener receives it.
+* The Game Object `pointerover` callback signature has a new argument. It now sends the `event` as the 4th argument.
+* The Game Object `gameobjectover` callback signature has a new argument. It now sends `event` as the 3rd argument.
+* The `pointerover` event, as dispatched by the InputPlugin, is now sent _after_ the Game Object specific events (`GameObject.pointerover` and `gameobjectover`). This gives you the chance to cancel the event before the global listener receives it.
+* The Game Object `pointerout` callback signature has a new argument. It now sends the `event` as the 2nd argument.
+* The Game Object `gameobjectout` callback signature has a new argument. It now sends `event` as the 3rd argument.
+* The `pointerout` event, as dispatched by the InputPlugin, is now sent _after_ the Game Object specific events (`GameObject.pointerout` and `gameobjectout`). This gives you the chance to cancel the event before the global listener receives it.
+
+### Game Object List Updates
+
+When Sprite's are created they are added to two lists within the Scene - the Display List and the Update List. Under 3.12 when a Scene was shut down it would emit a `shutdown` event, which Sprites listened out for. When they received it, they would destroy themselves.
+
+After [profiling and testing](https://github.com/photonstorm/phaser/issues/4028) this process has changed slightly. Game Object's no longer listen for the Scene `shutdown` event. Instead, the Display List and Update List will iterate their children and call `destroy` on them in turn. If being destroyed by a Scene in this way, the child will skip several expensive operations in its destroy function. More importantly, in busy Scenes you no longer need thousands of event listeners registered. The result is that changing Scene is now up to 100% faster than before. You need not change your code to benefit from this, however, if you were relying on custom Game Objects listening for the Scene `shutdown` event natively, then this is no longer the case and you'll have to manually add that listener to your classes.
+
+* The UpdateList will now clear out its internal `_list`, `_pendingRemoval` and `_pendingInsertion` lists on shutdown. Before, it would only clear `_list`.
+* `GameObject.destroy` has a new optional boolean argument `fromScene`, which controls how the destroy process flows.
+
+### Camera Render to Texture
+
+In 3.12 a new Camera method called `setRenderToTexture` was introduced. However, it had known issues so was placed under the experimental flag and you were advised not to use it unless in testing.
+
+Thanks to several fixes in this release the experimental flag has been dropped and it's now safe to try using this new feature in production.
+
+The method sets the Camera to render to a texture instead of to the main canvas. The Camera will redirect all Game Objects it's asked to render to this texture. During the render sequence, the texture itself will then be rendered to the main canvas.
+
+Doing this gives you the ability to modify the texture before this happens, allowing for special effects such as Camera specific shaders, or post-processing on the texture.
+
+* `Camera.setRenderToTexture` is a new method that enables the Camera to render to a target texture instead of the main canvas, allowing for application of special effects at run-time.
+* `Camera.clearRenderToTexture` is a new method that stops a Camera from rendering to a texture and frees-up all associated resources.
+* `Camera.setPipeline` allows you to change the WebGL pipeline being used if the Camera is rendering to a texture, effectively swapping the active shader. Call with no arguments to clear the pipeline.
+* `Camera.renderToTexture` is a boolean property that controls where the Camera renders. It can be toggled on the fly.
+* `Camera.canvas` is a Canvas Element that the Camera will render to if running under the Canvas Renderer and rendering to a texture.
+* `Camera.context` is a Rendering Context that the Camera will render to if running under the Canvas Renderer and rendering to a texture.
+* `Camera.glTexture` is a WebGL Texture that the Camera will render to if running under the WebGL Renderer and rendering to a texture.
+* `Camera.framebuffer` is a WebGL Frame Buffer that the Camera will render to if running under the WebGL Renderer and rendering to a texture.
+* `Camera.pipeline` is the Pipeline that the Camera will render with if running under the WebGL Renderer and rendering to a texture with a pipeline set.
+* If you set a Camera to render to a texture then it will emit 2 events during the render loop. First, it will emit the event `prerender`. This happens right before any Game Object's are drawn to the Camera texture. Then, it will emit the event `postrender`. This happens after all Game Object's have been drawn, but right before the Camera texture is rendered to the main game canvas. It's the final point at which you can manipulate the texture before it appears in-game.
+
+### New Features
+
+* The `Color` object has a new property `h` which represents the hue of the color. You can tween or adjust this property in real-time and it will automatically update the internal RGB values with it.
+* The `Color` object has a new property `s` which represents the saturation of the color. You can tween or adjust this property in real-time and it will automatically update the internal RGB values with it.
+* The `Color` object has a new property `v` which represents the lightness value of the color. You can tween or adjust this property in real-time and it will automatically update the internal RGB values with it.
+* `Color.setFromHSV` is a new method that will set the color values based on the HSV values given.
+* `Color.gray` is a new method that will set the color to be a shade of gray based on the amount given.
+* `Color.random` is a new method that will set the color to be a random hue based on the min and max values given.
+* `Color.randomGray` is a new method that will set the color to be a random grayscale based on the min and max values given.
+* `Color.saturate` is a new method that will saturate the color based on the amount given. This is a chainable version of adjusting the saturation property directly.
+* `Color.desaturate` is a new method that will desaturate the color based on the amount given. This is a chainable version of adjusting the saturation property directly.
+* `Color.lighten` is a new method that will lighten the color based on the amount given. This is a chainable version of adjusting the value property directly.
+* `Color.darken` is a new method that will darken the color based on the amount given. This is a chainable version of adjusting the value property directly.
+* `Color.brighten` is a new method that will brighten the color based on the amount given.
+* The `CanvasTexture` class has a new property `imageData` which contains the ImageData of the texture.
+* The `CanvasTexture` class has a new property `data` which is a Uint8ClampedArray view into the `buffer`.
+* The `CanvasTexture` class has a new property `pixels` which is a Uint32Array view into the `buffer`.
+* The `CanvasTexture` class has a new property `buffer` which is an ArrayBuffer the same size as the context ImageData.
+* The `CanvasTexture` class has a new method `update` which refreshes the ImageData and ArrayBuffer based on the texture contents.
+* The `CanvasTexture` class has a new method `draw` which draws the given Image or Canvas element to the CanvasTexture, then updates the internal ImageData buffer and arrays.
+* The `CanvasTexture` class has a new method `getPixel` which will get the color of a specific pixel from the Canvas Texture and store it in the returned Color object. It uses the ArrayBuffer to do this, which is extremely fast, allowing for quick iteration across the canvas data.
+* The WebGLPipeline and WebGLRenderer have new a method `setFloat1v` which allows you to set a `uniform1fv` uniform value (thanks @Mattykins)
+* The WebGLPipeline and WebGLRenderer have new a method `setFloat2v` which allows you to set a `uniform2fv` uniform value (thanks @Mattykins)
+* The WebGLPipeline and WebGLRenderer have new a method `setFloat3v` which allows you to set a `uniform3fv` uniform value (thanks @Mattykins)
+* The WebGLPipeline and WebGLRenderer have new a method `setFloat4v` which allows you to set a `uniform4fv` uniform value (thanks @Mattykins)
+* `Text.setLineSpacing` is a new method that allows you to easily set the line spacing value of a Text object in a chainable call (thanks @RafelSanso)
+
+### Updates
+
+* The Graphics Canvas Renderer will now automatically call `beginPath` on the target context before processing the command stack. This has the effect of clearing off any sub-paths that may have persisted on the stack from previous Graphics objects or frames. This makes it more in-line with WebGL re: expectations when calling `Graphics.clear`.
+* `initPipeline` now defaults to the Texture Tint Pipeline if nothing else is specified. This allowed me to remove explicit strings from 11 different Game Objects, saving some bytes in the process.
+* The `RGBToHSV` function can now take an optional `out` argument, which is either a `HSVColorObject` or a `Color` object, and the results will be set into that object instead of creating a new one.
+* The `HSVToRGB` function can now take an optional `out` argument, which is either a `HSVColorObject` or a `Color` object, and the results will be set into that object instead of creating a new one.
+* `Color.setTo` has a new argument `updateHSV` which allows you to control if the internal HSV values are updated during the same call or not.
+* The `Text._lineSpacing` property has been renamed to `lineSpacing` and made public, not private. You still set it in the same way, by passing a `lineSpacing` property to the Text configuration object, but internally it's now clearer.
+* If a Scene is already active (i.e. running) and you call `start` on it (such as from another Scene) then it will shutdown the Scene first, before starting it again.
+
+### Bug Fixes
+
+* TileSprite.setTileScale would set the tile position by mistake, instead of the scale. Using the properties directly worked, but the method was incorrect (thanks @alexeymolchan)
+* Calling `Text.setStyle` would make the Text vanish if you didn't provide a `resolution` property in the style configuration object. Calling `setStyle` now only changes the properties given in the object, leaving any previously changed properties as-is. Fix #4011 (thanks @okcompewter)
+* In Matter.js if a body had its debug `render.visible` property set to `false` it wouldn't then render any other debug body beyond it. Now it will just skip bodies with hidden debug graphics (thanks @jf908)
+* If you flagged a Tween as `paused` in its config, never started it, and then called `Tween.stop` it wouldn't ever be removed from the `_pending` array. It's now moved to the Tween Manager's destroy list, ready for removal on the next frame. Fix #4023 (thanks @goldfire)
+* Game Objects would not remove themselves from the Scene's `shutdown` event handler when destroyed, leading to a build-up over time (thanks @goldfire)
+* The WebGL Renderer will no longer try and just resize a canvas backed texture, instead it will properly delete it then re-create it. Fix #4016 (thanks @alexeymolchan)
+* The Camera background for mini-Cameras (those positioned deep inside another Camera) would be offset incorrectly in WebGL, causing the background fills to be displaced (thanks @aaronfc)
+* The WebGL Renderer now always enables the `SCISSOR_TEST`, this allows Game Objects that use the scissor (such as custom objects, or Bitmap Text) to render properly again.
+* The Cameras `setScene` method, which is called automatically when a new Camera is created, will now call `updateSystem` which correctly increases the custom viewport counter. This fixes an issue with mini-cams inside of larger cameras not clipping their contents properly. If a Camera is moved to another Scene it also now correctly shrinks the total custom viewport counter.
+* Due to the two fixes above another bug was fixed: The ability for you to swap between Cameras with and without `setRenderToTexture` enabled with custom shaders. Previously if you used this with a custom shader then only the first Camera using the shader would render, the rest would appear black. Now, all Cameras using the custom shader work correctly. As a result all of the 'experimental' Camera rendering properties from 3.12 have been moved to stable.
+* If you destroyed a Game Object that had a custom cursor set during one of its input events the cursor didn't correctly reset. Fix #4033 (thanks @pantoninho)
+* `RenderTexture.resize` wouldn't correctly resize the texture under WebGL. Fix #4034 (thanks @jbpuryear)
+* Calling `setFrame` on a TileSprite wouldn't change the frame, it would just change the frame size. Fix #4039 (thanks @Jerenaux)
+* `Zone.setRectangleDropZone` used the wrong `x` and `y` coordinates for the hit area, causing it to be offset from the zone itself after the changes made for issue #3865 in the 3.12 release.
+
+### Examples, Documentation and TypeScript
+
+My thanks to the following for helping with the Phaser 3 Examples, Docs and TypeScript definitions, either by reporting errors, fixing them or helping author the docs:
+
+@johanlindfors @Arthur3DLHC @JamesSkemp
+
+## Version 3.12.0 - Silica - 4th September 2018
+
+### FlatTintPipeline Updates
+
+In 3.11 I overhauled the TextureTintPipeline, the WebGL batch used to render all texture based Game Objects, such as Sprites. In this release I did the same to the FlatTintPipeline. This pipeline was used exclusively by the Graphics Game Object to draw filled and stroked primitives in WebGL. It was also used by classes such as the Camera in order to draw their colored backgrounds and flash / fade effects.
+
+When I looked closely at the shaders being used by the texture and graphics pipelines I noticed they were virtually identical. Yet if you were to mix Graphics objects and Sprites in your game, it would cause a complete batch flush as it switched between the them as it rebound the shaders, adding to both the draw calls and gl ops per frame.
+
+The more I looked through the graphics pipeline, the more I saw the same kind of things the texture one previously had: duplicate vars, in-line matrix operations and so on. So I worked through the process of refactoring it, boiling it down to just a handful of core methods and re-using methods the texture pipeline already had. The end result is that I've been able to remove the FlatTintPipeline entirely. This saves 42.3KB (unminifed) and removes 1000 lines of code from the build. Of course, lots of the methods were added to the texture pipeline, but that only increased from 730 sloc to 1087 sloc, a fraction of the amount before! And the benefits don't end there.
+
+If you had any custom pipelines that extended the FlatTintPipeline please update them to extend the TextureTintPipeline instead. You'll likely need to remap a few methods, but most of them remain the same. Double-check the method signatures though.
+
+The same pipeline can now draw both graphics and sprites, with the same shader and no texture swapping either. This means you can happily mix Graphics objects alongside Sprites and it won't cost any extra overhead at all. There are more benefits too, which are outlined in the list below.
+
+* The TextureTintPipeline now has 100% jsdoc coverage.
+* The removal of the FlatTintPipeline shaves 42.3KB and 1000 sloc from the bundle size.
+* The Graphics fill and line styles are now cached in the pipeline, rather than being re-calculated for every primitive drawn.
+* The new `batchTri` method will add a triangle to the vertex batch, either textured or filled.
+* `drawFillRect` is a new method that will add an untransformed rectangle to the batch. These are used by things like Cameras to fill in background colors.
+* `batchFillRect` has been moved to the TextureTintPipeline and has a new much more concise method signature.
+* `batchFillTriangle` has been moved to the TextureTintPipeline and has a new much more concise method signature.
+* `batchFillPath` has been moved to the TextureTintPipeline and has a new much more concise method signature.
+* `batchLine` has been moved to the TextureTintPipeline.
+* When drawing Graphics paths with a line width of 1 it will no longer spend any time drawing the line joins, speeding-up the rendering of 1px lines.
+
+### WebGL Scissor Update
+
+The process of managing scissors in the WebGLRenderer has been completely rewritten. Previously, the gl scissor was being constantly enabled and disabled for every Camera in your game, leading to pointless gl operations.
+
+* Cameras have a new internal method `updateSystem` which is automatically called if you change any Camera viewport values. This in turn tells the Scene Manager if there are any cameras with custom viewports, in any Scene of your game. If there are not then the scissor is never even enabled or set, meaning zero gl ops! If your game uses full sized Cameras it now doesn't cost anything at all with regard to scissoring.
+* If a new scissor is set it will now check to see if it's the same size and position as the current scissor, and if so, it'll skip setting it at all.
+
+### Render Texture New Features and Updates
+
+The Render Texture class has been rewritten from scratch and all Game Objects have been updated to support it. Previously it was very restricted in what you could do with it. It used to have a matrix stack for internal transforms, but this has been replaced with a Camera instead. This means you have the full power of a Camera system (scrolling, zooming, rotation) but it only impacts the contents of the Render Texture.
+
+* The biggest update is the change in what the `draw` method can accept. Previously you had to pass in a texture and frame reference. This has changed, as has the method signature. It can now accept any of the following:
+
+ - Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
+ - Dynamic and Static Tilemap Layers.
+ - A Group. The contents of which will be iterated and drawn in turn.
+ - A Container. The contents of which will be iterated fully, and drawn in turn.
+ - A Scene. Pass in `Scene.children` to draw the whole display list.
+ - Another Render Texture.
+ - A Texture Frame instance.
+ - A string. This is used to look-up a texture from the Texture Manager.
+
+* There is a new method `drawFrame` which allows you to pass in a string-based texture and frame key and have it drawn to the Render Texture.
+* The new method `saveTexture` allows you to save the Render Texture into the Texture Manager using your own key. You can then use the Render Texture for any Game Object that accepts textures as a source, such as Sprites or even Tilemap Layers. You can add frame data to a Render Texture using the `RenderTexture.texture.add` method.
+* The new `camera` property is an instance of a complete 2D Camera. You can use it to change the view into your Render Texture. Scroll, rotate, zoom, just like you would with a normal Camera, except it will only influence the objects being drawn to the Render Texture.
+* All of the matrix-style methods have been removed: `save`, `translate`, `restore`, `scale`, `rotate`. You can now achieve the same thing by either transforming the object you want to draw to the Render Texture, or using the built-in Camera.
+* You can now crop a Render Texture. Use the `setCrop` method to define the crop region.
+
+See the fully complete documentation for more details and the extensive examples and tests created.
+
+### Text Game Object New Features and Updates
+
+The Text Game Object has been given an internal overhaul to make it more flexible. Some properties have been renamed or moved and new features added:
+
+* Text can now be cropped in WebGL and Canvas! Use the `setCrop` method to crop the text.
+* Text now keeps a reference to the renderer in the `renderer` property.
+* The `canvasTexture` property has been removed.
+* Text now has internal `texture` and `frame` properties. These replace the old `canvasTexture` but perform the same task, while allowing for texture cropping and much smaller renderer code.
+* Previously, changing a Text object by setting its `text` property directly wouldn't change the text being rendered as using `setText` was the expected way to change what was being displayed. Internally the `text` property has been renamed to `_text` and flagged as private, and a new getter / setter for `text` has been added, which hands over to the `setText` method, meaning you can now use both ways of setting the text. Fix #3919 (thanks @hackhat @samid737)
+
+### Tile Sprite Object New Features and Updates
+
+The Tile Sprite Game Object has been given an internal overhaul to make it more flexible. Some properties have been renamed or moved and new features added:
+
+* Tile Sprites can now be cropped in WebGL and Canvas! Use the `setCrop` method to crop the tile sprite.
+* There is a new method `setTileScale` which will set the tile scale in a chainable call.
+* There is a new internal `canvas` property. Tile Sprites work differently than before in Canvas mode: Previously they would use the `fillRect` command on the game canvas to draw themselves every frame, even if they hadn't changed. They now draw to an internal canvas only when their position or scale changes. This canvas is then drawn to the game canvas instead. It's faster, as it doesn't fillRect every frame and also allows you to draw them to other contexts, such as Render Textures.
+* There are two new internal properties `_tilePosition` and `_tileScale` which are Vector 2s that hold the position and scale. Getters have been added, so use the same properties as before in your code.
+* There are two new properties `displayTexture` and `displayFrame`. These replace the previous `texture` and `frame` properties and hold references to the source texture the Tile Sprite is using.
+* The `canvasPattern` property has been renamed to `fillPattern`.
+* The `oldFrame` property has been removed.
+* The `canvasBuffer` property has been renamed to `fillCanvas`.
+* The `canvasBufferCtx` property has been renamed to `fillContext`.
+
+### Tilemap New Features and Updates
+
+The Tilemap and Dynamic and Static Tilemap Layer classes now all support 4 different modes of render order for drawing the tiles. This allows you to control the z-order of the tiles during render. This feature was requested by @etienne (who provided the test maps too) - see the new examples in the Labs for better understand the impact this has.
+
+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 four draw orders are:
+
+0 = right-down
+1 = left-down
+2 = right-up
+3 = left-up
+
+* Tilemap has a new property `renderOrder` which is a string based version of the render order, as used when new layers are created via the map. If the map is created from Tiled JSON data, it will use whatever render order has been specified in the map data.
+* Tilemap has a new method `setRenderOrder`. This takes either an integer or a string-based version of the render order and stores it locally. It's then used during the creation of any layers from that point on.
+* The DynamicTilemapLayer has a new method `setRenderOrder`. This takes either an integer or a string-based version of the render order and stores it locally. It's then used during rendering of the layer. You can change the value on the fly.
+* The StaticTilemapLayer has a new method `setRenderOrder`. This takes either an integer or a string-based version of the render order and stores it locally. Under WebGL it will re-create the whole vertex buffer, using the new draw order. Under Canvas it uses it at run-time during rendering. You can change it on the fly.
+* ParseJSONTiled now extracts the `renderorder` property from the Tiled JSON.
+* MapData has a new `renderOrder` property, which is populated by the Tiled Parser.
+
+### Matter.js Updates
+
+The version of Matter.js used by Phaser has been updated from 0.13.1 to 0.14.2. To clarify why we don't include Matter via npm, it's because we use a customized version of Matter that includes extra features and optimizations not yet found in the official library.
+
+Most of the updates were about documentation and module namespacing, however those relevant to Phaser are listed below. You can also view the full [Matter Change Log](https://github.com/liabru/matter-js/blob/master/CHANGELOG.md).
+
+* fix Composite.bounds global issue, closes #627, closes #544 ([f7f77b4](https://github.com/liabru/matter-js/commit/f7f77b4)), closes [#627](https://github.com/liabru/matter-js/issues/627) [#544](https://github.com/liabru/matter-js/issues/544)
+* updated pathseg library, closes #548, closes #602, closes #424 ([1e5758f](https://github.com/liabru/matter-js/commit/1e5758f)), closes [#548](https://github.com/liabru/matter-js/issues/548) [#602](https://github.com/liabru/matter-js/issues/602) [#424](https://github.com/liabru/matter-js/issues/424)
+* fix Common.isElement on node, closes #535 ([ec38eeb](https://github.com/liabru/matter-js/commit/ec38eeb)), closes [#535](https://github.com/liabru/matter-js/issues/535)
+* added Query.collides, closes #478 ([6593a72](https://github.com/liabru/matter-js/commit/6593a72)), closes [#478](https://github.com/liabru/matter-js/issues/478)
+* fix `point` argument of Body.scale, closes #428 ([894c1ef](https://github.com/liabru/matter-js/commit/894c1ef)), closes [#428](https://github.com/liabru/matter-js/issues/428)
+* fix Body.scale for compound bodies ([50a89d0](https://github.com/liabru/matter-js/commit/50a89d0))
+* fix centroid for static compound bodies, closes #483 ([ece66e6](https://github.com/liabru/matter-js/commit/ece66e6)), closes [#483](https://github.com/liabru/matter-js/issues/483)
+* fix Common.isElement, closes #501, closes #507, closes #459, closes #468, closes #517 ([18a0845](https://github.com/liabru/matter-js/commit/18a0845)), closes [#501](https://github.com/liabru/matter-js/issues/501) [#507](https://github.com/liabru/matter-js/issues/507) [#459](https://github.com/liabru/matter-js/issues/459) [#468](https://github.com/liabru/matter-js/issues/468) [#517](https://github.com/liabru/matter-js/issues/517)
+* fix inertia change in Body.setMass, closes #378 ([f7d1877](https://github.com/liabru/matter-js/commit/f7d1877)), closes [#378](https://github.com/liabru/matter-js/issues/378)
+* fix Vertices.chamfer radius argument, closes #467 ([3bceef4](https://github.com/liabru/matter-js/commit/3bceef4)), closes [#467](https://github.com/liabru/matter-js/issues/467)
+
+### Camera 3D Plugin
+
+Support for Camera 3D and Sprite 3D Game Objects have been removed from the core Phaser bundle and moved to an optional plugin.
+
+You can find the source for Camera 3D in the new `plugins/camera3d` folder, along with a README file explaining how to now use the plugin in your games.
+
+* When a Sprite3D object is added to a Camera via `Camera.add` it is now added to the Display and Update Lists. Fix #3945 (thanks @vvega)
+
+### New Features
+
+* `Camera.resolution` is a new read-only property that holds the current game config resolution that the camera is using. This is used internally for viewport calculations.
+* `Text.resolution` and the method `Text.setResolution` allows you to control the resolution of a Static Text Game Object. By default it will be set to match the resolution set in the Game Config, but you can override it yourself via the TextStyle. It allows for much clearer text on High DPI devices, at the cost of larger internal Canvas textures for the Text - so please use with caution, as the more high res Text you have, the more memory it uses up. Fix #3528 (thanks @kirillbunin)
+* `TransformMatrix.getCSSMatrix` will return a CSS transform matrix formatted string from the current matrix values.
+* `CacheManager` now creates a new cache called `html` which is used to store all loaded HTML snippets.
+* `FileType.HTML` is a new file type loader that will load an HTML snippet and store it in the new `html` cache. Access it via `load.html` (this method was previously used to load html to textures, please see `load.htmlTexture` for this feature now)
+* `TransformMatrix.getX` is a new method that return the x component from the given x and y values based on the current matrix. This is used heavily in the pipelines.
+* `TransformMatrix.getY` is a new method that return the y component from the given x and y values based on the current matrix. This is used heavily in the pipelines.
+* `TransformMatrix.copyToArray` is a new method that will copy the matrix values to the given array. It's the counter-part of `copyFromArray`.
+* `Graphics.setTexture` is a new WebGL only method that allows you to set a texture to be used when drawing the shapes on the Graphics object. You can also specify how the texture should be blended with the current fill or gradient colors. Note that the texture is not tiled, it is stretched to fit the shape being drawn.
+* `Graphics.fillGradientStyle` is a new WebGL only method that allows you to set a gradient for the shapes being filled. You can control the colors at the 4 corners of a rectangle. The colors are then blended automatically in the shader. Use of this feature is limited. For example, you cannot gradient fill a whole path or an arc, as it's made up of lots of triangles. But for quick gradient backgrounds or buttons it's perfect.
+* `Graphics.lineGradientStyle` is a new WebGL only method that allows you to set a gradient for the shapes being stroked. You can control the colors at the 4 corners of a rectangle. The colors are then blended automatically in the shader. Use of this feature is limited. For example, you cannot gradient stroke a whole path or an arc, as it's made up of lots of triangles. But for quick gradient lines it's perfect.
+* `TextureManager.getBase64` is a new method that will take a texture frame key and return a base64 encoded version of the frame. You can also provide the image type and encoder options.
+* Global Plugins now have a new optional `data` object, the contents of which are passed to the plugins `init` method. This allows users to pass data directly into a plugin when added in the config: `{ key: 'BankPlugin', plugin: BankPluginV3, start: true, data: { gold: 5000 } }` or when adding a plugin via the `install` method (thanks @samme)
+* You can now play animations in reverse! Use the new `Sprite.anims.playReverse` method to play a pre-defined animation in reverse from its starting frame. Or call `Sprite.anims.reverse` to immediately reverse the flow of an already running animation. Animations running in reverse still count towards the repeat total and respect the yoyo flag (thanks @khaleb85 @Ben-Millions)
+* The `ParticleEmitterManager` now has the Transform component. This means you can now set the position, rotation or scale of the Emitter Manager, and it will influence every Emitter it is rendering. The Managers transform is mixed with that of the Camera. This works in both Canvas and WebGL.
+* `TextureManager.addRenderTexture` is a new method that will add a Render Texture into the Texture Manager, allowing you to use it as the texture for Game Objects just by using the texture key. Modifying the source Render Texture will immediately modify any Game Objects using it.
+* TextureSource has a new boolean property `isRenderTexture` which is set automatically when it's created.
+* The Canvas Renderer has a new method `setContext` which allows it to swap the context being drawn to by all draw operations. Call the method with no arguments to reset it to the default game canvas.
+* If you set `window.FORCE_WEBGL` or `window.FORCE_CANVAS` in the window in which the Phaser game is loaded it will over-ride the renderer type setting in your game config, and force either WebGL or Canvas. This is handy for quickly testing the differences between renderers without having to do a new build each time.
+* `TextureSource.source` is a new property that contains the original source of the Texture image. It is cleared when the source is destroyed.
+* `TransformMatrix.copyToContext` is a new method that will copy the values from the Matrix to the given Canvas Rendering Context.
+* `Phaser.Utils.String.UUID` will return an RFC4122 complaint UUID as a string. This is used internally to avoid cache key conflicts, but is exposed for your own use as well.
+* There is a new `Crop` Component which is used by non-texture based Game Objects, such as Text and TileSprite. You either use `TextureCrop` or `Crop`, not both together on the same object.
+* `TransformMatrix.setToContext` is a new method that will set the values from the Matrix to the given Canvas Rendering Context using setTransform rather than transform.
+* `SetTransform` is a new Canvas Renderer function that consolidates the process of preparing a Game Object for rendering, without actually rendering it. This is used internally by the Graphics and Bitmap Text classes.
+* The Texture Manager has a new method called `renameTexture` which will let you rename a texture, changing the key to the new one given. All existing Game Objects will still maintain their reference, even after a rename.
+* When loading an SVG file you can now change the size of the SVG during the load process, before it is rendered to a texture. This is really helpful if you wish to increase SVGs that have small viewBoxes set, or want to try and reduce memory consumption from SVGs with extra large dimensions. You can either pass in a fixed width and height: `this.load.svg('morty', 'file.svg', { width: 300, height: 600 })` or you can provide a scale factor instead: `this.load.svg('morty', 'file.svg', { scale: 4 })` (thanks @ysraelJMM)
+* `Polygon.Perimeter` will return the perimeter for the given Polygon (thanks @iamchristopher)
+* `Polygon.GetPoints` will return an array of Point objects containing the coordinates of the points around the perimeter of the Polygon, based on the given quantity or stepRate values. This is available as a static function and as the `getPoints` method on a Polygon (thanks @iamchristopher)
+
+### Updates
+
+* The Camera class has been split into two: `BaseCamera` which contains all of the core Camera functions and properties, and would serve as a great base for you to extend for your own custom Cameras, and `Camera` which is the same class name as previously. `Camera` extends the Base Camera and adds in follower support and the Special Effects. You don't need to update your code, even if currently extending a Camera, as they work the same as before.
+* `Camera.x` and `Camera.y` have been turned into getters / setters, mapped to the internal private values `_x` and `_y` respectively. This is so that setting the Camera viewport position directly will now update the new internal resolution calculation vars too.
+* `Camera.setScene` will now set the Cameras `resolution` property at the same time and update the internal viewport vars.
+* The `Cull Tiles` method used by the Dynamic Tilemap Layer has had a nice and significant optimization. It will now use the cull area dimensions to restrict the amount of tile iteration that takes place per layer, resulting in dramatic reductions in processing time on large layers, or multiple layers (thanks @tarsupin)
+* `GameObject.willRender` now takes a Camera as its only argument and uses it within the check. This has allowed me to remove 23 duplicate checks spread across the various Game Objects, all of which did the same thing, saving both KB and CPU time as the flags were being checked twice in most cases.
+* The file type loader `HTML` has been renamed to `HTMLTexture`. If you were using this then please change your calls from `load.html` to `load.htmlTexture`. The arguments remain the same.
+* The `setBlendMode` method in the WebGL Renderer now returns a boolean. True if a new blend mode was set, otherwise false. Previously it returned a reference to the renderer instance.
+* The method `batchVertices` in the TextureTintPipeline has been renamed to `batchQuad` which more accurately describes what it does.
+* In ArcadePhysics `Body.setSize` you can now choose to not pass width and height values to the method. If you do this it will check to see if the parent Game Object has a texture frame, and if so, it will use the frame sizes for the Body dimensions (thanks @tarsupin)
+* `PluginCache.destroyCorePlugins` will remove all core plugins from the cache. Be very careful calling this as Phaser cannot restart or create any new Scenes once this has been called.
+* `PluginCache.destroyCustomPlugins` will remove all custom plugins from the cache.
+* `PluginManager.destroy` will now clear all custom plugins from the Plugin Cache. This fixes an issue with not being able to destroy a Phaser game instance and restart it if it used a custom plugin (thanks jd.joshuadavison)
+* `Game.destroy` has a new boolean argument `noReturn`. If set it will remove all Core plugins when the game instance is destroyed. You cannot restart Phaser on the same web page after doing this, so only set it if you know you're done and don't need to run Phaser again.
+* The `MouseManager` will no longer process its native events if the manager reference has been removed (i.e. you move the pointer as the game is destroying itself)
+* The `TouchManager` will no longer process its native events if the manager reference has been removed (i.e. you move the pointer as the game is destroying itself)
+* `Particle.color` has been removed as it's now calculated during rendering to allow for Camera alpha support.
+* The Game boot event flow has changed slightly. The Game will now listen for a `texturesready` event, which is dispatched by the Texture Manager when the default textures have finished processing. Upon receiving this, the Game will emit the `ready` event, which all the other systems listen for and respond to. The difference is that the Renderer uses the `texturesready` event to ensure that it is the first thing to be activated, before any other system.
+* The WebGLRenderer has a new property `blankTexture` which is a reference to an empty 32x32 transparent WebGL Texture. This is used internally for things like rendering Graphics with no texture fills and where no other texture has been set.
+* The WebGLRenderer has a new method `setBlankTexture` which forces it to set the blank texture as the current texture. This is used after drawing a Render Texture to ensure no other object tries to draw to itself.
+* The StaticTilemapLayer has had the following properties and methods added to it: `skipCull`, `tilesDrawn`, `tilesTotal`, `cullPaddingX`, `cullPaddingY`, `cullCallback`, `setSkipCull` and `setCullPadding` as these are all used by the Canvas Static Layer renderer. Static Layers in 3.11 didn't render in Canvas because the cull values were missing, but now render correctly and can also be rendered to other targets, like a Render Texture.
+* The Math.Snap methods `Snap.Floor`, `Snap.Ceil` and `Snap.To` have all gained a new optional boolean argument `divide`. If set the resulting snapped value will be divided by the gap amount before returning. This is handy if you're trying to quickly snap a value into a grid or array location.
+* The `currentBlendMode` property has been removed from the Canvas Renderer and is no longer checked by any class. Blend modes are now set directly on the context to avoid state saving invalidation.
+* The `currentAlpha` property has been removed from the Canvas Renderer and is no longer checked by any class. Alpha values are now set directly on the context to avoid state saving invalidation.
+* `TextureCrop` and `Crop` have a new method `resetCropObject` which generates the crop data object required by Game Objects that support cropping. This allows us to remove duplicate code from a number of Game Objects and replace it with a single function call.
+* The Canvas Renderer has a new `batchSprite` method that consolidates the process of drawing a texture-based Game Object to the canvas. It processes the alpha, blend mode and matrix calculations in a single function and now is used by nearly all Game Object canvas renderers.
+* The `batchTexture` method in the Texture Tint Pipeline now supports cropped Game Objects and will adjust the drawn texture frame accordingly.
+* The `Matrix Stack` Component has been removed. It's no longer used internally and was just wasting space.
+* You can now specify the `lineHeight` of a Retro Font in the Retro Font Config object (thanks @FelixNemis)
+* When a Static Tilemap Layer is generated in WebGL it will use the Cameras `roundPixels` value to clamp the tile coordinates.
+* The `CanvasRenderer.DrawImage` function has been removed, as has the associated `drawImage` property from the Canvas Renderer as they're no longer used.
+* The `CanvasRenderer.BlitImage` function has been removed, as has the associated `blitImage` property from the Canvas Renderer as they're no longer used.
+* You can now access the Game instance directly from a Scene using `this.game` as long as it exists in the Scene's Injection Map, which it does by default. Be very careful what you do here: there's next to nothing you should actually use this for.
+* `Camera.ignore` can now take nested-arrays of Game Objects and also supports both Groups and Containers.
+* The `changedata` event dispatched by the Data Manager now includes the previous value as the 4th argument to the callback, so the event signature is now: `parent, key, value, previousValue` (thanks @iamchristopher)
+* The call to `gl.clearColor` is now skipped when `clearBeforeRender` is set to `false` (thanks @goldfire)
+* The calls to `DistanceBetween` have been replaced with `DistanceSquared` in the `closest` and `furthest` functions within Arcade Physics (thanks @Mursaat)
+* The RandomDataGenerator will now create a default random seed if you instantiate your own version of the class (instead of using `Phaser.Math.RND`) and don't provide a seed for it (thanks michaeld)
+* The Tilemap `createFromObjects` method will now add custom properties to the Game Objects. It works by checking if the property exists or not, and if not, it sets it in the Game Objects Data Manager (thanks @scalemailted @samme)
+* In Matter.js if you scaled a Body it would only scale correctly once, due to the way Matter handles scaling internally. We now automatically reset the Matter scale before applying the new value, which allows you to keep the Phaser and Matter object scales in sync. Fix #3785 #3951 (thanks @bergben)
+* The default Container Blend Mode is now `SKIP_TEST`. This allows you to either set a blend mode for a Container, in which case all children use that blend mode. Or, you can set a blend mode on the children and the children will render using their own blend modes, as the Container doesn't have one set. The WebGL and Canvas Renderer functions have also been updated to support this change. Fix #3684 (thanks @TadejZupancic)
+* Previously the Input Manager would create a Touch handler unless the Game Config had `input.touch` set to `false` (the default was true). If no such property is set, it no longer defaults to `true` and instead is set to whatever `Device.input.touch` returns. On non-touchscreen desktops this means it will now only create one single Pointer, rather than two.
+* The Arcade Physics Body `_tempMatrix` property has been removed. It was only used if the Body's Game Object had a parent. The matrix has been moved to the World instance instead, shared by all bodies.
+* Arcade Physics World has gained two new private properties `_tempMatrix` and `_tempMatrix2`. These are used by all bodies in the simulation that need a temporal matrix for calculations, rather than having their own instances.
+* The Input Manager has gained a new private property `_tempMatrix2`. This is used internally in the hitTest checks to avoid constant matrix creation.
+* The Transform Matrix has a new method `applyInverse` which will take an x/y position and inverse translate it through the current matrix.
+* Using `keyboard.addKeys("W, A, S, D")` would fail because of the spacing between the characters. `addKeys` will now trim the input allowing you to space characters out if you prefer (thanks @dhruvyad)
+* Calling `setTimeScale` on the Sprite's Animation component will now set the time scale value and keep it set until you change it again. Previously it would be reset to 1 when a new animation was loaded into the component, but this no longer happens - once the time scale is set it remains in effect, regardless of which animations are played on the Sprite.
+
+### Game Config Resolution Specific Bug Fixes
+
+Setting the `resolution` property in the Game Config to a value other than 1 would cause various errors in the API. The following have been fixed:
+
+* The game canvas would be sized incorrectly, unless you had enabled auto resizing. It now scales the canvas to the size given, maintaining the resolution. Fix #3468 (thanks @Legomite)
+* Cameras with background colors set would display the filled color area at the wrong size. Camera fills now respect the resolution.
+* The Camera Fade Effect would display the fade fill rectangle at the wrong size. Camera fades now respect the resolution.
+* The Camera Flash Effect would display the fade fill rectangle at the wrong size. Camera flashes now respect the resolution.
+* The Camera Shake Effect would shake the Camera using the wrong width values. Camera Shakes now respect the resolution.
+* Input calculations would not factor in the Game Resolution correctly. If a Camera viewport was not at 0x0 or not the full size, or the Camera was rotated or zoomed, the input areas would be wrong if `resolution` was > 1. These are now factored in correctly and changing the resolution no longer breaks input. Fix #3606 (thanks @Secretmapper @thanh-taro)
+
+### Bug Fixes
+
+* The `setCrop` method stored its crop object on the prototype chain by mistake, causing all Images or Sprites that were cropped to display the same frame. The crop data has been moved to the Game Object instance, where it should be, fixing this issue (thanks NoxBrutalis)
+* If an AudioFile failed to load and throw an incomplete error, it would cause the console.log to crash JavaScript when trying to log the error. It now only logs the message if it exists. Fix #3830 (thanks @kelostrada)
+* Particles using a blend mode wouldn't render correctly after the updates in 3.11. If the blend mode changes during the processing of an emitter manager it'll now correctly rebind the texture, stopping the particles from vanishing. Fix #3851 (thanks @maxailloud)
+* Adding an array of children to a Group would cause it to mistakenly think you were passing a config object. Fix #3854 (thanks @pedro-w)
+* Graphics paths in WebGL would not render the line join between the final and the first path if the path was closed, leaving a noticeable gap if you used particularly thick strokes. If the path is closed it will now render the final line join properly.
+* If a Mesh caused a batch flush it would fail to render as its texture was lost. It's now rebound correctly after the flush.
+* `ArcadePhysics.closest` and `ArcadePhysics.furthest` used the wrong tree reference, causing them to throw errors (thanks @samme)
+* `BlitterCanvasRenderer` would fail to render a Bob in Canvas mode if it was flipped (thanks @SBCGames)
+* `RenderTexture.draw` would fail to draw the frame in Canvas mode (thanks @SBCGames)
+* `ParticleEmitter` would fail to draw a textured particle in Canvas mode (thanks @SBCGames)
+* `RenderTexture.preDestroy` will now release the canvas back to the CanvasPool if running in canvas mode (thanks @SBCGames)
+* The `alpha` value is now always set for Render Textures in canvas mode, regardless of the previous alpha value in the renderer (thanks @SBCGames)
+* Zone now calls `updateDisplayOrigin` in its constructor, causing the `displayOriginX` and `displayOriginY` values to now be correct if you create a Zone and then don't resize it. Fix #3865 (thanks @rexrainbow)
+* The `CameraManager` was accidentally adding extra destroy event calls when a Scene was restarted, causing an `Uncaught TypeError: Cannot read property 'events' of null` when trying to destroy a game instance having swapped from a Scene to another, and back again. Fix #3878 (thanks @mbunby)
+* RenderTextures in WebGL will now set the viewport size, stopping the console warning in Firefox. Fix #3823 (thanks @SBCGames)
+* Particles now take the Cameras alpha value into consideration when calculating their final alpha values in WebGL. They previously ignored it. If you now alpha a Camera out all particles will change accordingly.
+* The `CullTiles` updates from 3.11 didn't factor in the position of the Tilemap Layer to its bounds calculations, causing Static layers displayed out of the Camera viewport to never render in Canvas mode. The method has also been optimized further, with less divisions and less checks if culling is disabled.
+* The Particle Emitter when running in Canvas wouldn't allow more than 1 emitter to use a blend mode (as seen in the Electric examples). The blend mode is properly set for each emitter now.
+* The Blend Mode is now set directly in all Canvas Renderers without comparing it to what's stored in the Canvas Renderer. This fixes problems where the blend mode would be lost between two different Game Objects because they restored the context, but didn't update the renderer flag. Game Objects in Canvas can now mix and match blend modes across the display list.
+* Matter.js has received a tiny update that prevents `collisionEnd` from triggering many times when it should only trigger once (thanks @mikewesthad)
+* Graphics objects couldn't be set to be ignored by Cameras. Now every renderable Game Object can be ignored by a Camera, either directly or via a Container. The exception are Groups because they don't render and are non-exclusive parents.
+* The Tilemap Culling function now uses the Tilemap tile dimensions for its bounds calculations, instead of the layer tile sizes, as they two don't have to match and it's the underlying grid size that takes precedence when calculating visible tiles. Fix #3893 (thanks @Zax37)
+* The Arcade Physics `Body.speed` property is now set whenever you set the velocity via `setVelocity` or `setVelocityX` or `setVelocityY` which stops the body velocity being reset to zero if `useDamping` is enabled. Fix #3888 (thanks @samme)
+* The `getPixelAlpha` method in the Texture Manager wasn't using the correct frame name. This is now passed in correctly. Fix #3937 (thanks @goldfire)
+* The `getPixelAlpha` and `getPixel` methods in the Texture Manager would allow x/y coordinates from outside the cut area of a frame. It now tests to ensure they're within the frame. Fix #3937 (thanks @goldfire)
+* A Game Object couldn't have a blend mode of `SKIP_TEST` set by using the getter or the `setBlendMode` method.
+* In Arcade Physics the `World.disable` call was passing the wrong argument, so never disabling the actual body (thanks @samme)
+* There was a visual bug with Rounded Rectangles in Canvas mode, due to the addition of the `overshoot` argument in the Graphics arc call. This has been fixed, so arcs will now render correctly and consistently in WebGL and Canvas and Rounded Rectangles are back to normal again too. Fix #3912 (thanks @valse)
+* The `InputManager.inputCandidate` method, which determines if a Game Object can be interacted with by a given Pointer and Camera combination, now takes the full camera status into consideration. This means if a Camera is set to ignore a Game Object you can now no longer interact with it, or if the Camera is ignoring a Container with an interactive Game Object inside it, you cannot interact with the Container children anymore. Previously they would interact regardless of the Camera state. Fix #3984 (thanks @NemoStein @samid737)
+* `Transform.getWorldTransformMatrix` has been recoded to iterate the transform parents correctly, applying the matrix multiplications as it goes. This (along with some changes in the Input Manager) fix the issue with Game Objects inside of Containers failing hit tests between certain angles. Fix #3920 (thanks @chaping @hackhat)
+* Calling Arcade Physics `collide` during an `update` method wouldn't inject the results back into the Body parent, causing the bodies to carry on moving. Using Colliders worked, but manually checking did not. Now, both methods work. Fix #3777 (thanks @samme)
+* The `setTintFill` method would ignore the `alpha` value of the Game Object in the shader. The alpha value is now blended with the tint fill, allowing you to properly alpha out tint-filled Game Objects. Fix #3992 (thanks @trl-bsd)
+* Arcade Physics World `collideSpriteVsTilemapLayer` now syncs the collision results back to the body, allowing you to call `collide` from within an update loop once again. Fix #3999 (thanks @nkholski @mikewesthad)
+* Arcade Physics Body `deltaX` and `deltaY` methods will now return the previous steps delta values, rather than zero. Fix #3987 (thanks @HaoboZ)
+
+### Examples, Documentation and TypeScript
+
+My thanks to the following for helping with the Phaser 3 Examples, Docs and TypeScript definitions, either by reporting errors, fixing them or helping author the docs:
+
+@SBCGames @rgk @rook2pawn @robbintt @bguyl @halilcakarr @PhaserEditor2D @Edwin222 @tfelix @Yudikubota @hexus @guzmonne @ampled @thanh-taro @dcbriccetti @Dreaded-Gnu @padme-amidala @rootasjey @ampled @thejonanshow @polarstoat @jdjoshuadavison @alexeymolchan @samme @PBird @spontoreau @hypertrifle @kid-wumeng
+
+Thanks to @khaleb85 for fixing the super-annoying lag on the API Docs pages when it hung the browser while indexing the search field.
+
+
+## Version 3.11.0 - Leafa - 13th July 2018
### Camera - New Features, Updates and Fixes
* All of the 2D Camera classes are now 100% covered by JSDocs!
+* All of the 3D Camera classes are now deprecated and will be removed in the next version. They will be moved to a stand-alone plugin.
* `Camera.alpha` (and its related method `Camera.setAlpha`) allows you to set an alpha level for the entire camera. This impacts everything it is rendering, even if those objects also have their own alpha values too. You can tween the property to make the camera contents fade in / out, or otherwise set it as needed in your game.
* `Camera.deadzone` (and its related method `Camera.setDeadzone`) allows you to specify the deadzone for a camera. The deadzone is a rectangular region used when a camera is following a target. If the target is within the deadzone then the camera will not scroll. As soon as the target leaves the deadzone, the camera will begin tracking it (applying lerp if needed.) It allows you to set a region of the camera in which a player can move freely before tracking begins. The deadzone is re-centered on the camera mid point every frame, meaning you can also use the rectangle for other in-game checks as needed.
* `Camera.pan` is a new Camera Effect that allows you to control automatic camera pans between points in your game world. You can specify a duration and ease type for the pan, and it'll emit events just like all other camera effects, so you can hook into the start, update and completion of the pan. See the examples and docs for more details.
@@ -12,6 +844,8 @@
* `Camera.midPoint` is a new Vec2 property that is updated every frame. Use it to obtain exactly where in the world the center of the camera is currently looking.
* `Camera.displayWidth` is a new property that returns the display width of the camera, factoring in the current zoom level.
* `Camera.displayHeight` is a new property that returns the display height of the camera, factoring in the current zoom level.
+* `Camera.worldView` is a new property, an instance of a Rectangle, that contains the dimensions of the area of the world currently visible by the camera. You can use it for intersection or culling tests that don't need to factor in camera rotation.
+* `Camera.dirty` is a new boolean property. A dirty Camera has had either its viewport size, bounds, scroll, rotation or zoom levels changed since the last frame. The flag is reset in the `postCameraRender` method, but until that point can be checked and used.
* `Camera.centerOn` is a new method that will move the camera so its viewport is centered on the given coordinates. A handy way of jumping to different points around a map without needing to calculate the scroll offsets.
* The Camera bounds didn't factor in the camera zoom properly, meaning you would often not be able to reach the corners of a camera bound world at a zoom level other than 1. The bounds are now calculated each frame to ensure they match the zoom level and it will no longer allow you to scroll off the edge of the bounds. Fix #3547 (thanks @nkholski)
* `Camera.centerToBounds` didn't take the bounds offset into account, so bounds at non-zero positions wouldn't center properly. All bounds now center correctly. Fix #3706 (thanks @cyantree)
@@ -42,6 +876,80 @@ There is a third game config property called `pixelArt`. If set to `true` it's t
* If in your game config you have enabled either pixel art mode or roundPixels, then all Cameras will have their `roundPixels` values set to `true` by default. You can toggle this by changing the `CameraManager.roundPixels` property, or change it on a camera-by-camera basis, as needed.
* `Camera.roundPixels` is now used across all rendering code for both Canvas and WebGL. Previously, it would check the renderer config value, but now all renderer code uses the camera value to decide if it should floor the drawing position or not.
+### Texture Tint Pipeline - New Features, Updates and Fixes
+
+The Texture Tint Pipeline has been rewritten to tidy up hundreds of lines of duplicate code and to move the responsibility of drawing to the Game Objects themselves. Previously, had you excluded say Tilemaps from your build of Phaser, the renderer would still include masses of code dealing with the drawing of them. This task has been moved to the Game Objects and the pipeline just provides a set of clean utility functions for batching, flushing and drawing.
+
+The decision to make this change was not taken lightly. However, I felt that none of the pipelines actually lived up to their name. You could never actually pass objects through one pipeline to another as they didn't have entry and exit points and were instead just glorified singular batches. Although you could change the pipeline being used on a Game Object this action meant that every pipeline had to be responsible for every single type of Game Object, both now and in the future, and they were full of redundant stub functions as a result. The payload size was also considerable. It has now gone from 1,961 lines of code at 76 KB down to 729 lines of code and 27 KB. It's not the only file to benefit either. The `ForwardDiffuseLightPipeline` also reduced from 402 lines (15.7 KB) down to 159 lines and 6 KB. Sizes include comments and are un-minified. In a production bundle the difference will be even greater. This is work we will continue in the next release as we do the same updates to the FlatTintPipeline, responsible for rendering Graphics objects, and look at consolidating the shaders allowing you to use Graphics and Sprites mixed in the display list with no shader swapping cost.
+
+* You can now set the WebGL batch size in the Game Config via the property `batchSize`. The default is 2000 before the batch will flush, which is a happy average between desktop and mobile. If targeting desktop specifically, you may wish to increase this value to reduce draw calls.
+* There is a new method `batchVertices` which will add a vertices block to the current batch. This is now used internally by nearly all render functions.
+* The shader has a new attribute: `tintEffect`. This is a single FLOAT.
+* The vertex size has increased by 1 FLOAT to account for the extra shader attribute.
+* All of the rendering functions now use the `TransformMatrix` class far more than before. This allows the matrix operations to be run-time compiled and cut down on masses of code.
+* The `drawTexture` method has been removed. It has been replaced by `drawTextureFrame` which has a new and more concise signature. See the API docs for details.
+* The `batchTileSprite` method has been removed. It is now handled in the TileSprite WebGL Render function.
+* The `drawStaticTilemapLayer` method has been removed. It is now handled in the Static Tilemap Layer WebGL Render function.
+* The `drawEmitterManager` method has been removed. It is now handled in the Particle Manager WebGL Render function.
+* The `batchText` method has been removed. It is now handled in the Static Text WebGL Render function.
+* The `batchDynamicTilemapLayer` method has been removed. It is now handled in the Dynamic Tilemap Layer WebGL Render function.
+* The `batchMesh` method has been removed. It is now handled in the Mesh WebGL Render function.
+* The `batchBitmapText` method has been removed. It is now handled in the BitmapText WebGL Render function.
+* The `batchDynamicBitmapText` method has been removed. It is now handled in the DynamicBitmapText WebGL Render function.
+* The `batchBlitter` method has been removed. It is now handled in the Blitter WebGL Render function.
+
+Due to the changes in the Texture Tint Pipeline the `Textures.Frame` class has also been updated. The following changes concern the Frame UV data:
+
+* Previously, the UV data spanned 8 properties: `x0`, `y0`, `x1`, `y1`, `x2`, `y2`, `x3` and `y3` and was stored in the `data.uvs` object. These have been replaced with directly accessible properties: `u0`, `v0`, `u1` and `v1`. These 4 properties are used directly in all renderer code now. Although it was clearer having 8 properties, 4 of them were just duplicates, so we've traded a little clarity for a smaller overall object and less dictionary look-ups.
+* `Frame.uvs` (and the corresponding `Frame.data.uvs`) object has been removed.
+
+### New Tint Effects
+
+As well as tidying the Texture Tint Pipeline, I also updated the shader. It now has a new attribute 'tintEffect' which allows you to control how a tint is applied to a Game Object. The default way tinting worked was for the tint color values to be multiplied with the texture pixel values. This meant you were unable to do things like tint a Game Object white, because multiplying a color by white doesn't change it. The new tint mode allows you to literally replace the pixel color values.
+
+* `setTintFill` is a new method available to all Game Objects that have the Tint component. It differs from `setTint` in that the colors literally replace the pixel values from the texture (while still respecting the alpha). This means you can now create effects such as flashing a sprite white if it gets hit, or red for damage, etc. You can still use different colors per corner of the Game Object, allowing you to create nice seamless gradient effects.
+* `tintFill` is a new boolean property that allows you to toggle between the two different tint types: multiply or replace.
+* `isTinted` is a new read-only boolean indicating if a Game Object is tinted or not. Handy for knowing if you need to clear a tint after an effect.
+* `Mesh.tintFill` allows you to control the tint effect applied to the Mesh vertices when color blending.
+
+The Tint component documentation has been overhauled to explain these differences in more detail, and you can find lots of new examples as well.
+
+### New Texture Crop Component
+
+There is a new Game Object Component called `TextureCrop`. It replaces the Texture Component (which still exists) and adds in the ability to crop the texture being used. This component is now being used by the `Sprite` and `Image` Game Objects.
+
+* You can crop the frame being used via the new `setCrop` method. The crop is a rectangle that limits the area of the texture frame that is visible during rendering. Cropping a Game Object does not change its size, dimensions, physics body or hit area, it just changes what is shown when rendered. This is ideal for hiding part of a Sprite without using a mask, or for effects like displaying a progress or loading bar. Cropping works even when the Game Object is flipped, or is a trimmed frame from an atlas.
+* You can toggle the crop on a Game Object by changing the `isCropped` boolean at any point.
+* The crop is automatically re-applied when the texture or frame of a Game Object is changed. If you wish to disable this, turn off the crop before changing the frame.
+
+### BitmapText New Features, Updates and Bug Fixes
+
+* Multi-line BitmapText objects can now be aligned. The constructor has a new argument `align` which can accept either left-aligned (the default), center aligned, or right-aligned. Alignment works by calculating the longest line of text in the object and then offsetting the other lines to match it.
+* `BitmapText.setCenterAlign` is a new chainable method to center-align the text.
+* `BitmapText.setLeftAlign` is a new chainable method to left-align the text.
+* `BitmapText.setRightAlign` is a new chainable method to right-align the text.
+* `BitmapText.align` is a new property that holds the alignment of the text.
+* `BitmapText.setFont` is a new method that allows you to change the font it is rendering with.
+* Internally all of the BitmapText properties have been renamed with an underscore (i.e. `letterSpacing` is now `_letterSpacing`), so as to not change the API, getters and setters for them all have been added.
+* Internally there is a new `dirty` flag that tracks if any part of the BitmapText has changed. This is used when getting the BitmapText's bounds object, as used in the renderer for line alignment, and in properties like `width` and `height`. The dirty flag ensures the bounds are only recalculated if something has changed, cutting down on un-necessary calculations.
+* `GetBitmapTextSize`, which is used internally in the BitmapText Game Objects, will now produce different bounds from the previous version. Previously, the bounds were tight against the letters in the text. However, this meant the bounds were not properly aligned with the origin of the BitmapText, and consequently you'd get different bounds if the text consisted of different characters. The bounds are now calculated purely based on the glyph data and letter spacing values. This will give a far more consistent overall experience, but it does mean if you were using the bounds to position text previously, you'll need to revisit that code again. See issue #3799 for more details (and to discuss this further if you wish) (thanks @SBCGames)
+* `GetBitmapTextSize` and its exposed method `BitmapText.getTextBounds` now factor in the display origin of the BitmapText into the `global` position returned.
+* The `BitmapText` WebGL Renderer incorrectly calculated the font scale at very small sizes, causing characters to overlap when they shouldn't. Scale is now applied to the correct component parts in the render code.
+* Under WebGL `BitmapText` would be cut off if you specified a resolution value > 1. Fix #3642 (thanks @kanthi0802)
+* Under WebGL, `DynamicBitmapText` that had a crop set on it would fail to render if anything was above it on the display list. It now crops properly, no matter what is above or below it on the display list.
+* The `DynamicBitmapText` class now extends the `BitmapText` class. This saves on lots of space in the bundle and consolidates functionality between the two. Please be aware of it if you have classes that extend either of them.
+* If you were using the `displayCallback` in the `DynamicBitmapText` class it would generate a brand new object containing all the glyph data, every frame, for every glyph, and send it to the callback. This has been changed so it now uses a new cached local object: `callbackData`. This object is recycled for every glyph, stopping un-needed gc from building up.
+
+### Dynamic Tilemap Layer New Features, Updates and Bug Fixes
+
+* `DynamicTilemapLayer.tilesDrawn` is a read-only property that contains the number of tiles sent to the renderer in the previous frame.
+* `DynamicTilemapLayer.tilesTotal` is a read-only property that contains the total number of tiles in the layer, updated every frame.
+* `DynamicTilemapLayer.skipCull` and its associated chainable method `setSkipCull` allows you to control if the cameras should cull the layer tiles before rendering them or not. By default they will cull, to avoid over-rendering, but in some circumstances you may wish to disable this and can now do so by toggling this property.
+* The `CullTiles` component, as used by the Dynamic Tilemap, has been recoded from scratch to take advantage of updates in the Camera system. It will now properly cull tiles, irrespective of the layer scale, or camera zoom. It also now supports the layers `skipCull` property, allowing you to override the culling. The Dungeon Generator labs demo now works again as a result of this fix, and has been updated with a debug mode and camera control UI. You can edit the example source to swap between 4 different dungeon layouts, from 2500 tiles up to 1 million tiles. There are limitations to the way the culling works though. If you rotate the camera you may find you see the cull edge. You can disable this using the new `skipCull` property. Fixing this also fixed #3818 (thanks @Mursaat)
+* `DynamicTilemapLayer.cullPaddingX`, `cullPaddingY` and the associated chainable method `setCullPadding` allows you to control how many additional tiles are added into the cull rectangle when it is calculated. If you find that your camera size and zoom settings are causing tiles to get prematurely culled, resulting in clipping during scrolling, then set the `cullPadding` values to add extra layers of tiles to the calculations in both directions without needing to disable culling entirely.
+* `DynamicTilemapLayer.cullCallback` allows you to change the function that is used to perform the tile culling. By default it will call `TilemapComponents.CullTiles` but you can override this to call any function you like. It is sent 3 arguments: the layer data, the camera and the array to store the tiles in. Using this feature you can now create whatever culling system you require, should the default one prove to not be suitable for your game. Fix #3811 (thanks @georgzoeller)
+* Dynamic Tilemap Layers now properly support the Lights2D Pipeline. This means you can provide a normal map for the layer tileset and it'll illuminate with the Lights shader properly. See the new `light map` example in the labs for a demonstration. Note that there are limits on the number of tiles that can be rendered with lighting enabled. Fix #3544 (thanks @FrancescoNegri)
+
### New Features
* `Graphics.fillRoundedRect` will draw a stroked rounded rectangle to a Graphics object. The radius of the corners can be either a number, or an object, allowing you to specify different radius per corner (thanks @TadejZupancic)
@@ -53,6 +961,14 @@ There is a third game config property called `pixelArt`. If set to `true` it's t
* `ScenePlugin.wake` (and the corresponding methods in Scene Systems and the Scene Manager) now has a new optional `data` argument, which is passed to the target Scene and emitted in its 'wake' event.
* `ScenePlugin.setActive` now has a new optional `data` argument, which is passed to the target Scene and emitted in its 'pause' or 'resume' events.
* `TileSprite.tileScaleX` and `tileScaleY` are two new properties that allow you to control the scale of the texture within the Tile Sprite. This impacts the way the repeating texture is scaled, and is independent to scaling the Tile Sprite itself. It works in both Canvas and WebGL mode.
+* `TransformMatrix.copyFrom` is a new method that will copy the given matrix into the values of the current one.
+* `TransformMatrix.multiplyWithOffset` is a new method that will multiply the given matrix with the current one, factoring in an additional offset to the results. This is used internally by the renderer code in various places.
+* `Rectangle.Intersection` will take two Rectangle objects and return the area of intersection between them. If there is no intersection, an empty Rectangle is returned.
+* `Pointer.prevPosition` is a new Vector2 that stores the previous position of the Pointer, prior to the most recent DOM event. You can use this when performing calculations between the old and current positions, such as for tracking the pointer speed.
+* `Pointer.getInterpolatedPosition` is a new method that will return an array of smoothly interpolated values between the old and previous position of the Pointer. You can configure how many interpolation steps should take place (the default is 10) and provide an output array to store them in. This method is handy if you've got an object tracking a pointer and you want to ensure it has smooth movement (as the DOM will often process pointer events at a faster rate than the game loop can update).
+* `TransformMatrix.copyFromArray` will populate a matrix from the given array of values. Where 0, 1, 2, 3, 4 and 5 map to a, b, c, d, e and f.
+* `WebGLPipeline` has a new over-rideable method called `boot` which is called when the renderer and all core game systems have finished being set-up.
+* `KeyboardPlugin.checkDown` is a new method that allows you to check if a Key is being pressed down or not in an update loop. The difference between this method and checking the `Key.isDown` property directly is that you can provide a duration to this method. For example, if you wanted a key press to fire a bullet, but you only wanted it to be able to fire every 100ms, then you can call this method with a `duration` of 100 and it will only return `true` every 100ms.
### Updates
@@ -60,10 +976,19 @@ There is a third game config property called `pixelArt`. If set to `true` it's t
* The docs for the Loader `filecomplete` event said that you could listen for a specific file using its type and key, i.e.: `filecomplete-image-monster`, however, the code used an underscore instead of a hyphen. We feel the hyphen looks cleaner, so the Loader code has been updated, meaning you can now use the hyphen version of the event properly (thanks @NokFrt)
* If a Game Object is already being dragged, it cannot be dragged by another pointer (in multi-touch mode) until the original pointer has released it (thanks @rexrainbow)
* Calling `Tween.play` on a tween created via `TweenManager.create` wouldn't actually start playback until the tween was first added to the Tween Manager. Now, calling `play` will have it automatically add itself to the Tween Manager if it's not already in there. Fix #3763 (thanks @pantoninho)
-* If the Blitter object has no Bob's to render it will now abort immediately, avoiding several context calls in Canvas mode.
+* If the Blitter object has no Bobs to render it will now abort immediately, avoiding several context calls in Canvas mode.
* `Scene.run` will now pass the optional `data` object in all cases, no matter if it's waking, resuming or starting a Scene (thanks @rook2pawn)
* `ScenePlugin.start` and `ScenePlugin.restart` will now always queue the op with the Scene Manager, regardless of the state of the Scene, in order to avoid issues where plugins carry on running for a frame before closing down. Fix #3776 (thanks @jjalonso)
-* The `batchTileSprite` method has been removed from the `TextureTintPipeline` class, because it is now handled internally by the Tile Sprite object itself.
+* `Tileset.glTexture` is a new property that maps to the WebGL Texture for the Tileset image. It's used internally by the renderer to avoid expensive object look-ups and is set automatically in the `Tileset.setImage` method.
+* `Frame.glTexture` is a new property that maps to the WebGL Texture for the Frames Texture Source image. It's used internally by the renderer to avoid expensive object look-ups and is set automatically in the `Frame` constructor.
+* `TransformMatrix.e` and `TransformMatrix.f` are two new properties that are an alias for the `tx` and `ty` values.
+* `Graphics.arc` has a new optional argument `overshoot`. This is a small value that is added onto the end of the `endAngle` and allows you to extend the arc further than the default 360 degrees. You may wish to do this if you're trying to draw an arc with an especially thick line stroke, to ensure there are no gaps. Fix #3798 (thanks @jjalonso)
+* The TextureManager Sprite Sheet Parser will now throw a concise console warning if you specify invalid frame sizes that would result in no frames being generated (thanks @andygroff)
+* The `Quad` Game Object now has a new `setFrame` method that allows you to change the frame being rendered by the Quad, including using frames that are part of a texture atlas. Fix #3161 (thanks @halgorithm)
+* The `ScenePlugin` will now queue all of the following ops with the Scene Manager: `start`, `run`, `pause`, `resume`, `sleep`, `wake`, `switch` and `stop`. This means for all of these calls the Scene Manager will add the call into its queue and process it at the start of the next frame. This fixes #3812 and keeps things more predictable (thanks @Waclaw-I)
+* `TransformMatrix.multiply` has a new optional argument `out` which is a matrix to store the multiplication results in. If not given it will act as before, multiplying the current matrix.
+* `Zones` now have a NOOP `setAlpha` method, which allows them to be added into Containers (thanks @TadejZupancic)
+* The `setPipeline` method now returns the instance of the Game Object on which it was called. It used to return the pipeline that was set, but this made it non-chainable which broke with the conventions set in all the other `set` methods. If you use `setPipeline` in your code anywhere to retrieve the pipeline reference, please use the `pipeline` property of the Game Object instead.
### Bug Fixes
@@ -82,16 +1007,20 @@ There is a third game config property called `pixelArt`. If set to `true` it's t
* `ArrayUtils.AddAt` didn't calculate the array offset correctly if you passed an array in to be merged with an existing array. This also caused Container.addAt to fail if an array was passed to it. Fix #3788 (thanks @jjalonso)
* The `Pointer.camera` property would only be set if there was a viable Game Object in the camera view. Now it is set regardless, to always be the Camera the Pointer interacted with.
* Added the Mask component to Container. It worked without it, but this brings it in-line with the documentation and other Game Objects. Fix #3797 (thanks @zilbuz)
+* The DataManager couldn't redefine previously removed properties. Fix #3803 (thanks @AleBles @oo7ph)
+* The Canvas DrawImage function has been recoded entirely so it now correctly supports parent matrix and camera matrix calculations. This fixes an issue where children inside Containers would lose their rotation, and other issues, when in the Canvas Renderer. Fix #3728 (thanks @samid737)
+* `clearMask(true)` would throw an exception if the Game Object didn't have a mask. Now it checks first before destroying the mask. Fix #3809 (thanks @NokFrt)
+* In the WebGL `GeometryMask` the stencil has been changed from `INVERT` to `KEEP` in order to fix issues when masking Graphics objects and other complex objects. Fix #3807. This also fixes the issue where children in Containers would display incorrectly outside of a Geometry mask. Fix #3746 (thanks @zilbuz @oklar)
+* `BitmapMask.destroy` will now remove the textures and framebuffers that it created from the WebGL Renderer as part of the destroy process. Fix #3771 (thanks @nunof07)
### Examples, Documentation and TypeScript
My thanks to the following for helping with the Phaser 3 Examples, Docs and TypeScript definitions, either by reporting errors, fixing them or helping author the docs:
-@DannyT @squilibob @dvdbrink @t1gu1 @cyantree @DrevanTonder @mikewesthad
+@DannyT @squilibob @dvdbrink @t1gu1 @cyantree @DrevanTonder @mikewesthad @tarsupin @shadowofsoul
Also, a special mention to @andygroff for his excellent work enhancing the search box on the examples site, and @hexus for his assistance completing the documentation for the Game Objects.
-
## Version 3.10.1 - Hayashi - 13th June 2018
### Bug Fixes
diff --git a/README.md b/README.md
index 0e206034e..ae2391003 100644
--- a/README.md
+++ b/README.md
@@ -24,25 +24,29 @@ Grab the source and join the fun!
-> 13th June 2018
+> 16th October 2018
-I'm pleased to announce that Phaser 3.10.0 is now available. This release represents just under a month's worth of work and is a huge version for us. It introduces a lot of significant new features into v3, including multi-touch support, custom cursors, pixel perfect detection, Scene isolated input events, new Input plugins, a brand new Gamepad system and plenty more. There are big changes in Arcade Physics too, with a new fixed timestep option, angular damping, speed improvements, support for time scaling across your whole physics simulation and, yes, even more. The Data Manager too has been given a real shot in the arm, and there are subtle but important changes to the Scene flow and Loader interactions.
+Phaser 3.15 is now available. This is slightly ahead of schedule because we needed to get some important performance and iOS input related fixes released, without waiting for new features to be completed first.
-There are, of course, plenty of bug fixes and updates too. I'd urge you to carefully read the Change Log, especially if upgrading from an earlier version in an existing project. Hundreds more areas have been covered with documentation too. An on-going battle which we're winning, albeit slowly.
+This means that the new Scale Manager and Spine support have been moved to release 3.16 due towards the end of October. Please read the weekly Dev Logs for details about development.
-3.10 is a huge release and represents tireless effort on my part to get it into this shape. My aim has always been to continue the mission of enhancing Phaser 3 as quickly as I can. It means releasing significant updates in relatively short periods of time. But it also means I'm jumping on bug reports as quickly as I can, keeping the issues list total nice and low (the vast majority of the items in there are feature requests now!) - a massive thank-you to all of you who support Phaser on Patreon and PayPal. It's your support that allows me to work on this full-time, to the benefit of everyone.
+> 1st October 2018
+
+I'm pleased to announce that Phaser 3.14 is now out. Hot on the heels of the massive 3.13 release, 3.14 brings some sought-after new features to the party, including support for the new Tiled Map Editor 1.2 file formats, as well as the long-requested feature allowing use of multiple tilesets per single tilemap layer.
+
+There are also new features to make Matter JS debugging easier and body creation when using lists of vertices is now much cleaner too. It's never just features though. There are lots of important fixes and updates in 3.14, including a fix causing gl canvas resizing to fail, better handling of the game shutdown process and fixes for an issue with Graphics.generateTexture.
+
+If you're building an active project on 3.13 then please upgrade to 3.14 and, as usual, report any issues you find on GitHub so we can look at them immediately. Also, in the 3.14 release we have completed over 1000 new areas of documentation. At the time of writing there are now just 1900 items in the API left to document, which may sound like a lot, but is a fraction of the tens of thousands already done! With our current progress we should have 100% documentation coverage within the next couple of months.
+
+In case you missed the notice, Phaser 3.13 introduced the Facebook Instant Games Plugin. The plugin provides a seamless bridge between Phaser and version 6.2 of the Facebook Instant Games SDK. Every single SDK function is available via the plugin and we will keep track of the official SDK to make sure they stay in sync. My thanks to Facebook for helping make this possible.
+
+Also new in 3.13 were the Shape Game Objects, which allows for quick addition of geometry onto the display list. Easily add rectangles, triangles, curves, stars and more into your game and treat them just like any other Game Object. Perfect for place-holder art, abstract style games or just really fast iterations game-jam style.
+
+3.14 continues to represent the tireless effort on my part to get it fully production ready. I'm seeing lots more games being released with Phaser 3 and stacks of tutorials and plugins are starting to surface. My aim has always been to continue the mission of enhancing Phaser 3 as quickly as I can. It means releasing significant updates in relatively short periods of time. But it also means I'm jumping on bug reports as quickly as I can, keeping the issues list total nice and low (the vast majority of the items in there are feature requests now!) - a massive thank-you to all of you who support Phaser on Patreon and PayPal. It's your support that allows me to work on this full-time, to the benefit of everyone.
As always, please check out the [Change Log](#changelog) for comprehensive details about what recent versions contain.
-**About Phaser 3**
-
-After 1.5 years in the making, tens of thousands of lines of code, hundreds of examples and countless hours of relentless work: Phaser 3 is finally out. It has been a real labor of love and then some!
-
-Please understand this is a bleeding-edge and brand new release. There are features we've had to leave out, areas of the documentation that need completing and so many cool new things we wanted to add. But we had to draw a line in the sand somewhere and 3.0.0 represents that.
-
-For us this is just the start of a new chapter in Phaser's life. We will be jumping on bug reports as quickly as we can and releasing new versions rapidly. We've structured v3 in such a way that we can push out point releases as fast as needed.
-
-We publish our [Developer Logs](https://phaser.io/phaser3/devlog) in the [Phaser World](https://phaser.io/community/newsletter) newsletter. Subscribe to stay in touch and get all the latest news from us and the wider Phaser community.
+If you'd like to stay abreast of developments then I publish my [Developer Logs](https://phaser.io/phaser3/devlog) in the [Phaser World](https://phaser.io/community/newsletter) newsletter. Subscribe to stay in touch and get all the latest news from the core team and the wider community.
You can also follow Phaser on [Twitter](https://twitter.com/phaser_) and chat with fellow Phaser devs in our [Slack](https://phaser.io/community/slack) and [Discord](https://phaser.io/community/discord) channels.
@@ -104,19 +108,20 @@ npm install phaser
[Phaser is on jsDelivr](https://www.jsdelivr.com/projects/phaser) which is a "super-fast CDN for developers". Include the following in your html:
```html
-
+
```
or the minified version:
```html
-
+
```
### API Documentation
-1. Go to https://photonstorm.github.io/phaser3-docs/index.html to read the docs online. Use the drop-down menus at the top to navigate the name spaces, classes and Game Objects lists. If you wish to run the docs locally you can ...
-2. Checkout the [phaser3-docs](https://github.com/photonstorm/phaser3-docs) repository and then read the documentation by pointing your browser to the local `docs/` folder, and again selecting from the Classes or Namespaces links at the top of the page.
+Go to https://photonstorm.github.io/phaser3-docs/index.html to read the docs online. Use the drop-down menus at the top to navigate the name spaces, classes and Game Objects lists.
+
+Or, if you wish to run the docs locally you can checkout the [phaser3-docs](https://github.com/photonstorm/phaser3-docs) repository and then read the documentation by pointing your browser to the `docs/` folder.
The documentation for Phaser 3 is an on-going project. Please help us by searching the Phaser code for any instance of the string `[description]` and then replacing it with some documentation.
@@ -130,7 +135,7 @@ As soon as we're happy with the accuracy of the TS defs we'll merge them into th
### Webpack
-We use Webpack to build Phaser and we take advantage of its conditional build flag feature to handle renderer swapping. If you wish to use Webpack with Phaser then please use our [Phaser 3 Project Template](https://github.com/photonstorm/phaser3-project-template) as it's already set-up to handle the build conditions Phaser needs. Recent changes to our build steps mean you should now be able to us any other packager, like Parcel, without any config changes.
+We use Webpack to build Phaser and we take advantage of its conditional build flag feature to handle renderer swapping. If you wish to use Webpack with Phaser then please use our [Phaser 3 Project Template](https://github.com/photonstorm/phaser3-project-template) as it's already set-up to handle the build conditions Phaser needs. Recent changes to our build steps mean you should now be able to use any other packager, like Parcel, without any config changes.
### License
@@ -141,17 +146,60 @@ Phaser is released under the [MIT License](https://opensource.org/licenses/MIT).
-Phaser 3 is so new the "paint is still wet", but tutorials and guides are starting to come out!
+Tutorials and guides on Phaser 3 development are being published every week.
* [Getting Started with Phaser 3](https://phaser.io/tutorials/getting-started-phaser3) (useful if you are completely new to Phaser)
* [Making your first Phaser 3 Game](https://phaser.io/tutorials/making-your-first-phaser-3-game)
-* [Phaser 3 Bootstrap and Platformer Example](https://phaser.io/news/2018/02/phaser-3-bootstrap-platformer)
+* The [Complete Phaser 3 Game Development course](https://academy.zenva.com/product/html5-game-phaser-mini-degree/?a=13) contains over 15 hours of videos covering all kinds of important topics.
+* Plus, there are [over 700 Phaser tutorials](http://phaser.io/learn) listed on the official website.
Also, please subscribe to the [Phaser World](https://phaser.io/community/newsletter) newsletter for details about new tutorials as they are published.
+### Facebook Instant Games
+
+Phaser 3.13 introduced the new [Facebook Instant Games](http://phaser.io/news/2018/10/facebook-instant-games-phaser-tutorial) Plugin. The plugin provides a seamless bridge between Phaser and version 6.2 of the Facebook Instant Games SDK. Every single SDK function is available via the plugin and we will keep track of the official SDK to make sure they stay in sync.
+
+The plugin offers the following features:
+
+* Easy integration with the Phaser Loader so load events update the Facebook progress circle.
+* Events for every plugin method, allowing the async calls of the SDK to be correctly inserted into the Phaser game flow. When SDK calls resolve they will surface naturally as a Phaser event and you'll know you can safely act upon them without potentially doing something mid-way through the game step.
+* All Plugin methods check if the call is part of the supported APIs available in the SDK, without needing to launch an async request first.
+* Instant access to platform, player and locale data.
+* Easily load player photos directly into the Texture Manager, ready for use with a Game Object.
+* Subscribe to game bots.
+* The plugin has a built-in Data Manager which makes dealing with data stored on Facebook seamless. Just create whatever data properties you need and they are automatically synced.
+* Support for FB stats, to retrieve, store and increment stats into cloud storage.
+* Save Session data with built-in session length validation.
+* Easy context switching, to swap between game instances and session data retrieval.
+* Easily open a Facebook share, invite, request or game challenge window and populate the text and image content using any image stored in the Texture cache.
+* Full Leaderboard support. Retrieve, scan and update leaderboard entries, as well as player matching.
+* Support for in-app purchases, with product catalogs, the ability to handle purchases, get past purchases and consume previously unlocked purchases.
+* Easily preload a set of interstitial ads, in both banner and video form, then display the ad at any point in your game, with in-built tracking of ads displayed and inventory available.
+* Plus other features, such as logging to FB Analytics, creating short cuts, switching games, etc.
+
+We've 3 tutorials related to Facebook Instant Games and Phaser:
+
+* [Getting Started with Facebook Instant Games](http://phaser.io/news/2018/10/facebook-instant-games-phaser-tutorial)
+* [Facebook Instant Games Leaderboards Tutorial](http://phaser.io/news/2018/11/facebook-instant-games-leaderboards-tutorial)
+* [Displaying Ads in your Instant Games](http://phaser.io/news/2018/12/facebook-instant-games-ads-tutorial)
+
+A special build of Phaser with the Facebook Instant Games Plugin ready-enabled is [available on jsDelivr](https://www.jsdelivr.com/projects/phaser). Include the following in your html:
+
+```html
+
+```
+
+or the minified version:
+
+```html
+
+```
+
+The build files are in the git repository in the `dist` folder, and you can also include the plugin in custom builds.
+
### Source Code Examples
-During our development of Phaser 3, we created hundreds of examples with the full source code and assets. Until these examples are fully integrated into the Phaser website, you can browse them on [Phaser 3 Labs](https://labs.phaser.io), or clone the [examples repo][examples]. We are constantly adding to and refining these examples.
+During our development of Phaser 3, we created hundreds of examples with the full source code and assets ready available. Until these examples are fully integrated into the Phaser website, you can browse them on [Phaser 3 Labs](https://labs.phaser.io), or clone the [examples repo][examples]. We are constantly adding to and refining these examples.
### Create Your First Phaser 3 Example
@@ -257,11 +305,13 @@ There are both plain and minified compiled versions of Phaser in the `dist` fold
### Custom Builds
-Phaser 3 is built using Webpack and we take advantage of the Webpack definePlugin feature to allow for conditional building of the Canvas and WebGL renderers. As of Phaser 3.7 we have updated our webpack config to make our source far easier to consume in other package managers like Parcel and Electron. Please look our webpack config files to get an idea of the settings we use.
+Phaser 3 is built using Webpack and we take advantage of the Webpack definePlugin feature to allow for conditional building of the Canvas and WebGL renderers and extra plugins. You can custom the build process to only include the features you require. Doing so can cut the main build file size down to just 70KB.
+
+Read our [comprehensive guide](https://phaser.io/phaser3/devlog/127) on creating Custom Builds of Phaser 3 for full details.
### Building from Source
-If you wish to build Phaser 3 from source, ensure you have the required packages by cloning the repository and then running `npm install`.
+If you wish to build Phaser 3 from source, ensure you have the required packages by cloning the repository and then running `npm install` on your source directory.
You can then run `webpack` to create a development build in the `build` folder which includes source maps for local testing. You can also `npm run dist` to create a minified packaged build in the `dist` folder. For a list of all commands available use `npm run help`.
@@ -270,170 +320,42 @@ You can then run `webpack` to create a development build in the `build` folder w
# Change Log
-## Version 3.10.1 - Hayashi - 13th June 2018
+## Version 3.15.1 - Batou - 16th October 2018
-### Bug Fixes
-
-* The InputManager would only create 1 Pointer, even if Touch input was enabled in the config, which meant you couldn't use touch events unless you first called `addPointer` or specified one in the config. Now, it Touch is enabled in the config, it'll always create 2 pointers by default.
-
-## Version 3.10.0 - Hayashi - 13th June 2018
-
-### Input System New Features + Updates
-
-* All Input classes are now covered 100% by JSDocs.
-* The Input Manager and Input Plugin have been updated to support multiple simultaneous Pointers. Before, only one active pointer (mouse or touch) was supported. Now, you can have as many active pointers as you need, allowing for complex multi-touch games. These are stored in the Input Manager `pointers` array.
-* `addPointer` allows you to add one, or more, new pointers to the Input Manager. There is no hard-coded limit to the amount you can have, although realistically you should never need more than 10. This method is available on both the Input Manager and Plugin, allowing you to use `this.input.addPointer` from within your game code.
-* InputManager `pointersTotal` contains the total number of active pointers, which can be set in the Game Config using the `input.activePointers` property. Phaser will create 2 pointers on start unless a different value is given in the config, or you can add them at run-time.
-* `mousePointer` is a new property that is specifically allocated for mouse use only. This is perfect for desktop only games but should be ignored if you're creating a mouse + touch game (use activePointer instead).
-* `activePointer` will now reflect the most recently active pointer on the game, which is considered as being the pointer to have interacted with the game canvas most recently.
-* The InputManager and InputPlugin have three new methods: `addUpCallback`, `addDownCallback` and `addMoveCallback`. These methods allow you to add callbacks to be invoked whenever native DOM mouse or touch events are received. Callbacks passed to this method are invoked _immediately_ when the DOM event happens, within the scope of the DOM event handler. Therefore, they are considered as 'native' from the perspective of the browser. This means they can be used for tasks such as opening new browser windows, or anything which explicitly requires user input to activate. However, as a result of this, they come with their own risks, and as such should not be used for general game input, but instead be reserved for special circumstances. The callbacks can be set as `isOnce` so you can control if the callback is called once then removed, or every time the DOM event occurs.
-* Pointer has two new properties `worldX` and `worldY` which contain the position of the Pointer, translated into the coordinate space of the most recent Camera it interacted with.
-* When checking to see if a Pointer has interacted with any objects it will now iterate through the Camera list. Previously, it would only check against the top-most Camera in the list, but now if the top-most camera doesn't return anything, it will move to the next camera and so on. This also addresses #3631 (thanks @samid737)
-* `InputManager.dirty` is a new internal property that reflects if any of the Pointers have updated this frame.
-* `InputManager.update` now uses constants internally for the event type checking, rather than string-based like before.
-* `InputManager.startPointer` is a new internal method, called automatically by the update loop, that handles touch start events.
-* `InputManager.updatePointer` is a new internal method, called automatically by the update loop, that handles touch move events.
-* `InputManager.stopPointer` is a new internal method, called automatically by the update loop, that handles touch end events.
-* `InputManager.hitTest` has had its arguments changed. It no longer takes x/y properties as the first two arguments, but instead takes a Pointer object (from which the x/y coordinates are extracted).
-* `TouchManager.handler` has been removed as it's no longer used internally.
-* `TouchManager.onTouchStart`, `onTouchMove` and `onTouchEnd` are the new DOM Touch Event handlers. They pass the events on to the InputManagers `queueTouchStart`, `queueTouchMove` and `queueTouchEnd` methods respectively.
-* `MouseManager.handler` has been removed as it's no longer used internally.
-* `MouseManager.onMouseDown`, `onMouseMove` and `onMouseUp` are the new DOM Mouse Event handlers. They pass the events on to the InputManagers `queueMouseDown`, `queueMouseMove` and `queueMouseUp` methods respectively.
-* Setting `enabled` to false on either the TouchManager, MouseManager or KeyboardManager will prevent it from handling any native DOM events until you set it back again.
-* InputPlugin has the following new read-only properties: `mousePointer`, `pointer1`, `pointer2`, `pointer3`, `pointer4`, `pointer5`, `pointer6`, `pointer7`, `pointer8`, `pointer9` and `pointer10`. Most of these will be undefined unless you call `addPointer` first, or set the active pointers quantity in your Game Config.
-* InputManager has a new method `transformPointer` which will set the transformed x and y properties of a Pointer in one call, rather than the 2 calls it took before. This is now used by all Pointer event handlers.
-* InputPlugin has a new method `makePixelPerfect` which allows you to specify a texture-based Game Object as being pixel perfect when performing all input checks against it. You use it like this: `this.add.sprite(x, y, key).setInteractive(this.input.makePixelPerfect())`, or the easier: `setInteractive({ pixelPerfect: true })` - you can also pass or set an optional alpha tolerance level. See the method docs for full details and the new examples to see it in action. Note that 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.
-
-### Input - Custom Cursors
-
-* You can now set a custom cursor for your game via `this.input.setDefaultCursor()`. This will take any valid CSS cursor string, including URLs to cursor image files.
-* You can now set a custom cursor for specific Game Objects. This will take any valid CSS cursor string, including URLs to cursor image files, and is used when-ever a pointer is over that Game Object. For example, to have a hand cursor appear when over a button Sprite, you can do: `button.input.cursor = 'pointer'`, or to have a help cursor appear: `button.input.cursor = 'help'`, or to have a custom image: `button.input.cursor = 'url(assets/cursors/sword.cur), pointer'`.
-* You can also set a custom cursor in the new Input Configuration Object. To use the `pointer` (hand cursor) there is a new short-cut: `setInteractive({ useHandCursor: true })`. To use anything else: `setInteractive({ cursor: CSSString })` where `CSSString` is any valid CSS for setting a cursor.
-* Please be aware of limitations when it comes to image based cursors between browsers. It's up to you to find a suitable format and size that fits the browsers you wish to support (note: virtually all modern browsers no longer support animated CSS cursors.)
-
-### Input - Configuration Objects
-
-* The `setInteractive` method can now take an Input Configuration object as its only argument. This allows you to set multiple input related properties in a single call, i.e.: `setInteractive({ draggable: true, pixelPerfect: true })`. The available properties are:
-* `hitArea` - The object / shape to use as the Hit Area. If not given it will try to create a Rectangle based on the texture frame.
-* `hitAreaCallback` - The callback that determines if the pointer is within the Hit Area shape or not.
-* `draggable` - If `true` the Interactive Object will be set to be draggable and emit drag events.
-* `dropZone` - If `true` the Interactive Object will be set to be a drop zone for draggable objects.
-* `useHandCursor` - If `true` the Interactive Object will set the `pointer` hand cursor when a pointer is over it. This is a short-cut for setting `cursor: 'pointer'`.
-* `cursor` - The CSS string to be used when the cursor is over this Interactive Object.
-* `pixelPerfect` - If `true` the a pixel perfect function will be set for the hit area callback. Only works with texture based Game Objects.
-* `alphaTolerance` - If `pixelPerfect` is set, this is the alpha tolerance threshold value used in the callback.
-
-### Input - Keyboard Manager Updates
-
-* The `KeyboardManager` class has been removed. It has been replaced with `KeyboardPlugin` which is now an Input level plugin, that registers itself with the new `InputPluginCache`. The Input Plugin class (which belongs to a Scene) will now automatically inject registered plugins into itself on boot. Every Scene has its own instance of the Input Plugin (if enabled in the scene plugins), which in turn has its own instance of the KeyboardPlugin. The `InputManager` no longer has any reference to the Keyboard class at all. The benefits of this are two-fold: First, it allows you to now entirely exclude all of the keyboard classes from a custom build, saving a lot of space if not required. Secondly, it means that the Scenes themselves are now responsible for keyboard events, where-as before they were entirely global. This means a Scene can be paused and stop processing keyboard events, and stop having its Key objects updated, while another Scene can still carry on doing this. It also prevents key related callbacks in sleeping Scenes from being fired (which resolves issue #3733, thanks @JoeMoov2)
-* `KeyboardManager.handler` has been renamed to `onKeyHandler`.
-* The `KeyboardManager.captures` property has been removed as it can be more effectively handled by polling the `keys` object instead.
-* The Keyboard Manager will no longer process key down or up events if its `enabled` property is set to false, or if the Scene to which it belongs is not active.
-* The Keyboard Manager will now call `event.preventDefault` on the native DOM event as long as the Key exists in the keys array and has its `preventDefault` property set to `true` (which is the default). This means you can now control specifically which key prevents default on the browser, where-as before every key added did so.
-* KeyboardManager `addKeyCapture` and `removeKeyCapture` have been removed as you now control which keys prevent capture by using the `addKey` or `addKeys` methods (see entry above). The act of creating a Key is now enough to enable capture of it and can be toggled (at run-time) on a per-Key basis.
-* `KeyboardManager.addKeys` can now take either an object, or key codes, or a comma-separated string as its input. This means you can now do: `keyboard.addKeys('W,S,A,D')` and get an object back with the properties WSAD mapped to the relevant Key objects.
-* `KeyboardManager.addKey` can now take either a Key object, a string, such as `A` or `SPACE`, or a key code value.
-* `KeyboardManager.removeKey` can now take either a Key object, a string, such as `A` or `SPACE`, or a key code value.
-
-### Input - Gamepad Manager Updates
-
-* The `GamepadManager` class has been removed. It has been replaced with `GamepadPlugin` which is now an Input level plugin, that registers itself with the new `InputPluginCache`. The Input Plugin class (which belongs to a Scene) will now automatically inject the registered plugins into itself on boot. Every Scene has its own instance of the Input Plugin (if enabled in the scene plugins), which in turn has its own instance of the GamepadPlugin. The `InputManager` no longer has any reference to the Gamepad class at all. The benefits of this are two-fold: First, it allows you to now entirely exclude all of the gamepad classes from a custom build, saving a lot of space if not required. Secondly, it means that the Scenes themselves are now responsible for gamepad events, where-as before they were entirely global. This means a Scene can be paused and stop processing gamepad events, and stop having its Gamepad objects updated, while another Scene can still carry on doing this. It also prevents gamepad related callbacks in sleeping Scenes from being fired.
-* The Gamepad Plugin has been rewritten from scratch. It now offers a lot more features and far easier access to the Gamepads and their properties. You can now access the first 4 gamepads connected to the browser via the `pad1` to `pad4` properties, meaning you can do: `this.input.gamepad.pad1` for direct access to a pad once it's connected.
-* The Gamepad class has also been rewritten from scratch. It will no longer create Buttons or Axes dynamically, instead doing so on instantiation.
-* The Gamepad class now has a bunch of new properties for easy access to the various standard mapping buttons. These include `left`, `right`, `up`, `down` for directions, `A`, `Y`, `X` and `B` for buttons, `L1`, `L2`, `R1` and `R2` for shoulder buttons, and `leftStick` and `rightStick` for the axis sticks. You can still use `Gamepad.getButtonValue()` to get the value from a button and `Gamepad.getButtonTotal()` to get the total number of buttons available on the pad.
-* `Gamepad.getAxisTotal` and `Gamepad.getAxisValue` will return the total number of axis, and an axis value, accordingly.
-* `Gamepad.setAxisThreshold` will now let you set the threshold across all axis of a Gamepad in one call.
-* The Gamepad `Button` objects will now emit 2 events, one from the button itself and another from the Gamepad. This means you can listen for button events in 3 ways: 1) By directly polling the button value in an update loop, 2) Listening for events on the Gamepad Plugin: `this.input.gamepad.on('down')`, or 3) By listening for events on the Gamepad itself: `gamepadReference.on('down')`.
-
-### Arcade Physics New Features + Updates
-
-* Arcade Physics now uses a fixed time-step for all internal calculations. There is a new `fps` config value and property (defaults to 60fps), which you can change at run-time using the `setFPS` method. The core update loop has been recoded so that it steps based entirely on the given frame rate, and not the wall-clock or game step delta. This fixed time step allows for a straightforward implementation of a deterministic game state. Meaning you can now set the fps rate to a high value such as 240, regardless of the browser update speed (it will simply perform more physics steps per game step). This is handy if you want to increase the accuracy of the simulation in certain cases.
-* You can also optionally call the `step` function directly, to manually advance the simulation.
-* There is a new property `timeScale` which will scale all time-step calculations at run-time, allowing you to speed-up or slow-down your simulation at will, without adjusting the frame rate.
-* You can now disable the use of the RTree for dynamic bodies via the config property `useTree`. In certain situations, i.e. densely packed worlds, this may give better performance. Static bodies will always use an RTree.
-* `collideSpriteVsGroup` has been rewritten. If you are using an RTree it now uses the results directly from the tree search, instead of iterating all children in the Group, which dramatically reduces the work it does. If you have disabled the RTree it performs a brute-force O(N2) Sprite vs. Group iteration sweep. We tested multiple axis sorting variants but the cost of the array allocation and/or sorting, with large amounts of bodies (10,000+), far outweighed the simple math involved in the separation logic.
-* `Body.useDamping` is a new boolean property that allows you to use a damping effect for drag, rather than the default linear deceleration. This gives much better results if you need smooth deceleration across both axis, such as the way the ship slows down in the game Asteroids, without the tell-tale axis drift associated with linear drag.
-* `GetOverlapX` and `GetOverlapY` now use the calculated delta values, not the deltaX/Y methods.
-* `collideSpriteVsGroup` aborts early if the Sprite body has been disabled.
-* `updateMotion` has a new argument `delta` which should typically be a fixed-time delta value.
-* `intersects` has been restructured to prioritize rect vs. rect checks.
-* Body `update` and `postUpdate` have been recoded to handle the new fixed time-step system in place. `update` now takes a new argument, delta, which is used internally for calculations.
-* `Body.dirty` has been removed as a property as it's no longer used internally.
-* `Body.deltaAbsX` and `deltaAbsY` now return the cached absolute delta value from the previous update, and no longer calculate it during the actual call.
-* `World.enable` has been recoded to remove all the `hasOwnProperty` checks and streamline the internal flow.
-* `World.disable` has been recoded to remove all the `hasOwnProperty` checks and streamline the internal flow.
-* `World.add` is a new method that adds an existing body to the simulation and `enableBody` now passes its newly created bodies to this method.
-* `World.disableGameObjectBody` has been removed as it duplicated what the `disable` method did.
-* There is a new internal flow with regard to the creation and disabling of bodies. Calling `World.enable` will pass the objects to `enableBody`, which will create a new Body object, if required, and finally pass it to `add`. `World.disable` does the same, but removes the bodies from the simulation. It passes the bodies to `disableBody`, which in turn passes it to `remove`. Both of these work for single objects, an array of objects, Groups or even arrays of Groups.
-* `World.computeAngularVelocity` is a new method that specifically calculates the angular velocity of a Body.
-* `World.computeVelocity` has had its signature changed. Rather than taking a bunch of arguments all it now takes is a Body and a delta value. Internally it now calculates both the x and y velocity components together in the same single call, where-as before it was split into two calls and multiple assignments.
-* `World.computeVelocity` no longer returns the new velocities, they are now set directly on the body within the method.
-* `World.computeVelocity` has been recoded to use Fuzzy Greater Than and Less Than calls when applying drag to a previously accelerated body. Using a fuzzy epsilon allows us to mitigate the ping-pong issue, where a decelerating body would constantly flip between a small negative and positive velocity value and never come to an actual rest.
-* `World.computeVelocity` now checks the `Body.useDamping` property to perform either linear deceleration or damping on the Body.
-* `World.updateMotion` has changed to call the new `computeAngularVelocity` and `computeVelocity` methods.
-* Bodies set to bounce would eventually run out of velocity and stop. This has been fixed as part of the refactoring of the time step and compute velocity updates. Fix #3593 (thanks @helmi77)
-* If a Body collides with a Static Body it will now set the `blocked` properties accordingly (before it only set the `touching` properties.) This means you can now use checks like `Body.onFloor()` when traversing static bodies (thanks @fariazz)
-
-### Data Manager New Features and Updates
-
-* You can now access anything set in the DataManager using the new `values` property. For example, if you set a new value such as this: `data.set('gold', 50)` you can now access it via: `data.values.gold`, where it is treated as a normal property, allowing you to use it in conditional evaluations `if (data.values.level === 2)`, or modify it: `data.values.gold += 50`.
-* Each time a value is updated it emits a `changedata` event, regardless if it is changed via the `set` method, or the new `values` approach.
-* Each time a value is updated it emits a new event named after the value. For example, if the value was called `PlayerLives`, it will emit the event `changedata_PlayerLives`. This happens regardless if it is changed via the `set` method, or the new `values` approach.
-* The `set` method can now take an object containing key value pairs as the first argument. This means you can now set a bunch of values all at once, i.e: `data.set({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 })`.
-* The `get` method can now take an array of keys, and will return an array of matching values. This is handy for array destructuring in ES6.
-* The `remove` method can now take an array of keys, and will remove all matching values, emitting the `removedata` event for each.
-* The order of events has been updated. When a value is first set, and doesn't already exist in the Data Manager, it will emit a `setdata` event. If a value is set that already exists, it instead emits a `changedata` and related `changedata_key` event. Setting a new value no longer emits both events.
-* The `resetFunction` function has been removed from the `changedata` event arguments. Previously this was used to allow you to stop a value being updated by calling the reset function instead. However, it created brand new anonymous functions every single time a value was updated. As you can now access stored data via the `values` property you can use this for much easier conditional checks and sets.
-* The `blockSet` property has been removed as it's no longer used internally.
-
-### Loader and Scene Updates
-
-* Internally, the Loader has changed slightly. Rather than have each file cause the new batch to load, an `update` method is polled every frame, which does the same job instead. This avoids load-time race conditions where pre-populated files would trigger loads part way during an existing load, fixing #3705 in the process (thanks @the-simian)
-* The Scene Manager has been updated so that it will call Scene.Systems.step during the `init`, `preload` and `create` phase of your Scene. This means that any plugins, or custom code, written to use the Scene Systems `preupdate`, `update` or `postupdate` events will need to be aware that these are now fired from `init` onwards, not just once `create` has finished.
-* As a result of these two changes, there is a new Systems property called `sceneUpdate`, which is a reference that maps to your `Scene.update` function. During `init`, `preload` and `create` this is always mapped to NOOP. Once `create` has finished it gets re-mapped to your Scene's update function. If your Scene doesn't have one, it remains mapped to NOOP. In practise, this means nothing has changed from before. `Scene.update` never ran until `create` was completed, and it still doesn't. However, because the internal Scene systems are now updating right from `init`, it means that things like the update list and physics systems are fully operational _during_ your Preloader. This allows you to create far more elaborate preloaders than ever before. Although, with great power comes great responsibility, as the onus is now on you to be careful which events you consume (especially input events) during your preloader.
-* Another side-effect of these changes is that Scenes no longer need an 'update' function at all. Previously, if they were missing one, the Scene Manager would inject one into them automatically. It no longer does this.
+Note: We are releasing this version ahead of schedule in order to make some very important iOS performance and input related fixes available. It does not contain the new Scale Manager or Spine support, both of which have been moved to 3.16 as they require a few more weeks of development.
### New Features
-* `RenderTexture.resize` will allow you to resize the underlying Render Texture to the new dimensions given. Doing this also clears the Render Texture at the same time (thanks @saqsun).
-* `Rectangle.RandomOutside` is a new function that takes two Rectangles, `outer` and `inner`, and returns a random point that falls within the outer rectangle but is always outside of the inner rectangle.
-* The Update List has a new read-only property `length`, making it consistent with the Display List (thanks @samme)
-* The 2D Camera class has two new read-only properties `centerX` and `centerY` which return the coordinates of the center of the viewport, relative to the canvas (thanks @samme)
-* Camera has a new property `visible`. An invisible Camera will skip rendering and input tests of everything it can see. This allows you to create say a mini-cam and then toggle it on and off without needing to re-create it each time.
-* Camera has a new method `setVisible` which toggles its visible property.
-* `CameraManager.fromJSON` will now set the visible property is defined in the config.
-* `ScenePlugin.run` is a new method that will run the given Scene and not change the state of the current Scene at all. If the scene is asleep, it will be woken. If it's paused, it will be resumed. If not running at all, it will be started.
-* `TextureManager.getPixelAlpha` is a new method that will return the alpha value of a pixel from the given texture and frame. It will return `null` if the coordinates were out of bounds, otherwise a value between 0 and 255.
-* `Game.isOver` is a new read-only boolean property that indicates if the mouse pointer is currently over the game canvas or not. It is set by the VisibilityHandler and is only reliable on desktop systems.
-* A new event `Game.mouseout` is dispatched if the mouse leaves the game canvas. You can listen to it from `this.sys.game.events.on('mouseout')` from within a Scene.
-* A new event `Game.mouseover` is dispatched if the mouse enters the game canvas, having previously been outside of it. You can listen to it from `this.sys.game.events.on('mouseover')` from within a Scene.
-* You can now use PhysicsEditor (https://www.codeandweb.com/physicseditor) to create complex Matter.js bodies. Load them as normal JSON and then just pass it to the Matter Sprite as a shape property: `this.matter.add.sprite(x, y, texture, frame, { shape: shapes.banana })` (where `shapes.banana` is one of the exported PhysicsEditor shapes in the JSON you loaded). See the 'physics/matterjs/advanced shape creation.js' example for more details.
+* You can now set the `maxLights` value in the Game Config, which controls the total number of lights the Light2D shader can render in a single pass. The default is 10. Be careful about pushing this too far. More lights = less performance. Close #4081 (thanks @FrancescoNegri)
+* `Rectangle.SameDimensions` determines if the two objects (either Rectangles or Rectangle-like) have the same width and height values under strict equality.
+* An ArcadePhysics Group can now pass `{ enable: false }`` in its config to disable all the member bodies (thanks @samme)
+* `Body.setEnable` is a new chainable method that allows you to toggle the enable state of an Arcade Physics Body (thanks @samme)
+* `KeyboardPlugin.resetKeys` is a new method that will reset the state of any Key object created by a Scene's Keyboard Plugin.
+* `Pointer.wasCanceled` is a new boolean property that allows you to tell if a Pointer was cleared due to a `touchcancel` event. This flag is reset during the next `touchstart` event for the Pointer.
+* `Pointer.touchcancel` is a new internal method specifically for handling touch cancel events. It has the same result as `touchend` without setting any of the up properties, to avoid triggering up event handlers. It will also set the `wasCanceled` property to `true`.
### Updates
-* The `ForwardDiffuseLightPipeline`, used by the Lights system, now sets a flag if the Scene doesn't contain any lights. All of the Game Objects now check this flag and don't even bother adding themselves to the batch if there are no lights in the Scene, as they'd never render anyway. This also avoids the ghost-image problem if you swap Scenes to a new Scene with the Light Manager enabled, but no actual lights defined. Fix #3707 (thanks @samvieten).
-* `CameraManager.getCameraBelowPointer` has been renamed to `getCamerasBelowPointer` and it now returns an array of all the cameras below the given pointer, not just the top-most one. The array is sorted so that the top-most camera is at the start of the array.
-* In `TimeStep.step` the `rawDelta` and `delta` values are checked to make sure they are non-negative, which can happen in Chrome when the delta is reset and out of sync with the value passed to Request Animation Frame. Fix #3088 (thanks @Antriel)
-* `Cameras.Controls.Fixed` has been removed. It's was deprecated a few versions ago. Please use `FixedKeyControl` instead.
-* `Cameras.Controls.Smoothed` has been removed. It's was deprecated a few versions ago. Please use `SmoothedKeyControl` instead.
+* `WebGLRenderer.deleteTexture` will check to see if the texture it is being asked to delete is the currently bound texture or not. If it is, it'll set the blank texture to be bound after deletion. This should stop `RENDER WARNING: there is no texture bound to the unit 0` errors if you destroy a Game Object, such as Text or TileSprite, from an async or timed process (thanks jamespierce)
+* The `RequestAnimationFrame.step` and `stepTimeout` functions have been updated so that the new Frame is requested from raf before the main game step is called. This allows you to now stop the raf callback from within the game update or render loop. Fix #3952 (thanks @tolimeh)
+* If you pass zero as the width or height when creating a TileSprite it will now use the dimensions of the texture frame as the size of the TileSprite. Fix #4073 (thanks @jcyuan)
+* `TileSprite.setFrame` has had both the `updateSize` and `updateOrigin` arguments removed as they didn't do anything for TileSprites and were misleading.
+* `CameraManager.remove` has a new argument `runDestroy` which, if set, will automatically call `Camera.destroy` on the Cameras removed from the Camera Manager. You should nearly always allow this to happen (thanks jamespierce)
+* Device.OS has been restructured to allow fake UAs from Chrome dev tools to register iOS devices.
+* Texture batching during the batch flush has been implemented in the TextureTintPipeline which resolves the issues of very low frame rates, especially on iOS devices, when using non-batched textures such as those used by Text or TileSprites. Fix #4110 #4086 (thanks @ivanpopelyshev @sachinhosmani @maximtsai @alexeymolchan)
+* The WebGLRenderer method `canvasToTexture` has a new optional argument `noRepeat` which will stop it from using `gl.REPEAT` entirely. This is now used by the Text object to avoid it potentially switching between a REPEAT and CLAMP texture, causing texture black-outs (thanks @ivanpopelyshev)
+* `KeyboardPlugin.resetKeys` is now called automatically as part of the Keyboard Plugin `shutdown` method. This means, when the plugin shuts down, such as when stopping a Scene, it will reset the state of any key held in the plugin. It will also clear the queue of any pending events.
+* The `Touch Manager` has been rewritten to use declared functions for all touch event handlers, rather than bound functions. This means they will now clear properly when the TouchManager is shut down.
+* There is a new Input constant `TOUCH_CANCEL` which represents canceled touch events.
### Bug Fixes
-* The Canvas `RenderTexture.drawImage` method incorrectly set the values of the frame, causing them to appear wrongly scaled in the canvas renderer. Fix #3710 (thanks @saqsun).
-* Fixed `Math.Matrix4.makeRotationAxis()` (thanks @hexus)
-* Fixed an incorrect usage of `Math.abs()` in `Math.Quaternion.calculateW()` (thanks @qxzkjp).
-* Particle Emitter Managers can now be added to Containers (thanks @TadejZupancic)
-* Fixed a method signature issue with the Animation component's `remove()` handler when `Animation`s are removed from the `AnimationManager`. This prevented removed animations from stopping correctly.
-* If you set Phaser to use a pre-existing Canvas element it is no longer re-added to the DOM (thanks @NQNStudios)
-* The `TweenManager.getTweensOf` method has been fixed to remove a potential endless loop should multiple targets be passed in to it (thanks @cyantree)
-* Interactive Objects inside of Containers would still fire their input events even if the Container (or any ancestor) was set to be invisible. Objects now check their ancestor tree during the input cull and now properly skip input events if not visible. Fix #3620 (thanks @NemoStein)
-* Fixed Device.os incorrectly reporting Linux as OS on Android devices (thanks @AleBles)
-
-### Examples, Documentation and TypeScript
-
-Thanks to the work of @hexus we have now documented all of the Math namespace and made good progress on the Game Objects.
-
-I personally have also documented the entire Input system, which was 328 classes, properties and methods to describe, as well as lots of other areas.
+* Fixed a bug in the canvas rendering of both the Static and Dynamic Tilemap Layers where the camera matrix was being multiplied twice with the layer, causing the scale and placement to be off (thanks galerijanamar)
+* If you set `pixelArt` to true in your game config (or `antialias` to false) then TileSprites will now respect this when using the Canvas Renderer and disable smoothing on the internal fill canvas.
+* TileSprites that were set to be interactive before they had rendered once wouldn't receive a valid input hit area, causing input to fail. They now define their size immediately, allowing them to be made interactive without having rendered. Fix #4085 (thanks @DotTheGreat)
+* The Particle Emitter Manager has been given a NOOP method called `setBlendMode` to stop warnings from being thrown if you added an emitter to a Container in the Canvas renderer. Fix #4083 (thanks @maximtsai)
+* The `game.context` property would be incorrectly set to `null` after the WebGLRenderer instance was created (thanks @samme)
+* The Touch Manager, Input Manager and Pointer classes all now handle the `touchcancel` event, such as triggered on iOS when activating an out of browser UI gesture, or in Facebook Instant Games when displaying an overlay ad. This should prevent issues with touch input becoming locked on iOS specifically. Fix #3756 (thanks @sftsk @sachinhosmani @kooappsdevs)
Please see the complete [Change Log](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md) for previous releases.
@@ -466,8 +388,8 @@ All rights reserved.
"Above all, video games are meant to be just one thing: fun. Fun for everyone." - Satoru Iwata
-[get-js]: https://github.com/photonstorm/phaser/releases/download/v3.10.1/phaser.js
-[get-minjs]: https://github.com/photonstorm/phaser/releases/download/v3.10.1/phaser.min.js
+[get-js]: https://github.com/photonstorm/phaser/releases/download/v3.15.1/phaser.js
+[get-minjs]: https://github.com/photonstorm/phaser/releases/download/v3.15.1/phaser.min.js
[clone-http]: https://github.com/photonstorm/phaser.git
[clone-ssh]: git@github.com:photonstorm/phaser.git
[clone-ghwin]: github-windows://openRepo/https://github.com/photonstorm/phaser
@@ -476,4 +398,4 @@ All rights reserved.
[issues]: https://github.com/photonstorm/phaser/issues
[examples]: https://github.com/photonstorm/phaser3-examples
[contribute]: https://github.com/photonstorm/phaser/blob/master/.github/CONTRIBUTING.md
-[forum]: http://www.html5gamedevs.com/forum/33-phaser-3/
+[forum]: https://phaser.discourse.group/
diff --git a/dist/phaser-arcade-physics.js b/dist/phaser-arcade-physics.js
index 0d5800d21..40e97dc8e 100644
--- a/dist/phaser-arcade-physics.js
+++ b/dist/phaser-arcade-physics.js
@@ -76,7 +76,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/
/******/
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 1027);
+/******/ return __webpack_require__(__webpack_require__.s = 1078);
/******/ })
/************************************************************************/
/******/ ([
@@ -321,6 +321,33 @@ module.exports = Class;
/* 1 */
/***/ (function(module, exports) {
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * 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 Phaser.Utils.NOOP
+ * @since 3.0.0
+ */
+var NOOP = function ()
+{
+ // NOOP
+};
+
+module.exports = NOOP;
+
+
+/***/ }),
+/* 2 */
+/***/ (function(module, exports) {
+
/**
* @author Richard Davey
* @copyright 2018 Photon Storm Ltd.
@@ -330,7 +357,7 @@ module.exports = Class;
/**
* Finds the key within the top level of the {@link source} object, or returns {@link defaultValue}
*
- * @function Phaser.Utils.Object.GetFastValue
+ * @function Phaser.Utils.Objects.GetFastValue
* @since 3.0.0
*
* @param {object} source - The object to search
@@ -360,762 +387,8 @@ var GetFastValue = function (source, key, defaultValue)
module.exports = GetFastValue;
-/***/ }),
-/* 2 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Class = __webpack_require__(0);
-var Components = __webpack_require__(15);
-var DataManager = __webpack_require__(81);
-var EventEmitter = __webpack_require__(9);
-
-/**
- * @classdesc
- * 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
- * @memberOf Phaser.GameObjects
- * @extends Phaser.Events.EventEmitter
- * @constructor
- * @since 3.0.0
- *
- * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs.
- * @param {string} type - A textual representation of the type of Game Object, i.e. `sprite`.
- */
-var GameObject = new Class({
-
- Extends: EventEmitter,
-
- initialize:
-
- function GameObject (scene, type)
- {
- EventEmitter.call(this);
-
- /**
- * The Scene to which this Game Object belongs.
- * Game Objects can only belong to one Scene.
- *
- * @name Phaser.GameObjects.GameObject#scene
- * @type {Phaser.Scene}
- * @protected
- * @since 3.0.0
- */
- this.scene = 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.
- *
- * @name Phaser.GameObjects.GameObject#type
- * @type {string}
- * @since 3.0.0
- */
- this.type = type;
-
- /**
- * The parent Container of this Game Object, if it has one.
- *
- * @name Phaser.GameObjects.GameObject#parentContainer
- * @type {Phaser.GameObjects.Container}
- * @since 3.4.0
- */
- this.parentContainer = null;
-
- /**
- * The name of this Game Object.
- * Empty by default and never populated by Phaser, this is left for developers to use.
- *
- * @name Phaser.GameObjects.GameObject#name
- * @type {string}
- * @default ''
- * @since 3.0.0
- */
- this.name = '';
-
- /**
- * 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.
- *
- * @name Phaser.GameObjects.GameObject#active
- * @type {boolean}
- * @default true
- * @since 3.0.0
- */
- this.active = true;
-
- /**
- * The Tab Index of the Game Object.
- * Reserved for future use by plugins and the Input Manager.
- *
- * @name Phaser.GameObjects.GameObject#tabIndex
- * @type {integer}
- * @default -1
- * @since 3.0.0
- */
- this.tabIndex = -1;
-
- /**
- * 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`.
- *
- * @name Phaser.GameObjects.GameObject#data
- * @type {Phaser.Data.DataManager}
- * @default null
- * @since 3.0.0
- */
- this.data = null;
-
- /**
- * 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.
- *
- * @name Phaser.GameObjects.GameObject#renderFlags
- * @type {integer}
- * @default 15
- * @since 3.0.0
- */
- this.renderFlags = 15;
-
- /**
- * A bitmask that controls if this Game Object is drawn by a Camera or not.
- * Not usually set directly. Instead call `Camera.ignore`.
- *
- * @name Phaser.GameObjects.GameObject#cameraFilter
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.cameraFilter = 0;
-
- /**
- * If this Game Object is enabled for input then this property will contain an InteractiveObject instance.
- * Not usually set directly. Instead call `GameObject.setInteractive()`.
- *
- * @name Phaser.GameObjects.GameObject#input
- * @type {?Phaser.Input.InteractiveObject}
- * @default null
- * @since 3.0.0
- */
- this.input = null;
-
- /**
- * If this Game Object is enabled for physics then this property will contain a reference to a Physics Body.
- *
- * @name Phaser.GameObjects.GameObject#body
- * @type {?(object|Phaser.Physics.Arcade.Body|Phaser.Physics.Impact.Body)}
- * @default null
- * @since 3.0.0
- */
- this.body = null;
-
- /**
- * This Game Object will ignore all calls made to its destroy method if this flag is set to `true`.
- * This includes calls that may come from a Group, Container or the Scene itself.
- * While it allows you to persist a Game Object across Scenes, please understand you are entirely
- * responsible for managing references to and from this Game Object.
- *
- * @name Phaser.GameObjects.GameObject#ignoreDestroy
- * @type {boolean}
- * @default false
- * @since 3.5.0
- */
- this.ignoreDestroy = false;
-
- // Tell the Scene to re-sort the children
- scene.sys.queueDepthSort();
-
- scene.sys.events.once('shutdown', this.destroy, this);
- },
-
- /**
- * 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.
- *
- * @method Phaser.GameObjects.GameObject#setActive
- * @since 3.0.0
- *
- * @param {boolean} value - True if this Game Object should be set as active, false if not.
- *
- * @return {Phaser.GameObjects.GameObject} This GameObject.
- */
- setActive: function (value)
- {
- this.active = value;
-
- return 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.
- *
- * @method Phaser.GameObjects.GameObject#setName
- * @since 3.0.0
- *
- * @param {string} value - The name to be given to this Game Object.
- *
- * @return {Phaser.GameObjects.GameObject} This GameObject.
- */
- setName: function (value)
- {
- this.name = value;
-
- return this;
- },
-
- /**
- * Adds a Data Manager component to this Game Object.
- *
- * @method Phaser.GameObjects.GameObject#setDataEnabled
- * @since 3.0.0
- * @see Phaser.Data.DataManager
- *
- * @return {Phaser.GameObjects.GameObject} This GameObject.
- */
- setDataEnabled: function ()
- {
- if (!this.data)
- {
- this.data = new DataManager(this);
- }
-
- return 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.
- *
- * @method Phaser.GameObjects.GameObject#setData
- * @since 3.0.0
- *
- * @param {(string|object)} key - The key to set the value for. Or an object or 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.
- *
- * @return {this} This GameObject.
- */
- setData: function (key, value)
- {
- if (!this.data)
- {
- this.data = new DataManager(this);
- }
-
- this.data.set(key, value);
-
- return 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.
- *
- * @method Phaser.GameObjects.GameObject#getData
- * @since 3.0.0
- *
- * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys.
- *
- * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array.
- */
- getData: function (key)
- {
- if (!this.data)
- {
- this.data = new DataManager(this);
- }
-
- return this.data.get(key);
- },
-
- /**
- * 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.
- *
- * @method Phaser.GameObjects.GameObject#setInteractive
- * @since 3.0.0
- *
- * @param {(Phaser.Input.InputConfiguration|any)} [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 {HitAreaCallback} [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 {boolean} [dropZone=false] - Should this Game Object be treated as a drop zone target?
- *
- * @return {Phaser.GameObjects.GameObject} This GameObject.
- */
- setInteractive: function (shape, callback, dropZone)
- {
- this.scene.sys.input.enable(this, shape, callback, dropZone);
-
- return 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.
- *
- * @method Phaser.GameObjects.GameObject#disableInteractive
- * @since 3.7.0
- *
- * @return {Phaser.GameObjects.GameObject} This GameObject.
- */
- disableInteractive: function ()
- {
- if (this.input)
- {
- this.input.enabled = (this.input.enabled) ? false : true;
- }
-
- return this;
- },
-
- /**
- * If this Game Object has previously been enabled for input, this will remove it.
- *
- * 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 InteractiveOobject 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.
- *
- * @method Phaser.GameObjects.GameObject#removeInteractive
- * @since 3.7.0
- *
- * @return {Phaser.GameObjects.GameObject} This GameObject.
- */
- removeInteractive: function ()
- {
- this.scene.sys.input.clear(this);
-
- this.input = undefined;
-
- return this;
- },
-
- /**
- * To be overridden by custom GameObjects. Allows base objects to be used in a Pool.
- *
- * @method Phaser.GameObjects.GameObject#update
- * @since 3.0.0
- */
- update: function ()
- {
- },
-
- /**
- * Returns a JSON representation of the Game Object.
- *
- * @method Phaser.GameObjects.GameObject#toJSON
- * @since 3.0.0
- *
- * @return {JSONGameObject} A JSON representation of the Game Object.
- */
- toJSON: function ()
- {
- return Components.ToJSON(this);
- },
-
- /**
- * Compares the renderMask with the renderFlags to see if this Game Object will render or not.
- *
- * @method Phaser.GameObjects.GameObject#willRender
- * @since 3.0.0
- *
- * @return {boolean} True if the Game Object should be rendered, otherwise false.
- */
- willRender: function ()
- {
- return (GameObject.RENDER_MASK === this.renderFlags);
- },
-
- /**
- * 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.
- *
- * @method Phaser.GameObjects.GameObject#getIndexList
- * @since 3.4.0
- *
- * @return {integer[]} An array of display list position indexes.
- */
- getIndexList: function ()
- {
- // eslint-disable-next-line consistent-this
- var child = this;
- var parent = this.parentContainer;
-
- var indexes = [];
-
- while (parent)
- {
- // indexes.unshift([parent.getIndex(child), parent.name]);
- indexes.unshift(parent.getIndex(child));
-
- child = parent;
-
- if (!parent.parentContainer)
- {
- break;
- }
- else
- {
- parent = parent.parentContainer;
- }
- }
-
- // indexes.unshift([this.scene.sys.displayList.getIndex(child), 'root']);
- indexes.unshift(this.scene.sys.displayList.getIndex(child));
-
- return indexes;
- },
-
- /**
- * 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.
- *
- * @method Phaser.GameObjects.GameObject#destroy
- * @since 3.0.0
- */
- destroy: function ()
- {
- // This Game Object had already been destroyed
- if (!this.scene || this.ignoreDestroy)
- {
- return;
- }
-
- if (this.preDestroy)
- {
- this.preDestroy.call(this);
- }
-
- this.emit('destroy', this);
-
- var sys = this.scene.sys;
-
- sys.displayList.remove(this);
- sys.updateList.remove(this);
-
- if (this.input)
- {
- sys.input.clear(this);
- this.input = undefined;
- }
-
- if (this.data)
- {
- this.data.destroy();
-
- this.data = undefined;
- }
-
- if (this.body)
- {
- this.body.destroy();
- this.body = undefined;
- }
-
- // Tell the Scene to re-sort the children
- sys.queueDepthSort();
-
- this.active = false;
- this.visible = false;
-
- this.scene = undefined;
-
- this.parentContainer = undefined;
-
- this.removeAllListeners();
- }
-
-});
-
-/**
- * The bitmask that `GameObject.renderFlags` is compared against to determine if the Game Object will render or not.
- *
- * @constant {integer} RENDER_MASK
- * @memberOf Phaser.GameObjects.GameObject
- * @default
- */
-GameObject.RENDER_MASK = 15;
-
-module.exports = GameObject;
-
-
/***/ }),
/* 3 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * 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 Phaser.Utils.NOOP
- * @since 3.0.0
- */
-var NOOP = function ()
-{
- // NOOP
-};
-
-module.exports = NOOP;
-
-
-/***/ }),
-/* 4 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-// Source object
-// The key as a string, or an array of keys, i.e. 'banner', or 'banner.hideBanner'
-// The default value to use if the key doesn't exist
-
-/**
- * [description]
- *
- * @function Phaser.Utils.Object.GetValue
- * @since 3.0.0
- *
- * @param {object} source - [description]
- * @param {string} key - [description]
- * @param {*} defaultValue - [description]
- *
- * @return {*} [description]
- */
-var GetValue = function (source, key, defaultValue)
-{
- if (!source || typeof source === 'number')
- {
- return defaultValue;
- }
- else if (source.hasOwnProperty(key))
- {
- return source[key];
- }
- else if (key.indexOf('.'))
- {
- var keys = key.split('.');
- var parent = source;
- var value = defaultValue;
-
- // Use for loop here so we can break early
- for (var i = 0; i < keys.length; i++)
- {
- if (parent.hasOwnProperty(keys[i]))
- {
- // Yes it has a key property, let's carry on down
- value = parent[keys[i]];
-
- parent = parent[keys[i]];
- }
- else
- {
- // Can't go any further, so reset to default
- value = defaultValue;
- break;
- }
- }
-
- return value;
- }
- else
- {
- return defaultValue;
- }
-};
-
-module.exports = GetValue;
-
-
-/***/ }),
-/* 5 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Class = __webpack_require__(0);
-
-/**
- * @classdesc
- * Defines a Point in 2D space, with an x and y component.
- *
- * @class Point
- * @memberOf Phaser.Geom
- * @constructor
- * @since 3.0.0
- *
- * @param {number} [x=0] - The x coordinate of this Point.
- * @param {number} [y=x] - The y coordinate of this Point.
- */
-var Point = new Class({
-
- initialize:
-
- function Point (x, y)
- {
- if (x === undefined) { x = 0; }
- if (y === undefined) { y = x; }
-
- /**
- * The x coordinate of this Point.
- *
- * @name Phaser.Geom.Point#x
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.x = x;
-
- /**
- * The y coordinate of this Point.
- *
- * @name Phaser.Geom.Point#y
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.y = y;
- },
-
- /**
- * Set the x and y coordinates of the point to the given values.
- *
- * @method Phaser.Geom.Point#setTo
- * @since 3.0.0
- *
- * @param {number} [x=0] - The x coordinate of this Point.
- * @param {number} [y=x] - The y coordinate of this Point.
- *
- * @return {Phaser.Geom.Point} This Point object.
- */
- setTo: function (x, y)
- {
- if (x === undefined) { x = 0; }
- if (y === undefined) { y = x; }
-
- this.x = x;
- this.y = y;
-
- return this;
- }
-
-});
-
-module.exports = Point;
-
-
-/***/ }),
-/* 6 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -1143,11 +416,11 @@ var Class = __webpack_require__(0);
* A two-component vector.
*
* @class Vector2
- * @memberOf Phaser.Math
+ * @memberof Phaser.Math
* @constructor
* @since 3.0.0
*
- * @param {number} [x] - The x component.
+ * @param {number|Vector2Like} [x] - The x component, or an object with `x` and `y` properties.
* @param {number} [y] - The y component.
*/
var Vector2 = new Class({
@@ -1282,8 +555,8 @@ var Vector2 = new Class({
* @method Phaser.Math.Vector2#setToPolar
* @since 3.0.0
*
- * @param {float} azimuth - The angular coordinate, in radians.
- * @param {float} [radius=1] - The radial coordinate (length).
+ * @param {number} azimuth - The angular coordinate, in radians.
+ * @param {number} [radius=1] - The radial coordinate (length).
*
* @return {Phaser.Math.Vector2} This Vector2.
*/
@@ -1473,7 +746,7 @@ var Vector2 = new Class({
},
/**
- * Calculate the distance between this Vector, and the given Vector, squared.
+ * Calculate the distance between this Vector and the given Vector, squared.
*
* @method Phaser.Math.Vector2#distanceSq
* @since 3.0.0
@@ -1688,7 +961,9 @@ var Vector2 = new Class({
/**
* A static zero Vector2 for use by reference.
*
- * @method Phaser.Math.Vector2.ZERO
+ * @constant
+ * @name Phaser.Math.Vector2.ZERO
+ * @type {Vector2}
* @since 3.1.0
*/
Vector2.ZERO = new Vector2();
@@ -1696,6 +971,345 @@ Vector2.ZERO = new Vector2();
module.exports = Vector2;
+/***/ }),
+/* 4 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+// Source object
+// The key as a string, or an array of keys, i.e. 'banner', or 'banner.hideBanner'
+// The default value to use if the key doesn't exist
+
+/**
+ * Retrieves a value from an object.
+ *
+ * @function Phaser.Utils.Objects.GetValue
+ * @since 3.0.0
+ *
+ * @param {object} source - The object to retrieve the value from.
+ * @param {string} key - The name of the property to retrieve from the object. If a property is nested, the names of its preceding properties should be separated by a dot (`.`) - `banner.hideBanner` would return the value of the `hideBanner` property from the object stored in the `banner` property of the `source` object.
+ * @param {*} defaultValue - The value to return if the `key` isn't found in the `source` object.
+ *
+ * @return {*} The value of the requested key.
+ */
+var GetValue = function (source, key, defaultValue)
+{
+ if (!source || typeof source === 'number')
+ {
+ return defaultValue;
+ }
+ else if (source.hasOwnProperty(key))
+ {
+ return source[key];
+ }
+ else if (key.indexOf('.'))
+ {
+ var keys = key.split('.');
+ var parent = source;
+ var value = defaultValue;
+
+ // Use for loop here so we can break early
+ for (var i = 0; i < keys.length; i++)
+ {
+ if (parent.hasOwnProperty(keys[i]))
+ {
+ // Yes it has a key property, let's carry on down
+ value = parent[keys[i]];
+
+ parent = parent[keys[i]];
+ }
+ else
+ {
+ // Can't go any further, so reset to default
+ value = defaultValue;
+ break;
+ }
+ }
+
+ return value;
+ }
+ else
+ {
+ return defaultValue;
+ }
+};
+
+module.exports = GetValue;
+
+
+/***/ }),
+/* 5 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var PluginCache = __webpack_require__(15);
+
+/**
+ * @classdesc
+ * 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
+ * @memberof Phaser.GameObjects
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Game Object Factory belongs.
+ */
+var GameObjectFactory = new Class({
+
+ initialize:
+
+ function GameObjectFactory (scene)
+ {
+ /**
+ * The Scene to which this Game Object Factory belongs.
+ *
+ * @name Phaser.GameObjects.GameObjectFactory#scene
+ * @type {Phaser.Scene}
+ * @protected
+ * @since 3.0.0
+ */
+ this.scene = scene;
+
+ /**
+ * A reference to the Scene.Systems.
+ *
+ * @name Phaser.GameObjects.GameObjectFactory#systems
+ * @type {Phaser.Scenes.Systems}
+ * @protected
+ * @since 3.0.0
+ */
+ this.systems = scene.sys;
+
+ /**
+ * A reference to the Scene Display List.
+ *
+ * @name Phaser.GameObjects.GameObjectFactory#displayList
+ * @type {Phaser.GameObjects.DisplayList}
+ * @protected
+ * @since 3.0.0
+ */
+ this.displayList;
+
+ /**
+ * A reference to the Scene Update List.
+ *
+ * @name Phaser.GameObjects.GameObjectFactory#updateList;
+ * @type {Phaser.GameObjects.UpdateList}
+ * @protected
+ * @since 3.0.0
+ */
+ this.updateList;
+
+ scene.sys.events.once('boot', this.boot, this);
+ scene.sys.events.on('start', this.start, this);
+ },
+
+ /**
+ * This method is called automatically, only once, when the Scene is first created.
+ * Do not invoke it directly.
+ *
+ * @method Phaser.GameObjects.GameObjectFactory#boot
+ * @private
+ * @since 3.5.1
+ */
+ boot: function ()
+ {
+ this.displayList = this.systems.displayList;
+ this.updateList = this.systems.updateList;
+
+ this.systems.events.once('destroy', this.destroy, this);
+ },
+
+ /**
+ * This method is called automatically by the Scene when it is starting up.
+ * It is responsible for creating local systems, properties and listening for Scene events.
+ * Do not invoke it directly.
+ *
+ * @method Phaser.GameObjects.GameObjectFactory#start
+ * @private
+ * @since 3.5.0
+ */
+ start: function ()
+ {
+ this.systems.events.once('shutdown', this.shutdown, this);
+ },
+
+ /**
+ * 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.
+ *
+ * @method Phaser.GameObjects.GameObjectFactory#existing
+ * @since 3.0.0
+ *
+ * @param {Phaser.GameObjects.GameObject} child - The child to be added to this Scene.
+ *
+ * @return {Phaser.GameObjects.GameObject} The Game Object that was added.
+ */
+ existing: function (child)
+ {
+ if (child.renderCanvas || child.renderWebGL)
+ {
+ this.displayList.add(child);
+ }
+
+ if (child.preUpdate)
+ {
+ this.updateList.add(child);
+ }
+
+ return child;
+ },
+
+ /**
+ * 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.
+ *
+ * @method Phaser.GameObjects.GameObjectFactory#shutdown
+ * @private
+ * @since 3.0.0
+ */
+ shutdown: function ()
+ {
+ this.systems.events.off('shutdown', this.shutdown, this);
+ },
+
+ /**
+ * The Scene that owns this plugin is being destroyed.
+ * We need to shutdown and then kill off all external references.
+ *
+ * @method Phaser.GameObjects.GameObjectFactory#destroy
+ * @private
+ * @since 3.0.0
+ */
+ destroy: function ()
+ {
+ this.shutdown();
+
+ this.scene.sys.events.off('start', this.start, this);
+
+ this.scene = null;
+ this.systems = null;
+
+ this.displayList = null;
+ this.updateList = null;
+ }
+
+});
+
+// Static method called directly by the Game Object factory functions
+
+GameObjectFactory.register = function (factoryType, factoryFunction)
+{
+ if (!GameObjectFactory.prototype.hasOwnProperty(factoryType))
+ {
+ GameObjectFactory.prototype[factoryType] = factoryFunction;
+ }
+};
+
+PluginCache.register('GameObjectFactory', GameObjectFactory, 'add');
+
+module.exports = GameObjectFactory;
+
+
+/***/ }),
+/* 6 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+
+/**
+ * @classdesc
+ * Defines a Point in 2D space, with an x and y component.
+ *
+ * @class Point
+ * @memberof Phaser.Geom
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {number} [x=0] - The x coordinate of this Point.
+ * @param {number} [y=x] - The y coordinate of this Point.
+ */
+var Point = new Class({
+
+ initialize:
+
+ function Point (x, y)
+ {
+ if (x === undefined) { x = 0; }
+ if (y === undefined) { y = x; }
+
+ /**
+ * The x coordinate of this Point.
+ *
+ * @name Phaser.Geom.Point#x
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.x = x;
+
+ /**
+ * The y coordinate of this Point.
+ *
+ * @name Phaser.Geom.Point#y
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.y = y;
+ },
+
+ /**
+ * Set the x and y coordinates of the point to the given values.
+ *
+ * @method Phaser.Geom.Point#setTo
+ * @since 3.0.0
+ *
+ * @param {number} [x=0] - The x coordinate of this Point.
+ * @param {number} [y=x] - The y coordinate of this Point.
+ *
+ * @return {Phaser.Geom.Point} This Point object.
+ */
+ setTo: function (x, y)
+ {
+ if (x === undefined) { x = 0; }
+ if (y === undefined) { y = x; }
+
+ this.x = x;
+ this.y = y;
+
+ return this;
+ }
+
+});
+
+module.exports = Point;
+
+
/***/ }),
/* 7 */
/***/ (function(module, exports) {
@@ -1775,7 +1389,7 @@ module.exports = FileTypesManager;
* This is a slightly modified version of jQuery.isPlainObject.
* A plain object is an object whose internal class property is [object Object].
*
- * @function Phaser.Utils.Object.IsPlainObject
+ * @function Phaser.Utils.Objects.IsPlainObject
* @since 3.0.0
*
* @param {object} obj - The object to inspect.
@@ -1821,6 +1435,640 @@ module.exports = IsPlainObject;
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var Contains = __webpack_require__(39);
+var GetPoint = __webpack_require__(190);
+var GetPoints = __webpack_require__(398);
+var Line = __webpack_require__(54);
+var Random = __webpack_require__(187);
+
+/**
+ * @classdesc
+ * Encapsulates a 2D rectangle defined by its corner point in the top-left and its extends in x (width) and y (height)
+ *
+ * @class Rectangle
+ * @memberof Phaser.Geom
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {number} [x=0] - The X coordinate of the top left corner of the Rectangle.
+ * @param {number} [y=0] - The Y coordinate of the top left corner of the Rectangle.
+ * @param {number} [width=0] - The width of the Rectangle.
+ * @param {number} [height=0] - The height of the Rectangle.
+ */
+var Rectangle = new Class({
+
+ initialize:
+
+ function Rectangle (x, y, width, height)
+ {
+ if (x === undefined) { x = 0; }
+ if (y === undefined) { y = 0; }
+ if (width === undefined) { width = 0; }
+ if (height === undefined) { height = 0; }
+
+ /**
+ * The X coordinate of the top left corner of the Rectangle.
+ *
+ * @name Phaser.Geom.Rectangle#x
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.x = x;
+
+ /**
+ * The Y coordinate of the top left corner of the Rectangle.
+ *
+ * @name Phaser.Geom.Rectangle#y
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.y = y;
+
+ /**
+ * The width of the Rectangle, i.e. the distance between its left side (defined by `x`) and its right side.
+ *
+ * @name Phaser.Geom.Rectangle#width
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.width = width;
+
+ /**
+ * The height of the Rectangle, i.e. the distance between its top side (defined by `y`) and its bottom side.
+ *
+ * @name Phaser.Geom.Rectangle#height
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.height = height;
+ },
+
+ /**
+ * Checks if the given point is inside the Rectangle's bounds.
+ *
+ * @method Phaser.Geom.Rectangle#contains
+ * @since 3.0.0
+ *
+ * @param {number} x - The X coordinate of the point to check.
+ * @param {number} y - The Y coordinate of the point to check.
+ *
+ * @return {boolean} `true` if the point is within the Rectangle's bounds, otherwise `false`.
+ */
+ contains: function (x, y)
+ {
+ return Contains(this, x, y);
+ },
+
+ /**
+ * Calculates the coordinates of a point at a certain `position` on the Rectangle's perimeter.
+ *
+ * The `position` is a fraction between 0 and 1 which defines how far into the perimeter the point is.
+ *
+ * A value of 0 or 1 returns the point at the top left corner of the rectangle, while a value of 0.5 returns the point at the bottom right corner of the rectangle. Values between 0 and 0.5 are on the top or the right side and values between 0.5 and 1 are on the bottom or the left side.
+ *
+ * @method Phaser.Geom.Rectangle#getPoint
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Geom.Point} O - [output,$return]
+ *
+ * @param {number} position - The normalized distance into the Rectangle's perimeter to return.
+ * @param {(Phaser.Geom.Point|object)} [output] - An object to update with the `x` and `y` coordinates of the point.
+ *
+ * @return {(Phaser.Geom.Point|object)} The updated `output` object, or a new Point if no `output` object was given.
+ */
+ getPoint: function (position, output)
+ {
+ return GetPoint(this, position, output);
+ },
+
+ /**
+ * Returns an array of points from the perimeter of the Rectangle, each spaced out based on the quantity or step required.
+ *
+ * @method Phaser.Geom.Rectangle#getPoints
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Geom.Point[]} O - [output,$return]
+ *
+ * @param {integer} quantity - The number of points to return. Set to `false` or 0 to return an arbitrary number of points (`perimeter / stepRate`) evenly spaced around the Rectangle based on the `stepRate`.
+ * @param {number} [stepRate] - If `quantity` is 0, determines the normalized distance between each returned point.
+ * @param {(array|Phaser.Geom.Point[])} [output] - An array to which to append the points.
+ *
+ * @return {(array|Phaser.Geom.Point[])} The modified `output` array, or a new array if none was provided.
+ */
+ getPoints: function (quantity, stepRate, output)
+ {
+ return GetPoints(this, quantity, stepRate, output);
+ },
+
+ /**
+ * Returns a random point within the Rectangle's bounds.
+ *
+ * @method Phaser.Geom.Rectangle#getRandomPoint
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Geom.Point} O - [point,$return]
+ *
+ * @param {Phaser.Geom.Point} [point] - The object in which to store the `x` and `y` coordinates of the point.
+ *
+ * @return {Phaser.Geom.Point} The updated `point`, or a new Point if none was provided.
+ */
+ getRandomPoint: function (point)
+ {
+ return Random(this, point);
+ },
+
+ /**
+ * Sets the position, width, and height of the Rectangle.
+ *
+ * @method Phaser.Geom.Rectangle#setTo
+ * @since 3.0.0
+ *
+ * @param {number} x - The X coordinate of the top left corner of the Rectangle.
+ * @param {number} y - The Y coordinate of the top left corner of the Rectangle.
+ * @param {number} width - The width of the Rectangle.
+ * @param {number} height - The height of the Rectangle.
+ *
+ * @return {Phaser.Geom.Rectangle} This Rectangle object.
+ */
+ setTo: function (x, y, width, height)
+ {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+
+ return this;
+ },
+
+ /**
+ * Resets the position, width, and height of the Rectangle to 0.
+ *
+ * @method Phaser.Geom.Rectangle#setEmpty
+ * @since 3.0.0
+ *
+ * @return {Phaser.Geom.Rectangle} This Rectangle object.
+ */
+ setEmpty: function ()
+ {
+ return this.setTo(0, 0, 0, 0);
+ },
+
+ /**
+ * Sets the position of the Rectangle.
+ *
+ * @method Phaser.Geom.Rectangle#setPosition
+ * @since 3.0.0
+ *
+ * @param {number} x - The X coordinate of the top left corner of the Rectangle.
+ * @param {number} [y=x] - The Y coordinate of the top left corner of the Rectangle.
+ *
+ * @return {Phaser.Geom.Rectangle} This Rectangle object.
+ */
+ setPosition: function (x, y)
+ {
+ if (y === undefined) { y = x; }
+
+ this.x = x;
+ this.y = y;
+
+ return this;
+ },
+
+ /**
+ * Sets the width and height of the Rectangle.
+ *
+ * @method Phaser.Geom.Rectangle#setSize
+ * @since 3.0.0
+ *
+ * @param {number} width - The width to set the Rectangle to.
+ * @param {number} [height=width] - The height to set the Rectangle to.
+ *
+ * @return {Phaser.Geom.Rectangle} This Rectangle object.
+ */
+ setSize: function (width, height)
+ {
+ if (height === undefined) { height = width; }
+
+ this.width = width;
+ this.height = height;
+
+ return this;
+ },
+
+ /**
+ * Determines if the Rectangle is empty. A Rectangle is empty if its width or height is less than or equal to 0.
+ *
+ * @method Phaser.Geom.Rectangle#isEmpty
+ * @since 3.0.0
+ *
+ * @return {boolean} `true` if the Rectangle is empty. A Rectangle object is empty if its width or height is less than or equal to 0.
+ */
+ isEmpty: function ()
+ {
+ return (this.width <= 0 || this.height <= 0);
+ },
+
+ /**
+ * Returns a Line object that corresponds to the top of this Rectangle.
+ *
+ * @method Phaser.Geom.Rectangle#getLineA
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Geom.Line} O - [line,$return]
+ *
+ * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created.
+ *
+ * @return {Phaser.Geom.Line} A Line object that corresponds to the top of this Rectangle.
+ */
+ getLineA: function (line)
+ {
+ if (line === undefined) { line = new Line(); }
+
+ line.setTo(this.x, this.y, this.right, this.y);
+
+ return line;
+ },
+
+ /**
+ * Returns a Line object that corresponds to the right of this Rectangle.
+ *
+ * @method Phaser.Geom.Rectangle#getLineB
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Geom.Line} O - [line,$return]
+ *
+ * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created.
+ *
+ * @return {Phaser.Geom.Line} A Line object that corresponds to the right of this Rectangle.
+ */
+ getLineB: function (line)
+ {
+ if (line === undefined) { line = new Line(); }
+
+ line.setTo(this.right, this.y, this.right, this.bottom);
+
+ return line;
+ },
+
+ /**
+ * Returns a Line object that corresponds to the bottom of this Rectangle.
+ *
+ * @method Phaser.Geom.Rectangle#getLineC
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Geom.Line} O - [line,$return]
+ *
+ * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created.
+ *
+ * @return {Phaser.Geom.Line} A Line object that corresponds to the bottom of this Rectangle.
+ */
+ getLineC: function (line)
+ {
+ if (line === undefined) { line = new Line(); }
+
+ line.setTo(this.right, this.bottom, this.x, this.bottom);
+
+ return line;
+ },
+
+ /**
+ * Returns a Line object that corresponds to the left of this Rectangle.
+ *
+ * @method Phaser.Geom.Rectangle#getLineD
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Geom.Line} O - [line,$return]
+ *
+ * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created.
+ *
+ * @return {Phaser.Geom.Line} A Line object that corresponds to the left of this Rectangle.
+ */
+ getLineD: function (line)
+ {
+ if (line === undefined) { line = new Line(); }
+
+ line.setTo(this.x, this.bottom, this.x, this.y);
+
+ return line;
+ },
+
+ /**
+ * The x coordinate of the left of the Rectangle.
+ * Changing the left property of a Rectangle object has no effect on the y and height properties. However it does affect the width property, whereas changing the x value does not affect the width property.
+ *
+ * @name Phaser.Geom.Rectangle#left
+ * @type {number}
+ * @since 3.0.0
+ */
+ left: {
+
+ get: function ()
+ {
+ return this.x;
+ },
+
+ set: function (value)
+ {
+ if (value >= this.right)
+ {
+ this.width = 0;
+ }
+ else
+ {
+ this.width = this.right - value;
+ }
+
+ this.x = value;
+ }
+
+ },
+
+ /**
+ * The sum of the x and width properties.
+ * Changing the right property of a Rectangle object has no effect on the x, y and height properties, however it does affect the width property.
+ *
+ * @name Phaser.Geom.Rectangle#right
+ * @type {number}
+ * @since 3.0.0
+ */
+ right: {
+
+ get: function ()
+ {
+ return this.x + this.width;
+ },
+
+ set: function (value)
+ {
+ if (value <= this.x)
+ {
+ this.width = 0;
+ }
+ else
+ {
+ this.width = value - this.x;
+ }
+ }
+
+ },
+
+ /**
+ * The y coordinate of the top of the Rectangle. Changing the top property of a Rectangle object has no effect on the x and width properties.
+ * However it does affect the height property, whereas changing the y value does not affect the height property.
+ *
+ * @name Phaser.Geom.Rectangle#top
+ * @type {number}
+ * @since 3.0.0
+ */
+ top: {
+
+ get: function ()
+ {
+ return this.y;
+ },
+
+ set: function (value)
+ {
+ if (value >= this.bottom)
+ {
+ this.height = 0;
+ }
+ else
+ {
+ this.height = (this.bottom - value);
+ }
+
+ this.y = value;
+ }
+
+ },
+
+ /**
+ * The sum of the y and height properties.
+ * Changing the bottom property of a Rectangle object has no effect on the x, y and width properties, but does change the height property.
+ *
+ * @name Phaser.Geom.Rectangle#bottom
+ * @type {number}
+ * @since 3.0.0
+ */
+ bottom: {
+
+ get: function ()
+ {
+ return this.y + this.height;
+ },
+
+ set: function (value)
+ {
+ if (value <= this.y)
+ {
+ this.height = 0;
+ }
+ else
+ {
+ this.height = value - this.y;
+ }
+ }
+
+ },
+
+ /**
+ * The x coordinate of the center of the Rectangle.
+ *
+ * @name Phaser.Geom.Rectangle#centerX
+ * @type {number}
+ * @since 3.0.0
+ */
+ centerX: {
+
+ get: function ()
+ {
+ return this.x + (this.width / 2);
+ },
+
+ set: function (value)
+ {
+ this.x = value - (this.width / 2);
+ }
+
+ },
+
+ /**
+ * The y coordinate of the center of the Rectangle.
+ *
+ * @name Phaser.Geom.Rectangle#centerY
+ * @type {number}
+ * @since 3.0.0
+ */
+ centerY: {
+
+ get: function ()
+ {
+ return this.y + (this.height / 2);
+ },
+
+ set: function (value)
+ {
+ this.y = value - (this.height / 2);
+ }
+
+ }
+
+});
+
+module.exports = Rectangle;
+
+
+/***/ }),
+/* 10 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @author Felipe Alfonso <@bitnenfer>
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @namespace Phaser.Renderer.WebGL.Utils
+ * @since 3.0.0
+ */
+module.exports = {
+
+ /**
+ * Packs four floats on a range from 0.0 to 1.0 into a single Uint32
+ *
+ * @function Phaser.Renderer.WebGL.Utils.getTintFromFloats
+ * @since 3.0.0
+ *
+ * @param {number} r - Red component in a range from 0.0 to 1.0
+ * @param {number} g - [description]
+ * @param {number} b - [description]
+ * @param {number} a - Alpha component in a range from 0.0 to 1.0
+ *
+ * @return {number} [description]
+ */
+ getTintFromFloats: function (r, g, b, a)
+ {
+ var ur = ((r * 255.0)|0) & 0xFF;
+ var ug = ((g * 255.0)|0) & 0xFF;
+ var ub = ((b * 255.0)|0) & 0xFF;
+ var ua = ((a * 255.0)|0) & 0xFF;
+
+ return ((ua << 24) | (ur << 16) | (ug << 8) | ub) >>> 0;
+ },
+
+ /**
+ * Packs a Uint24, representing RGB components, with a Float32, representing
+ * the alpha component, with a range between 0.0 and 1.0 and return a Uint32
+ *
+ * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha
+ * @since 3.0.0
+ *
+ * @param {number} rgb - Uint24 representing RGB components
+ * @param {number} a - Float32 representing Alpha component
+ *
+ * @return {number} Packed RGBA as Uint32
+ */
+ getTintAppendFloatAlpha: function (rgb, a)
+ {
+ var ua = ((a * 255.0)|0) & 0xFF;
+ return ((ua << 24) | rgb) >>> 0;
+ },
+
+ /**
+ * Packs a Uint24, representing RGB components, with a Float32, representing
+ * the alpha component, with a range between 0.0 and 1.0 and return a
+ * swizzled Uint32
+ *
+ * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlphaAndSwap
+ * @since 3.0.0
+ *
+ * @param {number} rgb - Uint24 representing RGB components
+ * @param {number} a - Float32 representing Alpha component
+ *
+ * @return {number} Packed RGBA as Uint32
+ */
+ getTintAppendFloatAlphaAndSwap: function (rgb, a)
+ {
+ var ur = ((rgb >> 16)|0) & 0xff;
+ var ug = ((rgb >> 8)|0) & 0xff;
+ var ub = (rgb|0) & 0xff;
+ var ua = ((a * 255.0)|0) & 0xFF;
+
+ return ((ua << 24) | (ub << 16) | (ug << 8) | ur) >>> 0;
+ },
+
+ /**
+ * Unpacks a Uint24 RGB into an array of floats of ranges of 0.0 and 1.0
+ *
+ * @function Phaser.Renderer.WebGL.Utils.getFloatsFromUintRGB
+ * @since 3.0.0
+ *
+ * @param {number} rgb - RGB packed as a Uint24
+ *
+ * @return {array} Array of floats representing each component as a float
+ */
+ getFloatsFromUintRGB: function (rgb)
+ {
+ var ur = ((rgb >> 16)|0) & 0xff;
+ var ug = ((rgb >> 8)|0) & 0xff;
+ var ub = (rgb|0) & 0xff;
+
+ return [ ur / 255.0, ug / 255.0, ub / 255.0 ];
+ },
+
+ /**
+ * Counts how many attributes of 32 bits a vertex has
+ *
+ * @function Phaser.Renderer.WebGL.Utils.getComponentCount
+ * @since 3.0.0
+ *
+ * @param {array} attributes - Array of attributes
+ * @param {WebGLRenderingContext} glContext - WebGLContext used for check types
+ *
+ * @return {number} Count of 32 bit attributes in vertex
+ */
+ getComponentCount: function (attributes, glContext)
+ {
+ var count = 0;
+
+ for (var index = 0; index < attributes.length; ++index)
+ {
+ var element = attributes[index];
+
+ if (element.type === glContext.FLOAT)
+ {
+ count += element.size;
+ }
+ else
+ {
+ count += 1; // We'll force any other type to be 32 bit. for now
+ }
+ }
+
+ return count;
+ }
+
+};
+
+
+/***/ }),
+/* 11 */
+/***/ (function(module, exports, __webpack_require__) {
+
"use strict";
@@ -2161,7 +2409,7 @@ if (true) {
/***/ }),
-/* 10 */
+/* 12 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -2203,7 +2451,7 @@ var GetValue = __webpack_require__(4);
/**
* [description]
*
- * @function Phaser.Utils.Object.GetAdvancedValue
+ * @function Phaser.Utils.Objects.GetAdvancedValue
* @since 3.0.0
*
* @param {object} source - [description]
@@ -2246,376 +2494,6 @@ var GetAdvancedValue = function (source, key, defaultValue)
module.exports = GetAdvancedValue;
-/***/ }),
-/* 11 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Class = __webpack_require__(0);
-var PluginCache = __webpack_require__(12);
-
-/**
- * @classdesc
- * 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
- * @memberOf Phaser.GameObjects
- * @constructor
- * @since 3.0.0
- *
- * @param {Phaser.Scene} scene - The Scene to which this Game Object Factory belongs.
- */
-var GameObjectFactory = new Class({
-
- initialize:
-
- function GameObjectFactory (scene)
- {
- /**
- * The Scene to which this Game Object Factory belongs.
- *
- * @name Phaser.GameObjects.GameObjectFactory#scene
- * @type {Phaser.Scene}
- * @protected
- * @since 3.0.0
- */
- this.scene = scene;
-
- /**
- * A reference to the Scene.Systems.
- *
- * @name Phaser.GameObjects.GameObjectFactory#systems
- * @type {Phaser.Scenes.Systems}
- * @protected
- * @since 3.0.0
- */
- this.systems = scene.sys;
-
- /**
- * A reference to the Scene Display List.
- *
- * @name Phaser.GameObjects.GameObjectFactory#displayList
- * @type {Phaser.GameObjects.DisplayList}
- * @protected
- * @since 3.0.0
- */
- this.displayList;
-
- /**
- * A reference to the Scene Update List.
- *
- * @name Phaser.GameObjects.GameObjectFactory#updateList;
- * @type {Phaser.GameObjects.UpdateList}
- * @protected
- * @since 3.0.0
- */
- this.updateList;
-
- scene.sys.events.once('boot', this.boot, this);
- scene.sys.events.on('start', this.start, this);
- },
-
- /**
- * This method is called automatically, only once, when the Scene is first created.
- * Do not invoke it directly.
- *
- * @method Phaser.GameObjects.GameObjectFactory#boot
- * @private
- * @since 3.5.1
- */
- boot: function ()
- {
- this.displayList = this.systems.displayList;
- this.updateList = this.systems.updateList;
-
- this.systems.events.once('destroy', this.destroy, this);
- },
-
- /**
- * This method is called automatically by the Scene when it is starting up.
- * It is responsible for creating local systems, properties and listening for Scene events.
- * Do not invoke it directly.
- *
- * @method Phaser.GameObjects.GameObjectFactory#start
- * @private
- * @since 3.5.0
- */
- start: function ()
- {
- this.systems.events.once('shutdown', this.shutdown, this);
- },
-
- /**
- * 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.
- *
- * @method Phaser.GameObjects.GameObjectFactory#existing
- * @since 3.0.0
- *
- * @param {Phaser.GameObjects.GameObject} child - The child to be added to this Scene.
- *
- * @return {Phaser.GameObjects.GameObject} The Game Object that was added.
- */
- existing: function (child)
- {
- if (child.renderCanvas || child.renderWebGL)
- {
- this.displayList.add(child);
- }
-
- if (child.preUpdate)
- {
- this.updateList.add(child);
- }
-
- return child;
- },
-
- /**
- * 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.
- *
- * @method Phaser.GameObjects.GameObjectFactory#shutdown
- * @private
- * @since 3.0.0
- */
- shutdown: function ()
- {
- this.systems.events.off('shutdown', this.shutdown, this);
- },
-
- /**
- * The Scene that owns this plugin is being destroyed.
- * We need to shutdown and then kill off all external references.
- *
- * @method Phaser.GameObjects.GameObjectFactory#destroy
- * @private
- * @since 3.0.0
- */
- destroy: function ()
- {
- this.shutdown();
-
- this.scene.sys.events.off('start', this.start, this);
-
- this.scene = null;
- this.systems = null;
-
- this.displayList = null;
- this.updateList = null;
- }
-
-});
-
-// Static method called directly by the Game Object factory functions
-
-GameObjectFactory.register = function (factoryType, factoryFunction)
-{
- if (!GameObjectFactory.prototype.hasOwnProperty(factoryType))
- {
- GameObjectFactory.prototype[factoryType] = factoryFunction;
- }
-};
-
-PluginCache.register('GameObjectFactory', GameObjectFactory, 'add');
-
-module.exports = GameObjectFactory;
-
-
-/***/ }),
-/* 12 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-// Contains the plugins that Phaser uses globally and locally.
-// These are the source objects, not instantiated.
-var corePlugins = {};
-
-// Contains the plugins that the dev has loaded into their game
-// These are the source objects, not instantiated.
-var customPlugins = {};
-
-/**
- * @typedef {object} CorePluginContainer
- *
- * @property {string} key - The unique name of this plugin in the core plugin cache.
- * @property {function} plugin - The plugin to be stored. Should be the source object, not instantiated.
- * @property {string} [mapping] - If this plugin is to be injected into the Scene Systems, this is the property key map used.
- * @property {boolean} [custom=false] - Core Scene plugin or a Custom Scene plugin?
- */
-
-/**
- * @typedef {object} CustomPluginContainer
- *
- * @property {string} key - The unique name of this plugin in the custom plugin cache.
- * @property {function} plugin - The plugin to be stored. Should be the source object, not instantiated.
- */
-
-var PluginCache = {};
-
-/**
- * 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)
- *
- * @method Phaser.Plugins.PluginCache.register
- * @since 3.8.0
- *
- * @param {string} key - A reference used to get this plugin from the plugin cache.
- * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated.
- * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used.
- * @param {boolean} [custom=false] - Core Scene plugin or a Custom Scene plugin?
- */
-PluginCache.register = function (key, plugin, mapping, custom)
-{
- if (custom === undefined) { custom = false; }
-
- corePlugins[key] = { plugin: plugin, mapping: mapping, custom: custom };
-};
-
-/**
- * Stores a custom plugin in the global plugin cache.
- * The key must be unique, within the scope of the cache.
- *
- * @method Phaser.Plugins.PluginCache.registerCustom
- * @since 3.8.0
- *
- * @param {string} key - A reference used to get this plugin from the plugin cache.
- * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated.
- * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used.
- */
-PluginCache.registerCustom = function (key, plugin, mapping)
-{
- customPlugins[key] = { plugin: plugin, mapping: mapping };
-};
-
-/**
- * Checks if the given key is already being used in the core plugin cache.
- *
- * @method Phaser.Plugins.PluginCache.hasCore
- * @since 3.8.0
- *
- * @param {string} key - The key to check for.
- *
- * @return {boolean} `true` if the key is already in use in the core cache, otherwise `false`.
- */
-PluginCache.hasCore = function (key)
-{
- return corePlugins.hasOwnProperty(key);
-};
-
-/**
- * Checks if the given key is already being used in the custom plugin cache.
- *
- * @method Phaser.Plugins.PluginCache.hasCustom
- * @since 3.8.0
- *
- * @param {string} key - The key to check for.
- *
- * @return {boolean} `true` if the key is already in use in the custom cache, otherwise `false`.
- */
-PluginCache.hasCustom = function (key)
-{
- return customPlugins.hasOwnProperty(key);
-};
-
-/**
- * Returns the core plugin object from the cache based on the given key.
- *
- * @method Phaser.Plugins.PluginCache.getCore
- * @since 3.8.0
- *
- * @param {string} key - The key of the core plugin to get.
- *
- * @return {CorePluginContainer} The core plugin object.
- */
-PluginCache.getCore = function (key)
-{
- return corePlugins[key];
-};
-
-/**
- * Returns the custom plugin object from the cache based on the given key.
- *
- * @method Phaser.Plugins.PluginCache.getCustom
- * @since 3.8.0
- *
- * @param {string} key - The key of the custom plugin to get.
- *
- * @return {CustomPluginContainer} The custom plugin object.
- */
-PluginCache.getCustom = function (key)
-{
- return customPlugins[key];
-};
-
-/**
- * Returns an object from the custom cache based on the given key that can be instantiated.
- *
- * @method Phaser.Plugins.PluginCache.getCustomClass
- * @since 3.8.0
- *
- * @param {string} key - The key of the custom plugin to get.
- *
- * @return {function} The custom plugin object.
- */
-PluginCache.getCustomClass = function (key)
-{
- return (customPlugins.hasOwnProperty(key)) ? customPlugins[key].plugin : null;
-};
-
-/**
- * Removes a core plugin based on the given key.
- *
- * @method Phaser.Plugins.PluginCache.remove
- * @since 3.8.0
- *
- * @param {string} key - The key of the core plugin to remove.
- */
-PluginCache.remove = function (key)
-{
- if (corePlugins.hasOwnProperty(key))
- {
- delete corePlugins[key];
- }
-};
-
-/**
- * Removes a custom plugin based on the given key.
- *
- * @method Phaser.Plugins.PluginCache.removeCustom
- * @since 3.8.0
- *
- * @param {string} key - The key of the custom plugin to remove.
- */
-PluginCache.removeCustom = function (key)
-{
- if (customPlugins.hasOwnProperty(key))
- {
- delete customPlugins[key];
- }
-};
-
-module.exports = PluginCache;
-
-
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
@@ -2627,7 +2505,7 @@ module.exports = PluginCache;
*/
var Class = __webpack_require__(0);
-var PluginCache = __webpack_require__(12);
+var PluginCache = __webpack_require__(15);
/**
* @classdesc
@@ -2639,7 +2517,7 @@ var PluginCache = __webpack_require__(12);
* methods into the class.
*
* @class GameObjectCreator
- * @memberOf Phaser.GameObjects
+ * @memberof Phaser.GameObjects
* @constructor
* @since 3.0.0
*
@@ -2785,490 +2663,40 @@ module.exports = GameObjectCreator;
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var Class = __webpack_require__(0);
-var Contains = __webpack_require__(31);
-var GetPoint = __webpack_require__(135);
-var GetPoints = __webpack_require__(294);
-var Line = __webpack_require__(96);
-var Random = __webpack_require__(154);
-
/**
- * @classdesc
- * Encapsulates a 2D rectangle defined by its corner point in the top-left and its extends in x (width) and y (height)
- *
- * @class Rectangle
- * @memberOf Phaser.Geom
- * @constructor
- * @since 3.0.0
- *
- * @param {number} [x=0] - [description]
- * @param {number} [y=0] - [description]
- * @param {number} [width=0] - [description]
- * @param {number} [height=0] - [description]
+ * @namespace Phaser.GameObjects.Components
*/
-var Rectangle = new Class({
- initialize:
+module.exports = {
- function Rectangle (x, y, width, height)
- {
- if (x === undefined) { x = 0; }
- if (y === undefined) { y = 0; }
- if (width === undefined) { width = 0; }
- if (height === undefined) { height = 0; }
+ Alpha: __webpack_require__(401),
+ Animation: __webpack_require__(427),
+ BlendMode: __webpack_require__(400),
+ ComputedSize: __webpack_require__(1045),
+ Crop: __webpack_require__(1044),
+ Depth: __webpack_require__(399),
+ Flip: __webpack_require__(1043),
+ GetBounds: __webpack_require__(1042),
+ Mask: __webpack_require__(395),
+ Origin: __webpack_require__(1041),
+ Pipeline: __webpack_require__(186),
+ ScaleMode: __webpack_require__(1040),
+ ScrollFactor: __webpack_require__(392),
+ Size: __webpack_require__(1039),
+ Texture: __webpack_require__(1038),
+ TextureCrop: __webpack_require__(1037),
+ Tint: __webpack_require__(1036),
+ ToJSON: __webpack_require__(391),
+ Transform: __webpack_require__(390),
+ TransformMatrix: __webpack_require__(38),
+ Visible: __webpack_require__(389)
- /**
- * [description]
- *
- * @name Phaser.Geom.Rectangle#x
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.x = x;
-
- /**
- * [description]
- *
- * @name Phaser.Geom.Rectangle#y
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.y = y;
-
- /**
- * [description]
- *
- * @name Phaser.Geom.Rectangle#width
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.width = width;
-
- /**
- * [description]
- *
- * @name Phaser.Geom.Rectangle#height
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.height = height;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Geom.Rectangle#contains
- * @since 3.0.0
- *
- * @param {number} x - [description]
- * @param {number} y - [description]
- *
- * @return {boolean} [description]
- */
- contains: function (x, y)
- {
- return Contains(this, x, y);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Geom.Rectangle#getPoint
- * @since 3.0.0
- *
- * @generic {Phaser.Geom.Point} O - [output,$return]
- *
- * @param {float} position - [description]
- * @param {(Phaser.Geom.Point|object)} [output] - [description]
- *
- * @return {(Phaser.Geom.Point|object)} [description]
- */
- getPoint: function (position, output)
- {
- return GetPoint(this, position, output);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Geom.Rectangle#getPoints
- * @since 3.0.0
- *
- * @generic {Phaser.Geom.Point[]} O - [output,$return]
- *
- * @param {integer} quantity - [description]
- * @param {number} [stepRate] - [description]
- * @param {(array|Phaser.Geom.Point[])} [output] - [description]
- *
- * @return {(array|Phaser.Geom.Point[])} [description]
- */
- getPoints: function (quantity, stepRate, output)
- {
- return GetPoints(this, quantity, stepRate, output);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Geom.Rectangle#getRandomPoint
- * @since 3.0.0
- *
- * @generic {Phaser.Geom.Point} O - [point,$return]
- *
- * @param {Phaser.Geom.Point} [point] - [description]
- *
- * @return {Phaser.Geom.Point} [description]
- */
- getRandomPoint: function (point)
- {
- return Random(this, point);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Geom.Rectangle#setTo
- * @since 3.0.0
- *
- * @param {number} x - [description]
- * @param {number} y - [description]
- * @param {number} width - [description]
- * @param {number} height - [description]
- *
- * @return {Phaser.Geom.Rectangle} This Rectangle object.
- */
- setTo: function (x, y, width, height)
- {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Geom.Rectangle#setEmpty
- * @since 3.0.0
- *
- * @return {Phaser.Geom.Rectangle} This Rectangle object.
- */
- setEmpty: function ()
- {
- return this.setTo(0, 0, 0, 0);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Geom.Rectangle#setPosition
- * @since 3.0.0
- *
- * @param {number} x - [description]
- * @param {number} [y=x] - [description]
- *
- * @return {Phaser.Geom.Rectangle} This Rectangle object.
- */
- setPosition: function (x, y)
- {
- if (y === undefined) { y = x; }
-
- this.x = x;
- this.y = y;
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Geom.Rectangle#setSize
- * @since 3.0.0
- *
- * @param {number} width - [description]
- * @param {number} [height=width] - [description]
- *
- * @return {Phaser.Geom.Rectangle} This Rectangle object.
- */
- setSize: function (width, height)
- {
- if (height === undefined) { height = width; }
-
- this.width = width;
- this.height = height;
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Geom.Rectangle#isEmpty
- * @since 3.0.0
- *
- * @return {boolean} [description]
- */
- isEmpty: function ()
- {
- return (this.width <= 0 || this.height <= 0);
- },
-
- /**
- * Returns a Line object that corresponds to the top of this Rectangle.
- *
- * @method Phaser.Geom.Rectangle#getLineA
- * @since 3.0.0
- *
- * @generic {Phaser.Geom.Line} O - [line,$return]
- *
- * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created.
- *
- * @return {Phaser.Geom.Line} A Line object that corresponds to the top of this Rectangle.
- */
- getLineA: function (line)
- {
- if (line === undefined) { line = new Line(); }
-
- line.setTo(this.x, this.y, this.right, this.y);
-
- return line;
- },
-
- /**
- * Returns a Line object that corresponds to the right of this Rectangle.
- *
- * @method Phaser.Geom.Rectangle#getLineB
- * @since 3.0.0
- *
- * @generic {Phaser.Geom.Line} O - [line,$return]
- *
- * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created.
- *
- * @return {Phaser.Geom.Line} A Line object that corresponds to the right of this Rectangle.
- */
- getLineB: function (line)
- {
- if (line === undefined) { line = new Line(); }
-
- line.setTo(this.right, this.y, this.right, this.bottom);
-
- return line;
- },
-
- /**
- * Returns a Line object that corresponds to the bottom of this Rectangle.
- *
- * @method Phaser.Geom.Rectangle#getLineC
- * @since 3.0.0
- *
- * @generic {Phaser.Geom.Line} O - [line,$return]
- *
- * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created.
- *
- * @return {Phaser.Geom.Line} A Line object that corresponds to the bottom of this Rectangle.
- */
- getLineC: function (line)
- {
- if (line === undefined) { line = new Line(); }
-
- line.setTo(this.right, this.bottom, this.x, this.bottom);
-
- return line;
- },
-
- /**
- * Returns a Line object that corresponds to the left of this Rectangle.
- *
- * @method Phaser.Geom.Rectangle#getLineD
- * @since 3.0.0
- *
- * @generic {Phaser.Geom.Line} O - [line,$return]
- *
- * @param {Phaser.Geom.Line} [line] - A Line object to set the results in. If `undefined` a new Line will be created.
- *
- * @return {Phaser.Geom.Line} A Line object that corresponds to the left of this Rectangle.
- */
- getLineD: function (line)
- {
- if (line === undefined) { line = new Line(); }
-
- line.setTo(this.x, this.bottom, this.x, this.y);
-
- return line;
- },
-
- /**
- * [description]
- *
- * @name Phaser.Geom.Rectangle#left
- * @type {number}
- * @since 3.0.0
- */
- left: {
-
- get: function ()
- {
- return this.x;
- },
-
- set: function (value)
- {
- if (value >= this.right)
- {
- this.width = 0;
- }
- else
- {
- this.width = this.right - value;
- }
-
- this.x = value;
- }
-
- },
-
- /**
- * [description]
- *
- * @name Phaser.Geom.Rectangle#right
- * @type {number}
- * @since 3.0.0
- */
- right: {
-
- get: function ()
- {
- return this.x + this.width;
- },
-
- set: function (value)
- {
- if (value <= this.x)
- {
- this.width = 0;
- }
- else
- {
- this.width = value - this.x;
- }
- }
-
- },
-
- /**
- * [description]
- *
- * @name Phaser.Geom.Rectangle#top
- * @type {number}
- * @since 3.0.0
- */
- top: {
-
- get: function ()
- {
- return this.y;
- },
-
- set: function (value)
- {
- if (value >= this.bottom)
- {
- this.height = 0;
- }
- else
- {
- this.height = (this.bottom - value);
- }
-
- this.y = value;
- }
-
- },
-
- /**
- * [description]
- *
- * @name Phaser.Geom.Rectangle#bottom
- * @type {number}
- * @since 3.0.0
- */
- bottom: {
-
- get: function ()
- {
- return this.y + this.height;
- },
-
- set: function (value)
- {
- if (value <= this.y)
- {
- this.height = 0;
- }
- else
- {
- this.height = value - this.y;
- }
- }
-
- },
-
- /**
- * [description]
- *
- * @name Phaser.Geom.Rectangle#centerX
- * @type {number}
- * @since 3.0.0
- */
- centerX: {
-
- get: function ()
- {
- return this.x + (this.width / 2);
- },
-
- set: function (value)
- {
- this.x = value - (this.width / 2);
- }
-
- },
-
- /**
- * [description]
- *
- * @name Phaser.Geom.Rectangle#centerY
- * @type {number}
- * @since 3.0.0
- */
- centerY: {
-
- get: function ()
- {
- return this.y + (this.height / 2);
- },
-
- set: function (value)
- {
- this.y = value - (this.height / 2);
- }
-
- }
-
-});
-
-module.exports = Rectangle;
+};
/***/ }),
/* 15 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(module, exports) {
/**
* @author Richard Davey
@@ -3276,35 +2704,216 @@ module.exports = Rectangle;
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
+// Contains the plugins that Phaser uses globally and locally.
+// These are the source objects, not instantiated.
+var corePlugins = {};
+
+// Contains the plugins that the dev has loaded into their game
+// These are the source objects, not instantiated.
+var customPlugins = {};
+
/**
- * @namespace Phaser.GameObjects.Components
+ * @typedef {object} CorePluginContainer
+ *
+ * @property {string} key - The unique name of this plugin in the core plugin cache.
+ * @property {function} plugin - The plugin to be stored. Should be the source object, not instantiated.
+ * @property {string} [mapping] - If this plugin is to be injected into the Scene Systems, this is the property key map used.
+ * @property {boolean} [custom=false] - Core Scene plugin or a Custom Scene plugin?
*/
-module.exports = {
+/**
+ * @typedef {object} CustomPluginContainer
+ *
+ * @property {string} key - The unique name of this plugin in the custom plugin cache.
+ * @property {function} plugin - The plugin to be stored. Should be the source object, not instantiated.
+ */
- Alpha: __webpack_require__(587),
- Animation: __webpack_require__(302),
- BlendMode: __webpack_require__(586),
- ComputedSize: __webpack_require__(585),
- Depth: __webpack_require__(584),
- Flip: __webpack_require__(583),
- GetBounds: __webpack_require__(582),
- Mask: __webpack_require__(581),
- MatrixStack: __webpack_require__(580),
- Origin: __webpack_require__(579),
- Pipeline: __webpack_require__(291),
- ScaleMode: __webpack_require__(578),
- ScrollFactor: __webpack_require__(577),
- Size: __webpack_require__(576),
- Texture: __webpack_require__(575),
- Tint: __webpack_require__(574),
- ToJSON: __webpack_require__(573),
- Transform: __webpack_require__(572),
- TransformMatrix: __webpack_require__(64),
- Visible: __webpack_require__(571)
+var PluginCache = {};
+/**
+ * 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)
+ *
+ * @method Phaser.Plugins.PluginCache.register
+ * @since 3.8.0
+ *
+ * @param {string} key - A reference used to get this plugin from the plugin cache.
+ * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated.
+ * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used.
+ * @param {boolean} [custom=false] - Core Scene plugin or a Custom Scene plugin?
+ */
+PluginCache.register = function (key, plugin, mapping, custom)
+{
+ if (custom === undefined) { custom = false; }
+
+ corePlugins[key] = { plugin: plugin, mapping: mapping, custom: custom };
};
+/**
+ * Stores a custom plugin in the global plugin cache.
+ * The key must be unique, within the scope of the cache.
+ *
+ * @method Phaser.Plugins.PluginCache.registerCustom
+ * @since 3.8.0
+ *
+ * @param {string} key - A reference used to get this plugin from the plugin cache.
+ * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated.
+ * @param {string} mapping - If this plugin is to be injected into the Scene Systems, this is the property key map used.
+ * @param {?any} data - A value to be passed to the plugin's `init` method.
+ */
+PluginCache.registerCustom = function (key, plugin, mapping, data)
+{
+ customPlugins[key] = { plugin: plugin, mapping: mapping, data: data };
+};
+
+/**
+ * Checks if the given key is already being used in the core plugin cache.
+ *
+ * @method Phaser.Plugins.PluginCache.hasCore
+ * @since 3.8.0
+ *
+ * @param {string} key - The key to check for.
+ *
+ * @return {boolean} `true` if the key is already in use in the core cache, otherwise `false`.
+ */
+PluginCache.hasCore = function (key)
+{
+ return corePlugins.hasOwnProperty(key);
+};
+
+/**
+ * Checks if the given key is already being used in the custom plugin cache.
+ *
+ * @method Phaser.Plugins.PluginCache.hasCustom
+ * @since 3.8.0
+ *
+ * @param {string} key - The key to check for.
+ *
+ * @return {boolean} `true` if the key is already in use in the custom cache, otherwise `false`.
+ */
+PluginCache.hasCustom = function (key)
+{
+ return customPlugins.hasOwnProperty(key);
+};
+
+/**
+ * Returns the core plugin object from the cache based on the given key.
+ *
+ * @method Phaser.Plugins.PluginCache.getCore
+ * @since 3.8.0
+ *
+ * @param {string} key - The key of the core plugin to get.
+ *
+ * @return {CorePluginContainer} The core plugin object.
+ */
+PluginCache.getCore = function (key)
+{
+ return corePlugins[key];
+};
+
+/**
+ * Returns the custom plugin object from the cache based on the given key.
+ *
+ * @method Phaser.Plugins.PluginCache.getCustom
+ * @since 3.8.0
+ *
+ * @param {string} key - The key of the custom plugin to get.
+ *
+ * @return {CustomPluginContainer} The custom plugin object.
+ */
+PluginCache.getCustom = function (key)
+{
+ return customPlugins[key];
+};
+
+/**
+ * Returns an object from the custom cache based on the given key that can be instantiated.
+ *
+ * @method Phaser.Plugins.PluginCache.getCustomClass
+ * @since 3.8.0
+ *
+ * @param {string} key - The key of the custom plugin to get.
+ *
+ * @return {function} The custom plugin object.
+ */
+PluginCache.getCustomClass = function (key)
+{
+ return (customPlugins.hasOwnProperty(key)) ? customPlugins[key].plugin : null;
+};
+
+/**
+ * Removes a core plugin based on the given key.
+ *
+ * @method Phaser.Plugins.PluginCache.remove
+ * @since 3.8.0
+ *
+ * @param {string} key - The key of the core plugin to remove.
+ */
+PluginCache.remove = function (key)
+{
+ if (corePlugins.hasOwnProperty(key))
+ {
+ delete corePlugins[key];
+ }
+};
+
+/**
+ * Removes a custom plugin based on the given key.
+ *
+ * @method Phaser.Plugins.PluginCache.removeCustom
+ * @since 3.8.0
+ *
+ * @param {string} key - The key of the custom plugin to remove.
+ */
+PluginCache.removeCustom = function (key)
+{
+ if (customPlugins.hasOwnProperty(key))
+ {
+ delete customPlugins[key];
+ }
+};
+
+/**
+ * Removes all Core Plugins.
+ *
+ * This includes all of the internal system plugins that Phaser needs, like the Input Plugin and Loader Plugin.
+ * So be sure you only call this if you do not wish to run Phaser again.
+ *
+ * @method Phaser.Plugins.PluginCache.destroyCorePlugins
+ * @since 3.12.0
+ */
+PluginCache.destroyCorePlugins = function ()
+{
+ for (var key in corePlugins)
+ {
+ if (corePlugins.hasOwnProperty(key))
+ {
+ delete corePlugins[key];
+ }
+ }
+};
+
+/**
+ * Removes all Custom Plugins.
+ *
+ * @method Phaser.Plugins.PluginCache.destroyCustomPlugins
+ * @since 3.12.0
+ */
+PluginCache.destroyCustomPlugins = function ()
+{
+ for (var key in customPlugins)
+ {
+ if (customPlugins.hasOwnProperty(key))
+ {
+ delete customPlugins[key];
+ }
+ }
+};
+
+module.exports = PluginCache;
+
/***/ }),
/* 16 */
@@ -3316,7 +2925,7 @@ module.exports = {
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var RND = __webpack_require__(297);
+var RND = __webpack_require__(404);
var MATH_CONST = {
@@ -3389,93 +2998,86 @@ module.exports = MATH_CONST;
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var IsPlainObject = __webpack_require__(8);
-
-// @param {boolean} deep - Perform a deep copy?
-// @param {object} target - The target object to copy to.
-// @return {object} The extended object.
+var GetFastValue = __webpack_require__(2);
/**
- * This is a slightly modified version of http://api.jquery.com/jQuery.extend/
+ * @typedef {object} GetTilesWithinFilteringOptions
*
- * @function Phaser.Utils.Object.Extend
+ * @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index.
+ * @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side.
+ * @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face.
+ */
+
+/**
+ * Gets the tiles in the given rectangular area (in tile coordinates) of the layer.
+ *
+ * @function Phaser.Tilemaps.Components.GetTilesWithin
+ * @private
* @since 3.0.0
*
- * @return {object} [description]
+ * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area.
+ * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area.
+ * @param {integer} width - How many tiles wide from the `tileX` index the area will be.
+ * @param {integer} height - How many tiles tall from the `tileY` index the area will be.
+ * @param {object} GetTilesWithinFilteringOptions - Optional filters to apply when getting the tiles.
+ * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
+ *
+ * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects.
*/
-var Extend = function ()
+var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer)
{
- var options, name, src, copy, copyIsArray, clone,
- target = arguments[0] || {},
- i = 1,
- length = arguments.length,
- deep = false;
+ if (tileX === undefined) { tileX = 0; }
+ if (tileY === undefined) { tileY = 0; }
+ if (width === undefined) { width = layer.width; }
+ if (height === undefined) { height = layer.height; }
- // Handle a deep copy situation
- if (typeof target === 'boolean')
+ var isNotEmpty = GetFastValue(filteringOptions, 'isNotEmpty', false);
+ var isColliding = GetFastValue(filteringOptions, 'isColliding', false);
+ var hasInterestingFace = GetFastValue(filteringOptions, 'hasInterestingFace', false);
+
+ // Clip x, y to top left of map, while shrinking width/height to match.
+ if (tileX < 0)
{
- deep = target;
- target = arguments[1] || {};
-
- // skip the boolean and the target
- i = 2;
+ width += tileX;
+ tileX = 0;
+ }
+ if (tileY < 0)
+ {
+ height += tileY;
+ tileY = 0;
}
- // extend Phaser if only one argument is passed
- if (length === i)
+ // Clip width and height to bottom right of map.
+ if (tileX + width > layer.width)
{
- target = this;
- --i;
+ width = Math.max(layer.width - tileX, 0);
+ }
+ if (tileY + height > layer.height)
+ {
+ height = Math.max(layer.height - tileY, 0);
}
- for (; i < length; i++)
+ var results = [];
+
+ for (var ty = tileY; ty < tileY + height; ty++)
{
- // Only deal with non-null/undefined values
- if ((options = arguments[i]) != null)
+ for (var tx = tileX; tx < tileX + width; tx++)
{
- // Extend the base object
- for (name in options)
+ var tile = layer.data[ty][tx];
+ if (tile !== null)
{
- src = target[name];
- copy = options[name];
-
- // Prevent never-ending loop
- if (target === copy)
- {
- continue;
- }
-
- // Recurse if we're merging plain objects or arrays
- if (deep && copy && (IsPlainObject(copy) || (copyIsArray = Array.isArray(copy))))
- {
- if (copyIsArray)
- {
- copyIsArray = false;
- clone = src && Array.isArray(src) ? src : [];
- }
- else
- {
- clone = src && IsPlainObject(src) ? src : {};
- }
-
- // Never move original objects, clone them
- target[name] = Extend(deep, clone, copy);
-
- // Don't bring in undefined values
- }
- else if (copy !== undefined)
- {
- target[name] = copy;
- }
+ if (isNotEmpty && tile.index === -1) { continue; }
+ if (isColliding && !tile.collides) { continue; }
+ if (hasInterestingFace && !tile.hasInterestingFace) { continue; }
+ results.push(tile);
}
}
}
- // Return the modified object
- return target;
+ return results;
};
-module.exports = Extend;
+module.exports = GetTilesWithin;
/***/ }),
@@ -3634,6 +3236,704 @@ module.exports = FILE_CONST;
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var ComponentsToJSON = __webpack_require__(391);
+var DataManager = __webpack_require__(123);
+var EventEmitter = __webpack_require__(11);
+
+/**
+ * @classdesc
+ * 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
+ * @memberof Phaser.GameObjects
+ * @extends Phaser.Events.EventEmitter
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs.
+ * @param {string} type - A textual representation of the type of Game Object, i.e. `sprite`.
+ */
+var GameObject = new Class({
+
+ Extends: EventEmitter,
+
+ initialize:
+
+ function GameObject (scene, type)
+ {
+ EventEmitter.call(this);
+
+ /**
+ * The Scene to which this Game Object belongs.
+ * Game Objects can only belong to one Scene.
+ *
+ * @name Phaser.GameObjects.GameObject#scene
+ * @type {Phaser.Scene}
+ * @protected
+ * @since 3.0.0
+ */
+ this.scene = 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.
+ *
+ * @name Phaser.GameObjects.GameObject#type
+ * @type {string}
+ * @since 3.0.0
+ */
+ this.type = type;
+
+ /**
+ * The parent Container of this Game Object, if it has one.
+ *
+ * @name Phaser.GameObjects.GameObject#parentContainer
+ * @type {Phaser.GameObjects.Container}
+ * @since 3.4.0
+ */
+ this.parentContainer = null;
+
+ /**
+ * The name of this Game Object.
+ * Empty by default and never populated by Phaser, this is left for developers to use.
+ *
+ * @name Phaser.GameObjects.GameObject#name
+ * @type {string}
+ * @default ''
+ * @since 3.0.0
+ */
+ this.name = '';
+
+ /**
+ * 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.
+ *
+ * @name Phaser.GameObjects.GameObject#active
+ * @type {boolean}
+ * @default true
+ * @since 3.0.0
+ */
+ this.active = true;
+
+ /**
+ * The Tab Index of the Game Object.
+ * Reserved for future use by plugins and the Input Manager.
+ *
+ * @name Phaser.GameObjects.GameObject#tabIndex
+ * @type {integer}
+ * @default -1
+ * @since 3.0.0
+ */
+ this.tabIndex = -1;
+
+ /**
+ * 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`.
+ *
+ * @name Phaser.GameObjects.GameObject#data
+ * @type {Phaser.Data.DataManager}
+ * @default null
+ * @since 3.0.0
+ */
+ this.data = null;
+
+ /**
+ * 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.
+ *
+ * @name Phaser.GameObjects.GameObject#renderFlags
+ * @type {integer}
+ * @default 15
+ * @since 3.0.0
+ */
+ this.renderFlags = 15;
+
+ /**
+ * 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:
+ *
+ * @example
+ * this.cameraFilter |= camera.id
+ *
+ * @name Phaser.GameObjects.GameObject#cameraFilter
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.cameraFilter = 0;
+
+ /**
+ * If this Game Object is enabled for input then this property will contain an InteractiveObject instance.
+ * Not usually set directly. Instead call `GameObject.setInteractive()`.
+ *
+ * @name Phaser.GameObjects.GameObject#input
+ * @type {?Phaser.Input.InteractiveObject}
+ * @default null
+ * @since 3.0.0
+ */
+ this.input = null;
+
+ /**
+ * If this Game Object is enabled for physics then this property will contain a reference to a Physics Body.
+ *
+ * @name Phaser.GameObjects.GameObject#body
+ * @type {?(object|Phaser.Physics.Arcade.Body|Phaser.Physics.Impact.Body)}
+ * @default null
+ * @since 3.0.0
+ */
+ this.body = null;
+
+ /**
+ * This Game Object will ignore all calls made to its destroy method if this flag is set to `true`.
+ * This includes calls that may come from a Group, Container or the Scene itself.
+ * While it allows you to persist a Game Object across Scenes, please understand you are entirely
+ * responsible for managing references to and from this Game Object.
+ *
+ * @name Phaser.GameObjects.GameObject#ignoreDestroy
+ * @type {boolean}
+ * @default false
+ * @since 3.5.0
+ */
+ this.ignoreDestroy = false;
+
+ // Tell the Scene to re-sort the children
+ scene.sys.queueDepthSort();
+ },
+
+ /**
+ * 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.
+ *
+ * @method Phaser.GameObjects.GameObject#setActive
+ * @since 3.0.0
+ *
+ * @param {boolean} value - True if this Game Object should be set as active, false if not.
+ *
+ * @return {this} This GameObject.
+ */
+ setActive: function (value)
+ {
+ this.active = value;
+
+ return 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.
+ *
+ * @method Phaser.GameObjects.GameObject#setName
+ * @since 3.0.0
+ *
+ * @param {string} value - The name to be given to this Game Object.
+ *
+ * @return {this} This GameObject.
+ */
+ setName: function (value)
+ {
+ this.name = value;
+
+ return this;
+ },
+
+ /**
+ * Adds a Data Manager component to this Game Object.
+ *
+ * @method Phaser.GameObjects.GameObject#setDataEnabled
+ * @since 3.0.0
+ * @see Phaser.Data.DataManager
+ *
+ * @return {this} This GameObject.
+ */
+ setDataEnabled: function ()
+ {
+ if (!this.data)
+ {
+ this.data = new DataManager(this);
+ }
+
+ return 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.
+ *
+ * @method Phaser.GameObjects.GameObject#setData
+ * @since 3.0.0
+ *
+ * @param {(string|object)} key - The key to set the value for. Or an object or 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.
+ *
+ * @return {this} This GameObject.
+ */
+ setData: function (key, value)
+ {
+ if (!this.data)
+ {
+ this.data = new DataManager(this);
+ }
+
+ this.data.set(key, value);
+
+ return 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.
+ *
+ * @method Phaser.GameObjects.GameObject#getData
+ * @since 3.0.0
+ *
+ * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys.
+ *
+ * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array.
+ */
+ getData: function (key)
+ {
+ if (!this.data)
+ {
+ this.data = new DataManager(this);
+ }
+
+ return this.data.get(key);
+ },
+
+ /**
+ * 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.
+ *
+ * @method Phaser.GameObjects.GameObject#setInteractive
+ * @since 3.0.0
+ *
+ * @param {(Phaser.Input.InputConfiguration|any)} [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 {HitAreaCallback} [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 {boolean} [dropZone=false] - Should this Game Object be treated as a drop zone target?
+ *
+ * @return {this} This GameObject.
+ */
+ setInteractive: function (shape, callback, dropZone)
+ {
+ this.scene.sys.input.enable(this, shape, callback, dropZone);
+
+ return 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.
+ *
+ * @method Phaser.GameObjects.GameObject#disableInteractive
+ * @since 3.7.0
+ *
+ * @return {this} This GameObject.
+ */
+ disableInteractive: function ()
+ {
+ if (this.input)
+ {
+ this.input.enabled = false;
+ }
+
+ return 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.)
+ *
+ * @method Phaser.GameObjects.GameObject#removeInteractive
+ * @since 3.7.0
+ *
+ * @return {this} This GameObject.
+ */
+ removeInteractive: function ()
+ {
+ this.scene.sys.input.clear(this);
+
+ this.input = undefined;
+
+ return this;
+ },
+
+ /**
+ * To be overridden by custom GameObjects. Allows base objects to be used in a Pool.
+ *
+ * @method Phaser.GameObjects.GameObject#update
+ * @since 3.0.0
+ *
+ * @param {...*} [args] - args
+ */
+ update: function ()
+ {
+ },
+
+ /**
+ * Returns a JSON representation of the Game Object.
+ *
+ * @method Phaser.GameObjects.GameObject#toJSON
+ * @since 3.0.0
+ *
+ * @return {JSONGameObject} A JSON representation of the Game Object.
+ */
+ toJSON: function ()
+ {
+ return ComponentsToJSON(this);
+ },
+
+ /**
+ * 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.
+ *
+ * @method Phaser.GameObjects.GameObject#willRender
+ * @since 3.0.0
+ *
+ * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to check against this Game Object.
+ *
+ * @return {boolean} True if the Game Object should be rendered, otherwise false.
+ */
+ willRender: function (camera)
+ {
+ return !(GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter > 0 && (this.cameraFilter & camera.id)));
+ },
+
+ /**
+ * 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.
+ *
+ * @method Phaser.GameObjects.GameObject#getIndexList
+ * @since 3.4.0
+ *
+ * @return {integer[]} An array of display list position indexes.
+ */
+ getIndexList: function ()
+ {
+ // eslint-disable-next-line consistent-this
+ var child = this;
+ var parent = this.parentContainer;
+
+ var indexes = [];
+
+ while (parent)
+ {
+ // indexes.unshift([parent.getIndex(child), parent.name]);
+ indexes.unshift(parent.getIndex(child));
+
+ child = parent;
+
+ if (!parent.parentContainer)
+ {
+ break;
+ }
+ else
+ {
+ parent = parent.parentContainer;
+ }
+ }
+
+ // indexes.unshift([this.scene.sys.displayList.getIndex(child), 'root']);
+ indexes.unshift(this.scene.sys.displayList.getIndex(child));
+
+ return indexes;
+ },
+
+ /**
+ * 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.
+ *
+ * @method Phaser.GameObjects.GameObject#destroy
+ * @since 3.0.0
+ *
+ * @param {boolean} [fromScene=false] - Is this Game Object being destroyed as the result of a Scene shutdown?
+ */
+ destroy: function (fromScene)
+ {
+ if (fromScene === undefined) { fromScene = false; }
+
+ // This Game Object has already been destroyed
+ if (!this.scene || this.ignoreDestroy)
+ {
+ return;
+ }
+
+ if (this.preDestroy)
+ {
+ this.preDestroy.call(this);
+ }
+
+ this.emit('destroy', this);
+
+ var sys = this.scene.sys;
+
+ if (!fromScene)
+ {
+ sys.displayList.remove(this);
+ sys.updateList.remove(this);
+ }
+
+ if (this.input)
+ {
+ sys.input.clear(this);
+ this.input = undefined;
+ }
+
+ if (this.data)
+ {
+ this.data.destroy();
+
+ this.data = undefined;
+ }
+
+ if (this.body)
+ {
+ this.body.destroy();
+ this.body = undefined;
+ }
+
+ // Tell the Scene to re-sort the children
+ if (!fromScene)
+ {
+ sys.queueDepthSort();
+ }
+
+ this.active = false;
+ this.visible = false;
+
+ this.scene = undefined;
+
+ this.parentContainer = undefined;
+
+ this.removeAllListeners();
+ }
+
+});
+
+/**
+ * The bitmask that `GameObject.renderFlags` is compared against to determine if the Game Object will render or not.
+ *
+ * @constant {integer} RENDER_MASK
+ * @memberof Phaser.GameObjects.GameObject
+ * @default
+ */
+GameObject.RENDER_MASK = 15;
+
+module.exports = GameObject;
+
+
+/***/ }),
+/* 20 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var IsPlainObject = __webpack_require__(8);
+
+// @param {boolean} deep - Perform a deep copy?
+// @param {object} target - The target object to copy to.
+// @return {object} The extended object.
+
+/**
+ * This is a slightly modified version of http://api.jquery.com/jQuery.extend/
+ *
+ * @function Phaser.Utils.Objects.Extend
+ * @since 3.0.0
+ *
+ * @return {object} [description]
+ */
+var Extend = function ()
+{
+ var options, name, src, copy, copyIsArray, clone,
+ target = arguments[0] || {},
+ i = 1,
+ length = arguments.length,
+ deep = false;
+
+ // Handle a deep copy situation
+ if (typeof target === 'boolean')
+ {
+ deep = target;
+ target = arguments[1] || {};
+
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // extend Phaser if only one argument is passed
+ if (length === i)
+ {
+ target = this;
+ --i;
+ }
+
+ for (; i < length; i++)
+ {
+ // Only deal with non-null/undefined values
+ if ((options = arguments[i]) != null)
+ {
+ // Extend the base object
+ for (name in options)
+ {
+ src = target[name];
+ copy = options[name];
+
+ // Prevent never-ending loop
+ if (target === copy)
+ {
+ continue;
+ }
+
+ // Recurse if we're merging plain objects or arrays
+ if (deep && copy && (IsPlainObject(copy) || (copyIsArray = Array.isArray(copy))))
+ {
+ if (copyIsArray)
+ {
+ copyIsArray = false;
+ clone = src && Array.isArray(src) ? src : [];
+ }
+ else
+ {
+ clone = src && IsPlainObject(src) ? src : {};
+ }
+
+ // Never move original objects, clone them
+ target[name] = Extend(deep, clone, copy);
+
+ // Don't bring in undefined values
+ }
+ else if (copy !== undefined)
+ {
+ target[name] = copy;
+ }
+ }
+ }
+ }
+
+ // Return the modified object
+ return target;
+};
+
+module.exports = Extend;
+
+
+/***/ }),
+/* 21 */
+/***/ (function(module, exports, __webpack_require__) {
+
/**
* @author Richard Davey
* @copyright 2018 Photon Storm Ltd.
@@ -3642,11 +3942,11 @@ module.exports = FILE_CONST;
var Class = __webpack_require__(0);
var CONST = __webpack_require__(18);
-var GetFastValue = __webpack_require__(1);
-var GetURL = __webpack_require__(108);
-var MergeXHRSettings = __webpack_require__(107);
-var XHRLoader = __webpack_require__(169);
-var XHRSettings = __webpack_require__(75);
+var GetFastValue = __webpack_require__(2);
+var GetURL = __webpack_require__(141);
+var MergeXHRSettings = __webpack_require__(140);
+var XHRLoader = __webpack_require__(254);
+var XHRSettings = __webpack_require__(105);
/**
* @typedef {object} FileConfig
@@ -3667,7 +3967,7 @@ var XHRSettings = __webpack_require__(75);
* 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.
*
* @class File
- * @memberOf Phaser.Loader
+ * @memberof Phaser.Loader
* @constructor
* @since 3.0.0
*
@@ -3816,7 +4116,7 @@ var File = new Class({
* Only set if loading via XHR.
*
* @name Phaser.Loader.File#percentComplete
- * @type {float}
+ * @type {number}
* @default -1
* @since 3.0.0
*/
@@ -4153,7 +4453,7 @@ var File = new Class({
var type = this.type;
this.loader.emit('filecomplete', key, type, data);
- this.loader.emit('filecomplete_' + type + '_' + key, key, type, data);
+ this.loader.emit('filecomplete-' + type + '-' + key, key, type, data);
this.loader.flagForRemoval(this);
},
@@ -4228,8 +4528,8 @@ module.exports = File;
/***/ }),
-/* 20 */
-/***/ (function(module, exports, __webpack_require__) {
+/* 22 */
+/***/ (function(module, exports) {
/**
* @author Richard Davey
@@ -4238,136 +4538,83 @@ module.exports = File;
*/
/**
- * Global consts.
+ * Takes a reference to the Canvas Renderer, a Canvas Rendering Context, a Game Object, a Camera and a parent matrix
+ * and then performs the following steps:
*
- * @ignore
+ * 1) Checks the alpha of the source combined with the Camera alpha. If 0 or less it aborts.
+ * 2) Takes the Camera and Game Object matrix and multiplies them, combined with the parent matrix if given.
+ * 3) Sets the blend mode of the context to be that used by the Game Object.
+ * 4) Sets the alpha value of the context to be that used by the Game Object combined with the Camera.
+ * 5) Saves the context state.
+ * 6) Sets the final matrix values into the context via setTransform.
+ *
+ * This function is only meant to be used internally. Most of the Canvas Renderer classes use it.
+ *
+ * @function Phaser.Renderer.Canvas.SetTransform
+ * @since 3.12.0
+ *
+ * @param {Phaser.Renderer.Canvas.CanvasRenderer} renderer - A reference to the current active Canvas renderer.
+ * @param {CanvasRenderingContext2D} ctx - The canvas context to set the transform on.
+ * @param {Phaser.GameObjects.GameObject} src - The Game Object being rendered. Can be any type that extends the base class.
+ * @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object.
+ * @param {Phaser.GameObjects.Components.TransformMatrix} [parentMatrix] - A parent transform matrix to apply to the Game Object before rendering.
+ *
+ * @return {boolean} `true` if the Game Object context was set, otherwise `false`.
*/
+var SetTransform = function (renderer, ctx, src, camera, parentMatrix)
+{
+ var alpha = camera.alpha * src.alpha;
-var CONST = {
+ if (alpha <= 0)
+ {
+ // Nothing to see, so don't waste time calculating stuff
+ return false;
+ }
- /**
- * Phaser Release Version
- *
- * @name Phaser.VERSION
- * @readOnly
- * @type {string}
- * @since 3.0.0
- */
- VERSION: '3.10.1',
+ var camMatrix = renderer._tempMatrix1.copyFromArray(camera.matrix.matrix);
+ var gameObjectMatrix = renderer._tempMatrix2.applyITRS(src.x, src.y, src.rotation, src.scaleX, src.scaleY);
+ var calcMatrix = renderer._tempMatrix3;
- BlendModes: __webpack_require__(51),
+ if (parentMatrix)
+ {
+ // Multiply the camera by the parent matrix
+ camMatrix.multiplyWithOffset(parentMatrix, -camera.scrollX * src.scrollFactorX, -camera.scrollY * src.scrollFactorY);
- ScaleModes: __webpack_require__(59),
+ // Undo the camera scroll
+ gameObjectMatrix.e = src.x;
+ gameObjectMatrix.f = src.y;
- /**
- * AUTO Detect Renderer.
- *
- * @name Phaser.AUTO
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- AUTO: 0,
+ // Multiply by the Sprite matrix, store result in calcMatrix
+ camMatrix.multiply(gameObjectMatrix, calcMatrix);
+ }
+ else
+ {
+ gameObjectMatrix.e -= camera.scrollX * src.scrollFactorX;
+ gameObjectMatrix.f -= camera.scrollY * src.scrollFactorY;
- /**
- * Canvas Renderer.
- *
- * @name Phaser.CANVAS
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- CANVAS: 1,
+ // Multiply by the Sprite matrix, store result in calcMatrix
+ camMatrix.multiply(gameObjectMatrix, calcMatrix);
+ }
- /**
- * WebGL Renderer.
- *
- * @name Phaser.WEBGL
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- WEBGL: 2,
+ // Blend Mode
+ ctx.globalCompositeOperation = renderer.blendModes[src.blendMode];
- /**
- * Headless Renderer.
- *
- * @name Phaser.HEADLESS
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- HEADLESS: 3,
+ // Alpha
+ ctx.globalAlpha = alpha;
- /**
- * In Phaser the value -1 means 'forever' in lots of cases, this const allows you to use it instead
- * to help you remember what the value is doing in your code.
- *
- * @name Phaser.FOREVER
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- FOREVER: -1,
+ ctx.save();
- /**
- * Direction constant.
- *
- * @name Phaser.NONE
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- NONE: 4,
-
- /**
- * Direction constant.
- *
- * @name Phaser.UP
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- UP: 5,
-
- /**
- * Direction constant.
- *
- * @name Phaser.DOWN
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- DOWN: 6,
-
- /**
- * Direction constant.
- *
- * @name Phaser.LEFT
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- LEFT: 7,
-
- /**
- * Direction constant.
- *
- * @name Phaser.RIGHT
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- RIGHT: 8
+ calcMatrix.setToContext(ctx);
+ return true;
};
-module.exports = CONST;
+module.exports = SetTransform;
/***/ }),
-/* 21 */
-/***/ (function(module, exports, __webpack_require__) {
+/* 23 */
+/***/ (function(module, exports) {
/**
* @author Richard Davey
@@ -4375,90 +4622,28 @@ module.exports = CONST;
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var GetFastValue = __webpack_require__(1);
-
/**
- * @typedef {object} GetTilesWithinFilteringOptions
+ * Force a value within the boundaries by clamping it to the range `min`, `max`.
*
- * @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index.
- * @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side.
- * @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face.
- */
-
-/**
- * Gets the tiles in the given rectangular area (in tile coordinates) of the layer.
- *
- * @function Phaser.Tilemaps.Components.GetTilesWithin
- * @private
+ * @function Phaser.Math.Clamp
* @since 3.0.0
*
- * @param {integer} tileX - [description]
- * @param {integer} tileY - [description]
- * @param {integer} width - [description]
- * @param {integer} height - [description]
- * @param {object} GetTilesWithinFilteringOptions - Optional filters to apply when getting the tiles.
- * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
- *
- * @return {Phaser.Tilemaps.Tile[]} Array of Tile objects.
+ * @param {number} value - The value to be clamped.
+ * @param {number} min - The minimum bounds.
+ * @param {number} max - The maximum bounds.
+ *
+ * @return {number} The clamped value.
*/
-var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer)
+var Clamp = function (value, min, max)
{
- if (tileX === undefined) { tileX = 0; }
- if (tileY === undefined) { tileY = 0; }
- if (width === undefined) { width = layer.width; }
- if (height === undefined) { height = layer.height; }
-
- var isNotEmpty = GetFastValue(filteringOptions, 'isNotEmpty', false);
- var isColliding = GetFastValue(filteringOptions, 'isColliding', false);
- var hasInterestingFace = GetFastValue(filteringOptions, 'hasInterestingFace', false);
-
- // Clip x, y to top left of map, while shrinking width/height to match.
- if (tileX < 0)
- {
- width += tileX;
- tileX = 0;
- }
- if (tileY < 0)
- {
- height += tileY;
- tileY = 0;
- }
-
- // Clip width and height to bottom right of map.
- if (tileX + width > layer.width)
- {
- width = Math.max(layer.width - tileX, 0);
- }
- if (tileY + height > layer.height)
- {
- height = Math.max(layer.height - tileY, 0);
- }
-
- var results = [];
-
- for (var ty = tileY; ty < tileY + height; ty++)
- {
- for (var tx = tileX; tx < tileX + width; tx++)
- {
- var tile = layer.data[ty][tx];
- if (tile !== null)
- {
- if (isNotEmpty && tile.index === -1) { continue; }
- if (isColliding && !tile.collides) { continue; }
- if (hasInterestingFace && !tile.hasInterestingFace) { continue; }
- results.push(tile);
- }
- }
- }
-
- return results;
+ return Math.max(min, Math.min(max, value));
};
-module.exports = GetTilesWithin;
+module.exports = Clamp;
/***/ }),
-/* 22 */
+/* 24 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -4467,8 +4652,8 @@ module.exports = GetTilesWithin;
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var CONST = __webpack_require__(20);
-var Smoothing = __webpack_require__(131);
+var CONST = __webpack_require__(26);
+var Smoothing = __webpack_require__(120);
// The pool into which the canvas elements are placed.
var pool = [];
@@ -4719,7 +4904,7 @@ module.exports = CanvasPool();
/***/ }),
-/* 23 */
+/* 25 */
/***/ (function(module, exports) {
/**
@@ -4729,27 +4914,64 @@ module.exports = CanvasPool();
*/
/**
- * Force a value within the boundaries by clamping it to the range `min`, `max`.
+ * Takes an array of Game Objects, or any objects that have a public property as defined in `key`,
+ * and then sets it to the given value.
*
- * @function Phaser.Math.Clamp
- * @since 3.0.0
+ * The optional `step` property is applied incrementally, multiplied by each item in the array.
*
- * @param {number} value - The value to be clamped.
- * @param {number} min - The minimum bounds.
- * @param {number} max - The maximum bounds.
+ * To use this with a Group: `PropertyValueSet(group.getChildren(), key, value, step)`
*
- * @return {number} The clamped value.
+ * @function Phaser.Actions.PropertyValueSet
+ * @since 3.3.0
+ *
+ * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return]
+ *
+ * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action.
+ * @param {string} key - The property to be updated.
+ * @param {number} value - The amount to set the property to.
+ * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter.
+ * @param {integer} [index=0] - An optional offset to start searching from within the items array.
+ * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning.
+ *
+ * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action.
*/
-var Clamp = function (value, min, max)
+var PropertyValueSet = function (items, key, value, step, index, direction)
{
- return Math.max(min, Math.min(max, value));
+ if (step === undefined) { step = 0; }
+ if (index === undefined) { index = 0; }
+ if (direction === undefined) { direction = 1; }
+
+ var i;
+ var t = 0;
+ var end = items.length;
+
+ if (direction === 1)
+ {
+ // Start to End
+ for (i = index; i < end; i++)
+ {
+ items[i][key] = value + (t * step);
+ t++;
+ }
+ }
+ else
+ {
+ // End to Start
+ for (i = index; i >= 0; i--)
+ {
+ items[i][key] = value + (t * step);
+ t++;
+ }
+ }
+
+ return items;
};
-module.exports = Clamp;
+module.exports = PropertyValueSet;
/***/ }),
-/* 24 */
+/* 26 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -4758,9 +4980,448 @@ module.exports = Clamp;
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var BlendModes = __webpack_require__(51);
-var GetAdvancedValue = __webpack_require__(10);
-var ScaleModes = __webpack_require__(59);
+/**
+ * Global consts.
+ *
+ * @ignore
+ */
+
+var CONST = {
+
+ /**
+ * Phaser Release Version
+ *
+ * @name Phaser.VERSION
+ * @readonly
+ * @type {string}
+ * @since 3.0.0
+ */
+ VERSION: '3.15.1',
+
+ BlendModes: __webpack_require__(66),
+
+ ScaleModes: __webpack_require__(94),
+
+ /**
+ * AUTO Detect Renderer.
+ *
+ * @name Phaser.AUTO
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ AUTO: 0,
+
+ /**
+ * Canvas Renderer.
+ *
+ * @name Phaser.CANVAS
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ CANVAS: 1,
+
+ /**
+ * WebGL Renderer.
+ *
+ * @name Phaser.WEBGL
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ WEBGL: 2,
+
+ /**
+ * Headless Renderer.
+ *
+ * @name Phaser.HEADLESS
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ HEADLESS: 3,
+
+ /**
+ * In Phaser the value -1 means 'forever' in lots of cases, this const allows you to use it instead
+ * to help you remember what the value is doing in your code.
+ *
+ * @name Phaser.FOREVER
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ FOREVER: -1,
+
+ /**
+ * Direction constant.
+ *
+ * @name Phaser.NONE
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ NONE: 4,
+
+ /**
+ * Direction constant.
+ *
+ * @name Phaser.UP
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ UP: 5,
+
+ /**
+ * Direction constant.
+ *
+ * @name Phaser.DOWN
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ DOWN: 6,
+
+ /**
+ * Direction constant.
+ *
+ * @name Phaser.LEFT
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ LEFT: 7,
+
+ /**
+ * Direction constant.
+ *
+ * @name Phaser.RIGHT
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ RIGHT: 8
+
+};
+
+module.exports = CONST;
+
+
+/***/ }),
+/* 27 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var Components = __webpack_require__(14);
+var GameObject = __webpack_require__(19);
+var Line = __webpack_require__(54);
+
+/**
+ * @classdesc
+ * 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
+ * @memberof Phaser.GameObjects
+ * @constructor
+ * @since 3.13.0
+ *
+ * @extends Phaser.GameObjects.Components.Alpha
+ * @extends Phaser.GameObjects.Components.BlendMode
+ * @extends Phaser.GameObjects.Components.ComputedSize
+ * @extends Phaser.GameObjects.Components.Depth
+ * @extends Phaser.GameObjects.Components.GetBounds
+ * @extends Phaser.GameObjects.Components.Mask
+ * @extends Phaser.GameObjects.Components.Origin
+ * @extends Phaser.GameObjects.Components.Pipeline
+ * @extends Phaser.GameObjects.Components.ScaleMode
+ * @extends Phaser.GameObjects.Components.ScrollFactor
+ * @extends Phaser.GameObjects.Components.Transform
+ * @extends Phaser.GameObjects.Components.Visible
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time.
+ * @param {string} [type] - The internal type of the Shape.
+ * @param {any} [data] - The data of the source shape geometry, if any.
+ */
+var Shape = new Class({
+
+ Extends: GameObject,
+
+ Mixins: [
+ Components.Alpha,
+ Components.BlendMode,
+ Components.ComputedSize,
+ Components.Depth,
+ Components.GetBounds,
+ Components.Mask,
+ Components.Origin,
+ Components.Pipeline,
+ Components.ScaleMode,
+ Components.ScrollFactor,
+ Components.Transform,
+ Components.Visible
+ ],
+
+ initialize:
+
+ function Shape (scene, type, data)
+ {
+ if (type === undefined) { type = 'Shape'; }
+
+ GameObject.call(this, scene, type);
+
+ /**
+ * The source Shape data. Typically a geometry object.
+ * You should not manipulate this directly.
+ *
+ * @name Phaser.GameObjects.Shape#data
+ * @type {any}
+ * @readonly
+ * @since 3.13.0
+ */
+ this.geom = data;
+
+ /**
+ * Holds the polygon path data for filled rendering.
+ *
+ * @name Phaser.GameObjects.Shape#pathData
+ * @type {number[]}
+ * @readonly
+ * @since 3.13.0
+ */
+ this.pathData = [];
+
+ /**
+ * Holds the earcut polygon path index data for filled rendering.
+ *
+ * @name Phaser.GameObjects.Shape#pathIndexes
+ * @type {integer[]}
+ * @readonly
+ * @since 3.13.0
+ */
+ this.pathIndexes = [];
+
+ /**
+ * The fill color used by this Shape.
+ *
+ * @name Phaser.GameObjects.Shape#fillColor
+ * @type {number}
+ * @since 3.13.0
+ */
+ this.fillColor = 0xffffff;
+
+ /**
+ * The fill alpha value used by this Shape.
+ *
+ * @name Phaser.GameObjects.Shape#fillAlpha
+ * @type {number}
+ * @since 3.13.0
+ */
+ this.fillAlpha = 1;
+
+ /**
+ * The stroke color used by this Shape.
+ *
+ * @name Phaser.GameObjects.Shape#strokeColor
+ * @type {number}
+ * @since 3.13.0
+ */
+ this.strokeColor = 0xffffff;
+
+ /**
+ * The stroke alpha value used by this Shape.
+ *
+ * @name Phaser.GameObjects.Shape#strokeAlpha
+ * @type {number}
+ * @since 3.13.0
+ */
+ this.strokeAlpha = 1;
+
+ /**
+ * The stroke line width used by this Shape.
+ *
+ * @name Phaser.GameObjects.Shape#lineWidth
+ * @type {number}
+ * @since 3.13.0
+ */
+ this.lineWidth = 1;
+
+ /**
+ * Controls if this Shape is filled or not.
+ * Note that some Shapes do not support being filled (such as Line shapes)
+ *
+ * @name Phaser.GameObjects.Shape#isFilled
+ * @type {boolean}
+ * @since 3.13.0
+ */
+ this.isFilled = false;
+
+ /**
+ * Controls if this Shape is stroked or not.
+ * Note that some Shapes do not support being stroked (such as Iso Box shapes)
+ *
+ * @name Phaser.GameObjects.Shape#isStroked
+ * @type {boolean}
+ * @since 3.13.0
+ */
+ this.isStroked = false;
+
+ /**
+ * Controls if this Shape path is closed during rendering when stroked.
+ * Note that some Shapes are always closed when stroked (such as Ellipse shapes)
+ *
+ * @name Phaser.GameObjects.Shape#closePath
+ * @type {boolean}
+ * @since 3.13.0
+ */
+ this.closePath = true;
+
+ /**
+ * Private internal value.
+ * A Line used when parsing internal path data to avoid constant object re-creation.
+ *
+ * @name Phaser.GameObjects.Curve#_tempLine
+ * @type {Phaser.Geom.Line}
+ * @private
+ * @since 3.13.0
+ */
+ this._tempLine = new Line();
+
+ this.initPipeline();
+ },
+
+ /**
+ * 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.
+ *
+ * @method Phaser.GameObjects.Shape#setFillStyle
+ * @since 3.13.0
+ *
+ * @param {number} [color] - The color used to fill this shape. If not provided the Shape will not be filled.
+ * @param {number} [alpha=1] - The alpha value used when filling this shape, if a fill color is given.
+ *
+ * @return {this} This Game Object instance.
+ */
+ setFillStyle: function (color, alpha)
+ {
+ if (alpha === undefined) { alpha = 1; }
+
+ if (color === undefined)
+ {
+ this.isFilled = false;
+ }
+ else
+ {
+ this.fillColor = color;
+ this.fillAlpha = alpha;
+ this.isFilled = true;
+ }
+
+ return 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.
+ *
+ * @method Phaser.GameObjects.Shape#setStrokeStyle
+ * @since 3.13.0
+ *
+ * @param {number} [color] - The color used to stroke this shape. If not provided the Shape will not be stroked.
+ * @param {number} [alpha=1] - The alpha value used when stroking this shape, if a stroke color is given.
+ *
+ * @return {this} This Game Object instance.
+ */
+ setStrokeStyle: function (lineWidth, color, alpha)
+ {
+ if (alpha === undefined) { alpha = 1; }
+
+ if (lineWidth === undefined)
+ {
+ this.isStroked = false;
+ }
+ else
+ {
+ this.lineWidth = lineWidth;
+ this.strokeColor = color;
+ this.strokeAlpha = alpha;
+ this.isStroked = true;
+ }
+
+ return 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.
+ *
+ * @method Phaser.GameObjects.Shape#setClosePath
+ * @since 3.13.0
+ *
+ * @param {boolean} value - Set to `true` if the Shape should be closed when stroked, otherwise `false`.
+ *
+ * @return {this} This Game Object instance.
+ */
+ setClosePath: function (value)
+ {
+ this.closePath = value;
+
+ return this;
+ },
+
+ /**
+ * Internal destroy handler, called as part of the destroy process.
+ *
+ * @method Phaser.GameObjects.Shape#preDestroy
+ * @protected
+ * @since 3.13.0
+ */
+ preDestroy: function ()
+ {
+ this.geom = null;
+ this._tempLine = null;
+ this.pathData = [];
+ this.pathIndexes = [];
+ }
+
+});
+
+module.exports = Shape;
+
+
+/***/ }),
+/* 28 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var BlendModes = __webpack_require__(66);
+var GetAdvancedValue = __webpack_require__(12);
+var ScaleModes = __webpack_require__(94);
/**
* @typedef {object} GameObjectConfig
@@ -4902,74 +5563,7 @@ module.exports = BuildGameObject;
/***/ }),
-/* 25 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Takes an array of Game Objects, or any objects that have a public property as defined in `key`,
- * and then sets it to the given value.
- *
- * The optional `step` property is applied incrementally, multiplied by each item in the array.
- *
- * To use this with a Group: `PropertyValueSet(group.getChildren(), key, value, step)`
- *
- * @function Phaser.Actions.PropertyValueSet
- * @since 3.3.0
- *
- * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return]
- *
- * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action.
- * @param {string} key - The property to be updated.
- * @param {number} value - The amount to set the property to.
- * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter.
- * @param {integer} [index=0] - An optional offset to start searching from within the items array.
- * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning.
- *
- * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action.
- */
-var PropertyValueSet = function (items, key, value, step, index, direction)
-{
- if (step === undefined) { step = 0; }
- if (index === undefined) { index = 0; }
- if (direction === undefined) { direction = 1; }
-
- var i;
- var t = 0;
- var end = items.length;
-
- if (direction === 1)
- {
- // Start to End
- for (i = index; i < end; i++)
- {
- items[i][key] = value + (t * step);
- t++;
- }
- }
- else
- {
- // End to Start
- for (i = index; i >= 0; i--)
- {
- items[i][key] = value + (t * step);
- t++;
- }
- }
-
- return items;
-};
-
-module.exports = PropertyValueSet;
-
-
-/***/ }),
-/* 26 */
+/* 29 */
/***/ (function(module, exports) {
/**
@@ -5024,142 +5618,2563 @@ module.exports = {
/***/ }),
-/* 27 */
+/* 30 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @author Felipe Alfonso <@bitnenfer>
* @copyright 2018 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
- * @namespace Phaser.Renderer.WebGL.Utils
- * @since 3.0.0
+ * Sets the fillStyle on the target context based on the given Shape.
+ *
+ * @method Phaser.GameObjects.Shape#FillStyleCanvas
+ * @since 3.13.0
+ * @private
+ *
+ * @param {CanvasRenderingContext2D} ctx - The context to set the fill style on.
+ * @param {Phaser.GameObjects.Shape} src - The Game Object to set the fill style from.
*/
-module.exports = {
+var FillStyleCanvas = function (ctx, src, altColor)
+{
+ var fillColor = (altColor) ? altColor : src.fillColor;
+ var fillAlpha = src.fillAlpha;
- /**
- * Packs four floats on a range from 0.0 to 1.0 into a single Uint32
- *
- * @function Phaser.Renderer.WebGL.Utils.getTintFromFloats
- * @since 3.0.0
- *
- * @param {number} r - Red component in a range from 0.0 to 1.0
- * @param {number} g - [description]
- * @param {number} b - [description]
- * @param {number} a - Alpha component in a range from 0.0 to 1.0
- *
- * @return {number} [description]
- */
- getTintFromFloats: function (r, g, b, a)
- {
- var ur = ((r * 255.0)|0) & 0xFF;
- var ug = ((g * 255.0)|0) & 0xFF;
- var ub = ((b * 255.0)|0) & 0xFF;
- var ua = ((a * 255.0)|0) & 0xFF;
-
- return ((ua << 24) | (ur << 16) | (ug << 8) | ub) >>> 0;
- },
-
- /**
- * Packs a Uint24, representing RGB components, with a Float32, representing
- * the alpha component, with a range between 0.0 and 1.0 and return a Uint32
- *
- * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha
- * @since 3.0.0
- *
- * @param {number} rgb - Uint24 representing RGB components
- * @param {number} a - Float32 representing Alpha component
- *
- * @return {number} Packed RGBA as Uint32
- */
- getTintAppendFloatAlpha: function (rgb, a)
- {
- var ua = ((a * 255.0)|0) & 0xFF;
- return ((ua << 24) | rgb) >>> 0;
- },
-
- /**
- * Packs a Uint24, representing RGB components, with a Float32, representing
- * the alpha component, with a range between 0.0 and 1.0 and return a
- * swizzled Uint32
- *
- * @function Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlphaAndSwap
- * @since 3.0.0
- *
- * @param {number} rgb - Uint24 representing RGB components
- * @param {number} a - Float32 representing Alpha component
- *
- * @return {number} Packed RGBA as Uint32
- */
- getTintAppendFloatAlphaAndSwap: function (rgb, a)
- {
- var ur = ((rgb >> 16)|0) & 0xff;
- var ug = ((rgb >> 8)|0) & 0xff;
- var ub = (rgb|0) & 0xff;
- var ua = ((a * 255.0)|0) & 0xFF;
-
- return ((ua << 24) | (ub << 16) | (ug << 8) | ur) >>> 0;
- },
-
- /**
- * Unpacks a Uint24 RGB into an array of floats of ranges of 0.0 and 1.0
- *
- * @function Phaser.Renderer.WebGL.Utils.getFloatsFromUintRGB
- * @since 3.0.0
- *
- * @param {number} rgb - RGB packed as a Uint24
- *
- * @return {array} Array of floats representing each component as a float
- */
- getFloatsFromUintRGB: function (rgb)
- {
- var ur = ((rgb >> 16)|0) & 0xff;
- var ug = ((rgb >> 8)|0) & 0xff;
- var ub = (rgb|0) & 0xff;
-
- return [ ur / 255.0, ug / 255.0, ub / 255.0 ];
- },
-
- /**
- * Counts how many attributes of 32 bits a vertex has
- *
- * @function Phaser.Renderer.WebGL.Utils.getComponentCount
- * @since 3.0.0
- *
- * @param {array} attributes - Array of attributes
- * @param {WebGLRenderingContext} glContext - WebGLContext used for check types
- *
- * @return {number} Count of 32 bit attributes in vertex
- */
- getComponentCount: function (attributes, glContext)
- {
- var count = 0;
-
- for (var index = 0; index < attributes.length; ++index)
- {
- var element = attributes[index];
-
- if (element.type === glContext.FLOAT)
- {
- count += element.size;
- }
- else
- {
- count += 1; // We'll force any other type to be 32 bit. for now
- }
- }
-
- return count;
- }
+ var red = ((fillColor & 0xFF0000) >>> 16);
+ var green = ((fillColor & 0xFF00) >>> 8);
+ var blue = (fillColor & 0xFF);
+ ctx.fillStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + fillAlpha + ')';
};
+module.exports = FillStyleCanvas;
+
/***/ }),
-/* 28 */
+/* 31 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var CONST = __webpack_require__(16);
+
+/**
+ * Convert the given angle from degrees, to the equivalent angle in radians.
+ *
+ * @function Phaser.Math.DegToRad
+ * @since 3.0.0
+ *
+ * @param {integer} degrees - The angle (in degrees) to convert to radians.
+ *
+ * @return {number} The given angle converted to radians.
+ */
+var DegToRad = function (degrees)
+{
+ return degrees * CONST.DEG_TO_RAD;
+};
+
+module.exports = DegToRad;
+
+
+/***/ }),
+/* 32 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Takes an array of Game Objects, or any objects that have a public property as defined in `key`,
+ * and then adds the given value to it.
+ *
+ * The optional `step` property is applied incrementally, multiplied by each item in the array.
+ *
+ * To use this with a Group: `PropertyValueInc(group.getChildren(), key, value, step)`
+ *
+ * @function Phaser.Actions.PropertyValueInc
+ * @since 3.3.0
+ *
+ * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return]
+ *
+ * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action.
+ * @param {string} key - The property to be updated.
+ * @param {number} value - The amount to be added to the property.
+ * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter.
+ * @param {integer} [index=0] - An optional offset to start searching from within the items array.
+ * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning.
+ *
+ * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action.
+ */
+var PropertyValueInc = function (items, key, value, step, index, direction)
+{
+ if (step === undefined) { step = 0; }
+ if (index === undefined) { index = 0; }
+ if (direction === undefined) { direction = 1; }
+
+ var i;
+ var t = 0;
+ var end = items.length;
+
+ if (direction === 1)
+ {
+ // Start to End
+ for (i = index; i < end; i++)
+ {
+ items[i][key] += value + (t * step);
+ t++;
+ }
+ }
+ else
+ {
+ // End to Start
+ for (i = index; i >= 0; i--)
+ {
+ items[i][key] += value + (t * step);
+ t++;
+ }
+ }
+
+ return items;
+};
+
+module.exports = PropertyValueInc;
+
+
+/***/ }),
+/* 33 */,
+/* 34 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var GetTileAt = __webpack_require__(102);
+var GetTilesWithin = __webpack_require__(17);
+
+/**
+ * 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.
+ *
+ * @function Phaser.Tilemaps.Components.CalculateFacesWithin
+ * @private
+ * @since 3.0.0
+ *
+ * @param {integer} tileX - The left most tile index (in tile coordinates) to use as the origin of the area.
+ * @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area.
+ * @param {integer} width - How many tiles wide from the `tileX` index the area will be.
+ * @param {integer} height - How many tiles tall from the `tileY` index the area will be.
+ * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
+ */
+var CalculateFacesWithin = function (tileX, tileY, width, height, layer)
+{
+ var above = null;
+ var below = null;
+ var left = null;
+ var right = null;
+
+ var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer);
+
+ for (var i = 0; i < tiles.length; i++)
+ {
+ var tile = tiles[i];
+
+ if (tile)
+ {
+ if (tile.collides)
+ {
+ above = GetTileAt(tile.x, tile.y - 1, true, layer);
+ below = GetTileAt(tile.x, tile.y + 1, true, layer);
+ left = GetTileAt(tile.x - 1, tile.y, true, layer);
+ right = GetTileAt(tile.x + 1, tile.y, true, layer);
+
+ tile.faceTop = (above && above.collides) ? false : true;
+ tile.faceBottom = (below && below.collides) ? false : true;
+ tile.faceLeft = (left && left.collides) ? false : true;
+ tile.faceRight = (right && right.collides) ? false : true;
+ }
+ else
+ {
+ tile.resetFaces();
+ }
+ }
+ }
+};
+
+module.exports = CalculateFacesWithin;
+
+
+/***/ }),
+/* 35 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Arcade Physics consts.
+ *
+ * @ignore
+ */
+
+var CONST = {
+
+ /**
+ * Dynamic Body.
+ *
+ * @name Phaser.Physics.Arcade.DYNAMIC_BODY
+ * @readonly
+ * @type {number}
+ * @since 3.0.0
+ *
+ * @see Phaser.Physics.Arcade.Body#physicsType
+ * @see Phaser.Physics.Arcade.Group#physicsType
+ */
+ DYNAMIC_BODY: 0,
+
+ /**
+ * Static Body.
+ *
+ * @name Phaser.Physics.Arcade.STATIC_BODY
+ * @readonly
+ * @type {number}
+ * @since 3.0.0
+ *
+ * @see Phaser.Physics.Arcade.Body#physicsType
+ * @see Phaser.Physics.Arcade.StaticBody#physicsType
+ */
+ STATIC_BODY: 1,
+
+ /**
+ * [description]
+ *
+ * @name Phaser.Physics.Arcade.GROUP
+ * @readonly
+ * @type {number}
+ * @since 3.0.0
+ */
+ GROUP: 2,
+
+ /**
+ * [description]
+ *
+ * @name Phaser.Physics.Arcade.TILEMAPLAYER
+ * @readonly
+ * @type {number}
+ * @since 3.0.0
+ */
+ TILEMAPLAYER: 3,
+
+ /**
+ * Facing no direction (initial value).
+ *
+ * @name Phaser.Physics.Arcade.FACING_NONE
+ * @readonly
+ * @type {number}
+ * @since 3.0.0
+ *
+ * @see Phaser.Physics.Arcade.Body#facing
+ */
+ FACING_NONE: 10,
+
+ /**
+ * Facing up.
+ *
+ * @name Phaser.Physics.Arcade.FACING_UP
+ * @readonly
+ * @type {number}
+ * @since 3.0.0
+ *
+ * @see Phaser.Physics.Arcade.Body#facing
+ */
+ FACING_UP: 11,
+
+ /**
+ * Facing down.
+ *
+ * @name Phaser.Physics.Arcade.FACING_DOWN
+ * @readonly
+ * @type {number}
+ * @since 3.0.0
+ *
+ * @see Phaser.Physics.Arcade.Body#facing
+ */
+ FACING_DOWN: 12,
+
+ /**
+ * Facing left.
+ *
+ * @name Phaser.Physics.Arcade.FACING_LEFT
+ * @readonly
+ * @type {number}
+ * @since 3.0.0
+ *
+ * @see Phaser.Physics.Arcade.Body#facing
+ */
+ FACING_LEFT: 13,
+
+ /**
+ * Facing right.
+ *
+ * @name Phaser.Physics.Arcade.FACING_RIGHT
+ * @readonly
+ * @type {number}
+ * @since 3.0.0
+ *
+ * @see Phaser.Physics.Arcade.Body#facing
+ */
+ FACING_RIGHT: 14
+
+};
+
+module.exports = CONST;
+
+
+/***/ }),
+/* 36 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Sets the strokeStyle and lineWidth on the target context based on the given Shape.
+ *
+ * @method Phaser.GameObjects.Shape#LineStyleCanvas
+ * @since 3.13.0
+ * @private
+ *
+ * @param {CanvasRenderingContext2D} ctx - The context to set the stroke style on.
+ * @param {Phaser.GameObjects.Shape} src - The Game Object to set the stroke style from.
+ */
+var LineStyleCanvas = function (ctx, src)
+{
+ var strokeColor = src.strokeColor;
+ var strokeAlpha = src.strokeAlpha;
+
+ var red = ((strokeColor & 0xFF0000) >>> 16);
+ var green = ((strokeColor & 0xFF00) >>> 8);
+ var blue = (strokeColor & 0xFF);
+
+ ctx.strokeStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + strokeAlpha + ')';
+ ctx.lineWidth = src.lineWidth;
+};
+
+module.exports = LineStyleCanvas;
+
+
+/***/ }),
+/* 37 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var GetColor = __webpack_require__(177);
+var GetColor32 = __webpack_require__(376);
+var HSVToRGB = __webpack_require__(176);
+var RGBToHSV = __webpack_require__(375);
+
+/**
+ * @classdesc
+ * The Color class holds a single color value and allows for easy modification and reading of it.
+ *
+ * @class Color
+ * @memberof Phaser.Display
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {integer} [red=0] - The red color value. A number between 0 and 255.
+ * @param {integer} [green=0] - The green color value. A number between 0 and 255.
+ * @param {integer} [blue=0] - The blue color value. A number between 0 and 255.
+ * @param {integer} [alpha=255] - The alpha value. A number between 0 and 255.
+ */
+var Color = new Class({
+
+ initialize:
+
+ function Color (red, green, blue, alpha)
+ {
+ if (red === undefined) { red = 0; }
+ if (green === undefined) { green = 0; }
+ if (blue === undefined) { blue = 0; }
+ if (alpha === undefined) { alpha = 255; }
+
+ /**
+ * The internal red color value.
+ *
+ * @name Phaser.Display.Color#r
+ * @type {number}
+ * @private
+ * @default 0
+ * @since 3.0.0
+ */
+ this.r = 0;
+
+ /**
+ * The internal green color value.
+ *
+ * @name Phaser.Display.Color#g
+ * @type {number}
+ * @private
+ * @default 0
+ * @since 3.0.0
+ */
+ this.g = 0;
+
+ /**
+ * The internal blue color value.
+ *
+ * @name Phaser.Display.Color#b
+ * @type {number}
+ * @private
+ * @default 0
+ * @since 3.0.0
+ */
+ this.b = 0;
+
+ /**
+ * The internal alpha color value.
+ *
+ * @name Phaser.Display.Color#a
+ * @type {number}
+ * @private
+ * @default 255
+ * @since 3.0.0
+ */
+ this.a = 255;
+
+ /**
+ * The hue color value. A number between 0 and 1.
+ * This is the base color.
+ *
+ * @name Phaser.Display.Color#_h
+ * @type {number}
+ * @default 0
+ * @private
+ * @since 3.13.0
+ */
+ this._h = 0;
+
+ /**
+ * The saturation color value. A number between 0 and 1.
+ * This controls how much of the hue will be in the final color, where 1 is fully saturated and 0 will give you white.
+ *
+ * @name Phaser.Display.Color#_s
+ * @type {number}
+ * @default 0
+ * @private
+ * @since 3.13.0
+ */
+ this._s = 0;
+
+ /**
+ * The lightness color value. A number between 0 and 1.
+ * This controls how dark the color is. Where 1 is as bright as possible and 0 is black.
+ *
+ * @name Phaser.Display.Color#_v
+ * @type {number}
+ * @default 0
+ * @private
+ * @since 3.13.0
+ */
+ this._v = 0;
+
+ /**
+ * Is this color update locked?
+ *
+ * @name Phaser.Display.Color#_locked
+ * @type {boolean}
+ * @private
+ * @since 3.13.0
+ */
+ this._locked = false;
+
+ /**
+ * An array containing the calculated color values for WebGL use.
+ *
+ * @name Phaser.Display.Color#gl
+ * @type {number[]}
+ * @since 3.0.0
+ */
+ this.gl = [ 0, 0, 0, 1 ];
+
+ /**
+ * Pre-calculated internal color value.
+ *
+ * @name Phaser.Display.Color#_color
+ * @type {number}
+ * @private
+ * @default 0
+ * @since 3.0.0
+ */
+ this._color = 0;
+
+ /**
+ * Pre-calculated internal color32 value.
+ *
+ * @name Phaser.Display.Color#_color32
+ * @type {number}
+ * @private
+ * @default 0
+ * @since 3.0.0
+ */
+ this._color32 = 0;
+
+ /**
+ * Pre-calculated internal color rgb string value.
+ *
+ * @name Phaser.Display.Color#_rgba
+ * @type {string}
+ * @private
+ * @default ''
+ * @since 3.0.0
+ */
+ this._rgba = '';
+
+ this.setTo(red, green, blue, alpha);
+ },
+
+ /**
+ * Sets this color to be transparent. Sets all values to zero.
+ *
+ * @method Phaser.Display.Color#transparent
+ * @since 3.0.0
+ *
+ * @return {Phaser.Display.Color} This Color object.
+ */
+ transparent: function ()
+ {
+ this._locked = true;
+
+ this.red = 0;
+ this.green = 0;
+ this.blue = 0;
+ this.alpha = 0;
+
+ this._locked = false;
+
+ return this.update(true);
+ },
+
+ /**
+ * Sets the color of this Color component.
+ *
+ * @method Phaser.Display.Color#setTo
+ * @since 3.0.0
+ *
+ * @param {integer} red - The red color value. A number between 0 and 255.
+ * @param {integer} green - The green color value. A number between 0 and 255.
+ * @param {integer} blue - The blue color value. A number between 0 and 255.
+ * @param {integer} [alpha=255] - The alpha value. A number between 0 and 255.
+ * @param {boolean} [updateHSV=true] - Update the HSV values after setting the RGB values?
+ *
+ * @return {Phaser.Display.Color} This Color object.
+ */
+ setTo: function (red, green, blue, alpha, updateHSV)
+ {
+ if (alpha === undefined) { alpha = 255; }
+ if (updateHSV === undefined) { updateHSV = true; }
+
+ this._locked = true;
+
+ this.red = red;
+ this.green = green;
+ this.blue = blue;
+ this.alpha = alpha;
+
+ this._locked = false;
+
+ return this.update(updateHSV);
+ },
+
+ /**
+ * Sets the red, green, blue and alpha GL values of this Color component.
+ *
+ * @method Phaser.Display.Color#setGLTo
+ * @since 3.0.0
+ *
+ * @param {number} red - The red color value. A number between 0 and 1.
+ * @param {number} green - The green color value. A number between 0 and 1.
+ * @param {number} blue - The blue color value. A number between 0 and 1.
+ * @param {number} [alpha=1] - The alpha value. A number between 0 and 1.
+ *
+ * @return {Phaser.Display.Color} This Color object.
+ */
+ setGLTo: function (red, green, blue, alpha)
+ {
+ if (alpha === undefined) { alpha = 1; }
+
+ this._locked = true;
+
+ this.redGL = red;
+ this.greenGL = green;
+ this.blueGL = blue;
+ this.alphaGL = alpha;
+
+ this._locked = false;
+
+ return this.update(true);
+ },
+
+ /**
+ * Sets the color based on the color object given.
+ *
+ * @method Phaser.Display.Color#setFromRGB
+ * @since 3.0.0
+ *
+ * @param {InputColorObject} color - An object containing `r`, `g`, `b` and optionally `a` values in the range 0 to 255.
+ *
+ * @return {Phaser.Display.Color} This Color object.
+ */
+ setFromRGB: function (color)
+ {
+ this._locked = true;
+
+ this.red = color.r;
+ this.green = color.g;
+ this.blue = color.b;
+
+ if (color.hasOwnProperty('a'))
+ {
+ this.alpha = color.a;
+ }
+
+ this._locked = false;
+
+ return this.update(true);
+ },
+
+ /**
+ * Sets the color based on the hue, saturation and lightness values given.
+ *
+ * @method Phaser.Display.Color#setFromHSV
+ * @since 3.13.0
+ *
+ * @param {number} h - The hue, in the range 0 - 1. This is the base color.
+ * @param {number} s - The saturation, in the range 0 - 1. This controls how much of the hue will be in the final color, where 1 is fully saturated and 0 will give you white.
+ * @param {number} v - The value, in the range 0 - 1. This controls how dark the color is. Where 1 is as bright as possible and 0 is black.
+ *
+ * @return {Phaser.Display.Color} This Color object.
+ */
+ setFromHSV: function (h, s, v)
+ {
+ return HSVToRGB(h, s, v, this);
+ },
+
+ /**
+ * Updates the internal cache values.
+ *
+ * @method Phaser.Display.Color#update
+ * @private
+ * @since 3.0.0
+ *
+ * @return {Phaser.Display.Color} This Color object.
+ */
+ update: function (updateHSV)
+ {
+ if (updateHSV === undefined) { updateHSV = false; }
+
+ if (this._locked)
+ {
+ return this;
+ }
+
+ var r = this.r;
+ var g = this.g;
+ var b = this.b;
+ var a = this.a;
+
+ this._color = GetColor(r, g, b);
+ this._color32 = GetColor32(r, g, b, a);
+ this._rgba = 'rgba(' + r + ',' + g + ',' + b + ',' + (a / 255) + ')';
+
+ if (updateHSV)
+ {
+ RGBToHSV(r, g, b, this);
+ }
+
+ return this;
+ },
+
+ /**
+ * Updates the internal hsv cache values.
+ *
+ * @method Phaser.Display.Color#updateHSV
+ * @private
+ * @since 3.13.0
+ *
+ * @return {Phaser.Display.Color} This Color object.
+ */
+ updateHSV: function ()
+ {
+ var r = this.r;
+ var g = this.g;
+ var b = this.b;
+
+ RGBToHSV(r, g, b, this);
+
+ return this;
+ },
+
+ /**
+ * Returns a new Color component using the values from this one.
+ *
+ * @method Phaser.Display.Color#clone
+ * @since 3.0.0
+ *
+ * @return {Phaser.Display.Color} A new Color object.
+ */
+ clone: function ()
+ {
+ return new Color(this.r, this.g, this.b, this.a);
+ },
+
+ /**
+ * Sets this Color object to be grayscaled based on the shade value given.
+ *
+ * @method Phaser.Display.Color#gray
+ * @since 3.13.0
+ *
+ * @param {integer} shade - A value between 0 and 255.
+ *
+ * @return {Phaser.Display.Color} This Color object.
+ */
+ gray: function (shade)
+ {
+ return this.setTo(shade, shade, shade);
+ },
+
+ /**
+ * Sets this Color object to be a random color between the `min` and `max` values given.
+ *
+ * @method Phaser.Display.Color#random
+ * @since 3.13.0
+ *
+ * @param {integer} [min=0] - The minimum random color value. Between 0 and 255.
+ * @param {integer} [max=255] - The maximum random color value. Between 0 and 255.
+ *
+ * @return {Phaser.Display.Color} This Color object.
+ */
+ random: function (min, max)
+ {
+ if (min === undefined) { min = 0; }
+ if (max === undefined) { max = 255; }
+
+ var r = Math.floor(min + Math.random() * (max - min));
+ var g = Math.floor(min + Math.random() * (max - min));
+ var b = Math.floor(min + Math.random() * (max - min));
+
+ return this.setTo(r, g, b);
+ },
+
+ /**
+ * Sets this Color object to be a random grayscale color between the `min` and `max` values given.
+ *
+ * @method Phaser.Display.Color#randomGray
+ * @since 3.13.0
+ *
+ * @param {integer} [min=0] - The minimum random color value. Between 0 and 255.
+ * @param {integer} [max=255] - The maximum random color value. Between 0 and 255.
+ *
+ * @return {Phaser.Display.Color} This Color object.
+ */
+ randomGray: function (min, max)
+ {
+ if (min === undefined) { min = 0; }
+ if (max === undefined) { max = 255; }
+
+ var s = Math.floor(min + Math.random() * (max - min));
+
+ return this.setTo(s, s, s);
+ },
+
+ /**
+ * Increase the saturation of this Color by the percentage amount given.
+ * The saturation is the amount of the base color in the hue.
+ *
+ * @method Phaser.Display.Color#saturate
+ * @since 3.13.0
+ *
+ * @param {integer} amount - The percentage amount to change this color by. A value between 0 and 100.
+ *
+ * @return {Phaser.Display.Color} This Color object.
+ */
+ saturate: function (amount)
+ {
+ this.s += amount / 100;
+
+ return this;
+ },
+
+ /**
+ * Decrease the saturation of this Color by the percentage amount given.
+ * The saturation is the amount of the base color in the hue.
+ *
+ * @method Phaser.Display.Color#desaturate
+ * @since 3.13.0
+ *
+ * @param {integer} amount - The percentage amount to change this color by. A value between 0 and 100.
+ *
+ * @return {Phaser.Display.Color} This Color object.
+ */
+ desaturate: function (amount)
+ {
+ this.s -= amount / 100;
+
+ return this;
+ },
+
+ /**
+ * Increase the lightness of this Color by the percentage amount given.
+ *
+ * @method Phaser.Display.Color#lighten
+ * @since 3.13.0
+ *
+ * @param {integer} amount - The percentage amount to change this color by. A value between 0 and 100.
+ *
+ * @return {Phaser.Display.Color} This Color object.
+ */
+ lighten: function (amount)
+ {
+ this.v += amount / 100;
+
+ return this;
+ },
+
+ /**
+ * Decrease the lightness of this Color by the percentage amount given.
+ *
+ * @method Phaser.Display.Color#darken
+ * @since 3.13.0
+ *
+ * @param {integer} amount - The percentage amount to change this color by. A value between 0 and 100.
+ *
+ * @return {Phaser.Display.Color} This Color object.
+ */
+ darken: function (amount)
+ {
+ this.v -= amount / 100;
+
+ return this;
+ },
+
+ /**
+ * Brighten this Color by the percentage amount given.
+ *
+ * @method Phaser.Display.Color#brighten
+ * @since 3.13.0
+ *
+ * @param {integer} amount - The percentage amount to change this color by. A value between 0 and 100.
+ *
+ * @return {Phaser.Display.Color} This Color object.
+ */
+ brighten: function (amount)
+ {
+ var r = this.r;
+ var g = this.g;
+ var b = this.b;
+
+ r = Math.max(0, Math.min(255, r - Math.round(255 * - (amount / 100))));
+ g = Math.max(0, Math.min(255, g - Math.round(255 * - (amount / 100))));
+ b = Math.max(0, Math.min(255, b - Math.round(255 * - (amount / 100))));
+
+ return this.setTo(r, g, b);
+ },
+
+ /**
+ * The color of this Color component, not including the alpha channel.
+ *
+ * @name Phaser.Display.Color#color
+ * @type {number}
+ * @readonly
+ * @since 3.0.0
+ */
+ color: {
+
+ get: function ()
+ {
+ return this._color;
+ }
+
+ },
+
+ /**
+ * The color of this Color component, including the alpha channel.
+ *
+ * @name Phaser.Display.Color#color32
+ * @type {number}
+ * @readonly
+ * @since 3.0.0
+ */
+ color32: {
+
+ get: function ()
+ {
+ return this._color32;
+ }
+
+ },
+
+ /**
+ * The color of this Color component as a string which can be used in CSS color values.
+ *
+ * @name Phaser.Display.Color#rgba
+ * @type {string}
+ * @readonly
+ * @since 3.0.0
+ */
+ rgba: {
+
+ get: function ()
+ {
+ return this._rgba;
+ }
+
+ },
+
+ /**
+ * The red color value, normalized to the range 0 to 1.
+ *
+ * @name Phaser.Display.Color#redGL
+ * @type {number}
+ * @since 3.0.0
+ */
+ redGL: {
+
+ get: function ()
+ {
+ return this.gl[0];
+ },
+
+ set: function (value)
+ {
+ this.gl[0] = Math.min(Math.abs(value), 1);
+
+ this.r = Math.floor(this.gl[0] * 255);
+
+ this.update(true);
+ }
+
+ },
+
+ /**
+ * The green color value, normalized to the range 0 to 1.
+ *
+ * @name Phaser.Display.Color#greenGL
+ * @type {number}
+ * @since 3.0.0
+ */
+ greenGL: {
+
+ get: function ()
+ {
+ return this.gl[1];
+ },
+
+ set: function (value)
+ {
+ this.gl[1] = Math.min(Math.abs(value), 1);
+
+ this.g = Math.floor(this.gl[1] * 255);
+
+ this.update(true);
+ }
+
+ },
+
+ /**
+ * The blue color value, normalized to the range 0 to 1.
+ *
+ * @name Phaser.Display.Color#blueGL
+ * @type {number}
+ * @since 3.0.0
+ */
+ blueGL: {
+
+ get: function ()
+ {
+ return this.gl[2];
+ },
+
+ set: function (value)
+ {
+ this.gl[2] = Math.min(Math.abs(value), 1);
+
+ this.b = Math.floor(this.gl[2] * 255);
+
+ this.update(true);
+ }
+
+ },
+
+ /**
+ * The alpha color value, normalized to the range 0 to 1.
+ *
+ * @name Phaser.Display.Color#alphaGL
+ * @type {number}
+ * @since 3.0.0
+ */
+ alphaGL: {
+
+ get: function ()
+ {
+ return this.gl[3];
+ },
+
+ set: function (value)
+ {
+ this.gl[3] = Math.min(Math.abs(value), 1);
+
+ this.a = Math.floor(this.gl[3] * 255);
+
+ this.update();
+ }
+
+ },
+
+ /**
+ * The red color value, normalized to the range 0 to 255.
+ *
+ * @name Phaser.Display.Color#red
+ * @type {number}
+ * @since 3.0.0
+ */
+ red: {
+
+ get: function ()
+ {
+ return this.r;
+ },
+
+ set: function (value)
+ {
+ value = Math.floor(Math.abs(value));
+
+ this.r = Math.min(value, 255);
+
+ this.gl[0] = value / 255;
+
+ this.update(true);
+ }
+
+ },
+
+ /**
+ * The green color value, normalized to the range 0 to 255.
+ *
+ * @name Phaser.Display.Color#green
+ * @type {number}
+ * @since 3.0.0
+ */
+ green: {
+
+ get: function ()
+ {
+ return this.g;
+ },
+
+ set: function (value)
+ {
+ value = Math.floor(Math.abs(value));
+
+ this.g = Math.min(value, 255);
+
+ this.gl[1] = value / 255;
+
+ this.update(true);
+ }
+
+ },
+
+ /**
+ * The blue color value, normalized to the range 0 to 255.
+ *
+ * @name Phaser.Display.Color#blue
+ * @type {number}
+ * @since 3.0.0
+ */
+ blue: {
+
+ get: function ()
+ {
+ return this.b;
+ },
+
+ set: function (value)
+ {
+ value = Math.floor(Math.abs(value));
+
+ this.b = Math.min(value, 255);
+
+ this.gl[2] = value / 255;
+
+ this.update(true);
+ }
+
+ },
+
+ /**
+ * The alpha color value, normalized to the range 0 to 255.
+ *
+ * @name Phaser.Display.Color#alpha
+ * @type {number}
+ * @since 3.0.0
+ */
+ alpha: {
+
+ get: function ()
+ {
+ return this.a;
+ },
+
+ set: function (value)
+ {
+ value = Math.floor(Math.abs(value));
+
+ this.a = Math.min(value, 255);
+
+ this.gl[3] = value / 255;
+
+ this.update();
+ }
+
+ },
+
+ /**
+ * The hue color value. A number between 0 and 1.
+ * This is the base color.
+ *
+ * @name Phaser.Display.Color#h
+ * @type {number}
+ * @since 3.13.0
+ */
+ h: {
+
+ get: function ()
+ {
+ return this._h;
+ },
+
+ set: function (value)
+ {
+ this._h = value;
+
+ HSVToRGB(value, this._s, this._v, this);
+ }
+
+ },
+
+ /**
+ * The saturation color value. A number between 0 and 1.
+ * This controls how much of the hue will be in the final color, where 1 is fully saturated and 0 will give you white.
+ *
+ * @name Phaser.Display.Color#s
+ * @type {number}
+ * @since 3.13.0
+ */
+ s: {
+
+ get: function ()
+ {
+ return this._s;
+ },
+
+ set: function (value)
+ {
+ this._s = value;
+
+ HSVToRGB(this._h, value, this._v, this);
+ }
+
+ },
+
+ /**
+ * The lightness color value. A number between 0 and 1.
+ * This controls how dark the color is. Where 1 is as bright as possible and 0 is black.
+ *
+ * @name Phaser.Display.Color#v
+ * @type {number}
+ * @since 3.13.0
+ */
+ v: {
+
+ get: function ()
+ {
+ return this._v;
+ },
+
+ set: function (value)
+ {
+ this._v = value;
+
+ HSVToRGB(this._h, this._s, value, this);
+ }
+
+ }
+
+});
+
+module.exports = Color;
+
+
+/***/ }),
+/* 38 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var Vector2 = __webpack_require__(3);
+
+/**
+ * @classdesc
+ * A Matrix used for display transformations for rendering.
+ *
+ * It is represented like so:
+ *
+ * ```
+ * | a | c | tx |
+ * | b | d | ty |
+ * | 0 | 0 | 1 |
+ * ```
+ *
+ * @class TransformMatrix
+ * @memberof Phaser.GameObjects.Components
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {number} [a=1] - The Scale X value.
+ * @param {number} [b=0] - The Shear Y value.
+ * @param {number} [c=0] - The Shear X value.
+ * @param {number} [d=1] - The Scale Y value.
+ * @param {number} [tx=0] - The Translate X value.
+ * @param {number} [ty=0] - The Translate Y value.
+ */
+var TransformMatrix = new Class({
+
+ initialize:
+
+ function TransformMatrix (a, b, c, d, tx, ty)
+ {
+ if (a === undefined) { a = 1; }
+ if (b === undefined) { b = 0; }
+ if (c === undefined) { c = 0; }
+ if (d === undefined) { d = 1; }
+ if (tx === undefined) { tx = 0; }
+ if (ty === undefined) { ty = 0; }
+
+ /**
+ * The matrix values.
+ *
+ * @name Phaser.GameObjects.Components.TransformMatrix#matrix
+ * @type {Float32Array}
+ * @since 3.0.0
+ */
+ this.matrix = new Float32Array([ a, b, c, d, tx, ty, 0, 0, 1 ]);
+
+ /**
+ * The decomposed matrix.
+ *
+ * @name Phaser.GameObjects.Components.TransformMatrix#decomposedMatrix
+ * @type {object}
+ * @since 3.0.0
+ */
+ this.decomposedMatrix = {
+ translateX: 0,
+ translateY: 0,
+ scaleX: 1,
+ scaleY: 1,
+ rotation: 0
+ };
+ },
+
+ /**
+ * The Scale X value.
+ *
+ * @name Phaser.GameObjects.Components.TransformMatrix#a
+ * @type {number}
+ * @since 3.4.0
+ */
+ a: {
+
+ get: function ()
+ {
+ return this.matrix[0];
+ },
+
+ set: function (value)
+ {
+ this.matrix[0] = value;
+ }
+
+ },
+
+ /**
+ * The Shear Y value.
+ *
+ * @name Phaser.GameObjects.Components.TransformMatrix#b
+ * @type {number}
+ * @since 3.4.0
+ */
+ b: {
+
+ get: function ()
+ {
+ return this.matrix[1];
+ },
+
+ set: function (value)
+ {
+ this.matrix[1] = value;
+ }
+
+ },
+
+ /**
+ * The Shear X value.
+ *
+ * @name Phaser.GameObjects.Components.TransformMatrix#c
+ * @type {number}
+ * @since 3.4.0
+ */
+ c: {
+
+ get: function ()
+ {
+ return this.matrix[2];
+ },
+
+ set: function (value)
+ {
+ this.matrix[2] = value;
+ }
+
+ },
+
+ /**
+ * The Scale Y value.
+ *
+ * @name Phaser.GameObjects.Components.TransformMatrix#d
+ * @type {number}
+ * @since 3.4.0
+ */
+ d: {
+
+ get: function ()
+ {
+ return this.matrix[3];
+ },
+
+ set: function (value)
+ {
+ this.matrix[3] = value;
+ }
+
+ },
+
+ /**
+ * The Translate X value.
+ *
+ * @name Phaser.GameObjects.Components.TransformMatrix#e
+ * @type {number}
+ * @since 3.11.0
+ */
+ e: {
+
+ get: function ()
+ {
+ return this.matrix[4];
+ },
+
+ set: function (value)
+ {
+ this.matrix[4] = value;
+ }
+
+ },
+
+ /**
+ * The Translate Y value.
+ *
+ * @name Phaser.GameObjects.Components.TransformMatrix#f
+ * @type {number}
+ * @since 3.11.0
+ */
+ f: {
+
+ get: function ()
+ {
+ return this.matrix[5];
+ },
+
+ set: function (value)
+ {
+ this.matrix[5] = value;
+ }
+
+ },
+
+ /**
+ * The Translate X value.
+ *
+ * @name Phaser.GameObjects.Components.TransformMatrix#tx
+ * @type {number}
+ * @since 3.4.0
+ */
+ tx: {
+
+ get: function ()
+ {
+ return this.matrix[4];
+ },
+
+ set: function (value)
+ {
+ this.matrix[4] = value;
+ }
+
+ },
+
+ /**
+ * The Translate Y value.
+ *
+ * @name Phaser.GameObjects.Components.TransformMatrix#ty
+ * @type {number}
+ * @since 3.4.0
+ */
+ ty: {
+
+ get: function ()
+ {
+ return this.matrix[5];
+ },
+
+ set: function (value)
+ {
+ this.matrix[5] = value;
+ }
+
+ },
+
+ /**
+ * The rotation of the Matrix.
+ *
+ * @name Phaser.GameObjects.Components.TransformMatrix#rotation
+ * @type {number}
+ * @readonly
+ * @since 3.4.0
+ */
+ rotation: {
+
+ get: function ()
+ {
+ return Math.acos(this.a / this.scaleX) * (Math.atan(-this.c / this.a) < 0 ? -1 : 1);
+ }
+
+ },
+
+ /**
+ * The horizontal scale of the Matrix.
+ *
+ * @name Phaser.GameObjects.Components.TransformMatrix#scaleX
+ * @type {number}
+ * @readonly
+ * @since 3.4.0
+ */
+ scaleX: {
+
+ get: function ()
+ {
+ return Math.sqrt((this.a * this.a) + (this.c * this.c));
+ }
+
+ },
+
+ /**
+ * The vertical scale of the Matrix.
+ *
+ * @name Phaser.GameObjects.Components.TransformMatrix#scaleY
+ * @type {number}
+ * @readonly
+ * @since 3.4.0
+ */
+ scaleY: {
+
+ get: function ()
+ {
+ return Math.sqrt((this.b * this.b) + (this.d * this.d));
+ }
+
+ },
+
+ /**
+ * Reset the Matrix to an identity matrix.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#loadIdentity
+ * @since 3.0.0
+ *
+ * @return {this} This TransformMatrix.
+ */
+ loadIdentity: function ()
+ {
+ var matrix = this.matrix;
+
+ matrix[0] = 1;
+ matrix[1] = 0;
+ matrix[2] = 0;
+ matrix[3] = 1;
+ matrix[4] = 0;
+ matrix[5] = 0;
+
+ return this;
+ },
+
+ /**
+ * Translate the Matrix.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#translate
+ * @since 3.0.0
+ *
+ * @param {number} x - The horizontal translation value.
+ * @param {number} y - The vertical translation value.
+ *
+ * @return {this} This TransformMatrix.
+ */
+ translate: function (x, y)
+ {
+ var matrix = this.matrix;
+
+ matrix[4] = matrix[0] * x + matrix[2] * y + matrix[4];
+ matrix[5] = matrix[1] * x + matrix[3] * y + matrix[5];
+
+ return this;
+ },
+
+ /**
+ * Scale the Matrix.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#scale
+ * @since 3.0.0
+ *
+ * @param {number} x - The horizontal scale value.
+ * @param {number} y - The vertical scale value.
+ *
+ * @return {this} This TransformMatrix.
+ */
+ scale: function (x, y)
+ {
+ var matrix = this.matrix;
+
+ matrix[0] *= x;
+ matrix[1] *= x;
+ matrix[2] *= y;
+ matrix[3] *= y;
+
+ return this;
+ },
+
+ /**
+ * Rotate the Matrix.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#rotate
+ * @since 3.0.0
+ *
+ * @param {number} angle - The angle of rotation in radians.
+ *
+ * @return {this} This TransformMatrix.
+ */
+ rotate: function (angle)
+ {
+ var sin = Math.sin(angle);
+ var cos = Math.cos(angle);
+
+ var matrix = this.matrix;
+
+ var a = matrix[0];
+ var b = matrix[1];
+ var c = matrix[2];
+ var d = matrix[3];
+
+ matrix[0] = a * cos + c * sin;
+ matrix[1] = b * cos + d * sin;
+ matrix[2] = a * -sin + c * cos;
+ matrix[3] = b * -sin + d * cos;
+
+ return this;
+ },
+
+ /**
+ * Multiply this Matrix by the given Matrix.
+ *
+ * If an `out` Matrix is given then the results will be stored in it.
+ * If it is not given, this matrix will be updated in place instead.
+ * Use an `out` Matrix if you do not wish to mutate this matrix.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#multiply
+ * @since 3.0.0
+ *
+ * @param {Phaser.GameObjects.Components.TransformMatrix} rhs - The Matrix to multiply by.
+ * @param {Phaser.GameObjects.Components.TransformMatrix} [out] - An optional Matrix to store the results in.
+ *
+ * @return {Phaser.GameObjects.Components.TransformMatrix} Either this TransformMatrix, or the `out` Matrix, if given in the arguments.
+ */
+ multiply: function (rhs, out)
+ {
+ var matrix = this.matrix;
+ var source = rhs.matrix;
+
+ var localA = matrix[0];
+ var localB = matrix[1];
+ var localC = matrix[2];
+ var localD = matrix[3];
+ var localE = matrix[4];
+ var localF = matrix[5];
+
+ var sourceA = source[0];
+ var sourceB = source[1];
+ var sourceC = source[2];
+ var sourceD = source[3];
+ var sourceE = source[4];
+ var sourceF = source[5];
+
+ var destinationMatrix = (out === undefined) ? this : out;
+
+ destinationMatrix.a = (sourceA * localA) + (sourceB * localC);
+ destinationMatrix.b = (sourceA * localB) + (sourceB * localD);
+ destinationMatrix.c = (sourceC * localA) + (sourceD * localC);
+ destinationMatrix.d = (sourceC * localB) + (sourceD * localD);
+ destinationMatrix.e = (sourceE * localA) + (sourceF * localC) + localE;
+ destinationMatrix.f = (sourceE * localB) + (sourceF * localD) + localF;
+
+ return destinationMatrix;
+ },
+
+ /**
+ * Multiply this Matrix by the matrix given, including the offset.
+ *
+ * The offsetX is added to the tx value: `offsetX * a + offsetY * c + tx`.
+ * The offsetY is added to the ty value: `offsetY * b + offsetY * d + ty`.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#multiplyWithOffset
+ * @since 3.11.0
+ *
+ * @param {Phaser.GameObjects.Components.TransformMatrix} src - The source Matrix to copy from.
+ * @param {number} offsetX - Horizontal offset to factor in to the multiplication.
+ * @param {number} offsetY - Vertical offset to factor in to the multiplication.
+ *
+ * @return {this} This TransformMatrix.
+ */
+ multiplyWithOffset: function (src, offsetX, offsetY)
+ {
+ var matrix = this.matrix;
+ var otherMatrix = src.matrix;
+
+ var a0 = matrix[0];
+ var b0 = matrix[1];
+ var c0 = matrix[2];
+ var d0 = matrix[3];
+ var tx0 = matrix[4];
+ var ty0 = matrix[5];
+
+ var pse = offsetX * a0 + offsetY * c0 + tx0;
+ var psf = offsetX * b0 + offsetY * d0 + ty0;
+
+ var a1 = otherMatrix[0];
+ var b1 = otherMatrix[1];
+ var c1 = otherMatrix[2];
+ var d1 = otherMatrix[3];
+ var tx1 = otherMatrix[4];
+ var ty1 = otherMatrix[5];
+
+ matrix[0] = a1 * a0 + b1 * c0;
+ matrix[1] = a1 * b0 + b1 * d0;
+ matrix[2] = c1 * a0 + d1 * c0;
+ matrix[3] = c1 * b0 + d1 * d0;
+ matrix[4] = tx1 * a0 + ty1 * c0 + pse;
+ matrix[5] = tx1 * b0 + ty1 * d0 + psf;
+
+ return this;
+ },
+
+ /**
+ * Transform the Matrix.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#transform
+ * @since 3.0.0
+ *
+ * @param {number} a - The Scale X value.
+ * @param {number} b - The Shear Y value.
+ * @param {number} c - The Shear X value.
+ * @param {number} d - The Scale Y value.
+ * @param {number} tx - The Translate X value.
+ * @param {number} ty - The Translate Y value.
+ *
+ * @return {this} This TransformMatrix.
+ */
+ transform: function (a, b, c, d, tx, ty)
+ {
+ var matrix = this.matrix;
+
+ var a0 = matrix[0];
+ var b0 = matrix[1];
+ var c0 = matrix[2];
+ var d0 = matrix[3];
+ var tx0 = matrix[4];
+ var ty0 = matrix[5];
+
+ matrix[0] = a * a0 + b * c0;
+ matrix[1] = a * b0 + b * d0;
+ matrix[2] = c * a0 + d * c0;
+ matrix[3] = c * b0 + d * d0;
+ matrix[4] = tx * a0 + ty * c0 + tx0;
+ matrix[5] = tx * b0 + ty * d0 + ty0;
+
+ return this;
+ },
+
+ /**
+ * Transform a point using this Matrix.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#transformPoint
+ * @since 3.0.0
+ *
+ * @param {number} x - The x coordinate of the point to transform.
+ * @param {number} y - The y coordinate of the point to transform.
+ * @param {(Phaser.Geom.Point|Phaser.Math.Vector2|object)} point - The Point object to store the transformed coordinates.
+ *
+ * @return {(Phaser.Geom.Point|Phaser.Math.Vector2|object)} The Point containing the transformed coordinates.
+ */
+ transformPoint: function (x, y, point)
+ {
+ if (point === undefined) { point = { x: 0, y: 0 }; }
+
+ var matrix = this.matrix;
+
+ var a = matrix[0];
+ var b = matrix[1];
+ var c = matrix[2];
+ var d = matrix[3];
+ var tx = matrix[4];
+ var ty = matrix[5];
+
+ point.x = x * a + y * c + tx;
+ point.y = x * b + y * d + ty;
+
+ return point;
+ },
+
+ /**
+ * Invert the Matrix.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#invert
+ * @since 3.0.0
+ *
+ * @return {this} This TransformMatrix.
+ */
+ invert: function ()
+ {
+ var matrix = this.matrix;
+
+ var a = matrix[0];
+ var b = matrix[1];
+ var c = matrix[2];
+ var d = matrix[3];
+ var tx = matrix[4];
+ var ty = matrix[5];
+
+ var n = a * d - b * c;
+
+ matrix[0] = d / n;
+ matrix[1] = -b / n;
+ matrix[2] = -c / n;
+ matrix[3] = a / n;
+ matrix[4] = (c * ty - d * tx) / n;
+ matrix[5] = -(a * ty - b * tx) / n;
+
+ return this;
+ },
+
+ /**
+ * Set the values of this Matrix to copy those of the matrix given.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#copyFrom
+ * @since 3.11.0
+ *
+ * @param {Phaser.GameObjects.Components.TransformMatrix} src - The source Matrix to copy from.
+ *
+ * @return {this} This TransformMatrix.
+ */
+ copyFrom: function (src)
+ {
+ var matrix = this.matrix;
+
+ matrix[0] = src.a;
+ matrix[1] = src.b;
+ matrix[2] = src.c;
+ matrix[3] = src.d;
+ matrix[4] = src.e;
+ matrix[5] = src.f;
+
+ return this;
+ },
+
+ /**
+ * Set the values of this Matrix to copy those of the array given.
+ * Where array indexes 0, 1, 2, 3, 4 and 5 are mapped to a, b, c, d, e and f.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#copyFromArray
+ * @since 3.11.0
+ *
+ * @param {array} src - The array of values to set into this matrix.
+ *
+ * @return {this} This TransformMatrix.
+ */
+ copyFromArray: function (src)
+ {
+ var matrix = this.matrix;
+
+ matrix[0] = src[0];
+ matrix[1] = src[1];
+ matrix[2] = src[2];
+ matrix[3] = src[3];
+ matrix[4] = src[4];
+ matrix[5] = src[5];
+
+ return this;
+ },
+
+ /**
+ * Copy the values from this Matrix to the given Canvas Rendering Context.
+ * This will use the Context.transform method.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#copyToContext
+ * @since 3.12.0
+ *
+ * @param {CanvasRenderingContext2D} ctx - The Canvas Rendering Context to copy the matrix values to.
+ *
+ * @return {CanvasRenderingContext2D} The Canvas Rendering Context.
+ */
+ copyToContext: function (ctx)
+ {
+ var matrix = this.matrix;
+
+ ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
+
+ return ctx;
+ },
+
+ /**
+ * Copy the values from this Matrix to the given Canvas Rendering Context.
+ * This will use the Context.setTransform method.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#setToContext
+ * @since 3.12.0
+ *
+ * @param {CanvasRenderingContext2D} ctx - The Canvas Rendering Context to copy the matrix values to.
+ *
+ * @return {CanvasRenderingContext2D} The Canvas Rendering Context.
+ */
+ setToContext: function (ctx)
+ {
+ var matrix = this.matrix;
+
+ ctx.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
+
+ return ctx;
+ },
+
+ /**
+ * Copy the values in this Matrix to the array given.
+ *
+ * Where array indexes 0, 1, 2, 3, 4 and 5 are mapped to a, b, c, d, e and f.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#copyToArray
+ * @since 3.12.0
+ *
+ * @param {array} [out] - The array to copy the matrix values in to.
+ *
+ * @return {array} An array where elements 0 to 5 contain the values from this matrix.
+ */
+ copyToArray: function (out)
+ {
+ var matrix = this.matrix;
+
+ if (out === undefined)
+ {
+ out = [ matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5] ];
+ }
+ else
+ {
+ out[0] = matrix[0];
+ out[1] = matrix[1];
+ out[2] = matrix[2];
+ out[3] = matrix[3];
+ out[4] = matrix[4];
+ out[5] = matrix[5];
+ }
+
+ return out;
+ },
+
+ /**
+ * Set the values of this Matrix.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#setTransform
+ * @since 3.0.0
+ *
+ * @param {number} a - The Scale X value.
+ * @param {number} b - The Shear Y value.
+ * @param {number} c - The Shear X value.
+ * @param {number} d - The Scale Y value.
+ * @param {number} tx - The Translate X value.
+ * @param {number} ty - The Translate Y value.
+ *
+ * @return {this} This TransformMatrix.
+ */
+ setTransform: function (a, b, c, d, tx, ty)
+ {
+ var matrix = this.matrix;
+
+ matrix[0] = a;
+ matrix[1] = b;
+ matrix[2] = c;
+ matrix[3] = d;
+ matrix[4] = tx;
+ matrix[5] = ty;
+
+ return this;
+ },
+
+ /**
+ * Decompose this Matrix into its translation, scale and rotation values.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#decomposeMatrix
+ * @since 3.0.0
+ *
+ * @return {object} The decomposed Matrix.
+ */
+ decomposeMatrix: function ()
+ {
+ var decomposedMatrix = this.decomposedMatrix;
+
+ var matrix = this.matrix;
+
+ // a = scale X (1)
+ // b = shear Y (0)
+ // c = shear X (0)
+ // d = scale Y (1)
+
+ var a = matrix[0];
+ var b = matrix[1];
+ var c = matrix[2];
+ var d = matrix[3];
+
+ var a2 = a * a;
+ var b2 = b * b;
+ var c2 = c * c;
+ var d2 = d * d;
+
+ var sx = Math.sqrt(a2 + c2);
+ var sy = Math.sqrt(b2 + d2);
+
+ decomposedMatrix.translateX = matrix[4];
+ decomposedMatrix.translateY = matrix[5];
+
+ decomposedMatrix.scaleX = sx;
+ decomposedMatrix.scaleY = sy;
+
+ decomposedMatrix.rotation = Math.acos(a / sx) * (Math.atan(-c / a) < 0 ? -1 : 1);
+
+ return decomposedMatrix;
+ },
+
+ /**
+ * Apply the identity, translate, rotate and scale operations on the Matrix.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#applyITRS
+ * @since 3.0.0
+ *
+ * @param {number} x - The horizontal translation.
+ * @param {number} y - The vertical translation.
+ * @param {number} rotation - The angle of rotation in radians.
+ * @param {number} scaleX - The horizontal scale.
+ * @param {number} scaleY - The vertical scale.
+ *
+ * @return {this} This TransformMatrix.
+ */
+ applyITRS: function (x, y, rotation, scaleX, scaleY)
+ {
+ var matrix = this.matrix;
+
+ var radianSin = Math.sin(rotation);
+ var radianCos = Math.cos(rotation);
+
+ // Translate
+ matrix[4] = x;
+ matrix[5] = y;
+
+ // Rotate and Scale
+ matrix[0] = radianCos * scaleX;
+ matrix[1] = radianSin * scaleX;
+ matrix[2] = -radianSin * scaleY;
+ matrix[3] = radianCos * scaleY;
+
+ return this;
+ },
+
+ /**
+ * Takes the `x` and `y` values and returns a new position in the `output` vector that is the inverse of
+ * the current matrix with its transformation applied.
+ *
+ * Can be used to translate points from world to local space.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#applyInverse
+ * @since 3.12.0
+ *
+ * @param {number} x - The x position to translate.
+ * @param {number} y - The y position to translate.
+ * @param {Phaser.Math.Vector2} [output] - A Vector2, or point-like object, to store the results in.
+ *
+ * @return {Phaser.Math.Vector2} The coordinates, inverse-transformed through this matrix.
+ */
+ applyInverse: function (x, y, output)
+ {
+ if (output === undefined) { output = new Vector2(); }
+
+ var matrix = this.matrix;
+
+ var a = matrix[0];
+ var b = matrix[1];
+ var c = matrix[2];
+ var d = matrix[3];
+ var tx = matrix[4];
+ var ty = matrix[5];
+
+ var id = 1 / ((a * d) + (c * -b));
+
+ output.x = (d * id * x) + (-c * id * y) + (((ty * c) - (tx * d)) * id);
+ output.y = (a * id * y) + (-b * id * x) + (((-ty * a) + (tx * b)) * id);
+
+ return output;
+ },
+
+ /**
+ * Returns the X component of this matrix multiplied by the given values.
+ * This is the same as `x * a + y * c + e`.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#getX
+ * @since 3.12.0
+ *
+ * @param {number} x - The x value.
+ * @param {number} y - The y value.
+ *
+ * @return {number} The calculated x value.
+ */
+ getX: function (x, y)
+ {
+ return x * this.a + y * this.c + this.e;
+ },
+
+ /**
+ * Returns the Y component of this matrix multiplied by the given values.
+ * This is the same as `x * b + y * d + f`.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#getY
+ * @since 3.12.0
+ *
+ * @param {number} x - The x value.
+ * @param {number} y - The y value.
+ *
+ * @return {number} The calculated y value.
+ */
+ getY: function (x, y)
+ {
+ return x * this.b + y * this.d + this.f;
+ },
+
+ /**
+ * Returns a string that can be used in a CSS Transform call as a `matrix` property.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#getCSSMatrix
+ * @since 3.12.0
+ *
+ * @return {string} A string containing the CSS Transform matrix values.
+ */
+ getCSSMatrix: function ()
+ {
+ var m = this.matrix;
+
+ return 'matrix(' + m[0] + ',' + m[1] + ',' + m[2] + ',' + m[3] + ',' + m[4] + ',' + m[5] + ')';
+ },
+
+ /**
+ * Destroys this Transform Matrix.
+ *
+ * @method Phaser.GameObjects.Components.TransformMatrix#destroy
+ * @since 3.4.0
+ */
+ destroy: function ()
+ {
+ this.matrix = null;
+ this.decomposedMatrix = null;
+ }
+
+});
+
+module.exports = TransformMatrix;
+
+
+/***/ }),
+/* 39 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * [description]
+ *
+ * @function Phaser.Geom.Rectangle.Contains
+ * @since 3.0.0
+ *
+ * @param {Phaser.Geom.Rectangle} rect - [description]
+ * @param {number} x - [description]
+ * @param {number} y - [description]
+ *
+ * @return {boolean} [description]
+ */
+var Contains = function (rect, x, y)
+{
+ if (rect.width <= 0 || rect.height <= 0)
+ {
+ return false;
+ }
+
+ return (rect.x <= x && rect.x + rect.width >= x && rect.y <= y && rect.y + rect.height >= y);
+};
+
+module.exports = Contains;
+
+
+/***/ }),
+/* 40 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Check to see if the Circle contains the given x / y coordinates.
+ *
+ * @function Phaser.Geom.Circle.Contains
+ * @since 3.0.0
+ *
+ * @param {Phaser.Geom.Circle} circle - The Circle to check.
+ * @param {number} x - The x coordinate to check within the circle.
+ * @param {number} y - The y coordinate to check within the circle.
+ *
+ * @return {boolean} True if the coordinates are within the circle, otherwise false.
+ */
+var Contains = function (circle, x, y)
+{
+ // Check if x/y are within the bounds first
+ if (circle.radius > 0 && x >= circle.left && x <= circle.right && y >= circle.top && y <= circle.bottom)
+ {
+ var dx = (circle.x - x) * (circle.x - x);
+ var dy = (circle.y - y) * (circle.y - y);
+
+ return (dx + dy) <= (circle.radius * circle.radius);
+ }
+ else
+ {
+ return false;
+ }
+};
+
+module.exports = Contains;
+
+
+/***/ }),
+/* 41 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Positions the Game Object so that the top of its bounds aligns with the given coordinate.
+ *
+ * @function Phaser.Display.Bounds.SetTop
+ * @since 3.0.0
+ *
+ * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return]
+ *
+ * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned.
+ * @param {number} value - The coordinate to position the Game Object bounds on.
+ *
+ * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned.
+ */
+var SetTop = function (gameObject, value)
+{
+ gameObject.y = value + (gameObject.height * gameObject.originY);
+
+ return gameObject;
+};
+
+module.exports = SetTop;
+
+
+/***/ }),
+/* 42 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Returns the top coordinate from the bounds of the Game Object.
+ *
+ * @function Phaser.Display.Bounds.GetTop
+ * @since 3.0.0
+ *
+ * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from.
+ *
+ * @return {number} The top coordinate of the bounds of the Game Object.
+ */
+var GetTop = function (gameObject)
+{
+ return gameObject.y - (gameObject.height * gameObject.originY);
+};
+
+module.exports = GetTop;
+
+
+/***/ }),
+/* 43 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Positions the Game Object so that the left of its bounds aligns with the given coordinate.
+ *
+ * @function Phaser.Display.Bounds.SetRight
+ * @since 3.0.0
+ *
+ * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return]
+ *
+ * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned.
+ * @param {number} value - The coordinate to position the Game Object bounds on.
+ *
+ * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned.
+ */
+var SetRight = function (gameObject, value)
+{
+ gameObject.x = (value - gameObject.width) + (gameObject.width * gameObject.originX);
+
+ return gameObject;
+};
+
+module.exports = SetRight;
+
+
+/***/ }),
+/* 44 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Returns the right coordinate from the bounds of the Game Object.
+ *
+ * @function Phaser.Display.Bounds.GetRight
+ * @since 3.0.0
+ *
+ * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from.
+ *
+ * @return {number} The right coordinate of the bounds of the Game Object.
+ */
+var GetRight = function (gameObject)
+{
+ return (gameObject.x + gameObject.width) - (gameObject.width * gameObject.originX);
+};
+
+module.exports = GetRight;
+
+
+/***/ }),
+/* 45 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Positions the Game Object so that the left of its bounds aligns with the given coordinate.
+ *
+ * @function Phaser.Display.Bounds.SetLeft
+ * @since 3.0.0
+ *
+ * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return]
+ *
+ * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned.
+ * @param {number} value - The coordinate to position the Game Object bounds on.
+ *
+ * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned.
+ */
+var SetLeft = function (gameObject, value)
+{
+ gameObject.x = value + (gameObject.width * gameObject.originX);
+
+ return gameObject;
+};
+
+module.exports = SetLeft;
+
+
+/***/ }),
+/* 46 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Returns the left coordinate from the bounds of the Game Object.
+ *
+ * @function Phaser.Display.Bounds.GetLeft
+ * @since 3.0.0
+ *
+ * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from.
+ *
+ * @return {number} The left coordinate of the bounds of the Game Object.
+ */
+var GetLeft = function (gameObject)
+{
+ return gameObject.x - (gameObject.width * gameObject.originX);
+};
+
+module.exports = GetLeft;
+
+
+/***/ }),
+/* 47 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Positions the Game Object so that the bottom of its bounds aligns with the given coordinate.
+ *
+ * @function Phaser.Display.Bounds.SetBottom
+ * @since 3.0.0
+ *
+ * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return]
+ *
+ * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned.
+ * @param {number} value - The coordinate to position the Game Object bounds on.
+ *
+ * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned.
+ */
+var SetBottom = function (gameObject, value)
+{
+ gameObject.y = (value - gameObject.height) + (gameObject.height * gameObject.originY);
+
+ return gameObject;
+};
+
+module.exports = SetBottom;
+
+
+/***/ }),
+/* 48 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Returns the bottom coordinate from the bounds of the Game Object.
+ *
+ * @function Phaser.Display.Bounds.GetBottom
+ * @since 3.0.0
+ *
+ * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from.
+ *
+ * @return {number} The bottom coordinate of the bounds of the Game Object.
+ */
+var GetBottom = function (gameObject)
+{
+ return (gameObject.y + gameObject.height) - (gameObject.height * gameObject.originY);
+};
+
+module.exports = GetBottom;
+
+
+/***/ }),
+/* 49 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the
+ * layer's position, scale and scroll.
+ *
+ * @function Phaser.Tilemaps.Components.WorldToTileY
+ * @private
+ * @since 3.0.0
+ *
+ * @param {number} worldY - The y coordinate to be converted, in pixels, not tiles.
+ * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer.
+ * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
+ * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
+ *
+ * @return {number} The Y location in tile units.
+ */
+var WorldToTileY = function (worldY, snapToFloor, camera, layer)
+{
+ if (snapToFloor === undefined) { snapToFloor = true; }
+
+ var tileHeight = layer.baseTileHeight;
+ var tilemapLayer = layer.tilemapLayer;
+
+ if (tilemapLayer)
+ {
+ if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; }
+
+ // Find the world position relative to the static or dynamic layer's top left origin,
+ // factoring in the camera's vertical scroll
+ worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY));
+
+ tileHeight *= tilemapLayer.scaleY;
+ }
+
+ return snapToFloor
+ ? Math.floor(worldY / tileHeight)
+ : worldY / tileHeight;
+};
+
+module.exports = WorldToTileY;
+
+
+/***/ }),
+/* 50 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the
+ * layer's position, scale and scroll.
+ *
+ * @function Phaser.Tilemaps.Components.WorldToTileX
+ * @private
+ * @since 3.0.0
+ *
+ * @param {number} worldX - The x coordinate to be converted, in pixels, not tiles.
+ * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer.
+ * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
+ * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
+ *
+ * @return {number} The X location in tile units.
+ */
+var WorldToTileX = function (worldX, snapToFloor, camera, layer)
+{
+ if (snapToFloor === undefined) { snapToFloor = true; }
+
+ var tileWidth = layer.baseTileWidth;
+ var tilemapLayer = layer.tilemapLayer;
+
+ if (tilemapLayer)
+ {
+ if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; }
+
+ // Find the world position relative to the static or dynamic layer's top left origin,
+ // factoring in the camera's horizontal scroll
+ worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX));
+
+ tileWidth *= tilemapLayer.scaleX;
+ }
+
+ return snapToFloor
+ ? Math.floor(worldX / tileWidth)
+ : worldX / tileWidth;
+};
+
+module.exports = WorldToTileX;
+
+
+/***/ }),
+/* 51 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -5170,9 +8185,9 @@ module.exports = {
var Class = __webpack_require__(0);
var CONST = __webpack_require__(18);
-var File = __webpack_require__(19);
+var File = __webpack_require__(21);
var FileTypesManager = __webpack_require__(7);
-var GetFastValue = __webpack_require__(1);
+var GetFastValue = __webpack_require__(2);
var GetValue = __webpack_require__(4);
var IsPlainObject = __webpack_require__(8);
@@ -5196,7 +8211,7 @@ var IsPlainObject = __webpack_require__(8);
*
* @class JSONFile
* @extends Phaser.Loader.File
- * @memberOf Phaser.Loader.FileTypes
+ * @memberof Phaser.Loader.FileTypes
* @constructor
* @since 3.0.0
*
@@ -5398,2544 +8413,10 @@ FileTypesManager.register('json', function (key, url, dataKey, xhrSettings)
module.exports = JSONFile;
-/***/ }),
-/* 29 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Tests if the start and end indexes are a safe range for the given array.
- *
- * @function Phaser.Utils.Array.SafeRange
- * @since 3.4.0
- *
- * @param {array} array - The array to check.
- * @param {integer} startIndex - The start index.
- * @param {integer} endIndex - The end index.
- * @param {boolean} [throwError=true] - Throw an error if the range is out of bounds.
- *
- * @return {boolean} True if the range is safe, otherwise false.
- */
-var SafeRange = function (array, startIndex, endIndex, throwError)
-{
- var len = array.length;
-
- if (startIndex < 0 ||
- startIndex > len ||
- startIndex >= endIndex ||
- endIndex > len ||
- startIndex + endIndex > len)
- {
- if (throwError)
- {
- throw new Error('Range Error: Values outside acceptable range');
- }
-
- return false;
- }
- else
- {
- return true;
- }
-};
-
-module.exports = SafeRange;
-
-
-/***/ }),
-/* 30 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Class = __webpack_require__(0);
-var GetColor = __webpack_require__(152);
-var GetColor32 = __webpack_require__(284);
-
-/**
- * @classdesc
- * The Color class holds a single color value and allows for easy modification and reading of it.
- *
- * @class Color
- * @memberOf Phaser.Display
- * @constructor
- * @since 3.0.0
- *
- * @param {integer} [red=0] - The red color value. A number between 0 and 255.
- * @param {integer} [green=0] - The green color value. A number between 0 and 255.
- * @param {integer} [blue=0] - The blue color value. A number between 0 and 255.
- * @param {integer} [alpha=255] - The alpha value. A number between 0 and 255.
- */
-var Color = new Class({
-
- initialize:
-
- function Color (red, green, blue, alpha)
- {
- if (red === undefined) { red = 0; }
- if (green === undefined) { green = 0; }
- if (blue === undefined) { blue = 0; }
- if (alpha === undefined) { alpha = 255; }
-
- /**
- * The internal red color value.
- *
- * @name Phaser.Display.Color#r
- * @type {number}
- * @private
- * @default 0
- * @since 3.0.0
- */
- this.r = 0;
-
- /**
- * The internal green color value.
- *
- * @name Phaser.Display.Color#g
- * @type {number}
- * @private
- * @default 0
- * @since 3.0.0
- */
- this.g = 0;
-
- /**
- * The internal blue color value.
- *
- * @name Phaser.Display.Color#b
- * @type {number}
- * @private
- * @default 0
- * @since 3.0.0
- */
- this.b = 0;
-
- /**
- * The internal alpha color value.
- *
- * @name Phaser.Display.Color#a
- * @type {number}
- * @private
- * @default 255
- * @since 3.0.0
- */
- this.a = 255;
-
- /**
- * An array containing the calculated color values for WebGL use.
- *
- * @name Phaser.Display.Color#gl
- * @type {number[]}
- * @since 3.0.0
- */
- this.gl = [ 0, 0, 0, 1 ];
-
- /**
- * Pre-calculated internal color value.
- *
- * @name Phaser.Display.Color#_color
- * @type {number}
- * @private
- * @default 0
- * @since 3.0.0
- */
- this._color = 0;
-
- /**
- * Pre-calculated internal color32 value.
- *
- * @name Phaser.Display.Color#_color32
- * @type {number}
- * @private
- * @default 0
- * @since 3.0.0
- */
- this._color32 = 0;
-
- /**
- * Pre-calculated internal color rgb string value.
- *
- * @name Phaser.Display.Color#_rgba
- * @type {string}
- * @private
- * @default ''
- * @since 3.0.0
- */
- this._rgba = '';
-
- this.setTo(red, green, blue, alpha);
- },
-
- /**
- * Sets this color to be transparent. Sets all values to zero.
- *
- * @method Phaser.Display.Color#transparent
- * @since 3.0.0
- *
- * @return {Phaser.Display.Color} This Color object.
- */
- transparent: function ()
- {
- this.red = 0;
- this.green = 0;
- this.blue = 0;
- this.alpha = 0;
-
- return this.update();
- },
-
- /**
- * Sets the color of this Color component.
- *
- * @method Phaser.Display.Color#setTo
- * @since 3.0.0
- *
- * @param {integer} red - The red color value. A number between 0 and 255.
- * @param {integer} green - The green color value. A number between 0 and 255.
- * @param {integer} blue - The blue color value. A number between 0 and 255.
- * @param {integer} [alpha=255] - The alpha value. A number between 0 and 255.
- *
- * @return {Phaser.Display.Color} This Color object.
- */
- setTo: function (red, green, blue, alpha)
- {
- if (alpha === undefined) { alpha = 255; }
-
- this.red = red;
- this.green = green;
- this.blue = blue;
- this.alpha = alpha;
-
- return this.update();
- },
-
- /**
- * Sets the red, green, blue and alpha GL values of this Color component.
- *
- * @method Phaser.Display.Color#setGLTo
- * @since 3.0.0
- *
- * @param {float} red - The red color value. A number between 0 and 1.
- * @param {float} green - The green color value. A number between 0 and 1.
- * @param {float} blue - The blue color value. A number between 0 and 1.
- * @param {float} [alpha=1] - The alpha value. A number between 0 and 1.
- *
- * @return {Phaser.Display.Color} This Color object.
- */
- setGLTo: function (red, green, blue, alpha)
- {
- if (alpha === undefined) { alpha = 1; }
-
- this.redGL = red;
- this.greenGL = green;
- this.blueGL = blue;
- this.alphaGL = alpha;
-
- return this.update();
- },
-
- /**
- * Sets the color based on the color object given.
- *
- * @method Phaser.Display.Color#setFromRGB
- * @since 3.0.0
- *
- * @param {InputColorObject} color - An object containing `r`, `g`, `b` and optionally `a` values in the range 0 to 255.
- *
- * @return {Phaser.Display.Color} This Color object.
- */
- setFromRGB: function (color)
- {
- this.red = color.r;
- this.green = color.g;
- this.blue = color.b;
-
- if (color.hasOwnProperty('a'))
- {
- this.alpha = color.a;
- }
-
- return this.update();
- },
-
- /**
- * Updates the internal cache values.
- *
- * @method Phaser.Display.Color#update
- * @since 3.0.0
- *
- * @return {Phaser.Display.Color} This Color object.
- */
- update: function ()
- {
- this._color = GetColor(this.r, this.g, this.b);
- this._color32 = GetColor32(this.r, this.g, this.b, this.a);
- this._rgba = 'rgba(' + this.r + ',' + this.g + ',' + this.b + ',' + (this.a / 255) + ')';
-
- return this;
- },
-
- /**
- * Returns a new Color component using the values from this one.
- *
- * @method Phaser.Display.Color#clone
- * @since 3.0.0
- *
- * @return {Phaser.Display.Color} A new Color object.
- */
- clone: function ()
- {
- return new Color(this.r, this.g, this.b, this.a);
- },
-
- /**
- * The color of this Color component, not including the alpha channel.
- *
- * @name Phaser.Display.Color#color
- * @type {number}
- * @readOnly
- * @since 3.0.0
- */
- color: {
-
- get: function ()
- {
- return this._color;
- }
-
- },
-
- /**
- * The color of this Color component, including the alpha channel.
- *
- * @name Phaser.Display.Color#color32
- * @type {number}
- * @readOnly
- * @since 3.0.0
- */
- color32: {
-
- get: function ()
- {
- return this._color32;
- }
-
- },
-
- /**
- * The color of this Color component as a string which can be used in CSS color values.
- *
- * @name Phaser.Display.Color#rgba
- * @type {string}
- * @readOnly
- * @since 3.0.0
- */
- rgba: {
-
- get: function ()
- {
- return this._rgba;
- }
-
- },
-
- /**
- * The red color value, normalized to the range 0 to 1.
- *
- * @name Phaser.Display.Color#redGL
- * @type {float}
- * @since 3.0.0
- */
- redGL: {
-
- get: function ()
- {
- return this.gl[0];
- },
-
- set: function (value)
- {
- this.gl[0] = Math.min(Math.abs(value), 1);
-
- this.r = Math.floor(this.gl[0] * 255);
-
- this.update();
- }
-
- },
-
- /**
- * The green color value, normalized to the range 0 to 1.
- *
- * @name Phaser.Display.Color#greenGL
- * @type {float}
- * @since 3.0.0
- */
- greenGL: {
-
- get: function ()
- {
- return this.gl[1];
- },
-
- set: function (value)
- {
- this.gl[1] = Math.min(Math.abs(value), 1);
-
- this.g = Math.floor(this.gl[1] * 255);
-
- this.update();
- }
-
- },
-
- /**
- * The blue color value, normalized to the range 0 to 1.
- *
- * @name Phaser.Display.Color#blueGL
- * @type {float}
- * @since 3.0.0
- */
- blueGL: {
-
- get: function ()
- {
- return this.gl[2];
- },
-
- set: function (value)
- {
- this.gl[2] = Math.min(Math.abs(value), 1);
-
- this.b = Math.floor(this.gl[2] * 255);
-
- this.update();
- }
-
- },
-
- /**
- * The alpha color value, normalized to the range 0 to 1.
- *
- * @name Phaser.Display.Color#alphaGL
- * @type {float}
- * @since 3.0.0
- */
- alphaGL: {
-
- get: function ()
- {
- return this.gl[3];
- },
-
- set: function (value)
- {
- this.gl[3] = Math.min(Math.abs(value), 1);
-
- this.a = Math.floor(this.gl[3] * 255);
-
- this.update();
- }
-
- },
-
- /**
- * The red color value, normalized to the range 0 to 255.
- *
- * @name Phaser.Display.Color#red
- * @type {number}
- * @since 3.0.0
- */
- red: {
-
- get: function ()
- {
- return this.r;
- },
-
- set: function (value)
- {
- value = Math.floor(Math.abs(value));
-
- this.r = Math.min(value, 255);
-
- this.gl[0] = value / 255;
-
- this.update();
- }
-
- },
-
- /**
- * The green color value, normalized to the range 0 to 255.
- *
- * @name Phaser.Display.Color#green
- * @type {number}
- * @since 3.0.0
- */
- green: {
-
- get: function ()
- {
- return this.g;
- },
-
- set: function (value)
- {
- value = Math.floor(Math.abs(value));
-
- this.g = Math.min(value, 255);
-
- this.gl[1] = value / 255;
-
- this.update();
- }
-
- },
-
- /**
- * The blue color value, normalized to the range 0 to 255.
- *
- * @name Phaser.Display.Color#blue
- * @type {number}
- * @since 3.0.0
- */
- blue: {
-
- get: function ()
- {
- return this.b;
- },
-
- set: function (value)
- {
- value = Math.floor(Math.abs(value));
-
- this.b = Math.min(value, 255);
-
- this.gl[2] = value / 255;
-
- this.update();
- }
-
- },
-
- /**
- * The alpha color value, normalized to the range 0 to 255.
- *
- * @name Phaser.Display.Color#alpha
- * @type {number}
- * @since 3.0.0
- */
- alpha: {
-
- get: function ()
- {
- return this.a;
- },
-
- set: function (value)
- {
- value = Math.floor(Math.abs(value));
-
- this.a = Math.min(value, 255);
-
- this.gl[3] = value / 255;
-
- this.update();
- }
-
- }
-
-});
-
-module.exports = Color;
-
-
-/***/ }),
-/* 31 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * [description]
- *
- * @function Phaser.Geom.Rectangle.Contains
- * @since 3.0.0
- *
- * @param {Phaser.Geom.Rectangle} rect - [description]
- * @param {number} x - [description]
- * @param {number} y - [description]
- *
- * @return {boolean} [description]
- */
-var Contains = function (rect, x, y)
-{
- if (rect.width <= 0 || rect.height <= 0)
- {
- return false;
- }
-
- return (rect.x <= x && rect.x + rect.width >= x && rect.y <= y && rect.y + rect.height >= y);
-};
-
-module.exports = Contains;
-
-
-/***/ }),
-/* 32 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Check to see if the Circle contains the given x / y coordinates.
- *
- * @function Phaser.Geom.Circle.Contains
- * @since 3.0.0
- *
- * @param {Phaser.Geom.Circle} circle - The Circle to check.
- * @param {number} x - The x coordinate to check within the circle.
- * @param {number} y - The y coordinate to check within the circle.
- *
- * @return {boolean} True if the coordinates are within the circle, otherwise false.
- */
-var Contains = function (circle, x, y)
-{
- // Check if x/y are within the bounds first
- if (circle.radius > 0 && x >= circle.left && x <= circle.right && y >= circle.top && y <= circle.bottom)
- {
- var dx = (circle.x - x) * (circle.x - x);
- var dy = (circle.y - y) * (circle.y - y);
-
- return (dx + dy) <= (circle.radius * circle.radius);
- }
- else
- {
- return false;
- }
-};
-
-module.exports = Contains;
-
-
-/***/ }),
-/* 33 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Shallow Object Clone. Will not clone nested objects.
- *
- * @function Phaser.Utils.Object.Clone
- * @since 3.0.0
- *
- * @param {object} obj - the object from which to clone
- *
- * @return {object} a new object with the same properties as the input obj
- */
-var Clone = function (obj)
-{
- var clone = {};
-
- for (var key in obj)
- {
- if (Array.isArray(obj[key]))
- {
- clone[key] = obj[key].slice(0);
- }
- else
- {
- clone[key] = obj[key];
- }
- }
-
- return clone;
-};
-
-module.exports = Clone;
-
-
-/***/ }),
-/* 34 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Class = __webpack_require__(0);
-var Components = __webpack_require__(15);
-var GameObject = __webpack_require__(2);
-var SpriteRender = __webpack_require__(556);
-
-/**
- * @classdesc
- * A 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.
- *
- * @class Sprite
- * @extends Phaser.GameObjects.GameObject
- * @memberOf Phaser.GameObjects
- * @constructor
- * @since 3.0.0
- *
- * @extends Phaser.GameObjects.Components.Alpha
- * @extends Phaser.GameObjects.Components.BlendMode
- * @extends Phaser.GameObjects.Components.Depth
- * @extends Phaser.GameObjects.Components.Flip
- * @extends Phaser.GameObjects.Components.GetBounds
- * @extends Phaser.GameObjects.Components.Mask
- * @extends Phaser.GameObjects.Components.Origin
- * @extends Phaser.GameObjects.Components.Pipeline
- * @extends Phaser.GameObjects.Components.ScaleMode
- * @extends Phaser.GameObjects.Components.ScrollFactor
- * @extends Phaser.GameObjects.Components.Size
- * @extends Phaser.GameObjects.Components.Texture
- * @extends Phaser.GameObjects.Components.Tint
- * @extends Phaser.GameObjects.Components.Transform
- * @extends Phaser.GameObjects.Components.Visible
- *
- * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time.
- * @param {number} x - The horizontal position of this Game Object in the world.
- * @param {number} y - The vertical position of this Game Object in the world.
- * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
- * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
- */
-var Sprite = new Class({
-
- Extends: GameObject,
-
- Mixins: [
- Components.Alpha,
- Components.BlendMode,
- Components.Depth,
- Components.Flip,
- Components.GetBounds,
- Components.Mask,
- Components.Origin,
- Components.Pipeline,
- Components.ScaleMode,
- Components.ScrollFactor,
- Components.Size,
- Components.Texture,
- Components.Tint,
- Components.Transform,
- Components.Visible,
- SpriteRender
- ],
-
- initialize:
-
- function Sprite (scene, x, y, texture, frame)
- {
- GameObject.call(this, scene, 'Sprite');
-
- /**
- * The Animation Controller of this Sprite.
- *
- * @name Phaser.GameObjects.Sprite#anims
- * @type {Phaser.GameObjects.Components.Animation}
- * @since 3.0.0
- */
- this.anims = new Components.Animation(this);
-
- this.setTexture(texture, frame);
- this.setPosition(x, y);
- this.setSizeToFrame();
- this.setOriginFromFrame();
- this.initPipeline('TextureTintPipeline');
- },
-
- /**
- * Update this Sprite's animations.
- *
- * @method Phaser.GameObjects.Sprite#preUpdate
- * @protected
- * @since 3.0.0
- *
- * @param {number} time - The current timestamp.
- * @param {number} delta - The delta time, in ms, elapsed since the last frame.
- */
- preUpdate: function (time, delta)
- {
- this.anims.update(time, delta);
- },
-
- /**
- * Start playing the given animation.
- *
- * @method Phaser.GameObjects.Sprite#play
- * @since 3.0.0
- *
- * @param {string} key - The string-based key of the animation to play.
- * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call.
- * @param {integer} [startFrame=0] - Optionally start the animation playing from this frame index.
- *
- * @return {Phaser.GameObjects.Sprite} This Game Object.
- */
- play: function (key, ignoreIfPlaying, startFrame)
- {
- this.anims.play(key, ignoreIfPlaying, startFrame);
-
- return this;
- },
-
- /**
- * Build a JSON representation of this Sprite.
- *
- * @method Phaser.GameObjects.Sprite#toJSON
- * @since 3.0.0
- *
- * @return {JSONGameObject} A JSON representation of the Game Object.
- */
- toJSON: function ()
- {
- var data = Components.ToJSON(this);
-
- // Extra Sprite data is added here
-
- return data;
- }
-
-});
-
-module.exports = Sprite;
-
-
-/***/ }),
-/* 35 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Takes an array of Game Objects, or any objects that have a public property as defined in `key`,
- * and then adds the given value to it.
- *
- * The optional `step` property is applied incrementally, multiplied by each item in the array.
- *
- * To use this with a Group: `PropertyValueInc(group.getChildren(), key, value, step)`
- *
- * @function Phaser.Actions.PropertyValueInc
- * @since 3.3.0
- *
- * @generic {Phaser.GameObjects.GameObject[]} G - [items,$return]
- *
- * @param {(array|Phaser.GameObjects.GameObject[])} items - The array of items to be updated by this action.
- * @param {string} key - The property to be updated.
- * @param {number} value - The amount to be added to the property.
- * @param {number} [step=0] - This is added to the `value` amount, multiplied by the iteration counter.
- * @param {integer} [index=0] - An optional offset to start searching from within the items array.
- * @param {integer} [direction=1] - The direction to iterate through the array. 1 is from beginning to end, -1 from end to beginning.
- *
- * @return {(array|Phaser.GameObjects.GameObject[])} The array of objects that were passed to this Action.
- */
-var PropertyValueInc = function (items, key, value, step, index, direction)
-{
- if (step === undefined) { step = 0; }
- if (index === undefined) { index = 0; }
- if (direction === undefined) { direction = 1; }
-
- var i;
- var t = 0;
- var end = items.length;
-
- if (direction === 1)
- {
- // Start to End
- for (i = index; i < end; i++)
- {
- items[i][key] += value + (t * step);
- t++;
- }
- }
- else
- {
- // End to Start
- for (i = index; i >= 0; i--)
- {
- items[i][key] += value + (t * step);
- t++;
- }
- }
-
- return items;
-};
-
-module.exports = PropertyValueInc;
-
-
-/***/ }),
-/* 36 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Class = __webpack_require__(0);
-
-/**
- * @classdesc
- * A MultiFile is a special kind of parent that contains two, or more, Files as children and looks after
- * the loading and processing of them all. It is commonly extended and used as a base class for file types such as AtlasJSON or BitmapFont.
- *
- * You shouldn't create an instance of a MultiFile directly, but should extend it with your own class, setting a custom type and processing methods.
- *
- * @class MultiFile
- * @memberOf Phaser.Loader
- * @constructor
- * @since 3.7.0
- *
- * @param {Phaser.Loader.LoaderPlugin} loader - The Loader that is going to load this File.
- * @param {string} type - The file type string for sorting within the Loader.
- * @param {string} key - The key of the file within the loader.
- * @param {Phaser.Loader.File[]} files - An array of Files that make-up this MultiFile.
- */
-var MultiFile = new Class({
-
- initialize:
-
- function MultiFile (loader, type, key, files)
- {
- /**
- * A reference to the Loader that is going to load this file.
- *
- * @name Phaser.Loader.MultiFile#loader
- * @type {Phaser.Loader.LoaderPlugin}
- * @since 3.7.0
- */
- this.loader = loader;
-
- /**
- * The file type string for sorting within the Loader.
- *
- * @name Phaser.Loader.MultiFile#type
- * @type {string}
- * @since 3.7.0
- */
- this.type = type;
-
- /**
- * Unique cache key (unique within its file type)
- *
- * @name Phaser.Loader.MultiFile#key
- * @type {string}
- * @since 3.7.0
- */
- this.key = key;
-
- /**
- * Array of files that make up this MultiFile.
- *
- * @name Phaser.Loader.MultiFile#files
- * @type {Phaser.Loader.File[]}
- * @since 3.7.0
- */
- this.files = files;
-
- /**
- * The completion status of this MultiFile.
- *
- * @name Phaser.Loader.MultiFile#complete
- * @type {boolean}
- * @default false
- * @since 3.7.0
- */
- this.complete = false;
-
- /**
- * The number of files to load.
- *
- * @name Phaser.Loader.MultiFile#pending
- * @type {integer}
- * @since 3.7.0
- */
-
- this.pending = files.length;
-
- /**
- * The number of files that failed to load.
- *
- * @name Phaser.Loader.MultiFile#failed
- * @type {integer}
- * @default 0
- * @since 3.7.0
- */
- this.failed = 0;
-
- /**
- * A storage container for transient data that the loading files need.
- *
- * @name Phaser.Loader.MultiFile#config
- * @type {any}
- * @since 3.7.0
- */
- this.config = {};
-
- // Link the files
- for (var i = 0; i < files.length; i++)
- {
- files[i].multiFile = this;
- }
- },
-
- /**
- * Checks if this MultiFile is ready to process its children or not.
- *
- * @method Phaser.Loader.MultiFile#isReadyToProcess
- * @since 3.7.0
- *
- * @return {boolean} `true` if all children of this MultiFile have loaded, otherwise `false`.
- */
- isReadyToProcess: function ()
- {
- return (this.pending === 0 && this.failed === 0 && !this.complete);
- },
-
- /**
- * Adds another child to this MultiFile, increases the pending count and resets the completion status.
- *
- * @method Phaser.Loader.MultiFile#addToMultiFile
- * @since 3.7.0
- *
- * @param {Phaser.Loader.File} files - The File to add to this MultiFile.
- *
- * @return {Phaser.Loader.MultiFile} This MultiFile instance.
- */
- addToMultiFile: function (file)
- {
- this.files.push(file);
-
- file.multiFile = this;
-
- this.pending++;
-
- this.complete = false;
-
- return this;
- },
-
- /**
- * Called by each File when it finishes loading.
- *
- * @method Phaser.Loader.MultiFile#onFileComplete
- * @since 3.7.0
- *
- * @param {Phaser.Loader.File} file - The File that has completed processing.
- */
- onFileComplete: function (file)
- {
- var index = this.files.indexOf(file);
-
- if (index !== -1)
- {
- this.pending--;
- }
- },
-
- /**
- * Called by each File that fails to load.
- *
- * @method Phaser.Loader.MultiFile#onFileFailed
- * @since 3.7.0
- *
- * @param {Phaser.Loader.File} file - The File that has failed to load.
- */
- onFileFailed: function (file)
- {
- var index = this.files.indexOf(file);
-
- if (index !== -1)
- {
- this.failed++;
- }
- }
-
-});
-
-module.exports = MultiFile;
-
-
-/***/ }),
-/* 37 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Class = __webpack_require__(0);
-var CONST = __webpack_require__(18);
-var File = __webpack_require__(19);
-var FileTypesManager = __webpack_require__(7);
-var GetFastValue = __webpack_require__(1);
-var IsPlainObject = __webpack_require__(8);
-
-/**
- * @typedef {object} Phaser.Loader.FileTypes.ImageFrameConfig
- *
- * @property {integer} frameWidth - The width of the frame in pixels.
- * @property {integer} [frameHeight] - The height of the frame in pixels. Uses the `frameWidth` value if not provided.
- * @property {integer} [startFrame=0] - The first frame to start parsing from.
- * @property {integer} [endFrame] - The frame to stop parsing at. If not provided it will calculate the value based on the image and frame dimensions.
- * @property {integer} [margin=0] - The margin in the image. This is the space around the edge of the frames.
- * @property {integer} [spacing=0] - The spacing between each frame in the image.
- */
-
-/**
- * @typedef {object} Phaser.Loader.FileTypes.ImageFileConfig
- *
- * @property {string} key - The key of the file. Must be unique within both the Loader and the Texture Manager.
- * @property {string} [url] - The absolute or relative URL to load the file from.
- * @property {string} [extension='png'] - The default file extension to use if no url is provided.
- * @property {string} [normalMap] - The filename of an associated normal map. It uses the same path and url to load as the image.
- * @property {Phaser.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. Only provided for, and used by, Sprite Sheets.
- * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file.
- */
-
-/**
- * @classdesc
- * 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
- * @memberOf Phaser.Loader.FileTypes
- * @constructor
- * @since 3.0.0
- *
- * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file.
- * @param {(string|Phaser.Loader.FileTypes.ImageFileConfig)} key - The key to use for this file, or a file configuration object.
- * @param {string|string[]} [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 {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file.
- * @param {Phaser.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. Only provided for, and used by, Sprite Sheets.
- */
-var ImageFile = new Class({
-
- Extends: File,
-
- initialize:
-
- function ImageFile (loader, key, url, xhrSettings, frameConfig)
- {
- var extension = 'png';
- var normalMapURL;
-
- if (IsPlainObject(key))
- {
- var config = key;
-
- key = GetFastValue(config, 'key');
- url = GetFastValue(config, 'url');
- normalMapURL = GetFastValue(config, 'normalMap');
- xhrSettings = GetFastValue(config, 'xhrSettings');
- extension = GetFastValue(config, 'extension', extension);
- frameConfig = GetFastValue(config, 'frameConfig');
- }
-
- if (Array.isArray(url))
- {
- normalMapURL = url[1];
- url = url[0];
- }
-
- var fileConfig = {
- type: 'image',
- cache: loader.textureManager,
- extension: extension,
- responseType: 'blob',
- key: key,
- url: url,
- xhrSettings: xhrSettings,
- config: frameConfig
- };
-
- File.call(this, loader, fileConfig);
-
- // Do we have a normal map to load as well?
- if (normalMapURL)
- {
- var normalMap = new ImageFile(loader, this.key, normalMapURL, xhrSettings, frameConfig);
-
- normalMap.type = 'normalMap';
-
- this.setLink(normalMap);
-
- loader.addFile(normalMap);
- }
- },
-
- /**
- * Called automatically by Loader.nextFile.
- * This method controls what extra work this File does with its loaded data.
- *
- * @method Phaser.Loader.FileTypes.ImageFile#onProcess
- * @since 3.7.0
- */
- onProcess: function ()
- {
- this.state = CONST.FILE_PROCESSING;
-
- this.data = new Image();
-
- this.data.crossOrigin = this.crossOrigin;
-
- var _this = this;
-
- this.data.onload = function ()
- {
- File.revokeObjectURL(_this.data);
-
- _this.onProcessComplete();
- };
-
- this.data.onerror = function ()
- {
- File.revokeObjectURL(_this.data);
-
- _this.onProcessError();
- };
-
- File.createObjectURL(this.data, this.xhrLoader.response, 'image/png');
- },
-
- /**
- * Adds this file to its target cache upon successful loading and processing.
- *
- * @method Phaser.Loader.FileTypes.ImageFile#addToCache
- * @since 3.7.0
- */
- addToCache: function ()
- {
- var texture;
- var linkFile = this.linkFile;
-
- if (linkFile && linkFile.state === CONST.FILE_COMPLETE)
- {
- if (this.type === 'image')
- {
- texture = this.cache.addImage(this.key, this.data, linkFile.data);
- }
- else
- {
- texture = this.cache.addImage(linkFile.key, linkFile.data, this.data);
- }
-
- this.pendingDestroy(texture);
-
- linkFile.pendingDestroy(texture);
- }
- else if (!linkFile)
- {
- texture = this.cache.addImage(this.key, this.data);
-
- this.pendingDestroy(texture);
- }
- }
-
-});
-
-/**
- * Adds an Image, or array of Images, to the current load queue.
- *
- * 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.image('logo', 'images/phaserLogo.png');
- * }
- * ```
- *
- * 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.
- *
- * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle.
- * If you try to load an animated gif only the first frame will be rendered. Browsers do not natively support playback
- * of animated gifs to Canvas elements.
- *
- * 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.image({
- * key: 'logo',
- * url: 'images/AtariLogo.png'
- * });
- * ```
- *
- * See the documentation for `Phaser.Loader.FileTypes.ImageFileConfig` 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.image('logo', 'images/AtariLogo.png');
- * // and later in your game ...
- * this.add.image(x, y, 'logo');
- * ```
- *
- * 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.png". It will always add `.png` 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.
- *
- * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image,
- * then you can specify it by providing an array as the `url` where the second element is the normal map:
- *
- * ```javascript
- * this.load.image('logo', [ 'images/AtariLogo.png', 'images/AtariLogo-n.png' ]);
- * ```
- *
- * Or, if you are using a config object use the `normalMap` property:
- *
- * ```javascript
- * this.load.image({
- * key: 'logo',
- * url: 'images/AtariLogo.png',
- * normalMap: 'images/AtariLogo-n.png'
- * });
- * ```
- *
- * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings.
- * Normal maps are a WebGL only feature.
- *
- * Note: The ability to load this type of file will only be available if the Image File type has been built into Phaser.
- * It is available in the default build but can be excluded from custom builds.
- *
- * @method Phaser.Loader.LoaderPlugin#image
- * @fires Phaser.Loader.LoaderPlugin#addFileEvent
- * @since 3.0.0
- *
- * @param {(string|Phaser.Loader.FileTypes.ImageFileConfig|Phaser.Loader.FileTypes.ImageFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
- * @param {string|string[]} [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 {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings.
- *
- * @return {Phaser.Loader.LoaderPlugin} The Loader instance.
- */
-FileTypesManager.register('image', function (key, url, xhrSettings)
-{
- if (Array.isArray(key))
- {
- for (var i = 0; i < key.length; i++)
- {
- // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object
- this.addFile(new ImageFile(this, key[i]));
- }
- }
- else
- {
- this.addFile(new ImageFile(this, key, url, xhrSettings));
- }
-
- return this;
-});
-
-module.exports = ImageFile;
-
-
-/***/ }),
-/* 38 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var CONST = __webpack_require__(16);
-
-/**
- * Convert the given angle from degrees, to the equivalent angle in radians.
- *
- * @function Phaser.Math.DegToRad
- * @since 3.0.0
- *
- * @param {integer} degrees - The angle (in degrees) to convert to radians.
- *
- * @return {float} The given angle converted to radians.
- */
-var DegToRad = function (degrees)
-{
- return degrees * CONST.DEG_TO_RAD;
-};
-
-module.exports = DegToRad;
-
-
-/***/ }),
-/* 39 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Wrap the given `value` between `min` and `max.
- *
- * @function Phaser.Math.Wrap
- * @since 3.0.0
- *
- * @param {number} value - The value to wrap.
- * @param {number} min - The minimum value.
- * @param {number} max - The maximum value.
- *
- * @return {number} The wrapped value.
- */
-var Wrap = function (value, min, max)
-{
- var range = max - min;
-
- return (min + ((((value - min) % range) + range) % range));
-};
-
-module.exports = Wrap;
-
-
-/***/ }),
-/* 40 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var GetTileAt = __webpack_require__(140);
-var GetTilesWithin = __webpack_require__(21);
-
-/**
- * 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.
- *
- * @function Phaser.Tilemaps.Components.CalculateFacesWithin
- * @private
- * @since 3.0.0
- *
- * @param {integer} tileX - [description]
- * @param {integer} tileY - [description]
- * @param {integer} width - [description]
- * @param {integer} height - [description]
- * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
- */
-var CalculateFacesWithin = function (tileX, tileY, width, height, layer)
-{
- var above = null;
- var below = null;
- var left = null;
- var right = null;
-
- var tiles = GetTilesWithin(tileX, tileY, width, height, null, layer);
-
- for (var i = 0; i < tiles.length; i++)
- {
- var tile = tiles[i];
-
- if (tile)
- {
- if (tile.collides)
- {
- above = GetTileAt(tile.x, tile.y - 1, true, layer);
- below = GetTileAt(tile.x, tile.y + 1, true, layer);
- left = GetTileAt(tile.x - 1, tile.y, true, layer);
- right = GetTileAt(tile.x + 1, tile.y, true, layer);
-
- tile.faceTop = (above && above.collides) ? false : true;
- tile.faceBottom = (below && below.collides) ? false : true;
- tile.faceLeft = (left && left.collides) ? false : true;
- tile.faceRight = (right && right.collides) ? false : true;
- }
- else
- {
- tile.resetFaces();
- }
- }
- }
-};
-
-module.exports = CalculateFacesWithin;
-
-
-/***/ }),
-/* 41 */,
-/* 42 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Arcade Physics consts.
- *
- * @ignore
- */
-
-var CONST = {
-
- /**
- * [description]
- *
- * @name Phaser.Physics.Arcade.DYNAMIC_BODY
- * @readOnly
- * @type {number}
- * @since 3.0.0
- */
- DYNAMIC_BODY: 0,
-
- /**
- * [description]
- *
- * @name Phaser.Physics.Arcade.STATIC_BODY
- * @readOnly
- * @type {number}
- * @since 3.0.0
- */
- STATIC_BODY: 1,
-
- /**
- * [description]
- *
- * @name Phaser.Physics.Arcade.GROUP
- * @readOnly
- * @type {number}
- * @since 3.0.0
- */
- GROUP: 2,
-
- /**
- * [description]
- *
- * @name Phaser.Physics.Arcade.TILEMAPLAYER
- * @readOnly
- * @type {number}
- * @since 3.0.0
- */
- TILEMAPLAYER: 3,
-
- /**
- * [description]
- *
- * @name Phaser.Physics.Arcade.FACING_NONE
- * @readOnly
- * @type {number}
- * @since 3.0.0
- */
- FACING_NONE: 10,
-
- /**
- * [description]
- *
- * @name Phaser.Physics.Arcade.FACING_UP
- * @readOnly
- * @type {number}
- * @since 3.0.0
- */
- FACING_UP: 11,
-
- /**
- * [description]
- *
- * @name Phaser.Physics.Arcade.FACING_DOWN
- * @readOnly
- * @type {number}
- * @since 3.0.0
- */
- FACING_DOWN: 12,
-
- /**
- * [description]
- *
- * @name Phaser.Physics.Arcade.FACING_LEFT
- * @readOnly
- * @type {number}
- * @since 3.0.0
- */
- FACING_LEFT: 13,
-
- /**
- * [description]
- *
- * @name Phaser.Physics.Arcade.FACING_RIGHT
- * @readOnly
- * @type {number}
- * @since 3.0.0
- */
- FACING_RIGHT: 14
-
-};
-
-module.exports = CONST;
-
-
-/***/ }),
-/* 43 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Positions the Game Object so that the top of its bounds aligns with the given coordinate.
- *
- * @function Phaser.Display.Bounds.SetTop
- * @since 3.0.0
- *
- * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return]
- *
- * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned.
- * @param {number} value - The coordinate to position the Game Object bounds on.
- *
- * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned.
- */
-var SetTop = function (gameObject, value)
-{
- gameObject.y = value + (gameObject.height * gameObject.originY);
-
- return gameObject;
-};
-
-module.exports = SetTop;
-
-
-/***/ }),
-/* 44 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Returns the top coordinate from the bounds of the Game Object.
- *
- * @function Phaser.Display.Bounds.GetTop
- * @since 3.0.0
- *
- * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from.
- *
- * @return {number} The top coordinate of the bounds of the Game Object.
- */
-var GetTop = function (gameObject)
-{
- return gameObject.y - (gameObject.height * gameObject.originY);
-};
-
-module.exports = GetTop;
-
-
-/***/ }),
-/* 45 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Positions the Game Object so that the left of its bounds aligns with the given coordinate.
- *
- * @function Phaser.Display.Bounds.SetRight
- * @since 3.0.0
- *
- * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return]
- *
- * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned.
- * @param {number} value - The coordinate to position the Game Object bounds on.
- *
- * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned.
- */
-var SetRight = function (gameObject, value)
-{
- gameObject.x = (value - gameObject.width) + (gameObject.width * gameObject.originX);
-
- return gameObject;
-};
-
-module.exports = SetRight;
-
-
-/***/ }),
-/* 46 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Returns the right coordinate from the bounds of the Game Object.
- *
- * @function Phaser.Display.Bounds.GetRight
- * @since 3.0.0
- *
- * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from.
- *
- * @return {number} The right coordinate of the bounds of the Game Object.
- */
-var GetRight = function (gameObject)
-{
- return (gameObject.x + gameObject.width) - (gameObject.width * gameObject.originX);
-};
-
-module.exports = GetRight;
-
-
-/***/ }),
-/* 47 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Positions the Game Object so that the left of its bounds aligns with the given coordinate.
- *
- * @function Phaser.Display.Bounds.SetLeft
- * @since 3.0.0
- *
- * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return]
- *
- * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned.
- * @param {number} value - The coordinate to position the Game Object bounds on.
- *
- * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned.
- */
-var SetLeft = function (gameObject, value)
-{
- gameObject.x = value + (gameObject.width * gameObject.originX);
-
- return gameObject;
-};
-
-module.exports = SetLeft;
-
-
-/***/ }),
-/* 48 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Returns the left coordinate from the bounds of the Game Object.
- *
- * @function Phaser.Display.Bounds.GetLeft
- * @since 3.0.0
- *
- * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from.
- *
- * @return {number} The left coordinate of the bounds of the Game Object.
- */
-var GetLeft = function (gameObject)
-{
- return gameObject.x - (gameObject.width * gameObject.originX);
-};
-
-module.exports = GetLeft;
-
-
-/***/ }),
-/* 49 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Positions the Game Object so that the bottom of its bounds aligns with the given coordinate.
- *
- * @function Phaser.Display.Bounds.SetBottom
- * @since 3.0.0
- *
- * @generic {Phaser.GameObjects.GameObject} G - [gameObject,$return]
- *
- * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that will be re-positioned.
- * @param {number} value - The coordinate to position the Game Object bounds on.
- *
- * @return {Phaser.GameObjects.GameObject} The Game Object that was positioned.
- */
-var SetBottom = function (gameObject, value)
-{
- gameObject.y = (value - gameObject.height) + (gameObject.height * gameObject.originY);
-
- return gameObject;
-};
-
-module.exports = SetBottom;
-
-
-/***/ }),
-/* 50 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Returns the bottom coordinate from the bounds of the Game Object.
- *
- * @function Phaser.Display.Bounds.GetBottom
- * @since 3.0.0
- *
- * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to get the bounds value from.
- *
- * @return {number} The bottom coordinate of the bounds of the Game Object.
- */
-var GetBottom = function (gameObject)
-{
- return (gameObject.y + gameObject.height) - (gameObject.height * gameObject.originY);
-};
-
-module.exports = GetBottom;
-
-
-/***/ }),
-/* 51 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Phaser Blend Modes.
- *
- * @name Phaser.BlendModes
- * @enum {integer}
- * @memberOf Phaser
- * @readOnly
- * @since 3.0.0
- */
-
-module.exports = {
-
- /**
- * Skips the Blend Mode check in the renderer.
- *
- * @name Phaser.BlendModes.SKIP_CHECK
- */
- SKIP_CHECK: -1,
-
- /**
- * Normal blend mode.
- *
- * @name Phaser.BlendModes.NORMAL
- */
- NORMAL: 0,
-
- /**
- * Add blend mode.
- *
- * @name Phaser.BlendModes.ADD
- */
- ADD: 1,
-
- /**
- * Multiply blend mode.
- *
- * @name Phaser.BlendModes.MULTIPLY
- */
- MULTIPLY: 2,
-
- /**
- * Screen blend mode.
- *
- * @name Phaser.BlendModes.SCREEN
- */
- SCREEN: 3,
-
- /**
- * Overlay blend mode.
- *
- * @name Phaser.BlendModes.OVERLAY
- */
- OVERLAY: 4,
-
- /**
- * Darken blend mode.
- *
- * @name Phaser.BlendModes.DARKEN
- */
- DARKEN: 5,
-
- /**
- * Lighten blend mode.
- *
- * @name Phaser.BlendModes.LIGHTEN
- */
- LIGHTEN: 6,
-
- /**
- * Color Dodge blend mode.
- *
- * @name Phaser.BlendModes.COLOR_DODGE
- */
- COLOR_DODGE: 7,
-
- /**
- * Color Burn blend mode.
- *
- * @name Phaser.BlendModes.COLOR_BURN
- */
- COLOR_BURN: 8,
-
- /**
- * Hard Light blend mode.
- *
- * @name Phaser.BlendModes.HARD_LIGHT
- */
- HARD_LIGHT: 9,
-
- /**
- * Soft Light blend mode.
- *
- * @name Phaser.BlendModes.SOFT_LIGHT
- */
- SOFT_LIGHT: 10,
-
- /**
- * Difference blend mode.
- *
- * @name Phaser.BlendModes.DIFFERENCE
- */
- DIFFERENCE: 11,
-
- /**
- * Exclusion blend mode.
- *
- * @name Phaser.BlendModes.EXCLUSION
- */
- EXCLUSION: 12,
-
- /**
- * Hue blend mode.
- *
- * @name Phaser.BlendModes.HUE
- */
- HUE: 13,
-
- /**
- * Saturation blend mode.
- *
- * @name Phaser.BlendModes.SATURATION
- */
- SATURATION: 14,
-
- /**
- * Color blend mode.
- *
- * @name Phaser.BlendModes.COLOR
- */
- COLOR: 15,
-
- /**
- * Luminosity blend mode.
- *
- * @name Phaser.BlendModes.LUMINOSITY
- */
- LUMINOSITY: 16
-
-};
-
-
/***/ }),
/* 52 */
/***/ (function(module, exports) {
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the
- * layer's position, scale and scroll.
- *
- * @function Phaser.Tilemaps.Components.WorldToTileY
- * @private
- * @since 3.0.0
- *
- * @param {number} worldY - [description]
- * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the
- * nearest integer.
- * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
- * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
- *
- * @return {number} The Y location in tile units.
- */
-var WorldToTileY = function (worldY, snapToFloor, camera, layer)
-{
- if (snapToFloor === undefined) { snapToFloor = true; }
-
- var tileHeight = layer.baseTileHeight;
- var tilemapLayer = layer.tilemapLayer;
-
- if (tilemapLayer)
- {
- if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; }
-
- // Find the world position relative to the static or dynamic layer's top left origin,
- // factoring in the camera's vertical scroll
- worldY = worldY - (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY));
-
- tileHeight *= tilemapLayer.scaleY;
- }
-
- return snapToFloor
- ? Math.floor(worldY / tileHeight)
- : worldY / tileHeight;
-};
-
-module.exports = WorldToTileY;
-
-
-/***/ }),
-/* 53 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the
- * layer's position, scale and scroll.
- *
- * @function Phaser.Tilemaps.Components.WorldToTileX
- * @private
- * @since 3.0.0
- *
- * @param {number} worldX - [description]
- * @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the
- * nearest integer.
- * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
- * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
- *
- * @return {number} The X location in tile units.
- */
-var WorldToTileX = function (worldX, snapToFloor, camera, layer)
-{
- if (snapToFloor === undefined) { snapToFloor = true; }
-
- var tileWidth = layer.baseTileWidth;
- var tilemapLayer = layer.tilemapLayer;
-
- if (tilemapLayer)
- {
- if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; }
-
- // Find the world position relative to the static or dynamic layer's top left origin,
- // factoring in the camera's horizontal scroll
- worldX = worldX - (tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX));
-
- tileWidth *= tilemapLayer.scaleX;
- }
-
- return snapToFloor
- ? Math.floor(worldX / tileWidth)
- : worldX / tileWidth;
-};
-
-module.exports = WorldToTileX;
-
-
-/***/ }),
-/* 54 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Check to see if the Ellipse contains the given x / y coordinates.
- *
- * @function Phaser.Geom.Ellipse.Contains
- * @since 3.0.0
- *
- * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to check.
- * @param {number} x - The x coordinate to check within the ellipse.
- * @param {number} y - The y coordinate to check within the ellipse.
- *
- * @return {boolean} True if the coordinates are within the ellipse, otherwise false.
- */
-var Contains = function (ellipse, x, y)
-{
- if (ellipse.width <= 0 || ellipse.height <= 0)
- {
- return false;
- }
-
- // Normalize the coords to an ellipse with center 0,0 and a radius of 0.5
- var normx = ((x - ellipse.x) / ellipse.width);
- var normy = ((y - ellipse.y) / ellipse.height);
-
- normx *= normx;
- normy *= normy;
-
- return (normx + normy < 0.25);
-};
-
-module.exports = Contains;
-
-
-/***/ }),
-/* 55 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Scene consts.
- *
- * @ignore
- */
-
-var CONST = {
-
- /**
- * Scene state.
- *
- * @name Phaser.Scenes.PENDING
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- PENDING: 0,
-
- /**
- * Scene state.
- *
- * @name Phaser.Scenes.INIT
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- INIT: 1,
-
- /**
- * Scene state.
- *
- * @name Phaser.Scenes.START
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- START: 2,
-
- /**
- * Scene state.
- *
- * @name Phaser.Scenes.LOADING
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- LOADING: 3,
-
- /**
- * Scene state.
- *
- * @name Phaser.Scenes.CREATING
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- CREATING: 4,
-
- /**
- * Scene state.
- *
- * @name Phaser.Scenes.RUNNING
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- RUNNING: 5,
-
- /**
- * Scene state.
- *
- * @name Phaser.Scenes.PAUSED
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- PAUSED: 6,
-
- /**
- * Scene state.
- *
- * @name Phaser.Scenes.SLEEPING
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- SLEEPING: 7,
-
- /**
- * Scene state.
- *
- * @name Phaser.Scenes.SHUTDOWN
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- SHUTDOWN: 8,
-
- /**
- * Scene state.
- *
- * @name Phaser.Scenes.DESTROYED
- * @readOnly
- * @type {integer}
- * @since 3.0.0
- */
- DESTROYED: 9
-
-};
-
-module.exports = CONST;
-
-
-/***/ }),
-/* 56 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Removes a single item from an array and returns it without creating gc, like the native splice does.
- * Based on code by Mike Reinstein.
- *
- * @function Phaser.Utils.Array.SpliceOne
- * @since 3.0.0
- *
- * @param {array} array - [description]
- * @param {integer} index - [description]
- *
- * @return {*} [description]
- */
-var SpliceOne = function (array, index)
-{
- if (index >= array.length)
- {
- return;
- }
-
- var len = array.length - 1;
-
- var item = array[index];
-
- for (var i = index; i < len; i++)
- {
- array[i] = array[i + 1];
- }
-
- array.length = len;
-
- return item;
-};
-
-module.exports = SpliceOne;
-
-
-/***/ }),
-/* 57 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/* WEBPACK VAR INJECTION */(function(process) {/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Determines the operating system of the device running this Phaser Game instance.
- * These values are read-only and populated during the boot sequence of the game.
- * They are then referenced by internal game systems and are available for you to access
- * via `this.sys.game.device.os` from within any Scene.
- *
- * @typedef {object} Phaser.Device.OS
- * @since 3.0.0
- *
- * @property {boolean} android - Is running on android?
- * @property {boolean} chromeOS - Is running on chromeOS?
- * @property {boolean} cocoonJS - Is the game running under CocoonJS?
- * @property {boolean} cocoonJSApp - Is this game running with CocoonJS.App?
- * @property {boolean} cordova - Is the game running under Apache Cordova?
- * @property {boolean} crosswalk - Is the game running under the Intel Crosswalk XDK?
- * @property {boolean} desktop - Is running on a desktop?
- * @property {boolean} ejecta - Is the game running under Ejecta?
- * @property {boolean} electron - Is the game running under GitHub Electron?
- * @property {boolean} iOS - Is running on iOS?
- * @property {boolean} iPad - Is running on iPad?
- * @property {boolean} iPhone - Is running on iPhone?
- * @property {boolean} kindle - Is running on an Amazon Kindle?
- * @property {boolean} linux - Is running on linux?
- * @property {boolean} macOS - Is running on macOS?
- * @property {boolean} node - Is the game running under Node.js?
- * @property {boolean} nodeWebkit - Is the game running under Node-Webkit?
- * @property {boolean} webApp - Set to true if running as a WebApp, i.e. within a WebView
- * @property {boolean} windows - Is running on windows?
- * @property {boolean} windowsPhone - Is running on a Windows Phone?
- * @property {number} iOSVersion - If running in iOS this will contain the major version number.
- * @property {number} pixelRatio - PixelRatio of the host device?
- */
-var OS = {
-
- android: false,
- chromeOS: false,
- cocoonJS: false,
- cocoonJSApp: false,
- cordova: false,
- crosswalk: false,
- desktop: false,
- ejecta: false,
- electron: false,
- iOS: false,
- iOSVersion: 0,
- iPad: false,
- iPhone: false,
- kindle: false,
- linux: false,
- macOS: false,
- node: false,
- nodeWebkit: false,
- pixelRatio: 1,
- webApp: false,
- windows: false,
- windowsPhone: false
-
-};
-
-function init ()
-{
- var ua = navigator.userAgent;
-
- if (/Windows/.test(ua))
- {
- OS.windows = true;
- }
- else if (/Mac OS/.test(ua))
- {
- OS.macOS = true;
- }
- else if (/Android/.test(ua))
- {
- OS.android = true;
- }
- else if (/Linux/.test(ua))
- {
- OS.linux = true;
- }
- else if (/iP[ao]d|iPhone/i.test(ua))
- {
- OS.iOS = true;
- (navigator.appVersion).match(/OS (\d+)/);
- OS.iOSVersion = parseInt(RegExp.$1, 10);
- }
- else if (/Kindle/.test(ua) || (/\bKF[A-Z][A-Z]+/).test(ua) || (/Silk.*Mobile Safari/).test(ua))
- {
- OS.kindle = true;
-
- // This will NOT detect early generations of Kindle Fire, I think there is no reliable way...
- // E.g. "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-80) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true"
- }
- else if (/CrOS/.test(ua))
- {
- OS.chromeOS = true;
- }
-
- if (/Windows Phone/i.test(ua) || (/IEMobile/i).test(ua))
- {
- OS.android = false;
- OS.iOS = false;
- OS.macOS = false;
- OS.windows = true;
- OS.windowsPhone = true;
- }
-
- var silk = (/Silk/).test(ua);
-
- if (OS.windows || OS.macOS || (OS.linux && !silk) || OS.chromeOS)
- {
- OS.desktop = true;
- }
-
- // Windows Phone / Table reset
- if (OS.windowsPhone || ((/Windows NT/i.test(ua)) && (/Touch/i.test(ua))))
- {
- OS.desktop = false;
- }
-
- // WebApp mode in iOS
- if (navigator.standalone)
- {
- OS.webApp = true;
- }
-
- if (window.cordova !== undefined)
- {
- OS.cordova = true;
- }
-
- if (process && process.versions && process.versions.node)
- {
- OS.node = true;
- }
-
- if (OS.node && typeof process.versions === 'object')
- {
- OS.nodeWebkit = !!process.versions['node-webkit'];
-
- OS.electron = !!process.versions.electron;
- }
-
- if (navigator.isCocoonJS)
- {
- OS.cocoonJS = true;
-
- try
- {
- OS.cocoonJSApp = (typeof CocoonJS !== 'undefined');
- }
- catch (error)
- {
- OS.cocoonJSApp = false;
- }
- }
-
- if (window.ejecta !== undefined)
- {
- OS.ejecta = true;
- }
-
- if ((/Crosswalk/).test(ua))
- {
- OS.crosswalk = true;
- }
-
- OS.iPhone = ua.toLowerCase().indexOf('iphone') !== -1;
- OS.iPad = ua.toLowerCase().indexOf('ipad') !== -1;
-
- OS.pixelRatio = window['devicePixelRatio'] || 1;
-
- return OS;
-}
-
-module.exports = init();
-
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(537)))
-
-/***/ }),
-/* 58 */
-/***/ (function(module, exports) {
-
/**
* @author Richard Davey
* @copyright 2018 Photon Storm Ltd.
@@ -7967,7 +8448,7 @@ module.exports = DistanceBetween;
/***/ }),
-/* 59 */
+/* 53 */
/***/ (function(module, exports) {
/**
@@ -7977,371 +8458,29 @@ module.exports = DistanceBetween;
*/
/**
- * Phaser Scale Modes.
- *
- * @name Phaser.ScaleModes
- * @enum {integer}
- * @memberOf Phaser
- * @readOnly
- * @since 3.0.0
- */
-
-module.exports = {
-
- /**
- * Default Scale Mode (Linear).
- *
- * @name Phaser.ScaleModes.DEFAULT
- */
- DEFAULT: 0,
-
- /**
- * Linear Scale Mode.
- *
- * @name Phaser.ScaleModes.LINEAR
- */
- LINEAR: 0,
-
- /**
- * Nearest Scale Mode.
- *
- * @name Phaser.ScaleModes.NEAREST
- */
- NEAREST: 1
-
-};
-
-
-/***/ }),
-/* 60 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-// http://www.blackpawn.com/texts/pointinpoly/
-
-/**
- * [description]
+ * Wrap the given `value` between `min` and `max.
*
- * @function Phaser.Geom.Triangle.Contains
+ * @function Phaser.Math.Wrap
* @since 3.0.0
*
- * @param {Phaser.Geom.Triangle} triangle - [description]
- * @param {number} x - [description]
- * @param {number} y - [description]
+ * @param {number} value - The value to wrap.
+ * @param {number} min - The minimum value.
+ * @param {number} max - The maximum value.
*
- * @return {boolean} [description]
+ * @return {number} The wrapped value.
*/
-var Contains = function (triangle, x, y)
+var Wrap = function (value, min, max)
{
- var v0x = triangle.x3 - triangle.x1;
- var v0y = triangle.y3 - triangle.y1;
+ var range = max - min;
- var v1x = triangle.x2 - triangle.x1;
- var v1y = triangle.y2 - triangle.y1;
-
- var v2x = x - triangle.x1;
- var v2y = y - triangle.y1;
-
- var dot00 = (v0x * v0x) + (v0y * v0y);
- var dot01 = (v0x * v1x) + (v0y * v1y);
- var dot02 = (v0x * v2x) + (v0y * v2y);
- var dot11 = (v1x * v1x) + (v1y * v1y);
- var dot12 = (v1x * v2x) + (v1y * v2y);
-
- // Compute barycentric coordinates
- var b = ((dot00 * dot11) - (dot01 * dot01));
- var inv = (b === 0) ? 0 : (1 / b);
- var u = ((dot11 * dot02) - (dot01 * dot12)) * inv;
- var v = ((dot00 * dot12) - (dot01 * dot02)) * inv;
-
- return (u >= 0 && v >= 0 && (u + v < 1));
+ return (min + ((((value - min) % range) + range) % range));
};
-module.exports = Contains;
+module.exports = Wrap;
/***/ }),
-/* 61 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var TWEEN_CONST = {
-
- /**
- * TweenData state.
- *
- * @name Phaser.Tweens.CREATED
- * @type {integer}
- * @since 3.0.0
- */
- CREATED: 0,
-
- /**
- * TweenData state.
- *
- * @name Phaser.Tweens.INIT
- * @type {integer}
- * @since 3.0.0
- */
- INIT: 1,
-
- /**
- * TweenData state.
- *
- * @name Phaser.Tweens.DELAY
- * @type {integer}
- * @since 3.0.0
- */
- DELAY: 2,
-
- /**
- * TweenData state.
- *
- * @name Phaser.Tweens.OFFSET_DELAY
- * @type {integer}
- * @since 3.0.0
- */
- OFFSET_DELAY: 3,
-
- /**
- * TweenData state.
- *
- * @name Phaser.Tweens.PENDING_RENDER
- * @type {integer}
- * @since 3.0.0
- */
- PENDING_RENDER: 4,
-
- /**
- * TweenData state.
- *
- * @name Phaser.Tweens.PLAYING_FORWARD
- * @type {integer}
- * @since 3.0.0
- */
- PLAYING_FORWARD: 5,
-
- /**
- * TweenData state.
- *
- * @name Phaser.Tweens.PLAYING_BACKWARD
- * @type {integer}
- * @since 3.0.0
- */
- PLAYING_BACKWARD: 6,
-
- /**
- * TweenData state.
- *
- * @name Phaser.Tweens.HOLD_DELAY
- * @type {integer}
- * @since 3.0.0
- */
- HOLD_DELAY: 7,
-
- /**
- * TweenData state.
- *
- * @name Phaser.Tweens.REPEAT_DELAY
- * @type {integer}
- * @since 3.0.0
- */
- REPEAT_DELAY: 8,
-
- /**
- * TweenData state.
- *
- * @name Phaser.Tweens.COMPLETE
- * @type {integer}
- * @since 3.0.0
- */
- COMPLETE: 9,
-
- // Tween specific (starts from 20 to cleanly allow extra TweenData consts in the future)
-
- /**
- * Tween state.
- *
- * @name Phaser.Tweens.PENDING_ADD
- * @type {integer}
- * @since 3.0.0
- */
- PENDING_ADD: 20,
-
- /**
- * Tween state.
- *
- * @name Phaser.Tweens.PAUSED
- * @type {integer}
- * @since 3.0.0
- */
- PAUSED: 21,
-
- /**
- * Tween state.
- *
- * @name Phaser.Tweens.LOOP_DELAY
- * @type {integer}
- * @since 3.0.0
- */
- LOOP_DELAY: 22,
-
- /**
- * Tween state.
- *
- * @name Phaser.Tweens.ACTIVE
- * @type {integer}
- * @since 3.0.0
- */
- ACTIVE: 23,
-
- /**
- * Tween state.
- *
- * @name Phaser.Tweens.COMPLETE_DELAY
- * @type {integer}
- * @since 3.0.0
- */
- COMPLETE_DELAY: 24,
-
- /**
- * Tween state.
- *
- * @name Phaser.Tweens.PENDING_REMOVE
- * @type {integer}
- * @since 3.0.0
- */
- PENDING_REMOVE: 25,
-
- /**
- * Tween state.
- *
- * @name Phaser.Tweens.REMOVED
- * @type {integer}
- * @since 3.0.0
- */
- REMOVED: 26
-
-};
-
-module.exports = TWEEN_CONST;
-
-
-/***/ }),
-/* 62 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * [description]
- *
- * @function Phaser.Tweens.Builders.GetBoolean
- * @since 3.0.0
- *
- * @param {object} source - [description]
- * @param {string} key - [description]
- * @param {*} defaultValue - [description]
- *
- * @return {*} [description]
- */
-var GetBoolean = function (source, key, defaultValue)
-{
- if (!source)
- {
- return defaultValue;
- }
- else if (source.hasOwnProperty(key))
- {
- return source[key];
- }
- else
- {
- return defaultValue;
- }
-};
-
-module.exports = GetBoolean;
-
-
-/***/ }),
-/* 63 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var EaseMap = __webpack_require__(453);
-
-/**
- * [description]
- *
- * @function Phaser.Tweens.Builders.GetEaseFunction
- * @since 3.0.0
- *
- * @param {(string|function)} ease - [description]
- * @param {array} easeParams - [description]
- *
- * @return {function} [description]
- */
-var GetEaseFunction = function (ease, easeParams)
-{
- if (typeof ease === 'string' && EaseMap.hasOwnProperty(ease))
- {
- if (easeParams)
- {
- var cloneParams = easeParams.slice(0);
-
- cloneParams.unshift(0);
-
- return function (v)
- {
- cloneParams[0] = v;
-
- return EaseMap[ease].apply(this, cloneParams);
- };
- }
- else
- {
- // String based look-up
- return EaseMap[ease];
- }
- }
- else if (typeof ease === 'function')
- {
- // Custom function
- return ease;
- }
- else if (Array.isArray(ease) && ease.length === 4)
- {
- // Bezier function (TODO)
- }
-
- return EaseMap.Power0;
-};
-
-module.exports = GetEaseFunction;
-
-
-/***/ }),
-/* 64 */
+/* 54 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -8351,628 +8490,322 @@ module.exports = GetEaseFunction;
*/
var Class = __webpack_require__(0);
+var GetPoint = __webpack_require__(397);
+var GetPoints = __webpack_require__(189);
+var Random = __webpack_require__(188);
+var Vector2 = __webpack_require__(3);
/**
* @classdesc
- * [description]
+ * Defines a Line segment, a part of a line between two endpoints.
*
- * @class TransformMatrix
- * @memberOf Phaser.GameObjects.Components
+ * @class Line
+ * @memberof Phaser.Geom
* @constructor
* @since 3.0.0
*
- * @param {number} [a=1] - The Scale X value.
- * @param {number} [b=0] - The Shear Y value.
- * @param {number} [c=0] - The Shear X value.
- * @param {number} [d=1] - The Scale Y value.
- * @param {number} [tx=0] - The Translate X value.
- * @param {number} [ty=0] - The Translate Y value.
+ * @param {number} [x1=0] - The x coordinate of the lines starting point.
+ * @param {number} [y1=0] - The y coordinate of the lines starting point.
+ * @param {number} [x2=0] - The x coordinate of the lines ending point.
+ * @param {number} [y2=0] - The y coordinate of the lines ending point.
*/
-var TransformMatrix = new Class({
+var Line = new Class({
initialize:
- function TransformMatrix (a, b, c, d, tx, ty)
+ function Line (x1, y1, x2, y2)
{
- if (a === undefined) { a = 1; }
- if (b === undefined) { b = 0; }
- if (c === undefined) { c = 0; }
- if (d === undefined) { d = 1; }
- if (tx === undefined) { tx = 0; }
- if (ty === undefined) { ty = 0; }
+ if (x1 === undefined) { x1 = 0; }
+ if (y1 === undefined) { y1 = 0; }
+ if (x2 === undefined) { x2 = 0; }
+ if (y2 === undefined) { y2 = 0; }
/**
- * [description]
+ * The x coordinate of the lines starting point.
*
- * @name Phaser.GameObjects.Components.TransformMatrix#matrix
- * @type {Float32Array}
+ * @name Phaser.Geom.Line#x1
+ * @type {number}
* @since 3.0.0
*/
- this.matrix = new Float32Array([ a, b, c, d, tx, ty, 0, 0, 1 ]);
+ this.x1 = x1;
/**
- * [description]
+ * The y coordinate of the lines starting point.
*
- * @name Phaser.GameObjects.Components.TransformMatrix#decomposedMatrix
- * @type {object}
+ * @name Phaser.Geom.Line#y1
+ * @type {number}
* @since 3.0.0
*/
- this.decomposedMatrix = {
- translateX: 0,
- translateY: 0,
- scaleX: 1,
- scaleY: 1,
- rotation: 0
- };
+ this.y1 = y1;
+
+ /**
+ * The x coordinate of the lines ending point.
+ *
+ * @name Phaser.Geom.Line#x2
+ * @type {number}
+ * @since 3.0.0
+ */
+ this.x2 = x2;
+
+ /**
+ * The y coordinate of the lines ending point.
+ *
+ * @name Phaser.Geom.Line#y2
+ * @type {number}
+ * @since 3.0.0
+ */
+ this.y2 = y2;
},
/**
- * [description]
+ * Get a point on a line that's a given percentage along its length.
*
- * @name Phaser.GameObjects.Components.TransformMatrix#a
- * @type {number}
- * @since 3.4.0
+ * @method Phaser.Geom.Line#getPoint
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Geom.Point} O - [output,$return]
+ *
+ * @param {number} position - A value between 0 and 1, where 0 is the start, 0.5 is the middle and 1 is the end of the line.
+ * @param {(Phaser.Geom.Point|object)} [output] - An optional point, or point-like object, to store the coordinates of the point on the line.
+ *
+ * @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point on the line.
*/
- a: {
+ getPoint: function (position, output)
+ {
+ return GetPoint(this, position, output);
+ },
+
+ /**
+ * Get a number of points along a line's length.
+ *
+ * Provide a `quantity` to get an exact number of points along the line.
+ *
+ * Provide a `stepRate` to ensure a specific distance between each point on the line. Set `quantity` to `0` when
+ * providing a `stepRate`.
+ *
+ * @method Phaser.Geom.Line#getPoints
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Geom.Point} O - [output,$return]
+ *
+ * @param {integer} quantity - The number of points to place on the line. Set to `0` to use `stepRate` instead.
+ * @param {integer} [stepRate] - The distance between each point on the line. When set, `quantity` is implied and should be set to `0`.
+ * @param {(array|Phaser.Geom.Point[])} [output] - An optional array of Points, or point-like objects, to store the coordinates of the points on the line.
+ *
+ * @return {(array|Phaser.Geom.Point[])} An array of Points, or point-like objects, containing the coordinates of the points on the line.
+ */
+ getPoints: function (quantity, stepRate, output)
+ {
+ return GetPoints(this, quantity, stepRate, output);
+ },
+
+ /**
+ * Get a random Point on the Line.
+ *
+ * @method Phaser.Geom.Line#getRandomPoint
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Geom.Point} O - [point,$return]
+ *
+ * @param {(Phaser.Geom.Point|object)} [point] - An instance of a Point to be modified.
+ *
+ * @return {Phaser.Geom.Point} A random Point on the Line.
+ */
+ getRandomPoint: function (point)
+ {
+ return Random(this, point);
+ },
+
+ /**
+ * Set new coordinates for the line endpoints.
+ *
+ * @method Phaser.Geom.Line#setTo
+ * @since 3.0.0
+ *
+ * @param {number} [x1=0] - The x coordinate of the lines starting point.
+ * @param {number} [y1=0] - The y coordinate of the lines starting point.
+ * @param {number} [x2=0] - The x coordinate of the lines ending point.
+ * @param {number} [y2=0] - The y coordinate of the lines ending point.
+ *
+ * @return {Phaser.Geom.Line} This Line object.
+ */
+ setTo: function (x1, y1, x2, y2)
+ {
+ if (x1 === undefined) { x1 = 0; }
+ if (y1 === undefined) { y1 = 0; }
+ if (x2 === undefined) { x2 = 0; }
+ if (y2 === undefined) { y2 = 0; }
+
+ this.x1 = x1;
+ this.y1 = y1;
+
+ this.x2 = x2;
+ this.y2 = y2;
+
+ return this;
+ },
+
+ /**
+ * Returns a Vector2 object that corresponds to the start of this Line.
+ *
+ * @method Phaser.Geom.Line#getPointA
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Math.Vector2} O - [vec2,$return]
+ *
+ * @param {Phaser.Math.Vector2} [vec2] - A Vector2 object to set the results in. If `undefined` a new Vector2 will be created.
+ *
+ * @return {Phaser.Math.Vector2} A Vector2 object that corresponds to the start of this Line.
+ */
+ getPointA: function (vec2)
+ {
+ if (vec2 === undefined) { vec2 = new Vector2(); }
+
+ vec2.set(this.x1, this.y1);
+
+ return vec2;
+ },
+
+ /**
+ * Returns a Vector2 object that corresponds to the end of this Line.
+ *
+ * @method Phaser.Geom.Line#getPointB
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Math.Vector2} O - [vec2,$return]
+ *
+ * @param {Phaser.Math.Vector2} [vec2] - A Vector2 object to set the results in. If `undefined` a new Vector2 will be created.
+ *
+ * @return {Phaser.Math.Vector2} A Vector2 object that corresponds to the end of this Line.
+ */
+ getPointB: function (vec2)
+ {
+ if (vec2 === undefined) { vec2 = new Vector2(); }
+
+ vec2.set(this.x2, this.y2);
+
+ return vec2;
+ },
+
+ /**
+ * The left position of the Line.
+ *
+ * @name Phaser.Geom.Line#left
+ * @type {number}
+ * @since 3.0.0
+ */
+ left: {
get: function ()
{
- return this.matrix[0];
+ return Math.min(this.x1, this.x2);
},
set: function (value)
{
- this.matrix[0] = value;
+ if (this.x1 <= this.x2)
+ {
+ this.x1 = value;
+ }
+ else
+ {
+ this.x2 = value;
+ }
}
},
/**
- * [description]
+ * The right position of the Line.
*
- * @name Phaser.GameObjects.Components.TransformMatrix#b
+ * @name Phaser.Geom.Line#right
* @type {number}
- * @since 3.4.0
+ * @since 3.0.0
*/
- b: {
+ right: {
get: function ()
{
- return this.matrix[1];
+ return Math.max(this.x1, this.x2);
},
set: function (value)
{
- this.matrix[1] = value;
+ if (this.x1 > this.x2)
+ {
+ this.x1 = value;
+ }
+ else
+ {
+ this.x2 = value;
+ }
}
},
/**
- * [description]
+ * The top position of the Line.
*
- * @name Phaser.GameObjects.Components.TransformMatrix#c
+ * @name Phaser.Geom.Line#top
* @type {number}
- * @since 3.4.0
+ * @since 3.0.0
*/
- c: {
+ top: {
get: function ()
{
- return this.matrix[2];
+ return Math.min(this.y1, this.y2);
},
set: function (value)
{
- this.matrix[2] = value;
+ if (this.y1 <= this.y2)
+ {
+ this.y1 = value;
+ }
+ else
+ {
+ this.y2 = value;
+ }
}
},
/**
- * [description]
+ * The bottom position of the Line.
*
- * @name Phaser.GameObjects.Components.TransformMatrix#d
+ * @name Phaser.Geom.Line#bottom
* @type {number}
- * @since 3.4.0
+ * @since 3.0.0
*/
- d: {
+ bottom: {
get: function ()
{
- return this.matrix[3];
+ return Math.max(this.y1, this.y2);
},
set: function (value)
{
- this.matrix[3] = value;
+ if (this.y1 > this.y2)
+ {
+ this.y1 = value;
+ }
+ else
+ {
+ this.y2 = value;
+ }
}
- },
-
- /**
- * [description]
- *
- * @name Phaser.GameObjects.Components.TransformMatrix#tx
- * @type {number}
- * @since 3.4.0
- */
- tx: {
-
- get: function ()
- {
- return this.matrix[4];
- },
-
- set: function (value)
- {
- this.matrix[4] = value;
- }
-
- },
-
- /**
- * [description]
- *
- * @name Phaser.GameObjects.Components.TransformMatrix#ty
- * @type {number}
- * @since 3.4.0
- */
- ty: {
-
- get: function ()
- {
- return this.matrix[5];
- },
-
- set: function (value)
- {
- this.matrix[5] = value;
- }
-
- },
-
- /**
- * [description]
- *
- * @name Phaser.GameObjects.Components.TransformMatrix#rotation
- * @type {number}
- * @readOnly
- * @since 3.4.0
- */
- rotation: {
-
- get: function ()
- {
- return Math.acos(this.a / this.scaleX) * (Math.atan(-this.c / this.a) < 0 ? -1 : 1);
- }
-
- },
-
- /**
- * [description]
- *
- * @name Phaser.GameObjects.Components.TransformMatrix#scaleX
- * @type {number}
- * @readOnly
- * @since 3.4.0
- */
- scaleX: {
-
- get: function ()
- {
- return Math.sqrt((this.a * this.a) + (this.c * this.c));
- }
-
- },
-
- /**
- * [description]
- *
- * @name Phaser.GameObjects.Components.TransformMatrix#scaleY
- * @type {number}
- * @readOnly
- * @since 3.4.0
- */
- scaleY: {
-
- get: function ()
- {
- return Math.sqrt((this.b * this.b) + (this.d * this.d));
- }
-
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Components.TransformMatrix#loadIdentity
- * @since 3.0.0
- *
- * @return {this} This TransformMatrix.
- */
- loadIdentity: function ()
- {
- var matrix = this.matrix;
-
- matrix[0] = 1;
- matrix[1] = 0;
- matrix[2] = 0;
- matrix[3] = 1;
- matrix[4] = 0;
- matrix[5] = 0;
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Components.TransformMatrix#translate
- * @since 3.0.0
- *
- * @param {number} x - [description]
- * @param {number} y - [description]
- *
- * @return {this} This TransformMatrix.
- */
- translate: function (x, y)
- {
- var matrix = this.matrix;
-
- matrix[4] = matrix[0] * x + matrix[2] * y + matrix[4];
- matrix[5] = matrix[1] * x + matrix[3] * y + matrix[5];
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Components.TransformMatrix#scale
- * @since 3.0.0
- *
- * @param {number} x - [description]
- * @param {number} y - [description]
- *
- * @return {this} This TransformMatrix.
- */
- scale: function (x, y)
- {
- var matrix = this.matrix;
-
- matrix[0] *= x;
- matrix[1] *= x;
- matrix[2] *= y;
- matrix[3] *= y;
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Components.TransformMatrix#rotate
- * @since 3.0.0
- *
- * @param {number} radian - [description]
- *
- * @return {this} This TransformMatrix.
- */
- rotate: function (radian)
- {
- var radianSin = Math.sin(radian);
- var radianCos = Math.cos(radian);
- var matrix = this.matrix;
- var a = matrix[0];
- var b = matrix[1];
- var c = matrix[2];
- var d = matrix[3];
-
- matrix[0] = a * radianCos + c * radianSin;
- matrix[1] = b * radianCos + d * radianSin;
- matrix[2] = a * -radianSin + c * radianCos;
- matrix[3] = b * -radianSin + d * radianCos;
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Components.TransformMatrix#multiply
- * @since 3.0.0
- *
- * @param {Phaser.GameObjects.Components.TransformMatrix} rhs - [description]
- *
- * @return {this} This TransformMatrix.
- */
- multiply: function (rhs)
- {
- var matrix = this.matrix;
- var otherMatrix = rhs.matrix;
-
- var a0 = matrix[0];
- var b0 = matrix[1];
- var c0 = matrix[2];
- var d0 = matrix[3];
- var tx0 = matrix[4];
- var ty0 = matrix[5];
-
- var a1 = otherMatrix[0];
- var b1 = otherMatrix[1];
- var c1 = otherMatrix[2];
- var d1 = otherMatrix[3];
- var tx1 = otherMatrix[4];
- var ty1 = otherMatrix[5];
-
- matrix[0] = a1 * a0 + b1 * c0;
- matrix[1] = a1 * b0 + b1 * d0;
- matrix[2] = c1 * a0 + d1 * c0;
- matrix[3] = c1 * b0 + d1 * d0;
- matrix[4] = tx1 * a0 + ty1 * c0 + tx0;
- matrix[5] = tx1 * b0 + ty1 * d0 + ty0;
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Components.TransformMatrix#transform
- * @since 3.0.0
- *
- * @param {number} a - The Scale X value.
- * @param {number} b - The Shear Y value.
- * @param {number} c - The Shear X value.
- * @param {number} d - The Scale Y value.
- * @param {number} tx - The Translate X value.
- * @param {number} ty - The Translate Y value.
- *
- * @return {this} This TransformMatrix.
- */
- transform: function (a, b, c, d, tx, ty)
- {
- var matrix = this.matrix;
-
- var a0 = matrix[0];
- var b0 = matrix[1];
- var c0 = matrix[2];
- var d0 = matrix[3];
- var tx0 = matrix[4];
- var ty0 = matrix[5];
-
- matrix[0] = a * a0 + b * c0;
- matrix[1] = a * b0 + b * d0;
- matrix[2] = c * a0 + d * c0;
- matrix[3] = c * b0 + d * d0;
- matrix[4] = tx * a0 + ty * c0 + tx0;
- matrix[5] = tx * b0 + ty * d0 + ty0;
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Components.TransformMatrix#transformPoint
- * @since 3.0.0
- *
- * @param {number} x - [description]
- * @param {number} y - [description]
- * @param {(Phaser.Geom.Point|Phaser.Math.Vector2|object)} point - [description]
- *
- * @return {(Phaser.Geom.Point|Phaser.Math.Vector2|object)} [description]
- */
- transformPoint: function (x, y, point)
- {
- if (point === undefined) { point = { x: 0, y: 0 }; }
-
- var matrix = this.matrix;
-
- var a = matrix[0];
- var b = matrix[1];
- var c = matrix[2];
- var d = matrix[3];
- var tx = matrix[4];
- var ty = matrix[5];
-
- point.x = x * a + y * c + tx;
- point.y = x * b + y * d + ty;
-
- return point;
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Components.TransformMatrix#invert
- * @since 3.0.0
- *
- * @return {this} This TransformMatrix.
- */
- invert: function ()
- {
- var matrix = this.matrix;
-
- var a = matrix[0];
- var b = matrix[1];
- var c = matrix[2];
- var d = matrix[3];
- var tx = matrix[4];
- var ty = matrix[5];
-
- var n = a * d - b * c;
-
- matrix[0] = d / n;
- matrix[1] = -b / n;
- matrix[2] = -c / n;
- matrix[3] = a / n;
- matrix[4] = (c * ty - d * tx) / n;
- matrix[5] = -(a * ty - b * tx) / n;
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Components.TransformMatrix#setTransform
- * @since 3.0.0
- *
- * @param {number} a - [description]
- * @param {number} b - [description]
- * @param {number} c - [description]
- * @param {number} d - [description]
- * @param {number} tx - [description]
- * @param {number} ty - [description]
- *
- * @return {this} This TransformMatrix.
- */
- setTransform: function (a, b, c, d, tx, ty)
- {
- var matrix = this.matrix;
-
- matrix[0] = a;
- matrix[1] = b;
- matrix[2] = c;
- matrix[3] = d;
- matrix[4] = tx;
- matrix[5] = ty;
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Components.TransformMatrix#decomposeMatrix
- * @since 3.0.0
- *
- * @return {object} [description]
- */
- decomposeMatrix: function ()
- {
- var decomposedMatrix = this.decomposedMatrix;
-
- var matrix = this.matrix;
-
- // a = scale X (1)
- // b = shear Y (0)
- // c = shear X (0)
- // d = scale Y (1)
-
- var a = matrix[0];
- var b = matrix[1];
- var c = matrix[2];
- var d = matrix[3];
-
- var a2 = a * a;
- var b2 = b * b;
- var c2 = c * c;
- var d2 = d * d;
-
- var sx = Math.sqrt(a2 + c2);
- var sy = Math.sqrt(b2 + d2);
-
- decomposedMatrix.translateX = matrix[4];
- decomposedMatrix.translateY = matrix[5];
-
- decomposedMatrix.scaleX = sx;
- decomposedMatrix.scaleY = sy;
-
- decomposedMatrix.rotation = Math.acos(a / sx) * (Math.atan(-c / a) < 0 ? -1 : 1);
-
- return decomposedMatrix;
- },
-
- /**
- * Identity + Translate + Rotate + Scale
- *
- * @method Phaser.GameObjects.Components.TransformMatrix#applyITRS
- * @since 3.0.0
- *
- * @param {number} x - [description]
- * @param {number} y - [description]
- * @param {number} rotation - [description]
- * @param {number} scaleX - [description]
- * @param {number} scaleY - [description]
- *
- * @return {this} This TransformMatrix.
- */
- applyITRS: function (x, y, rotation, scaleX, scaleY)
- {
- var matrix = this.matrix;
-
- var radianSin = Math.sin(rotation);
- var radianCos = Math.cos(rotation);
-
- // Translate
- matrix[4] = x;
- matrix[5] = y;
-
- // Rotate and Scale
- matrix[0] = radianCos * scaleX;
- matrix[1] = radianSin * scaleX;
- matrix[2] = -radianSin * scaleY;
- matrix[3] = radianCos * scaleY;
-
- return this;
- },
-
- /**
- * Destroys this Transform Matrix.
- *
- * @method Phaser.GameObjects.Components.TransformMatrix#destroy
- * @since 3.4.0
- */
- destroy: function ()
- {
- this.matrix = null;
- this.decomposedMatrix = null;
}
});
-module.exports = TransformMatrix;
+module.exports = Line;
/***/ }),
-/* 65 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Clamp = __webpack_require__(23);
-
-/**
- * Return a value based on the range between `min` and `max` and the percentage given.
- *
- * @function Phaser.Math.FromPercent
- * @since 3.0.0
- *
- * @param {float} percent - A value between 0 and 1 representing the percentage.
- * @param {number} min - The minimum value.
- * @param {number} [max] - The maximum value.
- *
- * @return {number} The value that is `percent` percent between `min` and `max`.
- */
-var FromPercent = function (percent, min, max)
-{
- percent = Clamp(percent, 0, 1);
-
- return (max - min) * percent;
-};
-
-module.exports = FromPercent;
-
-
-/***/ }),
-/* 66 */
+/* 55 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -8982,8 +8815,8 @@ module.exports = FromPercent;
*/
var Class = __webpack_require__(0);
-var Components = __webpack_require__(15);
-var Rectangle = __webpack_require__(389);
+var Components = __webpack_require__(14);
+var Rectangle = __webpack_require__(265);
/**
* @classdesc
@@ -8992,7 +8825,7 @@ var Rectangle = __webpack_require__(389);
* scale or layer position.
*
* @class Tile
- * @memberOf Phaser.Tilemaps
+ * @memberof Phaser.Tilemaps
* @constructor
* @since 3.0.0
*
@@ -9697,7 +9530,7 @@ var Tile = new Class({
*
* @name Phaser.Tilemaps.Tile#canCollide
* @type {boolean}
- * @readOnly
+ * @readonly
* @since 3.0.0
*/
canCollide: {
@@ -9712,7 +9545,7 @@ var Tile = new Class({
*
* @name Phaser.Tilemaps.Tile#collides
* @type {boolean}
- * @readOnly
+ * @readonly
* @since 3.0.0
*/
collides: {
@@ -9727,7 +9560,7 @@ var Tile = new Class({
*
* @name Phaser.Tilemaps.Tile#hasInterestingFace
* @type {boolean}
- * @readOnly
+ * @readonly
* @since 3.0.0
*/
hasInterestingFace: {
@@ -9743,7 +9576,7 @@ var Tile = new Class({
*
* @name Phaser.Tilemaps.Tile#tileset
* @type {?Phaser.Tilemaps.Tileset}
- * @readOnly
+ * @readonly
* @since 3.0.0
*/
tileset: {
@@ -9761,7 +9594,7 @@ var Tile = new Class({
*
* @name Phaser.Tilemaps.Tile#tilemapLayer
* @type {?Phaser.Tilemaps.StaticTilemapLayer|Phaser.Tilemaps.DynamicTilemapLayer}
- * @readOnly
+ * @readonly
* @since 3.0.0
*/
tilemapLayer: {
@@ -9777,7 +9610,7 @@ var Tile = new Class({
*
* @name Phaser.Tilemaps.Tile#tilemap
* @type {?Phaser.Tilemaps.Tilemap}
- * @readOnly
+ * @readonly
* @since 3.0.0
*/
tilemap: {
@@ -9794,7 +9627,7 @@ module.exports = Tile;
/***/ }),
-/* 67 */
+/* 56 */
/***/ (function(module, exports) {
/**
@@ -9811,8 +9644,8 @@ module.exports = Tile;
* @private
* @since 3.0.0
*
- * @param {Phaser.Tilemaps.Tile} tile - [description]
- * @param {boolean} [collides=true] - [description]
+ * @param {Phaser.Tilemaps.Tile} tile - The Tile to set the collision on.
+ * @param {boolean} [collides=true] - Should the tile index collide or not?
*/
var SetTileCollision = function (tile, collides)
{
@@ -9830,7 +9663,7 @@ module.exports = SetTileCollision;
/***/ }),
-/* 68 */
+/* 57 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -9840,11 +9673,501 @@ module.exports = SetTileCollision;
*/
var Class = __webpack_require__(0);
-var Contains = __webpack_require__(60);
-var GetPoint = __webpack_require__(227);
-var GetPoints = __webpack_require__(226);
-var Line = __webpack_require__(96);
-var Random = __webpack_require__(153);
+
+/**
+ * @classdesc
+ * A MultiFile is a special kind of parent that contains two, or more, Files as children and looks after
+ * the loading and processing of them all. It is commonly extended and used as a base class for file types such as AtlasJSON or BitmapFont.
+ *
+ * You shouldn't create an instance of a MultiFile directly, but should extend it with your own class, setting a custom type and processing methods.
+ *
+ * @class MultiFile
+ * @memberof Phaser.Loader
+ * @constructor
+ * @since 3.7.0
+ *
+ * @param {Phaser.Loader.LoaderPlugin} loader - The Loader that is going to load this File.
+ * @param {string} type - The file type string for sorting within the Loader.
+ * @param {string} key - The key of the file within the loader.
+ * @param {Phaser.Loader.File[]} files - An array of Files that make-up this MultiFile.
+ */
+var MultiFile = new Class({
+
+ initialize:
+
+ function MultiFile (loader, type, key, files)
+ {
+ /**
+ * A reference to the Loader that is going to load this file.
+ *
+ * @name Phaser.Loader.MultiFile#loader
+ * @type {Phaser.Loader.LoaderPlugin}
+ * @since 3.7.0
+ */
+ this.loader = loader;
+
+ /**
+ * The file type string for sorting within the Loader.
+ *
+ * @name Phaser.Loader.MultiFile#type
+ * @type {string}
+ * @since 3.7.0
+ */
+ this.type = type;
+
+ /**
+ * Unique cache key (unique within its file type)
+ *
+ * @name Phaser.Loader.MultiFile#key
+ * @type {string}
+ * @since 3.7.0
+ */
+ this.key = key;
+
+ /**
+ * Array of files that make up this MultiFile.
+ *
+ * @name Phaser.Loader.MultiFile#files
+ * @type {Phaser.Loader.File[]}
+ * @since 3.7.0
+ */
+ this.files = files;
+
+ /**
+ * The completion status of this MultiFile.
+ *
+ * @name Phaser.Loader.MultiFile#complete
+ * @type {boolean}
+ * @default false
+ * @since 3.7.0
+ */
+ this.complete = false;
+
+ /**
+ * The number of files to load.
+ *
+ * @name Phaser.Loader.MultiFile#pending
+ * @type {integer}
+ * @since 3.7.0
+ */
+
+ this.pending = files.length;
+
+ /**
+ * The number of files that failed to load.
+ *
+ * @name Phaser.Loader.MultiFile#failed
+ * @type {integer}
+ * @default 0
+ * @since 3.7.0
+ */
+ this.failed = 0;
+
+ /**
+ * A storage container for transient data that the loading files need.
+ *
+ * @name Phaser.Loader.MultiFile#config
+ * @type {any}
+ * @since 3.7.0
+ */
+ this.config = {};
+
+ // Link the files
+ for (var i = 0; i < files.length; i++)
+ {
+ files[i].multiFile = this;
+ }
+ },
+
+ /**
+ * Checks if this MultiFile is ready to process its children or not.
+ *
+ * @method Phaser.Loader.MultiFile#isReadyToProcess
+ * @since 3.7.0
+ *
+ * @return {boolean} `true` if all children of this MultiFile have loaded, otherwise `false`.
+ */
+ isReadyToProcess: function ()
+ {
+ return (this.pending === 0 && this.failed === 0 && !this.complete);
+ },
+
+ /**
+ * Adds another child to this MultiFile, increases the pending count and resets the completion status.
+ *
+ * @method Phaser.Loader.MultiFile#addToMultiFile
+ * @since 3.7.0
+ *
+ * @param {Phaser.Loader.File} files - The File to add to this MultiFile.
+ *
+ * @return {Phaser.Loader.MultiFile} This MultiFile instance.
+ */
+ addToMultiFile: function (file)
+ {
+ this.files.push(file);
+
+ file.multiFile = this;
+
+ this.pending++;
+
+ this.complete = false;
+
+ return this;
+ },
+
+ /**
+ * Called by each File when it finishes loading.
+ *
+ * @method Phaser.Loader.MultiFile#onFileComplete
+ * @since 3.7.0
+ *
+ * @param {Phaser.Loader.File} file - The File that has completed processing.
+ */
+ onFileComplete: function (file)
+ {
+ var index = this.files.indexOf(file);
+
+ if (index !== -1)
+ {
+ this.pending--;
+ }
+ },
+
+ /**
+ * Called by each File that fails to load.
+ *
+ * @method Phaser.Loader.MultiFile#onFileFailed
+ * @since 3.7.0
+ *
+ * @param {Phaser.Loader.File} file - The File that has failed to load.
+ */
+ onFileFailed: function (file)
+ {
+ var index = this.files.indexOf(file);
+
+ if (index !== -1)
+ {
+ this.failed++;
+ }
+ }
+
+});
+
+module.exports = MultiFile;
+
+
+/***/ }),
+/* 58 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var CONST = __webpack_require__(18);
+var File = __webpack_require__(21);
+var FileTypesManager = __webpack_require__(7);
+var GetFastValue = __webpack_require__(2);
+var IsPlainObject = __webpack_require__(8);
+
+/**
+ * @typedef {object} Phaser.Loader.FileTypes.ImageFrameConfig
+ *
+ * @property {integer} frameWidth - The width of the frame in pixels.
+ * @property {integer} [frameHeight] - The height of the frame in pixels. Uses the `frameWidth` value if not provided.
+ * @property {integer} [startFrame=0] - The first frame to start parsing from.
+ * @property {integer} [endFrame] - The frame to stop parsing at. If not provided it will calculate the value based on the image and frame dimensions.
+ * @property {integer} [margin=0] - The margin in the image. This is the space around the edge of the frames.
+ * @property {integer} [spacing=0] - The spacing between each frame in the image.
+ */
+
+/**
+ * @typedef {object} Phaser.Loader.FileTypes.ImageFileConfig
+ *
+ * @property {string} key - The key of the file. Must be unique within both the Loader and the Texture Manager.
+ * @property {string} [url] - The absolute or relative URL to load the file from.
+ * @property {string} [extension='png'] - The default file extension to use if no url is provided.
+ * @property {string} [normalMap] - The filename of an associated normal map. It uses the same path and url to load as the image.
+ * @property {Phaser.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. Only provided for, and used by, Sprite Sheets.
+ * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file.
+ */
+
+/**
+ * @classdesc
+ * 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
+ * @memberof Phaser.Loader.FileTypes
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file.
+ * @param {(string|Phaser.Loader.FileTypes.ImageFileConfig)} key - The key to use for this file, or a file configuration object.
+ * @param {string|string[]} [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 {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file.
+ * @param {Phaser.Loader.FileTypes.ImageFrameConfig} [frameConfig] - The frame configuration object. Only provided for, and used by, Sprite Sheets.
+ */
+var ImageFile = new Class({
+
+ Extends: File,
+
+ initialize:
+
+ function ImageFile (loader, key, url, xhrSettings, frameConfig)
+ {
+ var extension = 'png';
+ var normalMapURL;
+
+ if (IsPlainObject(key))
+ {
+ var config = key;
+
+ key = GetFastValue(config, 'key');
+ url = GetFastValue(config, 'url');
+ normalMapURL = GetFastValue(config, 'normalMap');
+ xhrSettings = GetFastValue(config, 'xhrSettings');
+ extension = GetFastValue(config, 'extension', extension);
+ frameConfig = GetFastValue(config, 'frameConfig');
+ }
+
+ if (Array.isArray(url))
+ {
+ normalMapURL = url[1];
+ url = url[0];
+ }
+
+ var fileConfig = {
+ type: 'image',
+ cache: loader.textureManager,
+ extension: extension,
+ responseType: 'blob',
+ key: key,
+ url: url,
+ xhrSettings: xhrSettings,
+ config: frameConfig
+ };
+
+ File.call(this, loader, fileConfig);
+
+ // Do we have a normal map to load as well?
+ if (normalMapURL)
+ {
+ var normalMap = new ImageFile(loader, this.key, normalMapURL, xhrSettings, frameConfig);
+
+ normalMap.type = 'normalMap';
+
+ this.setLink(normalMap);
+
+ loader.addFile(normalMap);
+ }
+ },
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ *
+ * @method Phaser.Loader.FileTypes.ImageFile#onProcess
+ * @since 3.7.0
+ */
+ onProcess: function ()
+ {
+ this.state = CONST.FILE_PROCESSING;
+
+ this.data = new Image();
+
+ this.data.crossOrigin = this.crossOrigin;
+
+ var _this = this;
+
+ this.data.onload = function ()
+ {
+ File.revokeObjectURL(_this.data);
+
+ _this.onProcessComplete();
+ };
+
+ this.data.onerror = function ()
+ {
+ File.revokeObjectURL(_this.data);
+
+ _this.onProcessError();
+ };
+
+ File.createObjectURL(this.data, this.xhrLoader.response, 'image/png');
+ },
+
+ /**
+ * Adds this file to its target cache upon successful loading and processing.
+ *
+ * @method Phaser.Loader.FileTypes.ImageFile#addToCache
+ * @since 3.7.0
+ */
+ addToCache: function ()
+ {
+ var texture;
+ var linkFile = this.linkFile;
+
+ if (linkFile && linkFile.state === CONST.FILE_COMPLETE)
+ {
+ if (this.type === 'image')
+ {
+ texture = this.cache.addImage(this.key, this.data, linkFile.data);
+ }
+ else
+ {
+ texture = this.cache.addImage(linkFile.key, linkFile.data, this.data);
+ }
+
+ this.pendingDestroy(texture);
+
+ linkFile.pendingDestroy(texture);
+ }
+ else if (!linkFile)
+ {
+ texture = this.cache.addImage(this.key, this.data);
+
+ this.pendingDestroy(texture);
+ }
+ }
+
+});
+
+/**
+ * Adds an Image, or array of Images, to the current load queue.
+ *
+ * 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.image('logo', 'images/phaserLogo.png');
+ * }
+ * ```
+ *
+ * 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.
+ *
+ * Phaser can load all common image types: png, jpg, gif and any other format the browser can natively handle.
+ * If you try to load an animated gif only the first frame will be rendered. Browsers do not natively support playback
+ * of animated gifs to Canvas elements.
+ *
+ * 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.image({
+ * key: 'logo',
+ * url: 'images/AtariLogo.png'
+ * });
+ * ```
+ *
+ * See the documentation for `Phaser.Loader.FileTypes.ImageFileConfig` 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.image('logo', 'images/AtariLogo.png');
+ * // and later in your game ...
+ * this.add.image(x, y, 'logo');
+ * ```
+ *
+ * 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.png". It will always add `.png` 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.
+ *
+ * Phaser also supports the automatic loading of associated normal maps. If you have a normal map to go with this image,
+ * then you can specify it by providing an array as the `url` where the second element is the normal map:
+ *
+ * ```javascript
+ * this.load.image('logo', [ 'images/AtariLogo.png', 'images/AtariLogo-n.png' ]);
+ * ```
+ *
+ * Or, if you are using a config object use the `normalMap` property:
+ *
+ * ```javascript
+ * this.load.image({
+ * key: 'logo',
+ * url: 'images/AtariLogo.png',
+ * normalMap: 'images/AtariLogo-n.png'
+ * });
+ * ```
+ *
+ * The normal map file is subject to the same conditions as the image file with regard to the path, baseURL, CORs and XHR Settings.
+ * Normal maps are a WebGL only feature.
+ *
+ * Note: The ability to load this type of file will only be available if the Image File type has been built into Phaser.
+ * It is available in the default build but can be excluded from custom builds.
+ *
+ * @method Phaser.Loader.LoaderPlugin#image
+ * @fires Phaser.Loader.LoaderPlugin#addFileEvent
+ * @since 3.0.0
+ *
+ * @param {(string|Phaser.Loader.FileTypes.ImageFileConfig|Phaser.Loader.FileTypes.ImageFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
+ * @param {string|string[]} [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 {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings.
+ *
+ * @return {Phaser.Loader.LoaderPlugin} The Loader instance.
+ */
+FileTypesManager.register('image', function (key, url, xhrSettings)
+{
+ if (Array.isArray(key))
+ {
+ for (var i = 0; i < key.length; i++)
+ {
+ // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object
+ this.addFile(new ImageFile(this, key[i]));
+ }
+ }
+ else
+ {
+ this.addFile(new ImageFile(this, key, url, xhrSettings));
+ }
+
+ return this;
+});
+
+module.exports = ImageFile;
+
+
+/***/ }),
+/* 59 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var Contains = __webpack_require__(69);
+var GetPoint = __webpack_require__(278);
+var GetPoints = __webpack_require__(277);
+var Line = __webpack_require__(54);
+var Random = __webpack_require__(184);
/**
* @classdesc
@@ -9853,16 +10176,16 @@ var Random = __webpack_require__(153);
* specify the second point, and the last two arguments specify the third point.
*
* @class Triangle
- * @memberOf Phaser.Geom
+ * @memberof Phaser.Geom
* @constructor
* @since 3.0.0
*
- * @param {number} [x1=0] - [description]
- * @param {number} [y1=0] - [description]
- * @param {number} [x2=0] - [description]
- * @param {number} [y2=0] - [description]
- * @param {number} [x3=0] - [description]
- * @param {number} [y3=0] - [description]
+ * @param {number} [x1=0] - `x` coordinate of the first point.
+ * @param {number} [y1=0] - `y` coordinate of the first point.
+ * @param {number} [x2=0] - `x` coordinate of the second point.
+ * @param {number} [y2=0] - `y` coordinate of the second point.
+ * @param {number} [x3=0] - `x` coordinate of the third point.
+ * @param {number} [y3=0] - `y` coordinate of the third point.
*/
var Triangle = new Class({
@@ -9878,7 +10201,7 @@ var Triangle = new Class({
if (y3 === undefined) { y3 = 0; }
/**
- * [description]
+ * `x` coordinate of the first point.
*
* @name Phaser.Geom.Triangle#x1
* @type {number}
@@ -9888,7 +10211,7 @@ var Triangle = new Class({
this.x1 = x1;
/**
- * [description]
+ * `y` coordinate of the first point.
*
* @name Phaser.Geom.Triangle#y1
* @type {number}
@@ -9898,7 +10221,7 @@ var Triangle = new Class({
this.y1 = y1;
/**
- * [description]
+ * `x` coordinate of the second point.
*
* @name Phaser.Geom.Triangle#x2
* @type {number}
@@ -9908,7 +10231,7 @@ var Triangle = new Class({
this.x2 = x2;
/**
- * [description]
+ * `y` coordinate of the second point.
*
* @name Phaser.Geom.Triangle#y2
* @type {number}
@@ -9918,7 +10241,7 @@ var Triangle = new Class({
this.y2 = y2;
/**
- * [description]
+ * `x` coordinate of the third point.
*
* @name Phaser.Geom.Triangle#x3
* @type {number}
@@ -9928,7 +10251,7 @@ var Triangle = new Class({
this.x3 = x3;
/**
- * [description]
+ * `y` coordinate of the third point.
*
* @name Phaser.Geom.Triangle#y3
* @type {number}
@@ -9939,15 +10262,15 @@ var Triangle = new Class({
},
/**
- * [description]
+ * Checks whether a given points lies within the triangle.
*
* @method Phaser.Geom.Triangle#contains
* @since 3.0.0
*
- * @param {number} x - [description]
- * @param {number} y - [description]
+ * @param {number} x - The x coordinate of the point to check.
+ * @param {number} y - The y coordinate of the point to check.
*
- * @return {boolean} [description]
+ * @return {boolean} `true` if the coordinate pair is within the triangle, otherwise `false`.
*/
contains: function (x, y)
{
@@ -9955,17 +10278,17 @@ var Triangle = new Class({
},
/**
- * [description]
+ * Returns a specific point on the triangle.
*
* @method Phaser.Geom.Triangle#getPoint
* @since 3.0.0
*
* @generic {Phaser.Geom.Point} O - [output,$return]
*
- * @param {float} position - [description]
- * @param {(Phaser.Geom.Point|object)} [output] - [description]
+ * @param {number} position - Position as float within `0` and `1`. `0` equals the first point.
+ * @param {(Phaser.Geom.Point|object)} [output] - Optional Point, or point-like object, that the calculated point will be written to.
*
- * @return {(Phaser.Geom.Point|object)} [description]
+ * @return {(Phaser.Geom.Point|object)} Calculated `Point` that represents the requested position. It is the same as `output` when this parameter has been given.
*/
getPoint: function (position, output)
{
@@ -9973,18 +10296,18 @@ var Triangle = new Class({
},
/**
- * [description]
+ * Calculates a list of evenly distributed points on the triangle. It is either possible to pass an amount of points to be generated (`quantity`) or the distance between two points (`stepRate`).
*
* @method Phaser.Geom.Triangle#getPoints
* @since 3.0.0
*
* @generic {Phaser.Geom.Point[]} O - [output,$return]
*
- * @param {integer} quantity - [description]
- * @param {number} [stepRate] - [description]
- * @param {(array|Phaser.Geom.Point[])} [output] - [description]
+ * @param {integer} quantity - Number of points to be generated. Can be falsey when `stepRate` should be used. All points have the same distance along the triangle.
+ * @param {number} [stepRate] - Distance between two points. Will only be used when `quantity` is falsey.
+ * @param {(array|Phaser.Geom.Point[])} [output] - Optional Array for writing the calculated points into. Otherwise a new array will be created.
*
- * @return {(array|Phaser.Geom.Point[])} [description]
+ * @return {(array|Phaser.Geom.Point[])} Returns a list of calculated `Point` instances or the filled array passed as parameter `output`.
*/
getPoints: function (quantity, stepRate, output)
{
@@ -9992,16 +10315,16 @@ var Triangle = new Class({
},
/**
- * [description]
+ * Returns a random point along the triangle.
*
* @method Phaser.Geom.Triangle#getRandomPoint
* @since 3.0.0
*
* @generic {Phaser.Geom.Point} O - [point,$return]
*
- * @param {Phaser.Geom.Point} [point] - [description]
+ * @param {Phaser.Geom.Point} [point] - Optional `Point` that should be modified. Otherwise a new one will be created.
*
- * @return {Phaser.Geom.Point} [description]
+ * @return {Phaser.Geom.Point} Random `Point`. When parameter `point` has been provided it will be returned.
*/
getRandomPoint: function (point)
{
@@ -10009,17 +10332,17 @@ var Triangle = new Class({
},
/**
- * [description]
+ * Sets all three points of the triangle. Leaving out any coordinate sets it to be `0`.
*
* @method Phaser.Geom.Triangle#setTo
* @since 3.0.0
*
- * @param {number} [x1=0] - [description]
- * @param {number} [y1=0] - [description]
- * @param {number} [x2=0] - [description]
- * @param {number} [y2=0] - [description]
- * @param {number} [x3=0] - [description]
- * @param {number} [y3=0] - [description]
+ * @param {number} [x1=0] - `x` coordinate of the first point.
+ * @param {number} [y1=0] - `y` coordinate of the first point.
+ * @param {number} [x2=0] - `x` coordinate of the second point.
+ * @param {number} [y2=0] - `y` coordinate of the second point.
+ * @param {number} [x3=0] - `x` coordinate of the third point.
+ * @param {number} [y3=0] - `y` coordinate of the third point.
*
* @return {Phaser.Geom.Triangle} This Triangle object.
*/
@@ -10108,7 +10431,7 @@ var Triangle = new Class({
},
/**
- * [description]
+ * Left most X coordinate of the triangle. Setting it moves the triangle on the X axis accordingly.
*
* @name Phaser.Geom.Triangle#left
* @type {number}
@@ -10146,7 +10469,7 @@ var Triangle = new Class({
},
/**
- * [description]
+ * Right most X coordinate of the triangle. Setting it moves the triangle on the X axis accordingly.
*
* @name Phaser.Geom.Triangle#right
* @type {number}
@@ -10184,7 +10507,7 @@ var Triangle = new Class({
},
/**
- * [description]
+ * Top most Y coordinate of the triangle. Setting it moves the triangle on the Y axis accordingly.
*
* @name Phaser.Geom.Triangle#top
* @type {number}
@@ -10222,7 +10545,7 @@ var Triangle = new Class({
},
/**
- * [description]
+ * Bottom most Y coordinate of the triangle. Setting it moves the triangle on the Y axis accordingly.
*
* @name Phaser.Geom.Triangle#bottom
* @type {number}
@@ -10265,7 +10588,82 @@ module.exports = Triangle;
/***/ }),
-/* 69 */
+/* 60 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Utils = __webpack_require__(10);
+
+/**
+ * Renders a stroke outline around the given Shape.
+ *
+ * @method Phaser.GameObjects.Shape#StrokePathWebGL
+ * @since 3.13.0
+ * @private
+ *
+ * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The WebGL Pipeline used to render this Shape.
+ * @param {Phaser.GameObjects.Shape} src - The Game Object shape being rendered in this call.
+ * @param {number} alpha - The base alpha value.
+ * @param {number} dx - The source displayOriginX.
+ * @param {number} dy - The source displayOriginY.
+ */
+var StrokePathWebGL = function (pipeline, src, alpha, dx, dy)
+{
+ var strokeTint = pipeline.strokeTint;
+ var strokeTintColor = Utils.getTintAppendFloatAlphaAndSwap(src.strokeColor, src.strokeAlpha * alpha);
+
+ strokeTint.TL = strokeTintColor;
+ strokeTint.TR = strokeTintColor;
+ strokeTint.BL = strokeTintColor;
+ strokeTint.BR = strokeTintColor;
+
+ var path = src.pathData;
+ var pathLength = path.length - 1;
+ var lineWidth = src.lineWidth;
+ var halfLineWidth = lineWidth / 2;
+
+ var px1 = path[0] - dx;
+ var py1 = path[1] - dy;
+
+ if (!src.closePath)
+ {
+ pathLength -= 2;
+ }
+
+ for (var i = 2; i < pathLength; i += 2)
+ {
+ var px2 = path[i] - dx;
+ var py2 = path[i + 1] - dy;
+
+ pipeline.setTexture2D();
+
+ pipeline.batchLine(
+ px1,
+ py1,
+ px2,
+ py2,
+ halfLineWidth,
+ halfLineWidth,
+ lineWidth,
+ i - 2,
+ (src.closePath) ? (i === pathLength - 1) : false
+ );
+
+ px1 = px2;
+ py1 = py2;
+ }
+};
+
+module.exports = StrokePathWebGL;
+
+
+/***/ }),
+/* 61 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -10275,22 +10673,25 @@ module.exports = Triangle;
*/
var Class = __webpack_require__(0);
-var Components = __webpack_require__(15);
-var GameObject = __webpack_require__(2);
-var ImageRender = __webpack_require__(461);
+var Components = __webpack_require__(14);
+var GameObject = __webpack_require__(19);
+var SpriteRender = __webpack_require__(829);
/**
* @classdesc
- * An Image Game Object.
+ * A Sprite 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.
+ * 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.
*
- * @class Image
+ * 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.
+ *
+ * @class Sprite
* @extends Phaser.GameObjects.GameObject
- * @memberOf Phaser.GameObjects
+ * @memberof Phaser.GameObjects
* @constructor
* @since 3.0.0
*
@@ -10305,7 +10706,7 @@ var ImageRender = __webpack_require__(461);
* @extends Phaser.GameObjects.Components.ScaleMode
* @extends Phaser.GameObjects.Components.ScrollFactor
* @extends Phaser.GameObjects.Components.Size
- * @extends Phaser.GameObjects.Components.Texture
+ * @extends Phaser.GameObjects.Components.TextureCrop
* @extends Phaser.GameObjects.Components.Tint
* @extends Phaser.GameObjects.Components.Transform
* @extends Phaser.GameObjects.Components.Visible
@@ -10316,7 +10717,7 @@ var ImageRender = __webpack_require__(461);
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
* @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
*/
-var Image = new Class({
+var Sprite = new Class({
Extends: GameObject,
@@ -10332,29 +10733,1140 @@ var Image = new Class({
Components.ScaleMode,
Components.ScrollFactor,
Components.Size,
- Components.Texture,
+ Components.TextureCrop,
Components.Tint,
Components.Transform,
Components.Visible,
- ImageRender
+ SpriteRender
],
initialize:
- function Image (scene, x, y, texture, frame)
+ function Sprite (scene, x, y, texture, frame)
{
- GameObject.call(this, scene, 'Image');
+ GameObject.call(this, scene, 'Sprite');
+
+ /**
+ * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method.
+ *
+ * @name Phaser.GameObjects.Sprite#_crop
+ * @type {object}
+ * @private
+ * @since 3.11.0
+ */
+ this._crop = this.resetCropObject();
+
+ /**
+ * The Animation Controller of this Sprite.
+ *
+ * @name Phaser.GameObjects.Sprite#anims
+ * @type {Phaser.GameObjects.Components.Animation}
+ * @since 3.0.0
+ */
+ this.anims = new Components.Animation(this);
this.setTexture(texture, frame);
this.setPosition(x, y);
this.setSizeToFrame();
this.setOriginFromFrame();
- this.initPipeline('TextureTintPipeline');
+ this.initPipeline();
+ },
+
+ /**
+ * Update this Sprite's animations.
+ *
+ * @method Phaser.GameObjects.Sprite#preUpdate
+ * @protected
+ * @since 3.0.0
+ *
+ * @param {number} time - The current timestamp.
+ * @param {number} delta - The delta time, in ms, elapsed since the last frame.
+ */
+ preUpdate: function (time, delta)
+ {
+ this.anims.update(time, delta);
+ },
+
+ /**
+ * Start playing the given animation.
+ *
+ * @method Phaser.GameObjects.Sprite#play
+ * @since 3.0.0
+ *
+ * @param {string} key - The string-based key of the animation to play.
+ * @param {boolean} [ignoreIfPlaying=false] - If an animation is already playing then ignore this call.
+ * @param {integer} [startFrame=0] - Optionally start the animation playing from this frame index.
+ *
+ * @return {Phaser.GameObjects.Sprite} This Game Object.
+ */
+ play: function (key, ignoreIfPlaying, startFrame)
+ {
+ this.anims.play(key, ignoreIfPlaying, startFrame);
+
+ return this;
+ },
+
+ /**
+ * Build a JSON representation of this Sprite.
+ *
+ * @method Phaser.GameObjects.Sprite#toJSON
+ * @since 3.0.0
+ *
+ * @return {JSONGameObject} A JSON representation of the Game Object.
+ */
+ toJSON: function ()
+ {
+ var data = Components.ToJSON(this);
+
+ // Extra Sprite data is added here
+
+ return data;
+ },
+
+ /**
+ * Handles the pre-destroy step for the Sprite, which removes the Animation component.
+ *
+ * @method Phaser.GameObjects.Sprite#preDestroy
+ * @private
+ * @since 3.14.0
+ */
+ preDestroy: function ()
+ {
+ this.anims.destroy();
+
+ this.anims = undefined;
}
});
-module.exports = Image;
+module.exports = Sprite;
+
+
+/***/ }),
+/* 62 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Tests if the start and end indexes are a safe range for the given array.
+ *
+ * @function Phaser.Utils.Array.SafeRange
+ * @since 3.4.0
+ *
+ * @param {array} array - The array to check.
+ * @param {integer} startIndex - The start index.
+ * @param {integer} endIndex - The end index.
+ * @param {boolean} [throwError=true] - Throw an error if the range is out of bounds.
+ *
+ * @return {boolean} True if the range is safe, otherwise false.
+ */
+var SafeRange = function (array, startIndex, endIndex, throwError)
+{
+ var len = array.length;
+
+ if (startIndex < 0 ||
+ startIndex > len ||
+ startIndex >= endIndex ||
+ endIndex > len ||
+ startIndex + endIndex > len)
+ {
+ if (throwError)
+ {
+ throw new Error('Range Error: Values outside acceptable range');
+ }
+
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+};
+
+module.exports = SafeRange;
+
+
+/***/ }),
+/* 63 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Shallow Object Clone. Will not clone nested objects.
+ *
+ * @function Phaser.Utils.Objects.Clone
+ * @since 3.0.0
+ *
+ * @param {object} obj - the object from which to clone
+ *
+ * @return {object} a new object with the same properties as the input obj
+ */
+var Clone = function (obj)
+{
+ var clone = {};
+
+ for (var key in obj)
+ {
+ if (Array.isArray(obj[key]))
+ {
+ clone[key] = obj[key].slice(0);
+ }
+ else
+ {
+ clone[key] = obj[key];
+ }
+ }
+
+ return clone;
+};
+
+module.exports = Clone;
+
+
+/***/ }),
+/* 64 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+// 2.1.1 (Mar 17, 2016)
+
+/*
+ISC License
+
+Copyright (c) 2016, Mapbox
+
+Permission to use, copy, modify, and/or distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright notice
+and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+THIS SOFTWARE.
+ */
+
+
+
+module.exports = earcut;
+
+/*
+vertices is a flat array of vertice coordinates like [x0,y0, x1,y1, x2,y2, ...].
+holes is an array of hole indices if any (e.g. [5, 8] for a 12-vertice input would mean one hole with vertices 5–7 and another with 8–11).
+dimensions is the number of coordinates per vertice in the input array (2 by default).
+Each group of three vertice indices in the resulting array forms a triangle.
+ */
+
+function earcut(data, holeIndices, dim) {
+
+ dim = dim || 2;
+
+ var hasHoles = holeIndices && holeIndices.length,
+ outerLen = hasHoles ? holeIndices[0] * dim : data.length,
+ outerNode = linkedList(data, 0, outerLen, dim, true),
+ triangles = [];
+
+ if (!outerNode) return triangles;
+
+ var minX, minY, maxX, maxY, x, y, size;
+
+ if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
+
+ // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
+ if (data.length > 80 * dim) {
+ minX = maxX = data[0];
+ minY = maxY = data[1];
+
+ for (var i = dim; i < outerLen; i += dim) {
+ x = data[i];
+ y = data[i + 1];
+ if (x < minX) minX = x;
+ if (y < minY) minY = y;
+ if (x > maxX) maxX = x;
+ if (y > maxY) maxY = y;
+ }
+
+ // minX, minY and size are later used to transform coords into integers for z-order calculation
+ size = Math.max(maxX - minX, maxY - minY);
+ }
+
+ earcutLinked(outerNode, triangles, dim, minX, minY, size);
+
+ return triangles;
+}
+
+// create a circular doubly linked list from polygon points in the specified winding order
+function linkedList(data, start, end, dim, clockwise) {
+ var i, last;
+
+ if (clockwise === (signedArea(data, start, end, dim) > 0)) {
+ for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);
+ } else {
+ for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);
+ }
+
+ if (last && equals(last, last.next)) {
+ removeNode(last);
+ last = last.next;
+ }
+
+ return last;
+}
+
+// eliminate colinear or duplicate points
+function filterPoints(start, end) {
+ if (!start) return start;
+ if (!end) end = start;
+
+ var p = start,
+ again;
+ do {
+ again = false;
+
+ if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
+ removeNode(p);
+ p = end = p.prev;
+ if (p === p.next) return null;
+ again = true;
+
+ } else {
+ p = p.next;
+ }
+ } while (again || p !== end);
+
+ return end;
+}
+
+// main ear slicing loop which triangulates a polygon (given as a linked list)
+function earcutLinked(ear, triangles, dim, minX, minY, size, pass) {
+ if (!ear) return;
+
+ // interlink polygon nodes in z-order
+ if (!pass && size) indexCurve(ear, minX, minY, size);
+
+ var stop = ear,
+ prev, next;
+
+ // iterate through ears, slicing them one by one
+ while (ear.prev !== ear.next) {
+ prev = ear.prev;
+ next = ear.next;
+
+ if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) {
+ // cut off the triangle
+ triangles.push(prev.i / dim);
+ triangles.push(ear.i / dim);
+ triangles.push(next.i / dim);
+
+ removeNode(ear);
+
+ // skipping the next vertice leads to less sliver triangles
+ ear = next.next;
+ stop = next.next;
+
+ continue;
+ }
+
+ ear = next;
+
+ // if we looped through the whole remaining polygon and can't find any more ears
+ if (ear === stop) {
+ // try filtering points and slicing again
+ if (!pass) {
+ earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1);
+
+ // if this didn't work, try curing all small self-intersections locally
+ } else if (pass === 1) {
+ ear = cureLocalIntersections(ear, triangles, dim);
+ earcutLinked(ear, triangles, dim, minX, minY, size, 2);
+
+ // as a last resort, try splitting the remaining polygon into two
+ } else if (pass === 2) {
+ splitEarcut(ear, triangles, dim, minX, minY, size);
+ }
+
+ break;
+ }
+ }
+}
+
+// check whether a polygon node forms a valid ear with adjacent nodes
+function isEar(ear) {
+ var a = ear.prev,
+ b = ear,
+ c = ear.next;
+
+ if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
+
+ // now make sure we don't have other points inside the potential ear
+ var p = ear.next.next;
+
+ while (p !== ear.prev) {
+ if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&
+ area(p.prev, p, p.next) >= 0) return false;
+ p = p.next;
+ }
+
+ return true;
+}
+
+function isEarHashed(ear, minX, minY, size) {
+ var a = ear.prev,
+ b = ear,
+ c = ear.next;
+
+ if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
+
+ // triangle bbox; min & max are calculated like this for speed
+ var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),
+ minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),
+ maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),
+ maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);
+
+ // z-order range for the current triangle bbox;
+ var minZ = zOrder(minTX, minTY, minX, minY, size),
+ maxZ = zOrder(maxTX, maxTY, minX, minY, size);
+
+ // first look for points inside the triangle in increasing z-order
+ var p = ear.nextZ;
+
+ while (p && p.z <= maxZ) {
+ if (p !== ear.prev && p !== ear.next &&
+ pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&
+ area(p.prev, p, p.next) >= 0) return false;
+ p = p.nextZ;
+ }
+
+ // then look for points in decreasing z-order
+ p = ear.prevZ;
+
+ while (p && p.z >= minZ) {
+ if (p !== ear.prev && p !== ear.next &&
+ pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&
+ area(p.prev, p, p.next) >= 0) return false;
+ p = p.prevZ;
+ }
+
+ return true;
+}
+
+// go through all polygon nodes and cure small local self-intersections
+function cureLocalIntersections(start, triangles, dim) {
+ var p = start;
+ do {
+ var a = p.prev,
+ b = p.next.next;
+
+ if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
+
+ triangles.push(a.i / dim);
+ triangles.push(p.i / dim);
+ triangles.push(b.i / dim);
+
+ // remove two nodes involved
+ removeNode(p);
+ removeNode(p.next);
+
+ p = start = b;
+ }
+ p = p.next;
+ } while (p !== start);
+
+ return p;
+}
+
+// try splitting polygon into two and triangulate them independently
+function splitEarcut(start, triangles, dim, minX, minY, size) {
+ // look for a valid diagonal that divides the polygon into two
+ var a = start;
+ do {
+ var b = a.next.next;
+ while (b !== a.prev) {
+ if (a.i !== b.i && isValidDiagonal(a, b)) {
+ // split the polygon in two by the diagonal
+ var c = splitPolygon(a, b);
+
+ // filter colinear points around the cuts
+ a = filterPoints(a, a.next);
+ c = filterPoints(c, c.next);
+
+ // run earcut on each half
+ earcutLinked(a, triangles, dim, minX, minY, size);
+ earcutLinked(c, triangles, dim, minX, minY, size);
+ return;
+ }
+ b = b.next;
+ }
+ a = a.next;
+ } while (a !== start);
+}
+
+// link every hole into the outer loop, producing a single-ring polygon without holes
+function eliminateHoles(data, holeIndices, outerNode, dim) {
+ var queue = [],
+ i, len, start, end, list;
+
+ for (i = 0, len = holeIndices.length; i < len; i++) {
+ start = holeIndices[i] * dim;
+ end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
+ list = linkedList(data, start, end, dim, false);
+ if (list === list.next) list.steiner = true;
+ queue.push(getLeftmost(list));
+ }
+
+ queue.sort(compareX);
+
+ // process holes from left to right
+ for (i = 0; i < queue.length; i++) {
+ eliminateHole(queue[i], outerNode);
+ outerNode = filterPoints(outerNode, outerNode.next);
+ }
+
+ return outerNode;
+}
+
+function compareX(a, b) {
+ return a.x - b.x;
+}
+
+// find a bridge between vertices that connects hole with an outer ring and and link it
+function eliminateHole(hole, outerNode) {
+ outerNode = findHoleBridge(hole, outerNode);
+ if (outerNode) {
+ var b = splitPolygon(outerNode, hole);
+ filterPoints(b, b.next);
+ }
+}
+
+// David Eberly's algorithm for finding a bridge between hole and outer polygon
+function findHoleBridge(hole, outerNode) {
+ var p = outerNode,
+ hx = hole.x,
+ hy = hole.y,
+ qx = -Infinity,
+ m;
+
+ // find a segment intersected by a ray from the hole's leftmost point to the left;
+ // segment's endpoint with lesser x will be potential connection point
+ do {
+ if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
+ var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
+ if (x <= hx && x > qx) {
+ qx = x;
+ if (x === hx) {
+ if (hy === p.y) return p;
+ if (hy === p.next.y) return p.next;
+ }
+ m = p.x < p.next.x ? p : p.next;
+ }
+ }
+ p = p.next;
+ } while (p !== outerNode);
+
+ if (!m) return null;
+
+ if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint
+
+ // look for points inside the triangle of hole point, segment intersection and endpoint;
+ // if there are no points found, we have a valid connection;
+ // otherwise choose the point of the minimum angle with the ray as connection point
+
+ var stop = m,
+ mx = m.x,
+ my = m.y,
+ tanMin = Infinity,
+ tan;
+
+ p = m.next;
+
+ while (p !== stop) {
+ if (hx >= p.x && p.x >= mx && hx !== p.x &&
+ pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
+
+ tan = Math.abs(hy - p.y) / (hx - p.x); // tangential
+
+ if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) {
+ m = p;
+ tanMin = tan;
+ }
+ }
+
+ p = p.next;
+ }
+
+ return m;
+}
+
+// interlink polygon nodes in z-order
+function indexCurve(start, minX, minY, size) {
+ var p = start;
+ do {
+ if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);
+ p.prevZ = p.prev;
+ p.nextZ = p.next;
+ p = p.next;
+ } while (p !== start);
+
+ p.prevZ.nextZ = null;
+ p.prevZ = null;
+
+ sortLinked(p);
+}
+
+// Simon Tatham's linked list merge sort algorithm
+// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
+function sortLinked(list) {
+ var i, p, q, e, tail, numMerges, pSize, qSize,
+ inSize = 1;
+
+ do {
+ p = list;
+ list = null;
+ tail = null;
+ numMerges = 0;
+
+ while (p) {
+ numMerges++;
+ q = p;
+ pSize = 0;
+ for (i = 0; i < inSize; i++) {
+ pSize++;
+ q = q.nextZ;
+ if (!q) break;
+ }
+ qSize = inSize;
+
+ while (pSize > 0 || (qSize > 0 && q)) {
+
+ if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
+ e = p;
+ p = p.nextZ;
+ pSize--;
+ } else {
+ e = q;
+ q = q.nextZ;
+ qSize--;
+ }
+
+ if (tail) tail.nextZ = e;
+ else list = e;
+
+ e.prevZ = tail;
+ tail = e;
+ }
+
+ p = q;
+ }
+
+ tail.nextZ = null;
+ inSize *= 2;
+
+ } while (numMerges > 1);
+
+ return list;
+}
+
+// z-order of a point given coords and size of the data bounding box
+function zOrder(x, y, minX, minY, size) {
+ // coords are transformed into non-negative 15-bit integer range
+ x = 32767 * (x - minX) / size;
+ y = 32767 * (y - minY) / size;
+
+ x = (x | (x << 8)) & 0x00FF00FF;
+ x = (x | (x << 4)) & 0x0F0F0F0F;
+ x = (x | (x << 2)) & 0x33333333;
+ x = (x | (x << 1)) & 0x55555555;
+
+ y = (y | (y << 8)) & 0x00FF00FF;
+ y = (y | (y << 4)) & 0x0F0F0F0F;
+ y = (y | (y << 2)) & 0x33333333;
+ y = (y | (y << 1)) & 0x55555555;
+
+ return x | (y << 1);
+}
+
+// find the leftmost node of a polygon ring
+function getLeftmost(start) {
+ var p = start,
+ leftmost = start;
+ do {
+ if (p.x < leftmost.x) leftmost = p;
+ p = p.next;
+ } while (p !== start);
+
+ return leftmost;
+}
+
+// check if a point lies within a convex triangle
+function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
+ return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&
+ (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&
+ (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
+}
+
+// check if a diagonal between two polygon nodes is valid (lies in polygon interior)
+function isValidDiagonal(a, b) {
+ return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&
+ locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);
+}
+
+// signed area of a triangle
+function area(p, q, r) {
+ return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
+}
+
+// check if two points are equal
+function equals(p1, p2) {
+ return p1.x === p2.x && p1.y === p2.y;
+}
+
+// check if two segments intersect
+function intersects(p1, q1, p2, q2) {
+ if ((equals(p1, q1) && equals(p2, q2)) ||
+ (equals(p1, q2) && equals(p2, q1))) return true;
+ return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 &&
+ area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;
+}
+
+// check if a polygon diagonal intersects any polygon segments
+function intersectsPolygon(a, b) {
+ var p = a;
+ do {
+ if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&
+ intersects(p, p.next, a, b)) return true;
+ p = p.next;
+ } while (p !== a);
+
+ return false;
+}
+
+// check if a polygon diagonal is locally inside the polygon
+function locallyInside(a, b) {
+ return area(a.prev, a, a.next) < 0 ?
+ area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :
+ area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
+}
+
+// check if the middle point of a polygon diagonal is inside the polygon
+function middleInside(a, b) {
+ var p = a,
+ inside = false,
+ px = (a.x + b.x) / 2,
+ py = (a.y + b.y) / 2;
+ do {
+ if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&
+ (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))
+ inside = !inside;
+ p = p.next;
+ } while (p !== a);
+
+ return inside;
+}
+
+// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;
+// if one belongs to the outer ring and another to a hole, it merges it into a single ring
+function splitPolygon(a, b) {
+ var a2 = new Node(a.i, a.x, a.y),
+ b2 = new Node(b.i, b.x, b.y),
+ an = a.next,
+ bp = b.prev;
+
+ a.next = b;
+ b.prev = a;
+
+ a2.next = an;
+ an.prev = a2;
+
+ b2.next = a2;
+ a2.prev = b2;
+
+ bp.next = b2;
+ b2.prev = bp;
+
+ return b2;
+}
+
+// create a node and optionally link it with previous one (in a circular doubly linked list)
+function insertNode(i, x, y, last) {
+ var p = new Node(i, x, y);
+
+ if (!last) {
+ p.prev = p;
+ p.next = p;
+
+ } else {
+ p.next = last.next;
+ p.prev = last;
+ last.next.prev = p;
+ last.next = p;
+ }
+ return p;
+}
+
+function removeNode(p) {
+ p.next.prev = p.prev;
+ p.prev.next = p.next;
+
+ if (p.prevZ) p.prevZ.nextZ = p.nextZ;
+ if (p.nextZ) p.nextZ.prevZ = p.prevZ;
+}
+
+function Node(i, x, y) {
+ // vertice index in coordinates array
+ this.i = i;
+
+ // vertex coordinates
+ this.x = x;
+ this.y = y;
+
+ // previous and next vertice nodes in a polygon ring
+ this.prev = null;
+ this.next = null;
+
+ // z-order curve value
+ this.z = null;
+
+ // previous and next nodes in z-order
+ this.prevZ = null;
+ this.nextZ = null;
+
+ // indicates whether this is a steiner point
+ this.steiner = false;
+}
+
+// return a percentage difference between the polygon area and its triangulation area;
+// used to verify correctness of triangulation
+earcut.deviation = function (data, holeIndices, dim, triangles) {
+ var hasHoles = holeIndices && holeIndices.length;
+ var outerLen = hasHoles ? holeIndices[0] * dim : data.length;
+
+ var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));
+ if (hasHoles) {
+ for (var i = 0, len = holeIndices.length; i < len; i++) {
+ var start = holeIndices[i] * dim;
+ var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
+ polygonArea -= Math.abs(signedArea(data, start, end, dim));
+ }
+ }
+
+ var trianglesArea = 0;
+ for (i = 0; i < triangles.length; i += 3) {
+ var a = triangles[i] * dim;
+ var b = triangles[i + 1] * dim;
+ var c = triangles[i + 2] * dim;
+ trianglesArea += Math.abs(
+ (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -
+ (data[a] - data[b]) * (data[c + 1] - data[a + 1]));
+ }
+
+ return polygonArea === 0 && trianglesArea === 0 ? 0 :
+ Math.abs((trianglesArea - polygonArea) / polygonArea);
+};
+
+function signedArea(data, start, end, dim) {
+ var sum = 0;
+ for (var i = start, j = end - dim; i < end; i += dim) {
+ sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
+ j = i;
+ }
+ return sum;
+}
+
+// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts
+earcut.flatten = function (data) {
+ var dim = data[0][0].length,
+ result = {vertices: [], holes: [], dimensions: dim},
+ holeIndex = 0;
+
+ for (var i = 0; i < data.length; i++) {
+ for (var j = 0; j < data[i].length; j++) {
+ for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);
+ }
+ if (i > 0) {
+ holeIndex += data[i - 1].length;
+ result.holes.push(holeIndex);
+ }
+ }
+ return result;
+};
+
+/***/ }),
+/* 65 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Calculate the length of the given line.
+ *
+ * @function Phaser.Geom.Line.Length
+ * @since 3.0.0
+ *
+ * @param {Phaser.Geom.Line} line - The line to calculate the length of.
+ *
+ * @return {number} The length of the line.
+ */
+var Length = function (line)
+{
+ return Math.sqrt((line.x2 - line.x1) * (line.x2 - line.x1) + (line.y2 - line.y1) * (line.y2 - line.y1));
+};
+
+module.exports = Length;
+
+
+/***/ }),
+/* 66 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Phaser Blend Modes.
+ *
+ * @name Phaser.BlendModes
+ * @enum {integer}
+ * @memberof Phaser
+ * @readonly
+ * @since 3.0.0
+ */
+
+module.exports = {
+
+ /**
+ * Skips the Blend Mode check in the renderer.
+ *
+ * @name Phaser.BlendModes.SKIP_CHECK
+ */
+ SKIP_CHECK: -1,
+
+ /**
+ * Normal blend mode.
+ *
+ * @name Phaser.BlendModes.NORMAL
+ */
+ NORMAL: 0,
+
+ /**
+ * Add blend mode.
+ *
+ * @name Phaser.BlendModes.ADD
+ */
+ ADD: 1,
+
+ /**
+ * Multiply blend mode.
+ *
+ * @name Phaser.BlendModes.MULTIPLY
+ */
+ MULTIPLY: 2,
+
+ /**
+ * Screen blend mode.
+ *
+ * @name Phaser.BlendModes.SCREEN
+ */
+ SCREEN: 3,
+
+ /**
+ * Overlay blend mode.
+ *
+ * @name Phaser.BlendModes.OVERLAY
+ */
+ OVERLAY: 4,
+
+ /**
+ * Darken blend mode.
+ *
+ * @name Phaser.BlendModes.DARKEN
+ */
+ DARKEN: 5,
+
+ /**
+ * Lighten blend mode.
+ *
+ * @name Phaser.BlendModes.LIGHTEN
+ */
+ LIGHTEN: 6,
+
+ /**
+ * Color Dodge blend mode.
+ *
+ * @name Phaser.BlendModes.COLOR_DODGE
+ */
+ COLOR_DODGE: 7,
+
+ /**
+ * Color Burn blend mode.
+ *
+ * @name Phaser.BlendModes.COLOR_BURN
+ */
+ COLOR_BURN: 8,
+
+ /**
+ * Hard Light blend mode.
+ *
+ * @name Phaser.BlendModes.HARD_LIGHT
+ */
+ HARD_LIGHT: 9,
+
+ /**
+ * Soft Light blend mode.
+ *
+ * @name Phaser.BlendModes.SOFT_LIGHT
+ */
+ SOFT_LIGHT: 10,
+
+ /**
+ * Difference blend mode.
+ *
+ * @name Phaser.BlendModes.DIFFERENCE
+ */
+ DIFFERENCE: 11,
+
+ /**
+ * Exclusion blend mode.
+ *
+ * @name Phaser.BlendModes.EXCLUSION
+ */
+ EXCLUSION: 12,
+
+ /**
+ * Hue blend mode.
+ *
+ * @name Phaser.BlendModes.HUE
+ */
+ HUE: 13,
+
+ /**
+ * Saturation blend mode.
+ *
+ * @name Phaser.BlendModes.SATURATION
+ */
+ SATURATION: 14,
+
+ /**
+ * Color blend mode.
+ *
+ * @name Phaser.BlendModes.COLOR
+ */
+ COLOR: 15,
+
+ /**
+ * Luminosity blend mode.
+ *
+ * @name Phaser.BlendModes.LUMINOSITY
+ */
+ LUMINOSITY: 16
+
+};
+
+
+/***/ }),
+/* 67 */,
+/* 68 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Calculate the angle of the line in radians.
+ *
+ * @function Phaser.Geom.Line.Angle
+ * @since 3.0.0
+ *
+ * @param {Phaser.Geom.Line} line - The line to calculate the angle of.
+ *
+ * @return {number} The angle of the line, in radians.
+ */
+var Angle = function (line)
+{
+ return Math.atan2(line.y2 - line.y1, line.x2 - line.x1);
+};
+
+module.exports = Angle;
+
+
+/***/ }),
+/* 69 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+// http://www.blackpawn.com/texts/pointinpoly/
+
+/**
+ * [description]
+ *
+ * @function Phaser.Geom.Triangle.Contains
+ * @since 3.0.0
+ *
+ * @param {Phaser.Geom.Triangle} triangle - [description]
+ * @param {number} x - [description]
+ * @param {number} y - [description]
+ *
+ * @return {boolean} [description]
+ */
+var Contains = function (triangle, x, y)
+{
+ var v0x = triangle.x3 - triangle.x1;
+ var v0y = triangle.y3 - triangle.y1;
+
+ var v1x = triangle.x2 - triangle.x1;
+ var v1y = triangle.y2 - triangle.y1;
+
+ var v2x = x - triangle.x1;
+ var v2y = y - triangle.y1;
+
+ var dot00 = (v0x * v0x) + (v0y * v0y);
+ var dot01 = (v0x * v1x) + (v0y * v1y);
+ var dot02 = (v0x * v2x) + (v0y * v2y);
+ var dot11 = (v1x * v1x) + (v1y * v1y);
+ var dot12 = (v1x * v2x) + (v1y * v2y);
+
+ // Compute barycentric coordinates
+ var b = ((dot00 * dot11) - (dot01 * dot01));
+ var inv = (b === 0) ? 0 : (1 / b);
+ var u = ((dot11 * dot02) - (dot01 * dot12)) * inv;
+ var v = ((dot00 * dot12) - (dot01 * dot02)) * inv;
+
+ return (u >= 0 && v >= 0 && (u + v < 1));
+};
+
+module.exports = Contains;
/***/ }),
@@ -10368,3668 +11880,9 @@ module.exports = Image;
*/
var Class = __webpack_require__(0);
-
-/**
- * @callback EachSetCallback
- * @generic E - [entry]
- *
- * @param {*} entry - [description]
- * @param {number} index - [description]
- *
- * @return {?boolean} [description]
- */
-
-/**
- * @classdesc
- * A Set is a collection of unique elements.
- *
- * @class Set
- * @memberOf Phaser.Structs
- * @constructor
- * @since 3.0.0
- *
- * @generic T
- * @genericUse {T[]} - [elements]
- *
- * @param {Array.<*>} [elements] - [description]
- */
-var Set = new Class({
-
- initialize:
-
- function Set (elements)
- {
- /**
- * [description]
- *
- * @genericUse {T[]} - [$type]
- *
- * @name Phaser.Structs.Set#entries
- * @type {Array.<*>}
- * @default []
- * @since 3.0.0
- */
- this.entries = [];
-
- if (Array.isArray(elements))
- {
- for (var i = 0; i < elements.length; i++)
- {
- this.set(elements[i]);
- }
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.Set#set
- * @since 3.0.0
- *
- * @genericUse {T} - [value]
- * @genericUse {Phaser.Structs.Set.} - [$return]
- *
- * @param {*} value - [description]
- *
- * @return {Phaser.Structs.Set} This Set object.
- */
- set: function (value)
- {
- if (this.entries.indexOf(value) === -1)
- {
- this.entries.push(value);
- }
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.Set#get
- * @since 3.0.0
- *
- * @genericUse {T} - [value,$return]
- *
- * @param {string} property - [description]
- * @param {*} value - [description]
- *
- * @return {*} [description]
- */
- get: function (property, value)
- {
- for (var i = 0; i < this.entries.length; i++)
- {
- var entry = this.entries[i];
-
- if (entry[property] === value)
- {
- return entry;
- }
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.Set#getArray
- * @since 3.0.0
- *
- * @genericUse {T[]} - [$return]
- *
- * @return {Array.<*>} [description]
- */
- getArray: function ()
- {
- return this.entries.slice(0);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.Set#delete
- * @since 3.0.0
- *
- * @genericUse {T} - [value]
- * @genericUse {Phaser.Structs.Set.} - [$return]
- *
- * @param {*} value - [description]
- *
- * @return {Phaser.Structs.Set} This Set object.
- */
- delete: function (value)
- {
- var index = this.entries.indexOf(value);
-
- if (index > -1)
- {
- this.entries.splice(index, 1);
- }
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.Set#dump
- * @since 3.0.0
- */
- dump: function ()
- {
- // eslint-disable-next-line no-console
- console.group('Set');
-
- for (var i = 0; i < this.entries.length; i++)
- {
- var entry = this.entries[i];
- console.log(entry);
- }
-
- // eslint-disable-next-line no-console
- console.groupEnd();
- },
-
- /**
- * For when you know this Set will be modified during the iteration.
- *
- * @method Phaser.Structs.Set#each
- * @since 3.0.0
- *
- * @genericUse {EachSetCallback.} - [callback]
- * @genericUse {Phaser.Structs.Set.} - [$return]
- *
- * @param {EachSetCallback} callback - [description]
- * @param {*} callbackScope - [description]
- *
- * @return {Phaser.Structs.Set} This Set object.
- */
- each: function (callback, callbackScope)
- {
- var i;
- var temp = this.entries.slice();
- var len = temp.length;
-
- if (callbackScope)
- {
- for (i = 0; i < len; i++)
- {
- if (callback.call(callbackScope, temp[i], i) === false)
- {
- break;
- }
- }
- }
- else
- {
- for (i = 0; i < len; i++)
- {
- if (callback(temp[i], i) === false)
- {
- break;
- }
- }
- }
-
- return this;
- },
-
- /**
- * For when you absolutely know this Set won't be modified during the iteration.
- *
- * @method Phaser.Structs.Set#iterate
- * @since 3.0.0
- *
- * @genericUse {EachSetCallback.} - [callback]
- * @genericUse {Phaser.Structs.Set.} - [$return]
- *
- * @param {EachSetCallback} callback - [description]
- * @param {*} callbackScope - [description]
- *
- * @return {Phaser.Structs.Set} This Set object.
- */
- iterate: function (callback, callbackScope)
- {
- var i;
- var len = this.entries.length;
-
- if (callbackScope)
- {
- for (i = 0; i < len; i++)
- {
- if (callback.call(callbackScope, this.entries[i], i) === false)
- {
- break;
- }
- }
- }
- else
- {
- for (i = 0; i < len; i++)
- {
- if (callback(this.entries[i], i) === false)
- {
- break;
- }
- }
- }
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.Set#iterateLocal
- * @since 3.0.0
- *
- * @genericUse {Phaser.Structs.Set.} - [$return]
- *
- * @param {string} callbackKey - [description]
- * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
- *
- * @return {Phaser.Structs.Set} This Set object.
- */
- iterateLocal: function (callbackKey)
- {
- var i;
- var args = [];
-
- for (i = 1; i < arguments.length; i++)
- {
- args.push(arguments[i]);
- }
-
- var len = this.entries.length;
-
- for (i = 0; i < len; i++)
- {
- var entry = this.entries[i];
-
- entry[callbackKey].apply(entry, args);
- }
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.Set#clear
- * @since 3.0.0
- *
- * @genericUse {Phaser.Structs.Set.} - [$return]
- *
- * @return {Phaser.Structs.Set} This Set object.
- */
- clear: function ()
- {
- this.entries.length = 0;
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.Set#contains
- * @since 3.0.0
- *
- * @genericUse {T} - [value]
- *
- * @param {*} value - [description]
- *
- * @return {boolean} [description]
- */
- contains: function (value)
- {
- return (this.entries.indexOf(value) > -1);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.Set#union
- * @since 3.0.0
- *
- * @genericUse {Phaser.Structs.Set.} - [set,$return]
- *
- * @param {Phaser.Structs.Set} set - [description]
- *
- * @return {Phaser.Structs.Set} [description]
- */
- union: function (set)
- {
- var newSet = new Set();
-
- set.entries.forEach(function (value)
- {
- newSet.set(value);
- });
-
- this.entries.forEach(function (value)
- {
- newSet.set(value);
- });
-
- return newSet;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.Set#intersect
- * @since 3.0.0
- *
- * @genericUse {Phaser.Structs.Set.} - [set,$return]
- *
- * @param {Phaser.Structs.Set} set - [description]
- *
- * @return {Phaser.Structs.Set} [description]
- */
- intersect: function (set)
- {
- var newSet = new Set();
-
- this.entries.forEach(function (value)
- {
- if (set.contains(value))
- {
- newSet.set(value);
- }
- });
-
- return newSet;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.Set#difference
- * @since 3.0.0
- *
- * @genericUse {Phaser.Structs.Set.} - [set,$return]
- *
- * @param {Phaser.Structs.Set} set - [description]
- *
- * @return {Phaser.Structs.Set} [description]
- */
- difference: function (set)
- {
- var newSet = new Set();
-
- this.entries.forEach(function (value)
- {
- if (!set.contains(value))
- {
- newSet.set(value);
- }
- });
-
- return newSet;
- },
-
- /**
- * [description]
- *
- * @name Phaser.Structs.Set#size
- * @type {integer}
- * @since 3.0.0
- */
- size: {
-
- get: function ()
- {
- return this.entries.length;
- },
-
- set: function (value)
- {
- return this.entries.length = value;
- }
-
- }
-
-});
-
-module.exports = Set;
-
-
-/***/ }),
-/* 71 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * [description]
- *
- * @function Phaser.Geom.Line.Length
- * @since 3.0.0
- *
- * @param {Phaser.Geom.Line} line - [description]
- *
- * @return {number} [description]
- */
-var Length = function (line)
-{
- return Math.sqrt((line.x2 - line.x1) * (line.x2 - line.x1) + (line.y2 - line.y1) * (line.y2 - line.y1));
-};
-
-module.exports = Length;
-
-
-/***/ }),
-/* 72 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Defaults = __webpack_require__(100);
-var GetAdvancedValue = __webpack_require__(10);
-var GetBoolean = __webpack_require__(62);
-var GetEaseFunction = __webpack_require__(63);
-var GetNewValue = __webpack_require__(73);
-var GetProps = __webpack_require__(163);
-var GetTargets = __webpack_require__(102);
-var GetValue = __webpack_require__(4);
-var GetValueOp = __webpack_require__(101);
-var Tween = __webpack_require__(99);
-var TweenData = __webpack_require__(98);
-
-/**
- * [description]
- *
- * @function Phaser.Tweens.Builders.TweenBuilder
- * @since 3.0.0
- *
- * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description]
- * @param {object} config - [description]
- * @param {Phaser.Tweens.TweenConfigDefaults} defaults - [description]
- *
- * @return {Phaser.Tweens.Tween} [description]
- */
-var TweenBuilder = function (parent, config, defaults)
-{
- if (defaults === undefined)
- {
- defaults = Defaults;
- }
-
- // Create arrays of the Targets and the Properties
- var targets = (defaults.targets) ? defaults.targets : GetTargets(config);
-
- // var props = (defaults.props) ? defaults.props : GetProps(config);
- var props = GetProps(config);
-
- // Default Tween values
- var delay = GetNewValue(config, 'delay', defaults.delay);
- var duration = GetNewValue(config, 'duration', defaults.duration);
- var easeParams = GetValue(config, 'easeParams', defaults.easeParams);
- var ease = GetEaseFunction(GetValue(config, 'ease', defaults.ease), easeParams);
- var hold = GetNewValue(config, 'hold', defaults.hold);
- var repeat = GetNewValue(config, 'repeat', defaults.repeat);
- var repeatDelay = GetNewValue(config, 'repeatDelay', defaults.repeatDelay);
- var yoyo = GetBoolean(config, 'yoyo', defaults.yoyo);
- var flipX = GetBoolean(config, 'flipX', defaults.flipX);
- var flipY = GetBoolean(config, 'flipY', defaults.flipY);
-
- var data = [];
-
- // Loop through every property defined in the Tween, i.e.: props { x, y, alpha }
- for (var p = 0; p < props.length; p++)
- {
- var key = props[p].key;
- var value = props[p].value;
-
- // Create 1 TweenData per target, per property
- for (var t = 0; t < targets.length; t++)
- {
- var ops = GetValueOp(key, value);
-
- var tweenData = TweenData(
- targets[t],
- key,
- ops.getEnd,
- ops.getStart,
- GetEaseFunction(GetValue(value, 'ease', ease), easeParams),
- GetNewValue(value, 'delay', delay),
- GetNewValue(value, 'duration', duration),
- GetBoolean(value, 'yoyo', yoyo),
- GetNewValue(value, 'hold', hold),
- GetNewValue(value, 'repeat', repeat),
- GetNewValue(value, 'repeatDelay', repeatDelay),
- GetBoolean(value, 'flipX', flipX),
- GetBoolean(value, 'flipY', flipY)
- );
-
- data.push(tweenData);
- }
- }
-
- var tween = new Tween(parent, data, targets);
-
- tween.offset = GetAdvancedValue(config, 'offset', null);
- tween.completeDelay = GetAdvancedValue(config, 'completeDelay', 0);
- tween.loop = Math.round(GetAdvancedValue(config, 'loop', 0));
- tween.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0));
- tween.paused = GetBoolean(config, 'paused', false);
- tween.useFrames = GetBoolean(config, 'useFrames', false);
-
- // Set the Callbacks
- var scope = GetValue(config, 'callbackScope', tween);
-
- // Callback parameters: 0 = a reference to the Tween itself, 1 = the target/s of the Tween, ... your own params
- var tweenArray = [ tween, null ];
-
- var callbacks = Tween.TYPES;
-
- for (var i = 0; i < callbacks.length; i++)
- {
- var type = callbacks[i];
-
- var callback = GetValue(config, type, false);
-
- if (callback)
- {
- var callbackScope = GetValue(config, type + 'Scope', scope);
- var callbackParams = GetValue(config, type + 'Params', []);
-
- // The null is reset to be the Tween target
- tween.setCallback(type, callback, tweenArray.concat(callbackParams), callbackScope);
- }
- }
-
- return tween;
-};
-
-module.exports = TweenBuilder;
-
-
-/***/ }),
-/* 73 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * [description]
- *
- * @function Phaser.Tweens.Builders.GetNewValue
- * @since 3.0.0
- *
- * @param {object} source - [description]
- * @param {string} key - [description]
- * @param {*} defaultValue - [description]
- *
- * @return {function} [description]
- */
-var GetNewValue = function (source, key, defaultValue)
-{
- var valueCallback;
-
- if (source.hasOwnProperty(key))
- {
- var t = typeof(source[key]);
-
- if (t === 'function')
- {
- valueCallback = function (index, totalTargets, target)
- {
- return source[key](index, totalTargets, target);
- };
- }
- else
- {
- valueCallback = function ()
- {
- return source[key];
- };
- }
- }
- else if (typeof defaultValue === 'function')
- {
- valueCallback = defaultValue;
- }
- else
- {
- valueCallback = function ()
- {
- return defaultValue;
- };
- }
-
- return valueCallback;
-};
-
-module.exports = GetNewValue;
-
-
-/***/ }),
-/* 74 */,
-/* 75 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * @typedef {object} XHRSettingsObject
- *
- * @property {XMLHttpRequestResponseType} responseType - The response type of the XHR request, i.e. `blob`, `text`, etc.
- * @property {boolean} [async=true] - Should the XHR request use async or not?
- * @property {string} [user=''] - Optional username for the XHR request.
- * @property {string} [password=''] - Optional password for the XHR request.
- * @property {integer} [timeout=0] - Optional XHR timeout value.
- * @property {(string|undefined)} [header] - This value is used to populate the XHR `setRequestHeader` and is undefined by default.
- * @property {(string|undefined)} [headerValue] - This value is used to populate the XHR `setRequestHeader` and is undefined by default.
- * @property {(string|undefined)} [requestedWith] - This value is used to populate the XHR `setRequestHeader` and is undefined by default.
- * @property {(string|undefined)} [overrideMimeType] - Provide a custom mime-type to use instead of the default.
- */
-
-/**
- * Creates an XHRSettings Object with default values.
- *
- * @function Phaser.Loader.XHRSettings
- * @since 3.0.0
- *
- * @param {XMLHttpRequestResponseType} [responseType=''] - The responseType, such as 'text'.
- * @param {boolean} [async=true] - Should the XHR request use async or not?
- * @param {string} [user=''] - Optional username for the XHR request.
- * @param {string} [password=''] - Optional password for the XHR request.
- * @param {integer} [timeout=0] - Optional XHR timeout value.
- *
- * @return {XHRSettingsObject} The XHRSettings object as used by the Loader.
- */
-var XHRSettings = function (responseType, async, user, password, timeout)
-{
- if (responseType === undefined) { responseType = ''; }
- if (async === undefined) { async = true; }
- if (user === undefined) { user = ''; }
- if (password === undefined) { password = ''; }
- if (timeout === undefined) { timeout = 0; }
-
- // Before sending a request, set the xhr.responseType to "text",
- // "arraybuffer", "blob", or "document", depending on your data needs.
- // Note, setting xhr.responseType = '' (or omitting) will default the response to "text".
-
- return {
-
- // Ignored by the Loader, only used by File.
- responseType: responseType,
-
- async: async,
-
- // credentials
- user: user,
- password: password,
-
- // timeout in ms (0 = no timeout)
- timeout: timeout,
-
- // setRequestHeader
- header: undefined,
- headerValue: undefined,
- requestedWith: false,
-
- // overrideMimeType
- overrideMimeType: undefined
-
- };
-};
-
-module.exports = XHRSettings;
-
-
-/***/ }),
-/* 76 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var GetValue = __webpack_require__(4);
-
-// Contains the plugins that Phaser uses globally and locally.
-// These are the source objects, not instantiated.
-var inputPlugins = {};
-
-/**
- * @typedef {object} InputPluginContainer
- *
- * @property {string} key - The unique name of this plugin in the input plugin cache.
- * @property {function} plugin - The plugin to be stored. Should be the source object, not instantiated.
- * @property {string} [mapping] - If this plugin is to be injected into the Input Plugin, this is the property key map used.
- */
-
-var 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)
- *
- * @method Phaser.Input.InputPluginCache.register
- * @since 3.10.0
- *
- * @param {string} key - A reference used to get this plugin from the plugin cache.
- * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated.
- * @param {string} mapping - If this plugin is to be injected into the Input Plugin, this is the property key used.
- * @param {string} settingsKey - The key in the Scene Settings to check to see if this plugin should install or not.
- * @param {string} configKey - The key in the Game Config to check to see if this plugin should install or not.
- */
-InputPluginCache.register = function (key, plugin, mapping, settingsKey, configKey)
-{
- inputPlugins[key] = { plugin: plugin, mapping: mapping, settingsKey: settingsKey, configKey: configKey };
-};
-
-/**
- * Returns the input plugin object from the cache based on the given key.
- *
- * @method Phaser.Input.InputPluginCache.getCore
- * @since 3.10.0
- *
- * @param {string} key - The key of the input plugin to get.
- *
- * @return {InputPluginContainer} The input plugin object.
- */
-InputPluginCache.getPlugin = function (key)
-{
- return inputPlugins[key];
-};
-
-/**
- * Installs all of the registered Input Plugins into the given target.
- *
- * @method Phaser.Input.InputPluginCache.install
- * @since 3.10.0
- *
- * @param {Phaser.Input.InputPlugin} target - The target InputPlugin to install the plugins into.
- */
-InputPluginCache.install = function (target)
-{
- var sys = target.scene.sys;
- var settings = sys.settings.input;
- var config = sys.game.config;
-
- for (var key in inputPlugins)
- {
- var source = inputPlugins[key].plugin;
- var mapping = inputPlugins[key].mapping;
- var settingsKey = inputPlugins[key].settingsKey;
- var configKey = inputPlugins[key].configKey;
-
- if (GetValue(settings, settingsKey, config[configKey]))
- {
- target[mapping] = new source(target);
- }
- }
-};
-
-/**
- * Removes an input plugin based on the given key.
- *
- * @method Phaser.Input.InputPluginCache.remove
- * @since 3.10.0
- *
- * @param {string} key - The key of the input plugin to remove.
- */
-InputPluginCache.remove = function (key)
-{
- if (inputPlugins.hasOwnProperty(key))
- {
- delete inputPlugins[key];
- }
-};
-
-module.exports = InputPluginCache;
-
-
-/***/ }),
-/* 77 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-// Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}.
-
-var CheckMatrix = __webpack_require__(116);
-var TransposeMatrix = __webpack_require__(181);
-
-/**
- * [description]
- *
- * @function Phaser.Utils.Array.Matrix.RotateMatrix
- * @since 3.0.0
- *
- * @param {array} matrix - The array to rotate.
- * @param {(number|string)} [direction=90] - The amount to rotate the matrix by. The value can be given in degrees: 90, -90, 270, -270 or 180, or a string command: `rotateLeft`, `rotateRight` or `rotate180`.
- *
- * @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix.
- */
-var RotateMatrix = function (matrix, direction)
-{
- if (direction === undefined) { direction = 90; }
-
- if (!CheckMatrix(matrix))
- {
- return null;
- }
-
- if (typeof direction !== 'string')
- {
- direction = ((direction % 360) + 360) % 360;
- }
-
- if (direction === 90 || direction === -270 || direction === 'rotateLeft')
- {
- matrix = TransposeMatrix(matrix);
- matrix.reverse();
- }
- else if (direction === -90 || direction === 270 || direction === 'rotateRight')
- {
- matrix.reverse();
- matrix = TransposeMatrix(matrix);
- }
- else if (Math.abs(direction) === 180 || direction === 'rotate180')
- {
- for (var i = 0; i < matrix.length; i++)
- {
- matrix[i].reverse();
- }
-
- matrix.reverse();
- }
-
- return matrix;
-};
-
-module.exports = RotateMatrix;
-
-
-/***/ }),
-/* 78 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @author Pavle Goloskokovic (http://prunegames.com)
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Class = __webpack_require__(0);
-var EventEmitter = __webpack_require__(9);
-var Extend = __webpack_require__(17);
-var NOOP = __webpack_require__(3);
-
-/**
- * @classdesc
- * Class containing all the shared state and behavior of a sound object, independent of the implementation.
- *
- * @class BaseSound
- * @extends Phaser.Events.EventEmitter
- * @memberOf Phaser.Sound
- * @constructor
- * @since 3.0.0
- *
- * @param {Phaser.Sound.BaseSoundManager} manager - Reference to the current sound manager instance.
- * @param {string} key - Asset key for the sound.
- * @param {SoundConfig} [config] - An optional config object containing default sound settings.
- */
-var BaseSound = new Class({
-
- Extends: EventEmitter,
-
- initialize:
-
- function BaseSound (manager, key, config)
- {
- EventEmitter.call(this);
-
- /**
- * Local reference to the sound manager.
- *
- * @name Phaser.Sound.BaseSound#manager
- * @type {Phaser.Sound.BaseSoundManager}
- * @private
- * @since 3.0.0
- */
- this.manager = manager;
-
- /**
- * Asset key for the sound.
- *
- * @name Phaser.Sound.BaseSound#key
- * @type {string}
- * @readOnly
- * @since 3.0.0
- */
- this.key = key;
-
- /**
- * Flag indicating if sound is currently playing.
- *
- * @name Phaser.Sound.BaseSound#isPlaying
- * @type {boolean}
- * @default false
- * @readOnly
- * @since 3.0.0
- */
- this.isPlaying = false;
-
- /**
- * Flag indicating if sound is currently paused.
- *
- * @name Phaser.Sound.BaseSound#isPaused
- * @type {boolean}
- * @default false
- * @readOnly
- * @since 3.0.0
- */
- this.isPaused = false;
-
- /**
- * A property that holds the value of sound's actual playback rate,
- * after its rate and detune values has been combined with global
- * rate and detune values.
- *
- * @name Phaser.Sound.BaseSound#totalRate
- * @type {number}
- * @default 1
- * @readOnly
- * @since 3.0.0
- */
- this.totalRate = 1;
-
- /**
- * A value representing the duration, in seconds.
- * It could be total sound duration or a marker duration.
- *
- * @name Phaser.Sound.BaseSound#duration
- * @type {number}
- * @readOnly
- * @since 3.0.0
- */
- this.duration = this.duration || 0;
-
- /**
- * The total duration of the sound in seconds.
- *
- * @name Phaser.Sound.BaseSound#totalDuration
- * @type {number}
- * @readOnly
- * @since 3.0.0
- */
- this.totalDuration = this.totalDuration || 0;
-
- /**
- * A config object used to store default sound settings' values.
- * Default values will be set by properties' setters.
- *
- * @name Phaser.Sound.BaseSound#config
- * @type {SoundConfig}
- * @private
- * @since 3.0.0
- */
- this.config = {
-
- mute: false,
- volume: 1,
- rate: 1,
- detune: 0,
- seek: 0,
- loop: false,
- delay: 0
-
- };
-
- /**
- * Reference to the currently used config.
- * It could be default config or marker config.
- *
- * @name Phaser.Sound.BaseSound#currentConfig
- * @type {SoundConfig}
- * @private
- * @since 3.0.0
- */
- this.currentConfig = this.config;
-
- this.config = Extend(this.config, config);
-
- /**
- * Object containing markers definitions.
- *
- * @name Phaser.Sound.BaseSound#markers
- * @type {Object.}
- * @default {}
- * @readOnly
- * @since 3.0.0
- */
- this.markers = {};
-
- /**
- * Currently playing marker.
- * 'null' if whole sound is playing.
- *
- * @name Phaser.Sound.BaseSound#currentMarker
- * @type {SoundMarker}
- * @default null
- * @readOnly
- * @since 3.0.0
- */
- this.currentMarker = null;
-
- /**
- * Flag indicating if destroy method was called on this sound.
- *
- * @name Phaser.Sound.BaseSound#pendingRemove
- * @type {boolean}
- * @private
- * @default false
- * @since 3.0.0
- */
- this.pendingRemove = false;
- },
-
- /**
- * Adds a marker into the current sound. A marker is represented by name, start time, duration, and optionally config object.
- * This allows you to bundle multiple sounds together into a single audio file and use markers to jump between them for playback.
- *
- * @method Phaser.Sound.BaseSound#addMarker
- * @since 3.0.0
- *
- * @param {SoundMarker} marker - Marker object.
- *
- * @return {boolean} Whether the marker was added successfully.
- */
- addMarker: function (marker)
- {
- if (!marker || !marker.name || typeof marker.name !== 'string')
- {
- return false;
- }
-
- if (this.markers[marker.name])
- {
- // eslint-disable-next-line no-console
- console.error('addMarker ' + marker.name + ' already exists in Sound');
-
- return false;
- }
-
- marker = Extend(true, {
- name: '',
- start: 0,
- duration: this.totalDuration - (marker.start || 0),
- config: {
- mute: false,
- volume: 1,
- rate: 1,
- detune: 0,
- seek: 0,
- loop: false,
- delay: 0
- }
- }, marker);
-
- this.markers[marker.name] = marker;
-
- return true;
- },
-
- /**
- * Updates previously added marker.
- *
- * @method Phaser.Sound.BaseSound#updateMarker
- * @since 3.0.0
- *
- * @param {SoundMarker} marker - Marker object with updated values.
- *
- * @return {boolean} Whether the marker was updated successfully.
- */
- updateMarker: function (marker)
- {
- if (!marker || !marker.name || typeof marker.name !== 'string')
- {
- return false;
- }
-
- if (!this.markers[marker.name])
- {
- // eslint-disable-next-line no-console
- console.warn('Audio Marker: ' + marker.name + ' missing in Sound: ' + this.key);
-
- return false;
- }
-
- this.markers[marker.name] = Extend(true, this.markers[marker.name], marker);
-
- return true;
- },
-
- /**
- * Removes a marker from the sound.
- *
- * @method Phaser.Sound.BaseSound#removeMarker
- * @since 3.0.0
- *
- * @param {string} markerName - The name of the marker to remove.
- *
- * @return {?SoundMarker} Removed marker object or 'null' if there was no marker with provided name.
- */
- removeMarker: function (markerName)
- {
- var marker = this.markers[markerName];
-
- if (!marker)
- {
- return null;
- }
-
- this.markers[markerName] = null;
-
- return marker;
- },
-
- /**
- * Play this sound, or a marked section of it.
- * It always plays the sound from the start. If you want to start playback from a specific time
- * you can set 'seek' setting of the config object, provided to this call, to that value.
- *
- * @method Phaser.Sound.BaseSound#play
- * @since 3.0.0
- *
- * @param {string} [markerName=''] - If you want to play a marker then provide the marker name here, otherwise omit it to play the full sound.
- * @param {SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound.
- *
- * @return {boolean} Whether the sound started playing successfully.
- */
- play: function (markerName, config)
- {
- if (markerName === undefined) { markerName = ''; }
-
- if (typeof markerName === 'object')
- {
- config = markerName;
- markerName = '';
- }
-
- if (typeof markerName !== 'string')
- {
- return false;
- }
-
- if (!markerName)
- {
- this.currentMarker = null;
- this.currentConfig = this.config;
- this.duration = this.totalDuration;
- }
- else
- {
- if (!this.markers[markerName])
- {
- // eslint-disable-next-line no-console
- console.warn('Marker: ' + markerName + ' missing in Sound: ' + this.key);
-
- return false;
- }
-
- this.currentMarker = this.markers[markerName];
- this.currentConfig = this.currentMarker.config;
- this.duration = this.currentMarker.duration;
- }
-
- this.resetConfig();
-
- this.currentConfig = Extend(this.currentConfig, config);
-
- this.isPlaying = true;
- this.isPaused = false;
-
- return true;
- },
-
- /**
- * Pauses the sound.
- *
- * @method Phaser.Sound.BaseSound#pause
- * @since 3.0.0
- *
- * @return {boolean} Whether the sound was paused successfully.
- */
- pause: function ()
- {
- if (this.isPaused || !this.isPlaying)
- {
- return false;
- }
-
- this.isPlaying = false;
- this.isPaused = true;
-
- return true;
- },
-
- /**
- * Resumes the sound.
- *
- * @method Phaser.Sound.BaseSound#resume
- * @since 3.0.0
- *
- * @return {boolean} Whether the sound was resumed successfully.
- */
- resume: function ()
- {
- if (!this.isPaused || this.isPlaying)
- {
- return false;
- }
-
- this.isPlaying = true;
- this.isPaused = false;
-
- return true;
- },
-
- /**
- * Stop playing this sound.
- *
- * @method Phaser.Sound.BaseSound#stop
- * @since 3.0.0
- *
- * @return {boolean} Whether the sound was stopped successfully.
- */
- stop: function ()
- {
- if (!this.isPaused && !this.isPlaying)
- {
- return false;
- }
-
- this.isPlaying = false;
- this.isPaused = false;
-
- this.resetConfig();
-
- return true;
- },
-
- /**
- * Method used internally for applying config values to some of the sound properties.
- *
- * @method Phaser.Sound.BaseSound#applyConfig
- * @protected
- * @since 3.0.0
- */
- applyConfig: function ()
- {
- this.mute = this.currentConfig.mute;
- this.volume = this.currentConfig.volume;
- this.rate = this.currentConfig.rate;
- this.detune = this.currentConfig.detune;
- this.loop = this.currentConfig.loop;
- },
-
- /**
- * Method used internally for resetting values of some of the config properties.
- *
- * @method Phaser.Sound.BaseSound#resetConfig
- * @protected
- * @since 3.0.0
- */
- resetConfig: function ()
- {
- this.currentConfig.seek = 0;
- this.currentConfig.delay = 0;
- },
-
- /**
- * Update method called automatically by sound manager on every game step.
- *
- * @method Phaser.Sound.BaseSound#update
- * @override
- * @protected
- * @since 3.0.0
- *
- * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout.
- * @param {number} delta - The delta time elapsed since the last frame.
- */
- update: NOOP,
-
- /**
- * Method used internally to calculate total playback rate of the sound.
- *
- * @method Phaser.Sound.BaseSound#calculateRate
- * @protected
- * @since 3.0.0
- */
- calculateRate: function ()
- {
- var cent = 1.0005777895065548; // Math.pow(2, 1/1200);
- var totalDetune = this.currentConfig.detune + this.manager.detune;
- var detuneRate = Math.pow(cent, totalDetune);
-
- this.totalRate = this.currentConfig.rate * this.manager.rate * detuneRate;
- },
-
- /**
- * Destroys this sound and all associated events and marks it for removal from the sound manager.
- *
- * @method Phaser.Sound.BaseSound#destroy
- * @since 3.0.0
- */
- destroy: function ()
- {
- if (this.pendingRemove)
- {
- return;
- }
-
- this.emit('destroy', this);
- this.pendingRemove = true;
- this.manager = null;
- this.key = '';
- this.removeAllListeners();
- this.isPlaying = false;
- this.isPaused = false;
- this.config = null;
- this.currentConfig = null;
- this.markers = null;
- this.currentMarker = null;
- }
-
-});
-
-module.exports = BaseSound;
-
-
-/***/ }),
-/* 79 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @author Pavle Goloskokovic (http://prunegames.com)
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Class = __webpack_require__(0);
-var Clone = __webpack_require__(33);
-var EventEmitter = __webpack_require__(9);
-var NOOP = __webpack_require__(3);
-
-/**
- * @callback EachActiveSoundCallback
- *
- * @param {Phaser.Sound.BaseSoundManager} manager - The SoundManager
- * @param {Phaser.Sound.BaseSound} sound - The current active Sound
- * @param {number} index - The index of the current active Sound
- * @param {Phaser.Sound.BaseSound[]} sounds - All sounds
- */
-
-/**
- * Audio sprite sound type.
- *
- * @typedef {Phaser.Sound.BaseSound} Phaser.Sound.BaseSound.AudioSpriteSound
- *
- * @property {object} spritemap - Local reference to 'spritemap' object form json file generated by audiosprite tool.
- */
-
-/**
- * @classdesc
- * The sound manager is responsible for playing back audio via Web Audio API or HTML Audio tag as fallback.
- * The audio file type and the encoding of those files are extremely important.
- *
- * Not all browsers can play all audio formats.
- *
- * There is a good guide to what's supported [here](https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics#Audio_Codec_Support).
- *
- * @class BaseSoundManager
- * @extends Phaser.Events.EventEmitter
- * @memberOf Phaser.Sound
- * @constructor
- * @since 3.0.0
- *
- * @param {Phaser.Game} game - Reference to the current game instance.
- */
-var BaseSoundManager = new Class({
-
- Extends: EventEmitter,
-
- initialize:
-
- function BaseSoundManager (game)
- {
- EventEmitter.call(this);
-
- /**
- * Local reference to game.
- *
- * @name Phaser.Sound.BaseSoundManager#game
- * @type {Phaser.Game}
- * @readOnly
- * @since 3.0.0
- */
- this.game = game;
-
- /**
- * Local reference to the JSON Cache, as used by Audio Sprites.
- *
- * @name Phaser.Sound.BaseSoundManager#jsonCache
- * @type {Phaser.Cache.BaseCache}
- * @readOnly
- * @since 3.7.0
- */
- this.jsonCache = game.cache.json;
-
- /**
- * An array containing all added sounds.
- *
- * @name Phaser.Sound.BaseSoundManager#sounds
- * @type {Phaser.Sound.BaseSound[]}
- * @default []
- * @private
- * @since 3.0.0
- */
- this.sounds = [];
-
- /**
- * Global mute setting.
- *
- * @name Phaser.Sound.BaseSoundManager#mute
- * @type {boolean}
- * @default false
- * @since 3.0.0
- */
- this.mute = false;
-
- /**
- * Global volume setting.
- *
- * @name Phaser.Sound.BaseSoundManager#volume
- * @type {number}
- * @default 1
- * @since 3.0.0
- */
- this.volume = 1;
-
- /**
- * Flag indicating if sounds should be paused when game looses focus,
- * for instance when user switches to another tab/program/app.
- *
- * @name Phaser.Sound.BaseSoundManager#pauseOnBlur
- * @type {boolean}
- * @default true
- * @since 3.0.0
- */
- this.pauseOnBlur = true;
-
- /**
- * Property that actually holds the value of global playback rate.
- *
- * @name Phaser.Sound.BaseSoundManager#_rate
- * @type {number}
- * @private
- * @default 1
- * @since 3.0.0
- */
- this._rate = 1;
-
- /**
- * Property that actually holds the value of global detune.
- *
- * @name Phaser.Sound.BaseSoundManager#_detune
- * @type {number}
- * @private
- * @default 0
- * @since 3.0.0
- */
- this._detune = 0;
-
- /**
- * Mobile devices require sounds to be triggered from an explicit user action,
- * such as a tap, before any sound can be loaded/played on a web page.
- * Set to true if the audio system is currently locked awaiting user interaction.
- *
- * @name Phaser.Sound.BaseSoundManager#locked
- * @type {boolean}
- * @readOnly
- * @since 3.0.0
- */
- this.locked = this.locked || false;
-
- /**
- * Flag used internally for handling when the audio system
- * has been unlocked, if there ever was a need for it.
- *
- * @name Phaser.Sound.BaseSoundManager#unlocked
- * @type {boolean}
- * @default false
- * @private
- * @since 3.0.0
- */
- this.unlocked = false;
-
- game.events.on('blur', function ()
- {
- if (this.pauseOnBlur)
- {
- this.onBlur();
- }
- }, this);
-
- game.events.on('focus', function ()
- {
- if (this.pauseOnBlur)
- {
- this.onFocus();
- }
- }, this);
-
- game.events.on('prestep', this.update, this);
- game.events.once('destroy', this.destroy, this);
- },
-
- /**
- * Adds a new sound into the sound manager.
- *
- * @method Phaser.Sound.BaseSoundManager#add
- * @override
- * @since 3.0.0
- *
- * @param {string} key - Asset key for the sound.
- * @param {SoundConfig} [config] - An optional config object containing default sound settings.
- *
- * @return {Phaser.Sound.BaseSound} The new sound instance.
- */
- add: NOOP,
-
- /**
- * Adds a new audio sprite sound into the sound manager.
- * Audio Sprites are a combination of audio files and a JSON configuration.
- * The JSON follows the format of that created by https://github.com/tonistiigi/audiosprite
- *
- * @method Phaser.Sound.BaseSoundManager#addAudioSprite
- * @since 3.0.0
- *
- * @param {string} key - Asset key for the sound.
- * @param {SoundConfig} [config] - An optional config object containing default sound settings.
- *
- * @return {Phaser.Sound.BaseSound.AudioSpriteSound} The new audio sprite sound instance.
- */
- addAudioSprite: function (key, config)
- {
- if (config === undefined) { config = {}; }
-
- var sound = this.add(key, config);
-
- sound.spritemap = this.jsonCache.get(key).spritemap;
-
- for (var markerName in sound.spritemap)
- {
- if (!sound.spritemap.hasOwnProperty(markerName))
- {
- continue;
- }
-
- var markerConfig = Clone(config);
-
- var marker = sound.spritemap[markerName];
-
- markerConfig.loop = (marker.hasOwnProperty('loop')) ? marker.loop : false;
-
- sound.addMarker({
- name: markerName,
- start: marker.start,
- duration: marker.end - marker.start,
- config: markerConfig
- });
- }
-
- return sound;
- },
-
- /**
- * Enables playing sound on the fly without the need to keep a reference to it.
- * Sound will auto destroy once its playback ends.
- *
- * @method Phaser.Sound.BaseSoundManager#play
- * @since 3.0.0
- *
- * @param {string} key - Asset key for the sound.
- * @param {(SoundConfig|SoundMarker)} [extra] - An optional additional object containing settings to be applied to the sound. It could be either config or marker object.
- *
- * @return {boolean} Whether the sound started playing successfully.
- */
- play: function (key, extra)
- {
- var sound = this.add(key);
-
- sound.once('ended', sound.destroy, sound);
-
- if (extra)
- {
- if (extra.name)
- {
- sound.addMarker(extra);
-
- return sound.play(extra.name);
- }
- else
- {
- return sound.play(extra);
- }
- }
- else
- {
- return sound.play();
- }
- },
-
- /**
- * Enables playing audio sprite sound on the fly without the need to keep a reference to it.
- * Sound will auto destroy once its playback ends.
- *
- * @method Phaser.Sound.BaseSoundManager#playAudioSprite
- * @since 3.0.0
- *
- * @param {string} key - Asset key for the sound.
- * @param {string} spriteName - The name of the sound sprite to play.
- * @param {SoundConfig} [config] - An optional config object containing default sound settings.
- *
- * @return {boolean} Whether the audio sprite sound started playing successfully.
- */
- playAudioSprite: function (key, spriteName, config)
- {
- var sound = this.addAudioSprite(key);
-
- sound.once('ended', sound.destroy, sound);
-
- return sound.play(spriteName, config);
- },
-
- /**
- * Removes a sound from the sound manager.
- * The removed sound is destroyed before removal.
- *
- * @method Phaser.Sound.BaseSoundManager#remove
- * @since 3.0.0
- *
- * @param {Phaser.Sound.BaseSound} sound - The sound object to remove.
- *
- * @return {boolean} True if the sound was removed successfully, otherwise false.
- */
- remove: function (sound)
- {
- var index = this.sounds.indexOf(sound);
-
- if (index !== -1)
- {
- sound.destroy();
-
- this.sounds.splice(index, 1);
-
- return true;
- }
-
- return false;
- },
-
- /**
- * Removes all sounds from the sound manager that have an asset key matching the given value.
- * The removed sounds are destroyed before removal.
- *
- * @method Phaser.Sound.BaseSoundManager#removeByKey
- * @since 3.0.0
- *
- * @param {string} key - The key to match when removing sound objects.
- *
- * @return {number} The number of matching sound objects that were removed.
- */
- removeByKey: function (key)
- {
- var removed = 0;
-
- for (var i = this.sounds.length - 1; i >= 0; i--)
- {
- var sound = this.sounds[i];
-
- if (sound.key === key)
- {
- sound.destroy();
-
- this.sounds.splice(i, 1);
-
- removed++;
- }
- }
-
- return removed;
- },
-
- /**
- * @event Phaser.Sound.BaseSoundManager#pauseall
- * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event.
- */
-
- /**
- * Pauses all the sounds in the game.
- *
- * @method Phaser.Sound.BaseSoundManager#pauseAll
- * @fires Phaser.Sound.BaseSoundManager#pauseall
- * @since 3.0.0
- */
- pauseAll: function ()
- {
- this.forEachActiveSound(function (sound)
- {
- sound.pause();
- });
-
- this.emit('pauseall', this);
- },
-
- /**
- * @event Phaser.Sound.BaseSoundManager#resumeall
- * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event.
- */
-
- /**
- * Resumes all the sounds in the game.
- *
- * @method Phaser.Sound.BaseSoundManager#resumeAll
- * @fires Phaser.Sound.BaseSoundManager#resumeall
- * @since 3.0.0
- */
- resumeAll: function ()
- {
- this.forEachActiveSound(function (sound)
- {
- sound.resume();
- });
-
- this.emit('resumeall', this);
- },
-
- /**
- * @event Phaser.Sound.BaseSoundManager#stopall
- * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event.
- */
-
- /**
- * Stops all the sounds in the game.
- *
- * @method Phaser.Sound.BaseSoundManager#stopAll
- * @fires Phaser.Sound.BaseSoundManager#stopall
- * @since 3.0.0
- */
- stopAll: function ()
- {
- this.forEachActiveSound(function (sound)
- {
- sound.stop();
- });
-
- this.emit('stopall', this);
- },
-
- /**
- * Method used internally for unlocking audio playback on devices that
- * require user interaction before any sound can be played on a web page.
- *
- * Read more about how this issue is handled here in [this article](https://medium.com/@pgoloskokovic/unlocking-web-audio-the-smarter-way-8858218c0e09).
- *
- * @method Phaser.Sound.BaseSoundManager#unlock
- * @override
- * @protected
- * @since 3.0.0
- */
- unlock: NOOP,
-
- /**
- * Method used internally for pausing sound manager if
- * Phaser.Sound.BaseSoundManager#pauseOnBlur is set to true.
- *
- * @method Phaser.Sound.BaseSoundManager#onBlur
- * @override
- * @protected
- * @since 3.0.0
- */
- onBlur: NOOP,
-
- /**
- * Method used internally for resuming sound manager if
- * Phaser.Sound.BaseSoundManager#pauseOnBlur is set to true.
- *
- * @method Phaser.Sound.BaseSoundManager#onFocus
- * @override
- * @protected
- * @since 3.0.0
- */
- onFocus: NOOP,
-
- /**
- * Update method called on every game step.
- * Removes destroyed sounds and updates every active sound in the game.
- *
- * @method Phaser.Sound.BaseSoundManager#update
- * @protected
- * @since 3.0.0
- *
- * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout.
- * @param {number} delta - The delta time elapsed since the last frame.
- */
- update: function (time, delta)
- {
- if (this.unlocked)
- {
- this.unlocked = false;
- this.locked = false;
-
- /**
- * @event Phaser.Sound.BaseSoundManager#unlocked
- * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event.
- */
- this.emit('unlocked', this);
- }
-
- for (var i = this.sounds.length - 1; i >= 0; i--)
- {
- if (this.sounds[i].pendingRemove)
- {
- this.sounds.splice(i, 1);
- }
- }
-
- this.sounds.forEach(function (sound)
- {
- sound.update(time, delta);
- });
- },
-
- /**
- * Destroys all the sounds in the game and all associated events.
- *
- * @method Phaser.Sound.BaseSoundManager#destroy
- * @since 3.0.0
- */
- destroy: function ()
- {
- this.removeAllListeners();
-
- this.forEachActiveSound(function (sound)
- {
- sound.destroy();
- });
-
- this.sounds.length = 0;
- this.sounds = null;
-
- this.game = null;
- },
-
- /**
- * Method used internally for iterating only over active sounds and skipping sounds that are marked for removal.
- *
- * @method Phaser.Sound.BaseSoundManager#forEachActiveSound
- * @private
- * @since 3.0.0
- *
- * @param {EachActiveSoundCallback} callback - Callback function. (manager: Phaser.Sound.BaseSoundManager, sound: Phaser.Sound.BaseSound, index: number, sounds: Phaser.Manager.BaseSound[]) => void
- * @param {*} [scope] - Callback context.
- */
- forEachActiveSound: function (callback, scope)
- {
- var _this = this;
-
- this.sounds.forEach(function (sound, index)
- {
- if (!sound.pendingRemove)
- {
- callback.call(scope || _this, sound, index, _this.sounds);
- }
- });
- },
-
- /**
- * @event Phaser.Sound.BaseSoundManager#rate
- * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event.
- * @param {number} value - An updated value of Phaser.Sound.BaseSoundManager#rate property.
- */
-
- /**
- * Sets the global playback rate at which all the sounds will be played.
- *
- * For example, a value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed
- * and 2.0 doubles the audios playback speed.
- *
- * @method Phaser.Sound.BaseSoundManager#setRate
- * @fires Phaser.Sound.BaseSoundManager#rate
- * @since 3.3.0
- *
- * @param {number} value - Global playback rate at which all the sounds will be played.
- *
- * @return {Phaser.Sound.BaseSoundManager} This Sound Manager.
- */
- setRate: function (value)
- {
- this.rate = value;
-
- return this;
- },
-
- /**
- * Global playback rate at which all the sounds will be played.
- * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed
- * and 2.0 doubles the audio's playback speed.
- *
- * @name Phaser.Sound.BaseSoundManager#rate
- * @type {number}
- * @default 1
- * @since 3.0.0
- */
- rate: {
-
- get: function ()
- {
- return this._rate;
- },
-
- set: function (value)
- {
- this._rate = value;
-
- this.forEachActiveSound(function (sound)
- {
- sound.calculateRate();
- });
-
- this.emit('rate', this, value);
- }
-
- },
-
- /**
- * Sets the global detuning of all sounds in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29).
- * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent).
- *
- * @method Phaser.Sound.BaseSoundManager#setDetune
- * @fires Phaser.Sound.BaseSoundManager#detune
- * @since 3.3.0
- *
- * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent).
- *
- * @return {Phaser.Sound.BaseSoundManager} This Sound Manager.
- */
- setDetune: function (value)
- {
- this.detune = value;
-
- return this;
- },
-
- /**
- * @event Phaser.Sound.BaseSoundManager#detune
- * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event.
- * @param {number} value - An updated value of Phaser.Sound.BaseSoundManager#detune property.
- */
-
- /**
- * Global detuning of all sounds in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29).
- * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent).
- *
- * @name Phaser.Sound.BaseSoundManager#detune
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- detune: {
-
- get: function ()
- {
- return this._detune;
- },
-
- set: function (value)
- {
- this._detune = value;
-
- this.forEachActiveSound(function (sound)
- {
- sound.calculateRate();
- });
-
- this.emit('detune', this, value);
- }
-
- }
-
-});
-
-module.exports = BaseSoundManager;
-
-
-/***/ }),
-/* 80 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var OS = __webpack_require__(57);
-
-/**
- * Determines the browser type and version running this Phaser Game instance.
- * These values are read-only and populated during the boot sequence of the game.
- * They are then referenced by internal game systems and are available for you to access
- * via `this.sys.game.device.browser` from within any Scene.
- *
- * @typedef {object} Phaser.Device.Browser
- * @since 3.0.0
- *
- * @property {boolean} chrome - Set to true if running in Chrome.
- * @property {boolean} edge - Set to true if running in Microsoft Edge browser.
- * @property {boolean} firefox - Set to true if running in Firefox.
- * @property {boolean} ie - Set to true if running in Internet Explorer 11 or less (not Edge).
- * @property {boolean} mobileSafari - Set to true if running in Mobile Safari.
- * @property {boolean} opera - Set to true if running in Opera.
- * @property {boolean} safari - Set to true if running in Safari.
- * @property {boolean} silk - Set to true if running in the Silk browser (as used on the Amazon Kindle)
- * @property {boolean} trident - Set to true if running a Trident version of Internet Explorer (IE11+)
- * @property {number} chromeVersion - If running in Chrome this will contain the major version number.
- * @property {number} firefoxVersion - If running in Firefox this will contain the major version number.
- * @property {number} ieVersion - If running in Internet Explorer this will contain the major version number. Beyond IE10 you should use Browser.trident and Browser.tridentVersion.
- * @property {number} safariVersion - If running in Safari this will contain the major version number.
- * @property {number} tridentVersion - If running in Internet Explorer 11 this will contain the major version number. See {@link http://msdn.microsoft.com/en-us/library/ie/ms537503(v=vs.85).aspx}
- */
-var Browser = {
-
- chrome: false,
- chromeVersion: 0,
- edge: false,
- firefox: false,
- firefoxVersion: 0,
- ie: false,
- ieVersion: 0,
- mobileSafari: false,
- opera: false,
- safari: false,
- safariVersion: 0,
- silk: false,
- trident: false,
- tridentVersion: 0
-
-};
-
-function init ()
-{
- var ua = navigator.userAgent;
-
- if (/Edge\/\d+/.test(ua))
- {
- Browser.edge = true;
- }
- else if ((/Chrome\/(\d+)/).test(ua) && !OS.windowsPhone)
- {
- Browser.chrome = true;
- Browser.chromeVersion = parseInt(RegExp.$1, 10);
- }
- else if ((/Firefox\D+(\d+)/).test(ua))
- {
- Browser.firefox = true;
- Browser.firefoxVersion = parseInt(RegExp.$1, 10);
- }
- else if ((/AppleWebKit/).test(ua) && OS.iOS)
- {
- Browser.mobileSafari = true;
- }
- else if ((/MSIE (\d+\.\d+);/).test(ua))
- {
- Browser.ie = true;
- Browser.ieVersion = parseInt(RegExp.$1, 10);
- }
- else if ((/Opera/).test(ua))
- {
- Browser.opera = true;
- }
- else if ((/Safari/).test(ua) && !OS.windowsPhone)
- {
- Browser.safari = true;
- }
- else if ((/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/).test(ua))
- {
- Browser.ie = true;
- Browser.trident = true;
- Browser.tridentVersion = parseInt(RegExp.$1, 10);
- Browser.ieVersion = parseInt(RegExp.$3, 10);
- }
-
- // Silk gets its own if clause because its ua also contains 'Safari'
- if ((/Silk/).test(ua))
- {
- Browser.silk = true;
- }
-
- return Browser;
-}
-
-module.exports = init();
-
-
-/***/ }),
-/* 81 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Class = __webpack_require__(0);
-
-/**
- * @callback DataEachCallback
- *
- * @param {*} parent - The parent object of the DataManager.
- * @param {string} key - The key of the value.
- * @param {*} value - The value.
- * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data.
- */
-
-/**
- * @classdesc
- * The Data Component features a means to store pieces of data specific to a Game Object, System or Plugin.
- * You can then search, query it, and retrieve the data. The parent must either extend EventEmitter,
- * or have a property called `events` that is an instance of it.
- *
- * @class DataManager
- * @memberOf Phaser.Data
- * @constructor
- * @since 3.0.0
- *
- * @param {object} parent - The object that this DataManager belongs to.
- * @param {Phaser.Events.EventEmitter} eventEmitter - The DataManager's event emitter.
- */
-var DataManager = new Class({
-
- initialize:
-
- function DataManager (parent, eventEmitter)
- {
- /**
- * The object that this DataManager belongs to.
- *
- * @name Phaser.Data.DataManager#parent
- * @type {*}
- * @since 3.0.0
- */
- this.parent = parent;
-
- /**
- * The DataManager's event emitter.
- *
- * @name Phaser.Data.DataManager#events
- * @type {Phaser.Events.EventEmitter}
- * @since 3.0.0
- */
- this.events = eventEmitter;
-
- if (!eventEmitter)
- {
- this.events = (parent.events) ? parent.events : parent;
- }
-
- /**
- * The data list.
- *
- * @name Phaser.Data.DataManager#list
- * @type {Object.}
- * @default {}
- * @since 3.0.0
- */
- this.list = {};
-
- /**
- * The public values list. You can use this to access anything you have stored
- * in this Data Manager. For example, if you set a value called `gold` you can
- * access it via:
- *
- * ```javascript
- * this.data.values.gold;
- * ```
- *
- * You can also modify it directly:
- *
- * ```javascript
- * this.data.values.gold += 1000;
- * ```
- *
- * Doing so will emit a `setdata` event from the parent of this Data Manager.
- *
- * @name Phaser.Data.DataManager#values
- * @type {Object.}
- * @default {}
- * @since 3.10.0
- */
- this.values = {};
-
- /**
- * Whether setting data is frozen for this DataManager.
- *
- * @name Phaser.Data.DataManager#_frozen
- * @type {boolean}
- * @private
- * @default false
- * @since 3.0.0
- */
- this._frozen = false;
-
- if (!parent.hasOwnProperty('sys') && this.events)
- {
- this.events.once('destroy', this.destroy, this);
- }
- },
-
- /**
- * Retrieves the value for the given key, 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
- * this.data.get('gold');
- * ```
- *
- * Or access the value directly:
- *
- * ```javascript
- * this.data.values.gold;
- * ```
- *
- * You can also pass in an array of keys, in which case an array of values will be returned:
- *
- * ```javascript
- * this.data.get([ 'gold', 'armor', 'health' ]);
- * ```
- *
- * This approach is useful for destructuring arrays in ES6.
- *
- * @method Phaser.Data.DataManager#get
- * @since 3.0.0
- *
- * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys.
- *
- * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array.
- */
- get: function (key)
- {
- var list = this.list;
-
- if (Array.isArray(key))
- {
- var output = [];
-
- for (var i = 0; i < key.length; i++)
- {
- output.push(list[key[i]]);
- }
-
- return output;
- }
- else
- {
- return list[key];
- }
- },
-
- /**
- * Retrieves all data values in a new object.
- *
- * @method Phaser.Data.DataManager#getAll
- * @since 3.0.0
- *
- * @return {Object.} All data values.
- */
- getAll: function ()
- {
- var results = {};
-
- for (var key in this.list)
- {
- if (this.list.hasOwnProperty(key))
- {
- results[key] = this.list[key];
- }
- }
-
- return results;
- },
-
- /**
- * Queries the DataManager for the values of keys matching the given regular expression.
- *
- * @method Phaser.Data.DataManager#query
- * @since 3.0.0
- *
- * @param {RegExp} search - A regular expression object. If a non-RegExp object obj is passed, it is implicitly converted to a RegExp by using new RegExp(obj).
- *
- * @return {Object.} The values of the keys matching the search string.
- */
- query: function (search)
- {
- var results = {};
-
- for (var key in this.list)
- {
- if (this.list.hasOwnProperty(key) && key.match(search))
- {
- results[key] = this.list[key];
- }
- }
-
- return results;
- },
-
- /**
- * Sets a value for the given key. If the key doesn't already exist in the Data Manager then it is created.
- *
- * ```javascript
- * data.set('name', 'Red Gem Stone');
- * ```
- *
- * You can also pass in an object of key value pairs as the first argument:
- *
- * ```javascript
- * data.set({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 });
- * ```
- *
- * To get a value back again you can call `get`:
- *
- * ```javascript
- * data.get('gold');
- * ```
- *
- * Or you can access the value directly via the `values` property, where it works like any other variable:
- *
- * ```javascript
- * data.values.gold += 50;
- * ```
- *
- * When the value is first set, a `setdata` event is emitted.
- *
- * 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.
- *
- * @method Phaser.Data.DataManager#set
- * @since 3.0.0
- *
- * @param {(string|object)} key - The key to set the value for. Or an object or 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.
- *
- * @return {Phaser.Data.DataManager} This DataManager object.
- */
- set: function (key, data)
- {
- if (this._frozen)
- {
- return this;
- }
-
- if (typeof key === 'string')
- {
- return this.setValue(key, data);
- }
- else
- {
- for (var entry in key)
- {
- this.setValue(entry, key[entry]);
- }
- }
-
- return this;
- },
-
- /**
- * Internal value setter, called automatically by the `set` method.
- *
- * @method Phaser.Data.DataManager#setValue
- * @private
- * @since 3.10.0
- *
- * @param {string} key - The key to set the value for.
- * @param {*} data - The value to set.
- *
- * @return {Phaser.Data.DataManager} This DataManager object.
- */
- setValue: function (key, data)
- {
- if (this._frozen)
- {
- return this;
- }
-
- if (this.has(key))
- {
- // Hit the key getter, which will in turn emit the events.
- this.values[key] = data;
- }
- else
- {
- var _this = this;
- var list = this.list;
- var events = this.events;
- var parent = this.parent;
-
- Object.defineProperty(this.values, key, {
-
- enumerable: true,
-
- get: function ()
- {
- return list[key];
- },
-
- set: function (value)
- {
- if (!_this._frozen)
- {
- list[key] = value;
-
- events.emit('changedata', parent, key, data);
- events.emit('changedata_' + key, parent, data);
- }
- }
-
- });
-
- list[key] = data;
-
- events.emit('setdata', parent, key, data);
- }
-
- return this;
- },
-
- /**
- * Passes all data entries to the given callback.
- *
- * @method Phaser.Data.DataManager#each
- * @since 3.0.0
- *
- * @param {DataEachCallback} callback - The function to call.
- * @param {*} [context] - Value to use as `this` when executing callback.
- * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data.
- *
- * @return {Phaser.Data.DataManager} This DataManager object.
- */
- each: function (callback, context)
- {
- var args = [ this.parent, null, undefined ];
-
- for (var i = 1; i < arguments.length; i++)
- {
- args.push(arguments[i]);
- }
-
- for (var key in this.list)
- {
- args[1] = key;
- args[2] = this.list[key];
-
- callback.apply(context, args);
- }
-
- return this;
- },
-
- /**
- * Merge the given object of key value pairs into this DataManager.
- *
- * Any newly created values will emit a `setdata` event. Any updated values (see the `overwrite` argument)
- * will emit a `changedata` event.
- *
- * @method Phaser.Data.DataManager#merge
- * @since 3.0.0
- *
- * @param {Object.} data - The data to merge.
- * @param {boolean} [overwrite=true] - Whether to overwrite existing data. Defaults to true.
- *
- * @return {Phaser.Data.DataManager} This DataManager object.
- */
- merge: function (data, overwrite)
- {
- if (overwrite === undefined) { overwrite = true; }
-
- // Merge data from another component into this one
- for (var key in data)
- {
- if (data.hasOwnProperty(key) && (overwrite || (!overwrite && !this.has(key))))
- {
- this.setValue(key, data[key]);
- }
- }
-
- return this;
- },
-
- /**
- * Remove the value for the given key.
- *
- * If the key is found in this Data Manager it is removed from the internal lists and a
- * `removedata` event is emitted.
- *
- * You can also pass in an array of keys, in which case all keys in the array will be removed:
- *
- * ```javascript
- * this.data.remove([ 'gold', 'armor', 'health' ]);
- * ```
- *
- * @method Phaser.Data.DataManager#remove
- * @since 3.0.0
- *
- * @param {(string|string[])} key - The key to remove, or an array of keys to remove.
- *
- * @return {Phaser.Data.DataManager} This DataManager object.
- */
- remove: function (key)
- {
- if (this._frozen)
- {
- return this;
- }
-
- if (Array.isArray(key))
- {
- for (var i = 0; i < key.length; i++)
- {
- this.removeValue(key[i]);
- }
- }
- else
- {
- return this.removeValue(key);
- }
-
- return this;
- },
-
- /**
- * Internal value remover, called automatically by the `remove` method.
- *
- * @method Phaser.Data.DataManager#removeValue
- * @private
- * @since 3.10.0
- *
- * @param {string} key - The key to set the value for.
- *
- * @return {Phaser.Data.DataManager} This DataManager object.
- */
- removeValue: function (key)
- {
- if (this.has(key))
- {
- var data = this.list[key];
-
- delete this.list[key];
- delete this.values[key];
-
- this.events.emit('removedata', this, key, data);
- }
-
- return this;
- },
-
- /**
- * Retrieves the data associated with the given 'key', deletes it from this Data Manager, then returns it.
- *
- * @method Phaser.Data.DataManager#pop
- * @since 3.0.0
- *
- * @param {string} key - The key of the value to retrieve and delete.
- *
- * @return {*} The value of the given key.
- */
- pop: function (key)
- {
- var data = undefined;
-
- if (!this._frozen && this.has(key))
- {
- data = this.list[key];
-
- delete this.list[key];
- delete this.values[key];
-
- this.events.emit('removedata', this, key, data);
- }
-
- return data;
- },
-
- /**
- * Determines whether the given key is set in this Data Manager.
- *
- * Please note that the 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.
- *
- * @method Phaser.Data.DataManager#has
- * @since 3.0.0
- *
- * @param {string} key - The key to check.
- *
- * @return {boolean} Returns `true` if the key exists, otherwise `false`.
- */
- has: function (key)
- {
- return this.list.hasOwnProperty(key);
- },
-
- /**
- * Freeze or unfreeze this Data Manager. A frozen Data Manager will block all attempts
- * to create new values or update existing ones.
- *
- * @method Phaser.Data.DataManager#setFreeze
- * @since 3.0.0
- *
- * @param {boolean} value - Whether to freeze or unfreeze the Data Manager.
- *
- * @return {Phaser.Data.DataManager} This DataManager object.
- */
- setFreeze: function (value)
- {
- this._frozen = value;
-
- return this;
- },
-
- /**
- * Delete all data in this Data Manager and unfreeze it.
- *
- * @method Phaser.Data.DataManager#reset
- * @since 3.0.0
- *
- * @return {Phaser.Data.DataManager} This DataManager object.
- */
- reset: function ()
- {
- for (var key in this.list)
- {
- delete this.list[key];
- delete this.values[key];
- }
-
- this._frozen = false;
-
- return this;
- },
-
- /**
- * Destroy this data manager.
- *
- * @method Phaser.Data.DataManager#destroy
- * @since 3.0.0
- */
- destroy: function ()
- {
- this.reset();
-
- this.events.off('changedata');
- this.events.off('setdata');
- this.events.off('removedata');
-
- this.parent = null;
- },
-
- /**
- * Gets or sets the frozen state of this Data Manager.
- * A frozen Data Manager will block all attempts to create new values or update existing ones.
- *
- * @name Phaser.Data.DataManager#freeze
- * @type {boolean}
- * @since 3.0.0
- */
- freeze: {
-
- get: function ()
- {
- return this._frozen;
- },
-
- set: function (value)
- {
- this._frozen = (value) ? true : false;
- }
-
- },
-
- /**
- * Return the total number of entries in this Data Manager.
- *
- * @name Phaser.Data.DataManager#count
- * @type {integer}
- * @since 3.0.0
- */
- count: {
-
- get: function ()
- {
- var i = 0;
-
- for (var key in this.list)
- {
- if (this.list[key] !== undefined)
- {
- i++;
- }
- }
-
- return i;
- }
-
- }
-
-});
-
-module.exports = DataManager;
-
-
-/***/ }),
-/* 82 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * [description]
- *
- * @function Phaser.Geom.Line.Angle
- * @since 3.0.0
- *
- * @param {Phaser.Geom.Line} line - [description]
- *
- * @return {number} [description]
- */
-var Angle = function (line)
-{
- return Math.atan2(line.y2 - line.y1, line.x2 - line.x1);
-};
-
-module.exports = Angle;
-
-
-/***/ }),
-/* 83 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-//! stable.js 0.1.6, https://github.com/Two-Screen/stable
-//! © 2017 Angry Bytes and contributors. MIT licensed.
-
-(function() {
-
-// A stable array sort, because `Array#sort()` is not guaranteed stable.
-// This is an implementation of merge sort, without recursion.
-
-var stable = function(arr, comp) {
- return exec(arr.slice(), comp);
-};
-
-stable.inplace = function(arr, comp) {
- var result = exec(arr, comp);
-
- // This simply copies back if the result isn't in the original array,
- // which happens on an odd number of passes.
- if (result !== arr) {
- pass(result, null, arr.length, arr);
- }
-
- return arr;
-};
-
-// Execute the sort using the input array and a second buffer as work space.
-// Returns one of those two, containing the final result.
-function exec(arr, comp) {
- if (typeof(comp) !== 'function') {
- comp = function(a, b) {
- return String(a).localeCompare(b);
- };
- }
-
- // Short-circuit when there's nothing to sort.
- var len = arr.length;
- if (len <= 1) {
- return arr;
- }
-
- // Rather than dividing input, simply iterate chunks of 1, 2, 4, 8, etc.
- // Chunks are the size of the left or right hand in merge sort.
- // Stop when the left-hand covers all of the array.
- var buffer = new Array(len);
- for (var chk = 1; chk < len; chk *= 2) {
- pass(arr, comp, chk, buffer);
-
- var tmp = arr;
- arr = buffer;
- buffer = tmp;
- }
-
- return arr;
-}
-
-// Run a single pass with the given chunk size.
-var pass = function(arr, comp, chk, result) {
- var len = arr.length;
- var i = 0;
- // Step size / double chunk size.
- var dbl = chk * 2;
- // Bounds of the left and right chunks.
- var l, r, e;
- // Iterators over the left and right chunk.
- var li, ri;
-
- // Iterate over pairs of chunks.
- for (l = 0; l < len; l += dbl) {
- r = l + chk;
- e = r + chk;
- if (r > len) r = len;
- if (e > len) e = len;
-
- // Iterate both chunks in parallel.
- li = l;
- ri = r;
- while (true) {
- // Compare the chunks.
- if (li < r && ri < e) {
- // This works for a regular `sort()` compatible comparator,
- // but also for a simple comparator like: `a > b`
- if (comp(arr[li], arr[ri]) <= 0) {
- result[i++] = arr[li++];
- }
- else {
- result[i++] = arr[ri++];
- }
- }
- // Nothing to compare, just flush what's left.
- else if (li < r) {
- result[i++] = arr[li++];
- }
- else if (ri < e) {
- result[i++] = arr[ri++];
- }
- // Both iterators are at the chunk ends.
- else {
- break;
- }
- }
- }
-};
-
-// Export using CommonJS or to the window.
-if (true) {
- module.exports = stable;
-}
-else {}
-
-})();
-
-/***/ }),
-/* 84 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @author Felipe Alfonso <@bitnenfer>
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Class = __webpack_require__(0);
-var Utils = __webpack_require__(27);
-
-/**
- * @classdesc
- * WebGLPipeline is a class that describes the way elements will be rendererd
- * in WebGL, specially focused on batching vertices (batching is not provided).
- * Pipelines are mostly used for describing 2D rendering passes but it's
- * flexible enough to be used for any type of rendering including 3D.
- * Internally WebGLPipeline will handle things like compiling shaders,
- * creating vertex buffers, assigning primitive topology and binding
- * vertex attributes.
- *
- * The config properties are:
- * - game: Current game instance.
- * - renderer: Current WebGL renderer.
- * - gl: Current WebGL context.
- * - 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.
- * - vertices: An optional buffer of vertices
- * - attributes: An array describing the vertex attributes
- *
- * The vertex attributes properties are:
- * - name : String - Name of the attribute in the vertex shader
- * - size : integer - How many components describe the attribute. For ex: vec3 = size of 3, float = size of 1
- * - type : GLenum - WebGL type (gl.BYTE, gl.SHORT, gl.UNSIGNED_BYTE, gl.UNSIGNED_SHORT, gl.FLOAT)
- * - normalized : boolean - Is the attribute normalized
- * - offset : integer - The offset in bytes to the current attribute in the vertex. Equivalent to offsetof(vertex, attrib) in C
- * Here you can find more information of how to describe an attribute:
- * - https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/vertexAttribPointer
- *
- * @class WebGLPipeline
- * @memberOf Phaser.Renderer.WebGL
- * @constructor
- * @since 3.0.0
- *
- * @param {object} config - [description]
- */
-var WebGLPipeline = new Class({
-
- initialize:
-
- function WebGLPipeline (config)
- {
- /**
- * Name of the Pipeline. Used for identifying
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#name
- * @type {string}
- * @since 3.0.0
- */
- this.name = 'WebGLPipeline';
-
- /**
- * [description]
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#game
- * @type {Phaser.Game}
- * @since 3.0.0
- */
- this.game = config.game;
-
- /**
- * [description]
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#view
- * @type {HTMLCanvasElement}
- * @since 3.0.0
- */
- this.view = config.game.canvas;
-
- /**
- * Used to store the current game resolution
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#resolution
- * @type {number}
- * @since 3.0.0
- */
- this.resolution = config.game.config.resolution;
-
- /**
- * Width of the current viewport
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#width
- * @type {number}
- * @since 3.0.0
- */
- this.width = config.game.config.width * this.resolution;
-
- /**
- * Height of the current viewport
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#height
- * @type {number}
- * @since 3.0.0
- */
- this.height = config.game.config.height * this.resolution;
-
- /**
- * [description]
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#gl
- * @type {WebGLRenderingContext}
- * @since 3.0.0
- */
- this.gl = config.gl;
-
- /**
- * How many vertices have been fed to the current pipeline.
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCount
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.vertexCount = 0;
-
- /**
- * The limit of vertices that the pipeline can hold
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCapacity
- * @type {integer}
- * @since 3.0.0
- */
- this.vertexCapacity = config.vertexCapacity;
-
- /**
- * [description]
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#renderer
- * @type {Phaser.Renderer.WebGL.WebGLRenderer}
- * @since 3.0.0
- */
- this.renderer = config.renderer;
-
- /**
- * Raw byte buffer of vertices.
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexData
- * @type {ArrayBuffer}
- * @since 3.0.0
- */
- this.vertexData = (config.vertices ? config.vertices : new ArrayBuffer(config.vertexCapacity * config.vertexSize));
-
- /**
- * The handle to a WebGL vertex buffer object.
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexBuffer
- * @type {WebGLBuffer}
- * @since 3.0.0
- */
- this.vertexBuffer = this.renderer.createVertexBuffer((config.vertices ? config.vertices : this.vertexData.byteLength), this.gl.STREAM_DRAW);
-
- /**
- * The handle to a WebGL program
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#program
- * @type {WebGLProgram}
- * @since 3.0.0
- */
- this.program = this.renderer.createProgram(config.vertShader, config.fragShader);
-
- /**
- * Array of objects that describe the vertex attributes
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#attributes
- * @type {object}
- * @since 3.0.0
- */
- this.attributes = config.attributes;
-
- /**
- * The size in bytes of the vertex
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexSize
- * @type {integer}
- * @since 3.0.0
- */
- this.vertexSize = config.vertexSize;
-
- /**
- * The primitive topology which the pipeline will use to submit draw calls
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#topology
- * @type {integer}
- * @since 3.0.0
- */
- this.topology = config.topology;
-
- /**
- * Uint8 view to the vertex raw buffer. Used for uploading vertex buffer resources
- * to the GPU.
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#bytes
- * @type {Uint8Array}
- * @since 3.0.0
- */
- this.bytes = new Uint8Array(this.vertexData);
-
- /**
- * This will store the amount of components of 32 bit length
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#vertexComponentCount
- * @type {integer}
- * @since 3.0.0
- */
- this.vertexComponentCount = Utils.getComponentCount(config.attributes, this.gl);
-
- /**
- * Indicates if the current pipeline is flushing the contents to the GPU.
- * When the variable is set the flush function will be locked.
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#flushLocked
- * @type {boolean}
- * @since 3.1.0
- */
- this.flushLocked = false;
-
- /**
- * Indicates if the current pipeline is active or not for this frame only.
- * Reset in the onRender method.
- *
- * @name Phaser.Renderer.WebGL.WebGLPipeline#active
- * @type {boolean}
- * @since 3.10.0
- */
- this.active = false;
- },
-
- /**
- * Adds a description of vertex attribute to the pipeline
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#addAttribute
- * @since 3.2.0
- *
- * @param {string} name - Name of the vertex attribute
- * @param {integer} size - Vertex component size
- * @param {integer} type - Type of the attribute
- * @param {boolean} normalized - Is the value normalized to a range
- * @param {integer} offset - Byte offset to the beginning of the first element in the vertex
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- addAttribute: function (name, size, type, normalized, offset)
- {
- this.attributes.push({
- name: name,
- size: size,
- type: this.renderer.glFormats[type],
- normalized: normalized,
- offset: offset
- });
-
- return this;
- },
-
- /**
- * Check if the current batch of vertices is full.
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush
- * @since 3.0.0
- *
- * @return {boolean} [description]
- */
- shouldFlush: function ()
- {
- return (this.vertexCount >= this.vertexCapacity);
- },
-
- /**
- * Resizes the properties used to describe the viewport
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#resize
- * @since 3.0.0
- *
- * @param {number} width - [description]
- * @param {number} height - [description]
- * @param {number} resolution - [description]
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- resize: function (width, height, resolution)
- {
- this.width = width * resolution;
- this.height = height * resolution;
- return this;
- },
-
- /**
- * Binds the pipeline resources, including programs, vertex buffers and binds attributes
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#bind
- * @since 3.0.0
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- bind: function ()
- {
- var gl = this.gl;
- var vertexBuffer = this.vertexBuffer;
- var attributes = this.attributes;
- var program = this.program;
- var renderer = this.renderer;
- var vertexSize = this.vertexSize;
-
- renderer.setProgram(program);
- renderer.setVertexBuffer(vertexBuffer);
-
- for (var index = 0; index < attributes.length; ++index)
- {
- var element = attributes[index];
- var location = gl.getAttribLocation(program, element.name);
-
- if (location >= 0)
- {
- gl.enableVertexAttribArray(location);
- gl.vertexAttribPointer(location, element.size, element.type, element.normalized, vertexSize, element.offset);
- }
- else
- {
- gl.disableVertexAttribArray(location);
- }
- }
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#onBind
- * @since 3.0.0
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- onBind: function ()
- {
- // This is for updating uniform data it's called on each bind attempt.
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender
- * @since 3.0.0
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- onPreRender: function ()
- {
- // called once every frame
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#onRender
- * @since 3.0.0
- *
- * @param {Phaser.Scene} scene - [description]
- * @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- onRender: function ()
- {
- // called for each camera
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender
- * @since 3.0.0
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- onPostRender: function ()
- {
- // called once every frame
- return this;
- },
-
- /**
- * Uploads the vertex data and emits a draw call
- * for the current batch of vertices.
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#flush
- * @since 3.0.0
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- flush: function ()
- {
- if (this.flushLocked) { return this; }
-
- this.flushLocked = true;
-
- var gl = this.gl;
- var vertexCount = this.vertexCount;
- var topology = this.topology;
- var vertexSize = this.vertexSize;
-
- if (vertexCount === 0)
- {
- this.flushLocked = false;
- return;
- }
-
- gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize));
- gl.drawArrays(topology, 0, vertexCount);
-
- this.vertexCount = 0;
- this.flushLocked = false;
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#destroy
- * @since 3.0.0
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- destroy: function ()
- {
- var gl = this.gl;
-
- gl.deleteProgram(this.program);
- gl.deleteBuffer(this.vertexBuffer);
-
- delete this.program;
- delete this.vertexBuffer;
- delete this.gl;
-
- return this;
- },
-
- /**
- * Set a uniform value of the current pipeline program.
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat1
- * @since 3.2.0
- *
- * @param {string} name - [description]
- * @param {float} x - [description]
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- setFloat1: function (name, x)
- {
- this.renderer.setFloat1(this.program, name, x);
- return this;
- },
-
- /**
- * Set a uniform value of the current pipeline program.
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat2
- * @since 3.2.0
- *
- * @param {string} name - [description]
- * @param {float} x - [description]
- * @param {float} y - [description]
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- setFloat2: function (name, x, y)
- {
-
- this.renderer.setFloat2(this.program, name, x, y);
- return this;
- },
-
- /**
- * Set a uniform value of the current pipeline program.
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat3
- * @since 3.2.0
- *
- * @param {string} name - [description]
- * @param {float} x - [description]
- * @param {float} y - [description]
- * @param {float} z - [description]
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- setFloat3: function (name, x, y, z)
- {
-
- this.renderer.setFloat3(this.program, name, x, y, z);
- return this;
- },
-
- /**
- * Set a uniform value of the current pipeline program.
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat4
- * @since 3.2.0
- *
- * @param {string} name - Name of the uniform
- * @param {float} x - X component of the uniform
- * @param {float} y - Y component of the uniform
- * @param {float} z - Z component of the uniform
- * @param {float} w - W component of the uniform
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- setFloat4: function (name, x, y, z, w)
- {
-
- this.renderer.setFloat4(this.program, name, x, y, z, w);
- return this;
- },
-
- /**
- * Set a uniform value of the current pipeline program.
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt1
- * @since 3.2.0
- *
- * @param {string} name - [description]
- * @param {integer} x - [description]
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- setInt1: function (name, x)
- {
- this.renderer.setInt1(this.program, name, x);
- return this;
- },
-
- /**
- * Set a uniform value of the current pipeline program.
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt2
- * @since 3.2.0
- *
- * @param {string} name - [description]
- * @param {integer} x - [description]
- * @param {integer} y - [description]
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- setInt2: function (name, x, y)
- {
- this.renderer.setInt2(this.program, name, x, y);
- return this;
- },
-
- /**
- * Set a uniform value of the current pipeline program.
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt3
- * @since 3.2.0
- *
- * @param {string} name - [description]
- * @param {integer} x - [description]
- * @param {integer} y - [description]
- * @param {integer} z - [description]
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- setInt3: function (name, x, y, z)
- {
- this.renderer.setInt3(this.program, name, x, y, z);
- return this;
- },
-
- /**
- * Set a uniform value of the current pipeline program.
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#setInt4
- * @since 3.2.0
- *
- * @param {string} name - Name of the uniform
- * @param {integer} x - X component of the uniform
- * @param {integer} y - Y component of the uniform
- * @param {integer} z - Z component of the uniform
- * @param {integer} w - W component of the uniform
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- setInt4: function (name, x, y, z, w)
- {
- this.renderer.setInt4(this.program, name, x, y, z, w);
- return this;
- },
-
- /**
- * Set a uniform value of the current pipeline program.
- * [description]
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix2
- * @since 3.2.0
- *
- * @param {string} name - [description]
- * @param {boolean} transpose - [description]
- * @param {Float32Array} matrix - [description]
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- setMatrix2: function (name, transpose, matrix)
- {
- this.renderer.setMatrix2(this.program, name, transpose, matrix);
- return this;
- },
-
- /**
- * Set a uniform value of the current pipeline program.
- * [description]
- * [description]
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix3
- * @since 3.2.0
- *
- * @param {string} name - [description]
- * @param {boolean} transpose - [description]
- * @param {Float32Array} matrix - [description]
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- setMatrix3: function (name, transpose, matrix)
- {
- this.renderer.setMatrix3(this.program, name, transpose, matrix);
- return this;
- },
-
- /**
- * Set a uniform value of the current pipeline program.
- *
- * @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix4
- * @since 3.2.0
- *
- * @param {string} name - Name of the uniform
- * @param {boolean} transpose - Should the matrix be transpose
- * @param {Float32Array} matrix - Matrix data
- *
- * @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
- */
- setMatrix4: function (name, transpose, matrix)
- {
- this.renderer.setMatrix4(this.program, name, transpose, matrix);
- return this;
- }
-
-});
-
-module.exports = WebGLPipeline;
-
-
-/***/ }),
-/* 85 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Checks if the given `width` and `height` are a power of two.
- * Useful for checking texture dimensions.
- *
- * @function Phaser.Math.Pow2.IsSizePowerOfTwo
- * @since 3.0.0
- *
- * @param {number} width - The width.
- * @param {number} height - The height.
- *
- * @return {boolean} `true` if `width` and `height` are a power of two, otherwise `false`.
- */
-var IsSizePowerOfTwo = function (width, height)
-{
- return (width > 0 && (width & (width - 1)) === 0 && height > 0 && (height & (height - 1)) === 0);
-};
-
-module.exports = IsSizePowerOfTwo;
-
-
-/***/ }),
-/* 86 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Class = __webpack_require__(0);
-var FromPoints = __webpack_require__(274);
-var Rectangle = __webpack_require__(14);
-var Vector2 = __webpack_require__(6);
+var FromPoints = __webpack_require__(173);
+var Rectangle = __webpack_require__(9);
+var Vector2 = __webpack_require__(3);
/**
* @classdesc
@@ -14038,7 +11891,7 @@ var Vector2 = __webpack_require__(6);
* Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog)
*
* @class Curve
- * @memberOf Phaser.Curves
+ * @memberof Phaser.Curves
* @constructor
* @since 3.0.0
*
@@ -14153,7 +12006,7 @@ var Curve = new Class({
// So you can chain graphics calls
return graphics.strokePoints(this.getPoints(pointsTotal));
},
-
+
/**
* Returns a Rectangle where the position and dimensions match the bounds of this Curve.
*
@@ -14214,9 +12067,9 @@ var Curve = new Class({
* @method Phaser.Curves.Curve#getEndPoint
* @since 3.0.0
*
- * @param {Phaser.Math.Vector2} out - [description]
+ * @param {Phaser.Math.Vector2} [out] - Optional Vector object to store the result in.
*
- * @return {Phaser.Math.Vector2} [description]
+ * @return {Phaser.Math.Vector2} Vector2 containing the coordinates of the curves end point.
*/
getEndPoint: function (out)
{
@@ -14300,7 +12153,7 @@ var Curve = new Class({
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
- * @param {float} u - [description]
+ * @param {number} u - [description]
* @param {Phaser.Math.Vector2} [out] - [description]
*
* @return {Phaser.Math.Vector2} [description]
@@ -14420,7 +12273,7 @@ var Curve = new Class({
* @param {number} t - [description]
* @param {Phaser.Math.Vector2} [out] - [description]
*
- * @return {Phaser.Math.Vector2} [description]
+ * @return {Phaser.Math.Vector2} Vector approximating the tangent line at the point t (delta +/- 0.0001)
*/
getTangent: function (t, out)
{
@@ -14456,7 +12309,7 @@ var Curve = new Class({
*
* @generic {Phaser.Math.Vector2} O - [out,$return]
*
- * @param {float} u - [description]
+ * @param {number} u - [description]
* @param {Phaser.Math.Vector2} [out] - [description]
*
* @return {Phaser.Math.Vector2} [description]
@@ -14478,7 +12331,7 @@ var Curve = new Class({
* @param {integer} distance - [description]
* @param {integer} [divisions] - [description]
*
- * @return {float} [description]
+ * @return {number} [description]
*/
getTFromDistance: function (distance, divisions)
{
@@ -14498,7 +12351,7 @@ var Curve = new Class({
* @method Phaser.Curves.Curve#getUtoTmapping
* @since 3.0.0
*
- * @param {float} u - [description]
+ * @param {number} u - [description]
* @param {integer} distance - [description]
* @param {integer} [divisions] - [description]
*
@@ -14592,793 +12445,7 @@ module.exports = Curve;
/***/ }),
-/* 87 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji
-// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl
-
-var Class = __webpack_require__(0);
-
-/**
- * @classdesc
- * A representation of a vector in 3D space.
- *
- * A three-component vector.
- *
- * @class Vector3
- * @memberOf Phaser.Math
- * @constructor
- * @since 3.0.0
- *
- * @param {number} [x] - The x component.
- * @param {number} [y] - The y component.
- * @param {number} [z] - The z component.
- */
-var Vector3 = new Class({
-
- initialize:
-
- function Vector3 (x, y, z)
- {
- /**
- * The x component of this Vector.
- *
- * @name Phaser.Math.Vector3#x
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.x = 0;
-
- /**
- * The y component of this Vector.
- *
- * @name Phaser.Math.Vector3#y
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.y = 0;
-
- /**
- * The z component of this Vector.
- *
- * @name Phaser.Math.Vector3#z
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.z = 0;
-
- if (typeof x === 'object')
- {
- this.x = x.x || 0;
- this.y = x.y || 0;
- this.z = x.z || 0;
- }
- else
- {
- this.x = x || 0;
- this.y = y || 0;
- this.z = z || 0;
- }
- },
-
- /**
- * Set this Vector to point up.
- *
- * Sets the y component of the vector to 1, and the others to 0.
- *
- * @method Phaser.Math.Vector3#up
- * @since 3.0.0
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- up: function ()
- {
- this.x = 0;
- this.y = 1;
- this.z = 0;
-
- return this;
- },
-
- /**
- * Make a clone of this Vector3.
- *
- * @method Phaser.Math.Vector3#clone
- * @since 3.0.0
- *
- * @return {Phaser.Math.Vector3} A new Vector3 object containing this Vectors values.
- */
- clone: function ()
- {
- return new Vector3(this.x, this.y, this.z);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Math.Vector3#crossVectors
- * @since 3.0.0
- *
- * @param {Phaser.Math.Vector3} a - [description]
- * @param {Phaser.Math.Vector3} b - [description]
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- crossVectors: function (a, b)
- {
- var ax = a.x;
- var ay = a.y;
- var az = a.z;
- var bx = b.x;
- var by = b.y;
- var bz = b.z;
-
- this.x = ay * bz - az * by;
- this.y = az * bx - ax * bz;
- this.z = ax * by - ay * bx;
-
- return this;
- },
-
- /**
- * Check whether this Vector is equal to a given Vector.
- *
- * Performs a strict equality check against each Vector's components.
- *
- * @method Phaser.Math.Vector3#equals
- * @since 3.0.0
- *
- * @param {Phaser.Math.Vector3} v - The Vector3 to compare against.
- *
- * @return {boolean} True if the two vectors strictly match, otherwise false.
- */
- equals: function (v)
- {
- return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z));
- },
-
- /**
- * Copy the components of a given Vector into this Vector.
- *
- * @method Phaser.Math.Vector3#copy
- * @since 3.0.0
- *
- * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} src - The Vector to copy the components from.
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- copy: function (src)
- {
- this.x = src.x;
- this.y = src.y;
- this.z = src.z || 0;
-
- return this;
- },
-
- /**
- * Set the `x`, `y`, and `z` components of this Vector to the given `x`, `y`, and `z` values.
- *
- * @method Phaser.Math.Vector3#set
- * @since 3.0.0
- *
- * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y and z components.
- * @param {number} [y] - The y value to set for this Vector.
- * @param {number} [z] - The z value to set for this Vector.
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- set: function (x, y, z)
- {
- if (typeof x === 'object')
- {
- this.x = x.x || 0;
- this.y = x.y || 0;
- this.z = x.z || 0;
- }
- else
- {
- this.x = x || 0;
- this.y = y || 0;
- this.z = z || 0;
- }
-
- return this;
- },
-
- /**
- * Add a given Vector to this Vector. Addition is component-wise.
- *
- * @method Phaser.Math.Vector3#add
- * @since 3.0.0
- *
- * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector.
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- add: function (v)
- {
- this.x += v.x;
- this.y += v.y;
- this.z += v.z || 0;
-
- return this;
- },
-
- /**
- * Subtract the given Vector from this Vector. Subtraction is component-wise.
- *
- * @method Phaser.Math.Vector3#subtract
- * @since 3.0.0
- *
- * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to subtract from this Vector.
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- subtract: function (v)
- {
- this.x -= v.x;
- this.y -= v.y;
- this.z -= v.z || 0;
-
- return this;
- },
-
- /**
- * Perform a component-wise multiplication between this Vector and the given Vector.
- *
- * Multiplies this Vector by the given Vector.
- *
- * @method Phaser.Math.Vector3#multiply
- * @since 3.0.0
- *
- * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to multiply this Vector by.
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- multiply: function (v)
- {
- this.x *= v.x;
- this.y *= v.y;
- this.z *= v.z || 1;
-
- return this;
- },
-
- /**
- * Scale this Vector by the given value.
- *
- * @method Phaser.Math.Vector3#scale
- * @since 3.0.0
- *
- * @param {number} scale - The value to scale this Vector by.
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- scale: function (scale)
- {
- if (isFinite(scale))
- {
- this.x *= scale;
- this.y *= scale;
- this.z *= scale;
- }
- else
- {
- this.x = 0;
- this.y = 0;
- this.z = 0;
- }
-
- return this;
- },
-
- /**
- * Perform a component-wise division between this Vector and the given Vector.
- *
- * Divides this Vector by the given Vector.
- *
- * @method Phaser.Math.Vector3#divide
- * @since 3.0.0
- *
- * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to divide this Vector by.
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- divide: function (v)
- {
- this.x /= v.x;
- this.y /= v.y;
- this.z /= v.z || 1;
-
- return this;
- },
-
- /**
- * Negate the `x`, `y` and `z` components of this Vector.
- *
- * @method Phaser.Math.Vector3#negate
- * @since 3.0.0
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- negate: function ()
- {
- this.x = -this.x;
- this.y = -this.y;
- this.z = -this.z;
-
- return this;
- },
-
- /**
- * Calculate the distance between this Vector and the given Vector.
- *
- * @method Phaser.Math.Vector3#distance
- * @since 3.0.0
- *
- * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to.
- *
- * @return {number} The distance from this Vector to the given Vector.
- */
- distance: function (v)
- {
- var dx = v.x - this.x;
- var dy = v.y - this.y;
- var dz = v.z - this.z || 0;
-
- return Math.sqrt(dx * dx + dy * dy + dz * dz);
- },
-
- /**
- * Calculate the distance between this Vector, and the given Vector, squared.
- *
- * @method Phaser.Math.Vector3#distanceSq
- * @since 3.0.0
- *
- * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to.
- *
- * @return {number} The distance from this Vector to the given Vector, squared.
- */
- distanceSq: function (v)
- {
- var dx = v.x - this.x;
- var dy = v.y - this.y;
- var dz = v.z - this.z || 0;
-
- return dx * dx + dy * dy + dz * dz;
- },
-
- /**
- * Calculate the length (or magnitude) of this Vector.
- *
- * @method Phaser.Math.Vector3#length
- * @since 3.0.0
- *
- * @return {number} The length of this Vector.
- */
- length: function ()
- {
- var x = this.x;
- var y = this.y;
- var z = this.z;
-
- return Math.sqrt(x * x + y * y + z * z);
- },
-
- /**
- * Calculate the length of this Vector squared.
- *
- * @method Phaser.Math.Vector3#lengthSq
- * @since 3.0.0
- *
- * @return {number} The length of this Vector, squared.
- */
- lengthSq: function ()
- {
- var x = this.x;
- var y = this.y;
- var z = this.z;
-
- return x * x + y * y + z * z;
- },
-
- /**
- * Normalize this Vector.
- *
- * Makes the vector a unit length vector (magnitude of 1) in the same direction.
- *
- * @method Phaser.Math.Vector3#normalize
- * @since 3.0.0
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- normalize: function ()
- {
- var x = this.x;
- var y = this.y;
- var z = this.z;
- var len = x * x + y * y + z * z;
-
- if (len > 0)
- {
- len = 1 / Math.sqrt(len);
-
- this.x = x * len;
- this.y = y * len;
- this.z = z * len;
- }
-
- return this;
- },
-
- /**
- * Calculate the dot product of this Vector and the given Vector.
- *
- * @method Phaser.Math.Vector3#dot
- * @since 3.0.0
- *
- * @param {Phaser.Math.Vector3} v - The Vector3 to dot product with this Vector3.
- *
- * @return {number} [description]
- */
- dot: function (v)
- {
- return this.x * v.x + this.y * v.y + this.z * v.z;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Math.Vector3#cross
- * @since 3.0.0
- *
- * @param {Phaser.Math.Vector3} v - [description]
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- cross: function (v)
- {
- var ax = this.x;
- var ay = this.y;
- var az = this.z;
- var bx = v.x;
- var by = v.y;
- var bz = v.z;
-
- this.x = ay * bz - az * by;
- this.y = az * bx - ax * bz;
- this.z = ax * by - ay * bx;
-
- return this;
- },
-
- /**
- * Linearly interpolate between this Vector and the given Vector.
- *
- * Interpolates this Vector towards the given Vector.
- *
- * @method Phaser.Math.Vector3#lerp
- * @since 3.0.0
- *
- * @param {Phaser.Math.Vector3} v - The Vector3 to interpolate towards.
- * @param {number} [t=0] - The interpolation percentage, between 0 and 1.
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- lerp: function (v, t)
- {
- if (t === undefined) { t = 0; }
-
- var ax = this.x;
- var ay = this.y;
- var az = this.z;
-
- this.x = ax + t * (v.x - ax);
- this.y = ay + t * (v.y - ay);
- this.z = az + t * (v.z - az);
-
- return this;
- },
-
- /**
- * Transform this Vector with the given Matrix.
- *
- * @method Phaser.Math.Vector3#transformMat3
- * @since 3.0.0
- *
- * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector3 with.
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- transformMat3: function (mat)
- {
- var x = this.x;
- var y = this.y;
- var z = this.z;
- var m = mat.val;
-
- this.x = x * m[0] + y * m[3] + z * m[6];
- this.y = x * m[1] + y * m[4] + z * m[7];
- this.z = x * m[2] + y * m[5] + z * m[8];
-
- return this;
- },
-
- /**
- * Transform this Vector with the given Matrix.
- *
- * @method Phaser.Math.Vector3#transformMat4
- * @since 3.0.0
- *
- * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with.
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- transformMat4: function (mat)
- {
- var x = this.x;
- var y = this.y;
- var z = this.z;
- var m = mat.val;
-
- this.x = m[0] * x + m[4] * y + m[8] * z + m[12];
- this.y = m[1] * x + m[5] * y + m[9] * z + m[13];
- this.z = m[2] * x + m[6] * y + m[10] * z + m[14];
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Math.Vector3#transformCoordinates
- * @since 3.0.0
- *
- * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with.
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- transformCoordinates: function (mat)
- {
- var x = this.x;
- var y = this.y;
- var z = this.z;
- var m = mat.val;
-
- var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12];
- var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13];
- var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14];
- var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15];
-
- this.x = tx / tw;
- this.y = ty / tw;
- this.z = tz / tw;
-
- return this;
- },
-
- /**
- * Transform this Vector with the given Quaternion.
- *
- * @method Phaser.Math.Vector3#transformQuat
- * @since 3.0.0
- *
- * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with.
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- transformQuat: function (q)
- {
- // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations
- var x = this.x;
- var y = this.y;
- var z = this.z;
- var qx = q.x;
- var qy = q.y;
- var qz = q.z;
- var qw = q.w;
-
- // calculate quat * vec
- var ix = qw * x + qy * z - qz * y;
- var iy = qw * y + qz * x - qx * z;
- var iz = qw * z + qx * y - qy * x;
- var iw = -qx * x - qy * y - qz * z;
-
- // calculate result * inverse quat
- this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;
- this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;
- this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;
-
- return this;
- },
-
- /**
- * Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection,
- * e.g. unprojecting a 2D point into 3D space.
- *
- * @method Phaser.Math.Vector3#project
- * @since 3.0.0
- *
- * @param {Phaser.Math.Matrix4} mat - The Matrix4 to multiply this Vector3 with.
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- project: function (mat)
- {
- var x = this.x;
- var y = this.y;
- var z = this.z;
- var m = mat.val;
-
- var a00 = m[0];
- var a01 = m[1];
- var a02 = m[2];
- var a03 = m[3];
- var a10 = m[4];
- var a11 = m[5];
- var a12 = m[6];
- var a13 = m[7];
- var a20 = m[8];
- var a21 = m[9];
- var a22 = m[10];
- var a23 = m[11];
- var a30 = m[12];
- var a31 = m[13];
- var a32 = m[14];
- var a33 = m[15];
-
- var lw = 1 / (x * a03 + y * a13 + z * a23 + a33);
-
- this.x = (x * a00 + y * a10 + z * a20 + a30) * lw;
- this.y = (x * a01 + y * a11 + z * a21 + a31) * lw;
- this.z = (x * a02 + y * a12 + z * a22 + a32) * lw;
-
- return this;
- },
-
- /**
- * Unproject this point from 2D space to 3D space.
- * The point should have its x and y properties set to
- * 2D screen space, and the z either at 0 (near plane)
- * or 1 (far plane). The provided matrix is assumed to already
- * be combined, i.e. projection * view * model.
- *
- * After this operation, this vector's (x, y, z) components will
- * represent the unprojected 3D coordinate.
- *
- * @method Phaser.Math.Vector3#unproject
- * @since 3.0.0
- *
- * @param {Phaser.Math.Vector4} viewport - Screen x, y, width and height in pixels.
- * @param {Phaser.Math.Matrix4} invProjectionView - Combined projection and view matrix.
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- unproject: function (viewport, invProjectionView)
- {
- var viewX = viewport.x;
- var viewY = viewport.y;
- var viewWidth = viewport.z;
- var viewHeight = viewport.w;
-
- var x = this.x - viewX;
- var y = (viewHeight - this.y - 1) - viewY;
- var z = this.z;
-
- this.x = (2 * x) / viewWidth - 1;
- this.y = (2 * y) / viewHeight - 1;
- this.z = 2 * z - 1;
-
- return this.project(invProjectionView);
- },
-
- /**
- * Make this Vector the zero vector (0, 0, 0).
- *
- * @method Phaser.Math.Vector3#reset
- * @since 3.0.0
- *
- * @return {Phaser.Math.Vector3} This Vector3.
- */
- reset: function ()
- {
- this.x = 0;
- this.y = 0;
- this.z = 0;
-
- return this;
- }
-
-});
-
-/*
-Vector3.Zero = function ()
-{
- return new Vector3(0, 0, 0);
-};
-
-Vector3.Up = function ()
-{
- return new Vector3(0, 1.0, 0);
-};
-
-Vector3.Copy = function (source)
-{
- return new Vector3(source.x, source.y, source.z);
-};
-
-Vector3.TransformCoordinates = function (vector, transformation)
-{
- var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]) + (vector.z * transformation.m[8]) + transformation.m[12];
- var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]) + (vector.z * transformation.m[9]) + transformation.m[13];
- var z = (vector.x * transformation.m[2]) + (vector.y * transformation.m[6]) + (vector.z * transformation.m[10]) + transformation.m[14];
- var w = (vector.x * transformation.m[3]) + (vector.y * transformation.m[7]) + (vector.z * transformation.m[11]) + transformation.m[15];
-
- return new Vector3(x / w, y / w, z / w);
-};
-
-Vector3.TransformNormal = function (vector, transformation)
-{
- var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]) + (vector.z * transformation.m[8]);
- var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]) + (vector.z * transformation.m[9]);
- var z = (vector.x * transformation.m[2]) + (vector.y * transformation.m[6]) + (vector.z * transformation.m[10]);
-
- return new Vector3(x, y, z);
-};
-
-Vector3.Dot = function (left, right)
-{
- return (left.x * right.x + left.y * right.y + left.z * right.z);
-};
-
-Vector3.Cross = function (left, right)
-{
- var x = left.y * right.z - left.z * right.y;
- var y = left.z * right.x - left.x * right.z;
- var z = left.x * right.y - left.y * right.x;
-
- return new Vector3(x, y, z);
-};
-
-Vector3.Normalize = function (vector)
-{
- var newVector = Vector3.Copy(vector);
- newVector.normalize();
-
- return newVector;
-};
-
-Vector3.Distance = function (value1, value2)
-{
- return Math.sqrt(Vector3.DistanceSquared(value1, value2));
-};
-
-Vector3.DistanceSquared = function (value1, value2)
-{
- var x = value1.x - value2.x;
- var y = value1.y - value2.y;
- var z = value1.z - value2.z;
-
- return (x * x) + (y * y) + (z * z);
-};
-*/
-
-module.exports = Vector3;
-
-
-/***/ }),
-/* 88 */
+/* 71 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -15388,10 +12455,10 @@ module.exports = Vector3;
*/
var Class = __webpack_require__(0);
-var Contains = __webpack_require__(32);
-var GetPoint = __webpack_require__(298);
-var GetPoints = __webpack_require__(296);
-var Random = __webpack_require__(157);
+var Contains = __webpack_require__(40);
+var GetPoint = __webpack_require__(405);
+var GetPoints = __webpack_require__(403);
+var Random = __webpack_require__(191);
/**
* @classdesc
@@ -15402,7 +12469,7 @@ var Random = __webpack_require__(157);
* To render a Circle you should look at the capabilities of the Graphics class.
*
* @class Circle
- * @memberOf Phaser.Geom
+ * @memberof Phaser.Geom
* @constructor
* @since 3.0.0
*
@@ -15487,7 +12554,7 @@ var Circle = new Class({
*
* @generic {Phaser.Geom.Point} O - [out,$return]
*
- * @param {float} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the circle.
+ * @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the circle.
* @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created.
*
* @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the circle.
@@ -15741,7 +12808,7 @@ module.exports = Circle;
/***/ }),
-/* 89 */
+/* 72 */
/***/ (function(module, exports) {
/**
@@ -15769,7 +12836,7 @@ module.exports = GetCenterY;
/***/ }),
-/* 90 */
+/* 73 */
/***/ (function(module, exports) {
/**
@@ -15804,7 +12871,7 @@ module.exports = SetCenterY;
/***/ }),
-/* 91 */
+/* 74 */
/***/ (function(module, exports) {
/**
@@ -15839,7 +12906,7 @@ module.exports = SetCenterX;
/***/ }),
-/* 92 */
+/* 75 */
/***/ (function(module, exports) {
/**
@@ -15867,906 +12934,8 @@ module.exports = GetCenterX;
/***/ }),
-/* 93 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var ArrayUtils = __webpack_require__(147);
-var Class = __webpack_require__(0);
-var NOOP = __webpack_require__(3);
-var StableSort = __webpack_require__(83);
-
-/**
- * @callback EachListCallback
- * @generic I - [item]
- *
- * @param {*} item - [description]
- * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
- */
-
-/**
- * @classdesc
- * [description]
- *
- * @class List
- * @memberOf Phaser.Structs
- * @constructor
- * @since 3.0.0
- *
- * @generic T
- *
- * @param {*} parent - [description]
- */
-var List = new Class({
-
- initialize:
-
- function List (parent)
- {
- /**
- * The parent of this list.
- *
- * @name Phaser.Structs.List#parent
- * @type {*}
- * @since 3.0.0
- */
- this.parent = parent;
-
- /**
- * The objects that belong to this collection.
- *
- * @genericUse {T[]} - [$type]
- *
- * @name Phaser.Structs.List#list
- * @type {Array.<*>}
- * @default []
- * @since 3.0.0
- */
- this.list = [];
-
- /**
- * [description]
- *
- * @name Phaser.Structs.List#position
- * @type {integer}
- * @default 0
- * @since 3.0.0
- */
- this.position = 0;
-
- /**
- * A callback that is invoked every time a child is added to this list.
- *
- * @name Phaser.Structs.List#addCallback
- * @type {function}
- * @since 3.4.0
- */
- this.addCallback = NOOP;
-
- /**
- * A callback that is invoked every time a child is removed from this list.
- *
- * @name Phaser.Structs.List#removeCallback
- * @type {function}
- * @since 3.4.0
- */
- this.removeCallback = NOOP;
-
- /**
- * The property key to sort by.
- *
- * @name Phaser.Structs.List#_sortKey
- * @type {string}
- * @since 3.4.0
- */
- this._sortKey = '';
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#add
- * @since 3.0.0
- *
- * @genericUse {T} - [child,$return]
- *
- * @param {*|Array.<*>} child - [description]
- * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully.
- *
- * @return {*} [description]
- */
- add: function (child, skipCallback)
- {
- if (skipCallback)
- {
- return ArrayUtils.Add(this.list, child);
- }
- else
- {
- return ArrayUtils.Add(this.list, child, 0, this.addCallback, this);
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#addAt
- * @since 3.0.0
- *
- * @genericUse {T} - [child,$return]
- *
- * @param {*} child - [description]
- * @param {integer} [index=0] - [description]
- * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully.
- *
- * @return {*} [description]
- */
- addAt: function (child, index, skipCallback)
- {
- if (skipCallback)
- {
- return ArrayUtils.AddAt(this.list, child, index);
- }
- else
- {
- return ArrayUtils.AddAt(this.list, child, index, 0, this.addCallback, this);
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#getAt
- * @since 3.0.0
- *
- * @genericUse {T} - [$return]
- *
- * @param {integer} index - [description]
- *
- * @return {*} [description]
- */
- getAt: function (index)
- {
- return this.list[index];
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#getIndex
- * @since 3.0.0
- *
- * @genericUse {T} - [child]
- *
- * @param {*} child - [description]
- *
- * @return {integer} [description]
- */
- getIndex: function (child)
- {
- // Return -1 if given child isn't a child of this display list
- return this.list.indexOf(child);
- },
-
- /**
- * Sort the contents of this List so the items are in order based
- * on the given property. For example, `sort('alpha')` would sort the List
- * contents based on the value of their `alpha` property.
- *
- * @method Phaser.Structs.List#sort
- * @since 3.0.0
- *
- * @genericUse {T[]} - [children,$return]
- *
- * @param {string} property - The property to lexically sort by.
- *
- * @return {Array.<*>} [description]
- */
- sort: function (property)
- {
- if (property)
- {
- this._sortKey = property;
-
- StableSort.inplace(this.list, this.sortHandler);
- }
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#sortHandler
- * @private
- * @since 3.4.0
- *
- * @genericUse {T} - [childA,childB]
- *
- * @param {*} childA - [description]
- * @param {*} childB - [description]
- *
- * @return {integer} [description]
- */
- sortHandler: function (childA, childB)
- {
- return childA[this._sortKey] - childB[this._sortKey];
- },
-
- /**
- * Searches for the first instance of a child with its `name`
- * property matching the given argument. Should more than one child have
- * the same name only the first is returned.
- *
- * @method Phaser.Structs.List#getByName
- * @since 3.0.0
- *
- * @genericUse {T | null} - [$return]
- *
- * @param {string} name - The name to search for.
- *
- * @return {?*} The first child with a matching name, or null if none were found.
- */
- getByName: function (name)
- {
- return ArrayUtils.GetFirst(this.list, 'name', name);
- },
-
- /**
- * Returns a random child from the group.
- *
- * @method Phaser.Structs.List#getRandom
- * @since 3.0.0
- *
- * @genericUse {T | null} - [$return]
- *
- * @param {integer} [startIndex=0] - Offset from the front of the group (lowest child).
- * @param {integer} [length=(to top)] - Restriction on the number of values you want to randomly select from.
- *
- * @return {?*} A random child of this Group.
- */
- getRandom: function (startIndex, length)
- {
- return ArrayUtils.GetRandom(this.list, startIndex, length);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#getFirst
- * @since 3.0.0
- *
- * @genericUse {T} - [value]
- * @genericUse {T | null} - [$return]
- *
- * @param {string} property - [description]
- * @param {*} value - [description]
- * @param {number} [startIndex=0] - [description]
- * @param {number} [endIndex] - [description]
- *
- * @return {?*} [description]
- */
- getFirst: function (property, value, startIndex, endIndex)
- {
- return ArrayUtils.GetFirstElement(this.list, property, value, startIndex, endIndex);
- },
-
- /**
- * Returns all children in this List.
- *
- * You can optionally specify a matching criteria using the `property` and `value` arguments.
- *
- * For example: `getAll('parent')` would return only children that have a property called `parent`.
- *
- * You can also specify a value to compare the property to:
- *
- * `getAll('visible', true)` would return only children that have their visible property set to `true`.
- *
- * Optionally you can specify a start and end index. For example if this List had 100 children,
- * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only
- * the first 50 children in the List.
- *
- * @method Phaser.Structs.List#getAll
- * @since 3.0.0
- *
- * @genericUse {T} - [value]
- * @genericUse {T[]} - [$return]
- *
- * @param {string} [property] - An optional property to test against the value argument.
- * @param {*} [value] - If property is set then Child.property must strictly equal this value to be included in the results.
- * @param {integer} [startIndex] - The first child index to start the search from.
- * @param {integer} [endIndex] - The last child index to search up until.
- *
- * @return {Array.<*>} [description]
- */
- getAll: function (property, value, startIndex, endIndex)
- {
- return ArrayUtils.GetAll(this.list, property, value, startIndex, endIndex);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#count
- * @since 3.0.0
- *
- * @genericUse {T} - [value]
- *
- * @param {string} property - [description]
- * @param {*} value - [description]
- *
- * @return {integer} [description]
- */
- count: function (property, value)
- {
- return ArrayUtils.CountAllMatching(this.list, property, value);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#swap
- * @since 3.0.0
- *
- * @genericUse {T} - [child1,child2]
- *
- * @param {*} child1 - [description]
- * @param {*} child2 - [description]
- */
- swap: function (child1, child2)
- {
- ArrayUtils.Swap(this.list, child1, child2);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#moveTo
- * @since 3.0.0
- *
- * @genericUse {T} - [child,$return]
- *
- * @param {*} child - [description]
- * @param {integer} index - [description]
- *
- * @return {*} [description]
- */
- moveTo: function (child, index)
- {
- return ArrayUtils.MoveTo(this.list, child, index);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#remove
- * @since 3.0.0
- *
- * @genericUse {T} - [child,$return]
- *
- * @param {*} child - [description]
- * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback.
- *
- * @return {*} [description]
- */
- remove: function (child, skipCallback)
- {
- if (skipCallback)
- {
- return ArrayUtils.Remove(this.list, child);
- }
- else
- {
- return ArrayUtils.Remove(this.list, child, this.removeCallback, this);
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#removeAt
- * @since 3.0.0
- *
- * @genericUse {T} - [$return]
- *
- * @param {integer} index - [description]
- * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback.
- *
- * @return {*} [description]
- */
- removeAt: function (index, skipCallback)
- {
- if (skipCallback)
- {
- return ArrayUtils.RemoveAt(this.list, index);
- }
- else
- {
- return ArrayUtils.RemoveAt(this.list, index, this.removeCallback, this);
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#removeBetween
- * @since 3.0.0
- *
- * @genericUse {T[]} - [$return]
- *
- * @param {integer} [startIndex=0] - [description]
- * @param {integer} [endIndex] - [description]
- * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback.
- *
- * @return {Array.<*>} [description]
- */
- removeBetween: function (startIndex, endIndex, skipCallback)
- {
- if (skipCallback)
- {
- return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex);
- }
- else
- {
- return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex, this.removeCallback, this);
- }
- },
-
- /**
- * Removes all the items.
- *
- * @method Phaser.Structs.List#removeAll
- * @since 3.0.0
- *
- * @genericUse {Phaser.Structs.List.} - [$return]
- *
- * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback.
- *
- * @return {Phaser.Structs.List} This List object.
- */
- removeAll: function (skipCallback)
- {
- var i = this.list.length;
-
- while (i--)
- {
- this.remove(this.list[i], skipCallback);
- }
-
- return this;
- },
-
- /**
- * Brings the given child to the top of this List.
- *
- * @method Phaser.Structs.List#bringToTop
- * @since 3.0.0
- *
- * @genericUse {T} - [child,$return]
- *
- * @param {*} child - [description]
- *
- * @return {*} [description]
- */
- bringToTop: function (child)
- {
- return ArrayUtils.BringToTop(this.list, child);
- },
-
- /**
- * Sends the given child to the bottom of this List.
- *
- * @method Phaser.Structs.List#sendToBack
- * @since 3.0.0
- *
- * @genericUse {T} - [child,$return]
- *
- * @param {*} child - [description]
- *
- * @return {*} [description]
- */
- sendToBack: function (child)
- {
- return ArrayUtils.SendToBack(this.list, child);
- },
-
- /**
- * Moves the given child up one place in this group unless it's already at the top.
- *
- * @method Phaser.Structs.List#moveUp
- * @since 3.0.0
- *
- * @genericUse {T} - [child,$return]
- *
- * @param {*} child - [description]
- *
- * @return {*} [description]
- */
- moveUp: function (child)
- {
- ArrayUtils.MoveUp(this.list, child);
-
- return child;
- },
-
- /**
- * Moves the given child down one place in this group unless it's already at the bottom.
- *
- * @method Phaser.Structs.List#moveDown
- * @since 3.0.0
- *
- * @genericUse {T} - [child,$return]
- *
- * @param {*} child - [description]
- *
- * @return {*} [description]
- */
- moveDown: function (child)
- {
- ArrayUtils.MoveDown(this.list, child);
-
- return child;
- },
-
- /**
- * Reverses the order of all children in this List.
- *
- * @method Phaser.Structs.List#reverse
- * @since 3.0.0
- *
- * @genericUse {Phaser.Structs.List.} - [$return]
- *
- * @return {Phaser.Structs.List} This List object.
- */
- reverse: function ()
- {
- this.list.reverse();
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#shuffle
- * @since 3.0.0
- *
- * @genericUse {Phaser.Structs.List.} - [$return]
- *
- * @return {Phaser.Structs.List} This List object.
- */
- shuffle: function ()
- {
- ArrayUtils.Shuffle(this.list);
-
- return this;
- },
-
- /**
- * Replaces a child of this List with the given newChild. The newChild cannot be a member of this List.
- *
- * @method Phaser.Structs.List#replace
- * @since 3.0.0
- *
- * @genericUse {T} - [oldChild,newChild,$return]
- *
- * @param {*} oldChild - The child in this List that will be replaced.
- * @param {*} newChild - The child to be inserted into this List.
- *
- * @return {*} Returns the oldChild that was replaced within this group.
- */
- replace: function (oldChild, newChild)
- {
- return ArrayUtils.Replace(this.list, oldChild, newChild);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#exists
- * @since 3.0.0
- *
- * @genericUse {T} - [child]
- *
- * @param {*} child - [description]
- *
- * @return {boolean} True if the item is found in the list, otherwise false.
- */
- exists: function (child)
- {
- return (this.list.indexOf(child) > -1);
- },
-
- /**
- * Sets the property `key` to the given value on all members of this List.
- *
- * @method Phaser.Structs.List#setAll
- * @since 3.0.0
- *
- * @genericUse {T} - [value]
- *
- * @param {string} property - [description]
- * @param {*} value - [description]
- * @param {integer} [startIndex] - The first child index to start the search from.
- * @param {integer} [endIndex] - The last child index to search up until.
- */
- setAll: function (property, value, startIndex, endIndex)
- {
- ArrayUtils.SetAll(this.list, property, value, startIndex, endIndex);
-
- return this;
- },
-
- /**
- * Passes all children to the given callback.
- *
- * @method Phaser.Structs.List#each
- * @since 3.0.0
- *
- * @genericUse {EachListCallback.} - [callback]
- *
- * @param {EachListCallback} callback - The function to call.
- * @param {*} [context] - Value to use as `this` when executing callback.
- * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
- */
- each: function (callback, context)
- {
- var args = [ null ];
-
- for (var i = 2; i < arguments.length; i++)
- {
- args.push(arguments[i]);
- }
-
- for (i = 0; i < this.list.length; i++)
- {
- args[0] = this.list[i];
-
- callback.apply(context, args);
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#shutdown
- * @since 3.0.0
- */
- shutdown: function ()
- {
- this.removeAll();
-
- this.list = [];
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.List#destroy
- * @since 3.0.0
- */
- destroy: function ()
- {
- this.removeAll();
-
- this.parent = null;
- this.addCallback = null;
- this.removeCallback = null;
- },
-
- /**
- * [description]
- *
- * @name Phaser.Structs.List#length
- * @type {integer}
- * @readOnly
- * @since 3.0.0
- */
- length: {
-
- get: function ()
- {
- return this.list.length;
- }
-
- },
-
- /**
- * [description]
- *
- * @name Phaser.Structs.List#first
- * @type {integer}
- * @readOnly
- * @since 3.0.0
- */
- first: {
-
- get: function ()
- {
- this.position = 0;
-
- if (this.list.length > 0)
- {
- return this.list[0];
- }
- else
- {
- return null;
- }
- }
-
- },
-
- /**
- * [description]
- *
- * @name Phaser.Structs.List#last
- * @type {integer}
- * @readOnly
- * @since 3.0.0
- */
- last: {
-
- get: function ()
- {
- if (this.list.length > 0)
- {
- this.position = this.list.length - 1;
-
- return this.list[this.position];
- }
- else
- {
- return null;
- }
- }
-
- },
-
- /**
- * [description]
- *
- * @name Phaser.Structs.List#next
- * @type {integer}
- * @readOnly
- * @since 3.0.0
- */
- next: {
-
- get: function ()
- {
- if (this.position < this.list.length)
- {
- this.position++;
-
- return this.list[this.position];
- }
- else
- {
- return null;
- }
- }
-
- },
-
- /**
- * [description]
- *
- * @name Phaser.Structs.List#previous
- * @type {integer}
- * @readOnly
- * @since 3.0.0
- */
- previous: {
-
- get: function ()
- {
- if (this.position > 0)
- {
- this.position--;
-
- return this.list[this.position];
- }
- else
- {
- return null;
- }
- }
-
- }
-
-});
-
-module.exports = List;
-
-
-/***/ }),
-/* 94 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Clone = __webpack_require__(33);
-
-/**
- * Creates a new Object using all values from obj1 and obj2.
- * If a value exists in both obj1 and obj2, the value in obj1 is used.
- *
- * @function Phaser.Utils.Object.Merge
- * @since 3.0.0
- *
- * @param {object} obj1 - [description]
- * @param {object} obj2 - [description]
- *
- * @return {object} [description]
- */
-var Merge = function (obj1, obj2)
-{
- var clone = Clone(obj1);
-
- for (var key in obj2)
- {
- if (!clone.hasOwnProperty(key))
- {
- clone[key] = obj2[key];
- }
- }
-
- return clone;
-};
-
-module.exports = Merge;
-
-
-/***/ }),
-/* 95 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Shuffles the contents of the given array using the Fisher-Yates implementation.
- *
- * The original array is modified directly and returned.
- *
- * @function Phaser.Utils.Array.Shuffle
- * @since 3.0.0
- *
- * @param {array} array - The array to shuffle. This array is modified in place.
- *
- * @return {array} The shuffled array.
- */
-var Shuffle = function (array)
-{
- for (var i = array.length - 1; i > 0; i--)
- {
- var j = Math.floor(Math.random() * (i + 1));
- var temp = array[i];
- array[i] = array[j];
- array[j] = temp;
- }
-
- return array;
-};
-
-module.exports = Shuffle;
-
-
-/***/ }),
-/* 96 */
+/* 76 */,
+/* 77 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -16776,2164 +12945,7 @@ module.exports = Shuffle;
*/
var Class = __webpack_require__(0);
-var GetPoint = __webpack_require__(293);
-var GetPoints = __webpack_require__(156);
-var Random = __webpack_require__(155);
-var Vector2 = __webpack_require__(6);
-
-/**
- * @classdesc
- * Defines a Line segment, a part of a line between two endpoints.
- *
- * @class Line
- * @memberOf Phaser.Geom
- * @constructor
- * @since 3.0.0
- *
- * @param {number} [x1=0] - The x coordinate of the lines starting point.
- * @param {number} [y1=0] - The y coordinate of the lines starting point.
- * @param {number} [x2=0] - The x coordinate of the lines ending point.
- * @param {number} [y2=0] - The y coordinate of the lines ending point.
- */
-var Line = new Class({
-
- initialize:
-
- function Line (x1, y1, x2, y2)
- {
- if (x1 === undefined) { x1 = 0; }
- if (y1 === undefined) { y1 = 0; }
- if (x2 === undefined) { x2 = 0; }
- if (y2 === undefined) { y2 = 0; }
-
- /**
- * The x coordinate of the lines starting point.
- *
- * @name Phaser.Geom.Line#x1
- * @type {number}
- * @since 3.0.0
- */
- this.x1 = x1;
-
- /**
- * The y coordinate of the lines starting point.
- *
- * @name Phaser.Geom.Line#y1
- * @type {number}
- * @since 3.0.0
- */
- this.y1 = y1;
-
- /**
- * The x coordinate of the lines ending point.
- *
- * @name Phaser.Geom.Line#x2
- * @type {number}
- * @since 3.0.0
- */
- this.x2 = x2;
-
- /**
- * The y coordinate of the lines ending point.
- *
- * @name Phaser.Geom.Line#y2
- * @type {number}
- * @since 3.0.0
- */
- this.y2 = y2;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Geom.Line#getPoint
- * @since 3.0.0
- *
- * @generic {Phaser.Geom.Point} O - [output,$return]
- *
- * @param {float} position - [description]
- * @param {(Phaser.Geom.Point|object)} [output] - [description]
- *
- * @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point on the line.
- */
- getPoint: function (position, output)
- {
- return GetPoint(this, position, output);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Geom.Line#getPoints
- * @since 3.0.0
- *
- * @generic {Phaser.Geom.Point} O - [output,$return]
- *
- * @param {integer} quantity - [description]
- * @param {integer} [stepRate] - [description]
- * @param {(array|Phaser.Geom.Point[])} [output] - [description]
- *
- * @return {(array|Phaser.Geom.Point[])} [description]
- */
- getPoints: function (quantity, stepRate, output)
- {
- return GetPoints(this, quantity, stepRate, output);
- },
-
- /**
- * Get a random Point on the Line.
- *
- * @method Phaser.Geom.Line#getRandomPoint
- * @since 3.0.0
- *
- * @generic {Phaser.Geom.Point} O - [point,$return]
- *
- * @param {(Phaser.Geom.Point|object)} [point] - An instance of a Point to be modified.
- *
- * @return {Phaser.Geom.Point} A random Point on the Line.
- */
- getRandomPoint: function (point)
- {
- return Random(this, point);
- },
-
- /**
- * Set new coordinates for the line endpoints.
- *
- * @method Phaser.Geom.Line#setTo
- * @since 3.0.0
- *
- * @param {number} [x1=0] - The x coordinate of the lines starting point.
- * @param {number} [y1=0] - The y coordinate of the lines starting point.
- * @param {number} [x2=0] - The x coordinate of the lines ending point.
- * @param {number} [y2=0] - The y coordinate of the lines ending point.
- *
- * @return {Phaser.Geom.Line} This Line object.
- */
- setTo: function (x1, y1, x2, y2)
- {
- if (x1 === undefined) { x1 = 0; }
- if (y1 === undefined) { y1 = 0; }
- if (x2 === undefined) { x2 = 0; }
- if (y2 === undefined) { y2 = 0; }
-
- this.x1 = x1;
- this.y1 = y1;
-
- this.x2 = x2;
- this.y2 = y2;
-
- return this;
- },
-
- /**
- * Returns a Vector2 object that corresponds to the start of this Line.
- *
- * @method Phaser.Geom.Line#getPointA
- * @since 3.0.0
- *
- * @generic {Phaser.Math.Vector2} O - [vec2,$return]
- *
- * @param {Phaser.Math.Vector2} [vec2] - A Vector2 object to set the results in. If `undefined` a new Vector2 will be created.
- *
- * @return {Phaser.Math.Vector2} A Vector2 object that corresponds to the start of this Line.
- */
- getPointA: function (vec2)
- {
- if (vec2 === undefined) { vec2 = new Vector2(); }
-
- vec2.set(this.x1, this.y1);
-
- return vec2;
- },
-
- /**
- * Returns a Vector2 object that corresponds to the start of this Line.
- *
- * @method Phaser.Geom.Line#getPointB
- * @since 3.0.0
- *
- * @generic {Phaser.Math.Vector2} O - [vec2,$return]
- *
- * @param {Phaser.Math.Vector2} [vec2] - A Vector2 object to set the results in. If `undefined` a new Vector2 will be created.
- *
- * @return {Phaser.Math.Vector2} A Vector2 object that corresponds to the start of this Line.
- */
- getPointB: function (vec2)
- {
- if (vec2 === undefined) { vec2 = new Vector2(); }
-
- vec2.set(this.x2, this.y2);
-
- return vec2;
- },
-
- /**
- * The left position of the Line.
- *
- * @name Phaser.Geom.Line#left
- * @type {number}
- * @since 3.0.0
- */
- left: {
-
- get: function ()
- {
- return Math.min(this.x1, this.x2);
- },
-
- set: function (value)
- {
- if (this.x1 <= this.x2)
- {
- this.x1 = value;
- }
- else
- {
- this.x2 = value;
- }
- }
-
- },
-
- /**
- * The right position of the Line.
- *
- * @name Phaser.Geom.Line#right
- * @type {number}
- * @since 3.0.0
- */
- right: {
-
- get: function ()
- {
- return Math.max(this.x1, this.x2);
- },
-
- set: function (value)
- {
- if (this.x1 > this.x2)
- {
- this.x1 = value;
- }
- else
- {
- this.x2 = value;
- }
- }
-
- },
-
- /**
- * The top position of the Line.
- *
- * @name Phaser.Geom.Line#top
- * @type {number}
- * @since 3.0.0
- */
- top: {
-
- get: function ()
- {
- return Math.min(this.y1, this.y2);
- },
-
- set: function (value)
- {
- if (this.y1 <= this.y2)
- {
- this.y1 = value;
- }
- else
- {
- this.y2 = value;
- }
- }
-
- },
-
- /**
- * The bottom position of the Line.
- *
- * @name Phaser.Geom.Line#bottom
- * @type {number}
- * @since 3.0.0
- */
- bottom: {
-
- get: function ()
- {
- return Math.max(this.y1, this.y2);
- },
-
- set: function (value)
- {
- if (this.y1 > this.y2)
- {
- this.y1 = value;
- }
- else
- {
- this.y2 = value;
- }
- }
-
- }
-
-});
-
-module.exports = Line;
-
-
-/***/ }),
-/* 97 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * [description]
- *
- * @function Phaser.Geom.Rectangle.Perimeter
- * @since 3.0.0
- *
- * @param {Phaser.Geom.Rectangle} rect - [description]
- *
- * @return {number} [description]
- */
-var Perimeter = function (rect)
-{
- return 2 * (rect.width + rect.height);
-};
-
-module.exports = Perimeter;
-
-
-/***/ }),
-/* 98 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * @typedef {object} TweenDataGenConfig
- *
- * @property {function} delay - [description]
- * @property {function} duration - [description]
- * @property {function} hold - [description]
- * @property {function} repeat - [description]
- * @property {function} repeatDelay - [description]
- */
-
-/**
- * @typedef {object} Phaser.Tweens.TweenDataConfig
- *
- * @property {object} target - The target to tween.
- * @property {string} key - The property of the target being tweened.
- * @property {function} getEndValue - The returned value sets what the property will be at the END of the Tween.
- * @property {function} getStartValue - The returned value sets what the property will be at the START of the Tween.
- * @property {function} ease - The ease function this tween uses.
- * @property {number} [duration=0] - Duration of the tween in ms/frames, excludes time for yoyo or repeats.
- * @property {number} [totalDuration=0] - The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo)
- * @property {number} [delay=0] - Time in ms/frames before tween will start.
- * @property {boolean} [yoyo=false] - Cause the tween to return back to its start value after hold has expired.
- * @property {number} [hold=0] - Time in ms/frames the tween will pause before running the yoyo or starting a repeat.
- * @property {integer} [repeat=0] - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice.
- * @property {number} [repeatDelay=0] - Time in ms/frames before the repeat will start.
- * @property {boolean} [flipX=false] - Automatically call toggleFlipX when the TweenData yoyos or repeats
- * @property {boolean} [flipY=false] - Automatically call toggleFlipY when the TweenData yoyos or repeats
- * @property {float} [progress=0] - Between 0 and 1 showing completion of this TweenData.
- * @property {float} [elapsed=0] - Delta counter
- * @property {integer} [repeatCounter=0] - How many repeats are left to run?
- * @property {number} [start=0] - Ease value data.
- * @property {number} [current=0] - Ease value data.
- * @property {number} [end=0] - Ease value data.
- * @property {number} [t1=0] - Time duration 1.
- * @property {number} [t2=0] - Time duration 2.
- * @property {TweenDataGenConfig} [gen] - LoadValue generation functions.
- * @property {integer} [state=0] - TWEEN_CONST.CREATED
- */
-
-/**
- * [description]
- *
- * @function Phaser.Tweens.TweenData
- * @since 3.0.0
- *
- * @param {object} target - [description]
- * @param {string} key - [description]
- * @param {function} getEnd - [description]
- * @param {function} getStart - [description]
- * @param {function} ease - [description]
- * @param {number} delay - [description]
- * @param {number} duration - [description]
- * @param {boolean} yoyo - [description]
- * @param {number} hold - [description]
- * @param {number} repeat - [description]
- * @param {number} repeatDelay - [description]
- * @param {boolean} flipX - [description]
- * @param {boolean} flipY - [description]
- *
- * @return {TweenDataConfig} [description]
- */
-var TweenData = function (target, key, getEnd, getStart, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY)
-{
- return {
-
- // The target to tween
- target: target,
-
- // The property of the target to tween
- key: key,
-
- // The returned value sets what the property will be at the END of the Tween.
- getEndValue: getEnd,
-
- // The returned value sets what the property will be at the START of the Tween.
- getStartValue: getStart,
-
- // The ease function this tween uses.
- ease: ease,
-
- // Duration of the tween in ms/frames, excludes time for yoyo or repeats.
- duration: 0,
-
- // The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo)
- totalDuration: 0,
-
- // Time in ms/frames before tween will start.
- delay: 0,
-
- // Cause the tween to return back to its start value after hold has expired.
- yoyo: yoyo,
-
- // Time in ms/frames the tween will pause before running the yoyo or starting a repeat.
- hold: 0,
-
- // Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice.
- repeat: 0,
-
- // Time in ms/frames before the repeat will start.
- repeatDelay: 0,
-
- // Automatically call toggleFlipX when the TweenData yoyos or repeats
- flipX: flipX,
-
- // Automatically call toggleFlipY when the TweenData yoyos or repeats
- flipY: flipY,
-
- // Between 0 and 1 showing completion of this TweenData.
- progress: 0,
-
- // Delta counter.
- elapsed: 0,
-
- // How many repeats are left to run?
- repeatCounter: 0,
-
- // Ease Value Data:
-
- start: 0,
- current: 0,
- end: 0,
-
- // Time Durations
- t1: 0,
- t2: 0,
-
- // LoadValue generation functions
- gen: {
- delay: delay,
- duration: duration,
- hold: hold,
- repeat: repeat,
- repeatDelay: repeatDelay
- },
-
- // TWEEN_CONST.CREATED
- state: 0
- };
-};
-
-module.exports = TweenData;
-
-
-/***/ }),
-/* 99 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Class = __webpack_require__(0);
-var GameObjectCreator = __webpack_require__(13);
-var GameObjectFactory = __webpack_require__(11);
-var TWEEN_CONST = __webpack_require__(61);
-
-/**
- * @classdesc
- * [description]
- *
- * @class Tween
- * @memberOf Phaser.Tweens
- * @constructor
- * @since 3.0.0
- *
- * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description]
- * @param {Phaser.Tweens.TweenDataConfig[]} data - [description]
- * @param {array} targets - [description]
- */
-var Tween = new Class({
-
- initialize:
-
- function Tween (parent, data, targets)
- {
- /**
- * [description]
- *
- * @name Phaser.Tweens.Tween#parent
- * @type {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)}
- * @since 3.0.0
- */
- this.parent = parent;
-
- /**
- * Is the parent of this Tween a Timeline?
- *
- * @name Phaser.Tweens.Tween#parentIsTimeline
- * @type {boolean}
- * @since 3.0.0
- */
- this.parentIsTimeline = parent.hasOwnProperty('isTimeline');
-
- /**
- * An array of TweenData objects, each containing a unique property and target being tweened.
- *
- * @name Phaser.Tweens.Tween#data
- * @type {Phaser.Tweens.TweenDataConfig[]}
- * @since 3.0.0
- */
- this.data = data;
-
- /**
- * data array doesn't change, so we can cache the length
- *
- * @name Phaser.Tweens.Tween#totalData
- * @type {integer}
- * @since 3.0.0
- */
- this.totalData = data.length;
-
- /**
- * An array of references to the target/s this Tween is operating on
- *
- * @name Phaser.Tweens.Tween#targets
- * @type {object[]}
- * @since 3.0.0
- */
- this.targets = targets;
-
- /**
- * Cached target total (not necessarily the same as the data total)
- *
- * @name Phaser.Tweens.Tween#totalTargets
- * @type {integer}
- * @since 3.0.0
- */
- this.totalTargets = targets.length;
-
- /**
- * If true then duration, delay, etc values are all frame totals.
- *
- * @name Phaser.Tweens.Tween#useFrames
- * @type {boolean}
- * @default false
- * @since 3.0.0
- */
- this.useFrames = false;
-
- /**
- * Scales the time applied to this Tween. 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 tween, it's a run-time delta adjustment only.
- *
- * @name Phaser.Tweens.Tween#timeScale
- * @type {number}
- * @default 1
- * @since 3.0.0
- */
- this.timeScale = 1;
-
- /**
- * Loop this tween? Can be -1 for an infinite loop, or an integer.
- * When enabled it will play through ALL TweenDatas again (use TweenData.repeat to loop a single TD)
- *
- * @name Phaser.Tweens.Tween#loop
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.loop = 0;
-
- /**
- * Time in ms/frames before the tween loops.
- *
- * @name Phaser.Tweens.Tween#loopDelay
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.loopDelay = 0;
-
- /**
- * How many loops are left to run?
- *
- * @name Phaser.Tweens.Tween#loopCounter
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.loopCounter = 0;
-
- /**
- * Time in ms/frames before the 'onComplete' event fires. This never fires if loop = -1 (as it never completes)
- *
- * @name Phaser.Tweens.Tween#completeDelay
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.completeDelay = 0;
-
- /**
- * Countdown timer (used by timeline offset, loopDelay and completeDelay)
- *
- * @name Phaser.Tweens.Tween#countdown
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.countdown = 0;
-
- /**
- * Set only if this Tween is part of a Timeline.
- *
- * @name Phaser.Tweens.Tween#offset
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.offset = 0;
-
- /**
- * Set only if this Tween is part of a Timeline. The calculated offset amount.
- *
- * @name Phaser.Tweens.Tween#calculatedOffset
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.calculatedOffset = 0;
-
- /**
- * The current state of the tween
- *
- * @name Phaser.Tweens.Tween#state
- * @type {integer}
- * @since 3.0.0
- */
- this.state = TWEEN_CONST.PENDING_ADD;
-
- /**
- * The state of the tween when it was paused (used by Resume)
- *
- * @name Phaser.Tweens.Tween#_pausedState
- * @type {integer}
- * @private
- * @since 3.0.0
- */
- this._pausedState = TWEEN_CONST.PENDING_ADD;
-
- /**
- * Does the Tween start off paused? (if so it needs to be started with Tween.play)
- *
- * @name Phaser.Tweens.Tween#paused
- * @type {boolean}
- * @default false
- * @since 3.0.0
- */
- this.paused = false;
-
- /**
- * Elapsed time in ms/frames of this run through the Tween.
- *
- * @name Phaser.Tweens.Tween#elapsed
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.elapsed = 0;
-
- /**
- * Total elapsed time in ms/frames of the entire Tween, including looping.
- *
- * @name Phaser.Tweens.Tween#totalElapsed
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.totalElapsed = 0;
-
- /**
- * Time in ms/frames for the whole Tween to play through once, excluding loop amounts and loop delays.
- *
- * @name Phaser.Tweens.Tween#duration
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.duration = 0;
-
- /**
- * Value between 0 and 1. The amount through the Tween, excluding loops.
- *
- * @name Phaser.Tweens.Tween#progress
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.progress = 0;
-
- /**
- * Time in ms/frames for the Tween to complete (including looping)
- *
- * @name Phaser.Tweens.Tween#totalDuration
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.totalDuration = 0;
-
- /**
- * Value between 0 and 1. The amount through the entire Tween, including looping.
- *
- * @name Phaser.Tweens.Tween#totalProgress
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.totalProgress = 0;
-
- /**
- * An object containing the various Tween callback references.
- *
- * @name Phaser.Tweens.Tween#callbacks
- * @type {object}
- * @default 0
- * @since 3.0.0
- */
- this.callbacks = {
- onComplete: null,
- onLoop: null,
- onRepeat: null,
- onStart: null,
- onUpdate: null,
- onYoyo: null
- };
-
- this.callbackScope;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#getValue
- * @since 3.0.0
- *
- * @return {number} [description]
- */
- getValue: function ()
- {
- return this.data[0].current;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#setTimeScale
- * @since 3.0.0
- *
- * @param {number} value - [description]
- *
- * @return {Phaser.Tweens.Tween} This Tween object.
- */
- setTimeScale: function (value)
- {
- this.timeScale = value;
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#getTimeScale
- * @since 3.0.0
- *
- * @return {number} [description]
- */
- getTimeScale: function ()
- {
- return this.timeScale;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#isPlaying
- * @since 3.0.0
- *
- * @return {boolean} [description]
- */
- isPlaying: function ()
- {
- return (this.state === TWEEN_CONST.ACTIVE);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#isPaused
- * @since 3.0.0
- *
- * @return {boolean} [description]
- */
- isPaused: function ()
- {
- return (this.state === TWEEN_CONST.PAUSED);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#hasTarget
- * @since 3.0.0
- *
- * @param {object} target - [description]
- *
- * @return {boolean} [description]
- */
- hasTarget: function (target)
- {
- return (this.targets.indexOf(target) !== -1);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#updateTo
- * @since 3.0.0
- *
- * @param {string} key - [description]
- * @param {*} value - [description]
- * @param {boolean} startToCurrent - [description]
- *
- * @return {Phaser.Tweens.Tween} This Tween object.
- */
- updateTo: function (key, value, startToCurrent)
- {
- for (var i = 0; i < this.totalData; i++)
- {
- var tweenData = this.data[i];
-
- if (tweenData.key === key)
- {
- tweenData.end = value;
-
- if (startToCurrent)
- {
- tweenData.start = tweenData.current;
- }
-
- break;
- }
- }
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#restart
- * @since 3.0.0
- */
- restart: function ()
- {
- if (this.state === TWEEN_CONST.REMOVED)
- {
- this.seek(0);
- this.parent.makeActive(this);
- }
- else
- {
- this.stop();
- this.play();
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#calcDuration
- * @since 3.0.0
- */
- calcDuration: function ()
- {
- var max = 0;
-
- var data = this.data;
-
- for (var i = 0; i < this.totalData; i++)
- {
- var tweenData = data[i];
-
- // Set t1 (duration + hold + yoyo)
- tweenData.t1 = tweenData.duration + tweenData.hold;
-
- if (tweenData.yoyo)
- {
- tweenData.t1 += tweenData.duration;
- }
-
- // Set t2 (repeatDelay + duration + hold + yoyo)
- tweenData.t2 = tweenData.t1 + tweenData.repeatDelay;
-
- // Total Duration
- tweenData.totalDuration = tweenData.delay + tweenData.t1;
-
- if (tweenData.repeat === -1)
- {
- tweenData.totalDuration += (tweenData.t2 * 999999999999);
- }
- else if (tweenData.repeat > 0)
- {
- tweenData.totalDuration += (tweenData.t2 * tweenData.repeat);
- }
-
- if (tweenData.totalDuration > max)
- {
- // Get the longest TweenData from the Tween, used to calculate the Tween TD
- max = tweenData.totalDuration;
- }
- }
-
- // Excludes loop values
- this.duration = max;
-
- this.loopCounter = (this.loop === -1) ? 999999999999 : this.loop;
-
- if (this.loopCounter > 0)
- {
- this.totalDuration = this.duration + this.completeDelay + ((this.duration + this.loopDelay) * this.loopCounter);
- }
- else
- {
- this.totalDuration = this.duration + this.completeDelay;
- }
- },
-
- /**
- * Called by TweenManager.preUpdate as part of its loop to check pending and active tweens.
- * Should not be called directly.
- *
- * @method Phaser.Tweens.Tween#init
- * @since 3.0.0
- *
- * @return {boolean} Returns `true` if this Tween should be moved from the pending list to the active list by the Tween Manager.
- */
- init: function ()
- {
- var data = this.data;
- var totalTargets = this.totalTargets;
-
- for (var i = 0; i < this.totalData; i++)
- {
- var tweenData = data[i];
- var target = tweenData.target;
- var gen = tweenData.gen;
-
- tweenData.delay = gen.delay(i, totalTargets, target);
- tweenData.duration = gen.duration(i, totalTargets, target);
- tweenData.hold = gen.hold(i, totalTargets, target);
- tweenData.repeat = gen.repeat(i, totalTargets, target);
- tweenData.repeatDelay = gen.repeatDelay(i, totalTargets, target);
- }
-
- this.calcDuration();
-
- this.progress = 0;
- this.totalProgress = 0;
- this.elapsed = 0;
- this.totalElapsed = 0;
-
- // You can't have a paused Tween if it's part of a Timeline
- if (this.paused && !this.parentIsTimeline)
- {
- this.state = TWEEN_CONST.PENDING_ADD;
- this._pausedState = TWEEN_CONST.INIT;
-
- return false;
- }
- else
- {
- this.state = TWEEN_CONST.INIT;
-
- return true;
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#nextState
- * @since 3.0.0
- */
- nextState: function ()
- {
- if (this.loopCounter > 0)
- {
- this.elapsed = 0;
- this.progress = 0;
- this.loopCounter--;
-
- var onLoop = this.callbacks.onLoop;
-
- if (onLoop)
- {
- onLoop.params[1] = this.targets;
-
- onLoop.func.apply(onLoop.scope, onLoop.params);
- }
-
- this.resetTweenData(true);
-
- if (this.loopDelay > 0)
- {
- this.countdown = this.loopDelay;
- this.state = TWEEN_CONST.LOOP_DELAY;
- }
- else
- {
- this.state = TWEEN_CONST.ACTIVE;
- }
- }
- else if (this.completeDelay > 0)
- {
- this.countdown = this.completeDelay;
- this.state = TWEEN_CONST.COMPLETE_DELAY;
- }
- else
- {
- var onComplete = this.callbacks.onComplete;
-
- if (onComplete)
- {
- onComplete.params[1] = this.targets;
-
- onComplete.func.apply(onComplete.scope, onComplete.params);
- }
-
- this.state = TWEEN_CONST.PENDING_REMOVE;
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#pause
- * @since 3.0.0
- *
- * @return {Phaser.Tweens.Tween} This Tween object.
- */
- pause: function ()
- {
- if (this.state === TWEEN_CONST.PAUSED)
- {
- return;
- }
-
- this.paused = true;
-
- this._pausedState = this.state;
-
- this.state = TWEEN_CONST.PAUSED;
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#play
- * @since 3.0.0
- *
- * @param {boolean} resetFromTimeline - [description]
- */
- play: function (resetFromTimeline)
- {
- if (this.state === TWEEN_CONST.ACTIVE)
- {
- return;
- }
- else if (this.state === TWEEN_CONST.PENDING_REMOVE || this.state === TWEEN_CONST.REMOVED)
- {
- this.init();
- this.parent.makeActive(this);
- resetFromTimeline = true;
- }
-
- var onStart = this.callbacks.onStart;
-
- if (this.parentIsTimeline)
- {
- this.resetTweenData(resetFromTimeline);
-
- if (this.calculatedOffset === 0)
- {
- if (onStart)
- {
- onStart.params[1] = this.targets;
-
- onStart.func.apply(onStart.scope, onStart.params);
- }
-
- this.state = TWEEN_CONST.ACTIVE;
- }
- else
- {
- this.countdown = this.calculatedOffset;
-
- this.state = TWEEN_CONST.OFFSET_DELAY;
- }
- }
- else if (this.paused)
- {
- this.paused = false;
-
- this.parent.makeActive(this);
- }
- else
- {
- this.resetTweenData(resetFromTimeline);
-
- this.state = TWEEN_CONST.ACTIVE;
-
- if (onStart)
- {
- onStart.params[1] = this.targets;
-
- onStart.func.apply(onStart.scope, onStart.params);
- }
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#resetTweenData
- * @since 3.0.0
- *
- * @param {boolean} resetFromLoop - [description]
- */
- resetTweenData: function (resetFromLoop)
- {
- var data = this.data;
-
- for (var i = 0; i < this.totalData; i++)
- {
- var tweenData = data[i];
-
- tweenData.progress = 0;
- tweenData.elapsed = 0;
-
- tweenData.repeatCounter = (tweenData.repeat === -1) ? 999999999999 : tweenData.repeat;
-
- if (resetFromLoop)
- {
- tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start);
-
- tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.end);
-
- tweenData.current = tweenData.start;
-
- tweenData.state = TWEEN_CONST.PLAYING_FORWARD;
- }
- else if (tweenData.delay > 0)
- {
- tweenData.elapsed = tweenData.delay;
- tweenData.state = TWEEN_CONST.DELAY;
- }
- else
- {
- tweenData.state = TWEEN_CONST.PENDING_RENDER;
- }
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#resume
- * @since 3.0.0
- *
- * @return {Phaser.Tweens.Tween} This Tween object.
- */
- resume: function ()
- {
- if (this.state === TWEEN_CONST.PAUSED)
- {
- this.paused = false;
-
- this.state = this._pausedState;
- }
- else
- {
- this.play();
- }
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#seek
- * @since 3.0.0
- *
- * @param {float} toPosition - A value between 0 and 1.
- */
- seek: function (toPosition)
- {
- var data = this.data;
-
- for (var i = 0; i < this.totalData; i++)
- {
- // This won't work with loop > 0 yet
- var ms = this.totalDuration * toPosition;
-
- var tweenData = data[i];
- var progress = 0;
- var elapsed = 0;
-
- if (ms <= tweenData.delay)
- {
- progress = 0;
- elapsed = 0;
- }
- else if (ms >= tweenData.totalDuration)
- {
- progress = 1;
- elapsed = tweenData.duration;
- }
- else if (ms > tweenData.delay && ms <= tweenData.t1)
- {
- // Keep it zero bound
- ms = Math.max(0, ms - tweenData.delay);
-
- // Somewhere in the first playthru range
- progress = ms / tweenData.t1;
- elapsed = tweenData.duration * progress;
- }
- else if (ms > tweenData.t1 && ms < tweenData.totalDuration)
- {
- // Somewhere in repeat land
- ms -= tweenData.delay;
- ms -= tweenData.t1;
-
- // var repeats = Math.floor(ms / tweenData.t2);
-
- // remainder
- ms = ((ms / tweenData.t2) % 1) * tweenData.t2;
-
- if (ms > tweenData.repeatDelay)
- {
- progress = ms / tweenData.t1;
- elapsed = tweenData.duration * progress;
- }
- }
-
- tweenData.progress = progress;
- tweenData.elapsed = elapsed;
-
- var v = tweenData.ease(tweenData.progress);
-
- tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v);
-
- // console.log(tweenData.key, 'Seek', tweenData.target[tweenData.key], 'to', tweenData.current, 'pro', tweenData.progress, 'marker', toPosition, progress);
-
- // if (tweenData.current === 0)
- // {
- // console.log('zero', tweenData.start, tweenData.end, v, 'progress', progress);
- // }
-
- tweenData.target[tweenData.key] = tweenData.current;
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#setCallback
- * @since 3.0.0
- *
- * @param {string} type - [description]
- * @param {function} callback - [description]
- * @param {array} [params] - [description]
- * @param {object} [scope] - [description]
- *
- * @return {Phaser.Tweens.Tween} This Tween object.
- */
- setCallback: function (type, callback, params, scope)
- {
- this.callbacks[type] = { func: callback, scope: scope, params: params };
-
- return this;
- },
-
- /**
- * Flags the Tween as being complete, whatever stage of progress it is at.
- *
- * If an onComplete callback has been defined it will automatically invoke it, unless a `delay`
- * argument is provided, in which case the Tween will delay for that period of time before calling the callback.
- *
- * If you don't need a delay, or have an onComplete callback, then call `Tween.stop` instead.
- *
- * @method Phaser.Tweens.Tween#complete
- * @since 3.2.0
- *
- * @param {number} [delay=0] - The time to wait before invoking the complete callback. If zero it will fire immediately.
- */
- complete: function (delay)
- {
- if (delay === undefined) { delay = 0; }
-
- if (delay)
- {
- this.countdown = delay;
- this.state = TWEEN_CONST.COMPLETE_DELAY;
- }
- else
- {
- var onComplete = this.callbacks.onComplete;
-
- if (onComplete)
- {
- onComplete.params[1] = this.targets;
-
- onComplete.func.apply(onComplete.scope, onComplete.params);
- }
-
- this.state = TWEEN_CONST.PENDING_REMOVE;
- }
- },
-
- /**
- * Stops the Tween immediately, whatever stage of progress it is at and flags it for removal by the TweenManager.
- *
- * @method Phaser.Tweens.Tween#stop
- * @since 3.0.0
- *
- * @param {float} [resetTo] - A value between 0 and 1.
- */
- stop: function (resetTo)
- {
- if (this.state === TWEEN_CONST.ACTIVE)
- {
- if (resetTo !== undefined)
- {
- this.seek(resetTo);
- }
- }
-
- if (this.state !== TWEEN_CONST.REMOVED)
- {
- this.state = TWEEN_CONST.PENDING_REMOVE;
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#update
- * @since 3.0.0
- *
- * @param {number} timestamp - [description]
- * @param {number} delta - [description]
- *
- * @return {boolean} Returns `true` if this Tween has finished and should be removed from the Tween Manager, otherwise returns `false`.
- */
- update: function (timestamp, delta)
- {
- if (this.state === TWEEN_CONST.PAUSED)
- {
- return false;
- }
-
- if (this.useFrames)
- {
- delta = 1 * this.parent.timeScale;
- }
-
- delta *= this.timeScale;
-
- this.elapsed += delta;
- this.progress = Math.min(this.elapsed / this.duration, 1);
-
- this.totalElapsed += delta;
- this.totalProgress = Math.min(this.totalElapsed / this.totalDuration, 1);
-
- switch (this.state)
- {
- case TWEEN_CONST.ACTIVE:
-
- var stillRunning = false;
-
- for (var i = 0; i < this.totalData; i++)
- {
- if (this.updateTweenData(this, this.data[i], delta))
- {
- stillRunning = true;
- }
- }
-
- // Anything still running? If not, we're done
- if (!stillRunning)
- {
- this.nextState();
- }
-
- break;
-
- case TWEEN_CONST.LOOP_DELAY:
-
- this.countdown -= delta;
-
- if (this.countdown <= 0)
- {
- this.state = TWEEN_CONST.ACTIVE;
- }
-
- break;
-
- case TWEEN_CONST.OFFSET_DELAY:
-
- this.countdown -= delta;
-
- if (this.countdown <= 0)
- {
- var onStart = this.callbacks.onStart;
-
- if (onStart)
- {
- onStart.params[1] = this.targets;
-
- onStart.func.apply(onStart.scope, onStart.params);
- }
-
- this.state = TWEEN_CONST.ACTIVE;
- }
-
- break;
-
- case TWEEN_CONST.COMPLETE_DELAY:
-
- this.countdown -= delta;
-
- if (this.countdown <= 0)
- {
- var onComplete = this.callbacks.onComplete;
-
- if (onComplete)
- {
- onComplete.func.apply(onComplete.scope, onComplete.params);
- }
-
- this.state = TWEEN_CONST.PENDING_REMOVE;
- }
-
- break;
- }
-
- return (this.state === TWEEN_CONST.PENDING_REMOVE);
- },
-
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#setStateFromEnd
- * @since 3.0.0
- *
- * @param {Phaser.Tweens.Tween} tween - [description]
- * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description]
- * @param {number} diff - [description]
- *
- * @return {integer} The state of this Tween.
- */
- setStateFromEnd: function (tween, tweenData, diff)
- {
- if (tweenData.yoyo)
- {
- // We've hit the end of a Playing Forward TweenData and we have a yoyo
-
- // Account for any extra time we got from the previous frame
- tweenData.elapsed = diff;
- tweenData.progress = diff / tweenData.duration;
-
- if (tweenData.flipX)
- {
- tweenData.target.toggleFlipX();
- }
-
- // Problem: The flip and callback and so on gets called for every TweenData that triggers it at the same time.
- // If you're tweening several properties it can fire for all of them, at once.
-
- if (tweenData.flipY)
- {
- tweenData.target.toggleFlipY();
- }
-
- var onYoyo = tween.callbacks.onYoyo;
-
- if (onYoyo)
- {
- // Element 1 is reserved for the target of the yoyo (and needs setting here)
- onYoyo.params[1] = tweenData.target;
-
- onYoyo.func.apply(onYoyo.scope, onYoyo.params);
- }
-
- tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start);
-
- return TWEEN_CONST.PLAYING_BACKWARD;
- }
- else if (tweenData.repeatCounter > 0)
- {
- // We've hit the end of a Playing Forward TweenData and we have a Repeat.
- // So we're going to go right back to the start to repeat it again.
-
- tweenData.repeatCounter--;
-
- // Account for any extra time we got from the previous frame
- tweenData.elapsed = diff;
- tweenData.progress = diff / tweenData.duration;
-
- if (tweenData.flipX)
- {
- tweenData.target.toggleFlipX();
- }
-
- if (tweenData.flipY)
- {
- tweenData.target.toggleFlipY();
- }
-
- var onRepeat = tween.callbacks.onRepeat;
-
- if (onRepeat)
- {
- // Element 1 is reserved for the target of the repeat (and needs setting here)
- onRepeat.params[1] = tweenData.target;
-
- onRepeat.func.apply(onRepeat.scope, onRepeat.params);
- }
-
- tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start);
-
- tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start);
-
- // Delay?
- if (tweenData.repeatDelay > 0)
- {
- tweenData.elapsed = tweenData.repeatDelay - diff;
-
- tweenData.current = tweenData.start;
-
- tweenData.target[tweenData.key] = tweenData.current;
-
- return TWEEN_CONST.REPEAT_DELAY;
- }
- else
- {
- return TWEEN_CONST.PLAYING_FORWARD;
- }
- }
-
- return TWEEN_CONST.COMPLETE;
- },
-
- /**
- * Was PLAYING_BACKWARD and has hit the start.
- *
- * @method Phaser.Tweens.Tween#setStateFromStart
- * @since 3.0.0
- *
- * @param {Phaser.Tweens.Tween} tween - [description]
- * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description]
- * @param {number} diff - [description]
- *
- * @return {integer} The state of this Tween.
- */
- setStateFromStart: function (tween, tweenData, diff)
- {
- if (tweenData.repeatCounter > 0)
- {
- tweenData.repeatCounter--;
-
- // Account for any extra time we got from the previous frame
- tweenData.elapsed = diff;
- tweenData.progress = diff / tweenData.duration;
-
- if (tweenData.flipX)
- {
- tweenData.target.toggleFlipX();
- }
-
- if (tweenData.flipY)
- {
- tweenData.target.toggleFlipY();
- }
-
- var onRepeat = tween.callbacks.onRepeat;
-
- if (onRepeat)
- {
- // Element 1 is reserved for the target of the repeat (and needs setting here)
- onRepeat.params[1] = tweenData.target;
-
- onRepeat.func.apply(onRepeat.scope, onRepeat.params);
- }
-
- tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start);
-
- // Delay?
- if (tweenData.repeatDelay > 0)
- {
- tweenData.elapsed = tweenData.repeatDelay - diff;
-
- tweenData.current = tweenData.start;
-
- tweenData.target[tweenData.key] = tweenData.current;
-
- return TWEEN_CONST.REPEAT_DELAY;
- }
- else
- {
- return TWEEN_CONST.PLAYING_FORWARD;
- }
- }
-
- return TWEEN_CONST.COMPLETE;
- },
-
- //
- /**
- * [description]
- *
- * @method Phaser.Tweens.Tween#updateTweenData
- * @since 3.0.0
- *
- * @param {Phaser.Tweens.Tween} tween - [description]
- * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description]
- * @param {number} delta - Either a value in ms, or 1 if Tween.useFrames is true
- *
- * @return {boolean} [description]
- */
- updateTweenData: function (tween, tweenData, delta)
- {
- switch (tweenData.state)
- {
- case TWEEN_CONST.PLAYING_FORWARD:
- case TWEEN_CONST.PLAYING_BACKWARD:
-
- if (!tweenData.target)
- {
- tweenData.state = TWEEN_CONST.COMPLETE;
- break;
- }
-
- var elapsed = tweenData.elapsed;
- var duration = tweenData.duration;
- var diff = 0;
-
- elapsed += delta;
-
- if (elapsed > duration)
- {
- diff = elapsed - duration;
- elapsed = duration;
- }
-
- var forward = (tweenData.state === TWEEN_CONST.PLAYING_FORWARD);
- var progress = elapsed / duration;
-
- var v;
-
- if (forward)
- {
- v = tweenData.ease(progress);
- }
- else
- {
- v = tweenData.ease(1 - progress);
- }
-
- tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v);
-
- tweenData.target[tweenData.key] = tweenData.current;
-
- tweenData.elapsed = elapsed;
- tweenData.progress = progress;
-
- var onUpdate = tween.callbacks.onUpdate;
-
- if (onUpdate)
- {
- onUpdate.params[1] = tweenData.target;
-
- onUpdate.func.apply(onUpdate.scope, onUpdate.params);
- }
-
- if (progress === 1)
- {
- if (forward)
- {
- if (tweenData.hold > 0)
- {
- tweenData.elapsed = tweenData.hold - diff;
-
- tweenData.state = TWEEN_CONST.HOLD_DELAY;
- }
- else
- {
- tweenData.state = this.setStateFromEnd(tween, tweenData, diff);
- }
- }
- else
- {
- tweenData.state = this.setStateFromStart(tween, tweenData, diff);
- }
- }
-
- break;
-
- case TWEEN_CONST.DELAY:
-
- tweenData.elapsed -= delta;
-
- if (tweenData.elapsed <= 0)
- {
- tweenData.elapsed = Math.abs(tweenData.elapsed);
-
- tweenData.state = TWEEN_CONST.PENDING_RENDER;
- }
-
- break;
-
- case TWEEN_CONST.REPEAT_DELAY:
-
- tweenData.elapsed -= delta;
-
- if (tweenData.elapsed <= 0)
- {
- tweenData.elapsed = Math.abs(tweenData.elapsed);
-
- tweenData.state = TWEEN_CONST.PLAYING_FORWARD;
- }
-
- break;
-
- case TWEEN_CONST.HOLD_DELAY:
-
- tweenData.elapsed -= delta;
-
- if (tweenData.elapsed <= 0)
- {
- tweenData.state = this.setStateFromEnd(tween, tweenData, Math.abs(tweenData.elapsed));
- }
-
- break;
-
- case TWEEN_CONST.PENDING_RENDER:
-
- if (tweenData.target)
- {
- tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.target[tweenData.key]);
-
- tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start);
-
- tweenData.current = tweenData.start;
-
- tweenData.target[tweenData.key] = tweenData.start;
-
- tweenData.state = TWEEN_CONST.PLAYING_FORWARD;
- }
- else
- {
- tweenData.state = TWEEN_CONST.COMPLETE;
- }
-
- break;
- }
-
- // Return TRUE if this TweenData still playing, otherwise return FALSE
- return (tweenData.state !== TWEEN_CONST.COMPLETE);
- }
-
-});
-
-Tween.TYPES = [
- 'onComplete',
- 'onLoop',
- 'onRepeat',
- 'onStart',
- 'onUpdate',
- 'onYoyo'
-];
-
-/**
- * Creates a new Tween object.
- *
- * Note: This method will only be available Tweens have been built into Phaser.
- *
- * @method Phaser.GameObjects.GameObjectFactory#tween
- * @since 3.0.0
- *
- * @param {object} config - The Tween configuration.
- *
- * @return {Phaser.Tweens.Tween} The Tween that was created.
- */
-GameObjectFactory.register('tween', function (config)
-{
- return this.scene.sys.tweens.add(config);
-});
-
-// When registering a factory function 'this' refers to the GameObjectFactory context.
-//
-// There are several properties available to use:
-//
-// this.scene - a reference to the Scene that owns the GameObjectFactory
-// this.displayList - a reference to the Display List the Scene owns
-// this.updateList - a reference to the Update List the Scene owns
-
-/**
- * Creates a new Tween object and returns it.
- *
- * Note: This method will only be available if Tweens have been built into Phaser.
- *
- * @method Phaser.GameObjects.GameObjectCreator#tween
- * @since 3.0.0
- *
- * @param {object} config - The Tween configuration.
- *
- * @return {Phaser.Tweens.Tween} The Tween that was created.
- */
-GameObjectCreator.register('tween', function (config)
-{
- return this.scene.sys.tweens.create(config);
-});
-
-// When registering a factory function 'this' refers to the GameObjectCreator context.
-
-module.exports = Tween;
-
-
-/***/ }),
-/* 100 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * @typedef {object} Phaser.Tweens.TweenConfigDefaults
- *
- * @property {(object|object[])} targets - [description]
- * @property {number} [delay=0] - [description]
- * @property {number} [duration=1000] - [description]
- * @property {string} [ease='Power0'] - [description]
- * @property {array} [easeParams] - [description]
- * @property {number} [hold=0] - [description]
- * @property {number} [repeat=0] - [description]
- * @property {number} [repeatDelay=0] - [description]
- * @property {boolean} [yoyo=false] - [description]
- * @property {boolean} [flipX=false] - [description]
- * @property {boolean} [flipY=false] - [description]
- */
-
-var TWEEN_DEFAULTS = {
- targets: null,
- delay: 0,
- duration: 1000,
- ease: 'Power0',
- easeParams: null,
- hold: 0,
- repeat: 0,
- repeatDelay: 0,
- yoyo: false,
- flipX: false,
- flipY: false
-};
-
-module.exports = TWEEN_DEFAULTS;
-
-
-/***/ }),
-/* 101 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-function hasGetStart (def)
-{
- return (!!def.getStart && typeof def.getStart === 'function');
-}
-
-function hasGetEnd (def)
-{
- return (!!def.getEnd && typeof def.getEnd === 'function');
-}
-
-function hasGetters (def)
-{
- return hasGetStart(def) || hasGetEnd(def);
-}
-
-/**
- * [description]
- *
- * @function Phaser.Tweens.Builders.GetValueOp
- * @since 3.0.0
- *
- * @param {string} key - [description]
- * @param {*} propertyValue - [description]
- *
- * @return {function} [description]
- */
-var GetValueOp = function (key, propertyValue)
-{
- var callbacks;
-
- // The returned value sets what the property will be at the END of the Tween (usually called at the start of the Tween)
- var getEnd = function (target, key, value) { return value; };
-
- // The returned value sets what the property will be at the START of the Tween (usually called at the end of the Tween)
- var getStart = function (target, key, value) { return value; };
-
- var t = typeof(propertyValue);
-
- if (t === 'number')
- {
- // props: {
- // x: 400,
- // y: 300
- // }
-
- getEnd = function ()
- {
- return propertyValue;
- };
- }
- else if (t === 'string')
- {
- // props: {
- // x: '+=400',
- // y: '-=300',
- // z: '*=2',
- // w: '/=2'
- // }
-
- var op = propertyValue[0];
- var num = parseFloat(propertyValue.substr(2));
-
- switch (op)
- {
- case '+':
- getEnd = function (target, key, value)
- {
- return value + num;
- };
- break;
-
- case '-':
- getEnd = function (target, key, value)
- {
- return value - num;
- };
- break;
-
- case '*':
- getEnd = function (target, key, value)
- {
- return value * num;
- };
- break;
-
- case '/':
- getEnd = function (target, key, value)
- {
- return value / num;
- };
- break;
-
- default:
- getEnd = function ()
- {
- return parseFloat(propertyValue);
- };
- }
- }
- else if (t === 'function')
- {
- // The same as setting just the getEnd function and no getStart
-
- // props: {
- // x: function (target, key, value) { return value + 50); },
- // }
-
- getEnd = propertyValue;
- }
- else if (t === 'object' && hasGetters(propertyValue))
- {
- /*
- x: {
- // Called at the start of the Tween. The returned value sets what the property will be at the END of the Tween.
- getEnd: function (target, key, value)
- {
- return value;
- },
-
- // Called at the end of the Tween. The returned value sets what the property will be at the START of the Tween.
- getStart: function (target, key, value)
- {
- return value;
- }
- }
- */
-
- if (hasGetEnd(propertyValue))
- {
- getEnd = propertyValue.getEnd;
- }
-
- if (hasGetStart(propertyValue))
- {
- getStart = propertyValue.getStart;
- }
- }
- else if (propertyValue.hasOwnProperty('value'))
- {
- // Value may still be a string, function or a number
- // props: {
- // x: { value: 400, ... },
- // y: { value: 300, ... }
- // }
-
- callbacks = GetValueOp(key, propertyValue.value);
- }
-
- // If callback not set by the else if block above then set it here and return it
- if (!callbacks)
- {
- callbacks = {
- getEnd: getEnd,
- getStart: getStart
- };
- }
-
- return callbacks;
-};
-
-module.exports = GetValueOp;
-
-
-/***/ }),
-/* 102 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var GetValue = __webpack_require__(4);
-
-/**
- * [description]
- *
- * @function Phaser.Tweens.Builders.GetTargets
- * @since 3.0.0
- *
- * @param {object} config - [description]
- *
- * @return {array} [description]
- */
-var GetTargets = function (config)
-{
- var targets = GetValue(config, 'targets', null);
-
- if (targets === null)
- {
- return targets;
- }
-
- if (typeof targets === 'function')
- {
- targets = targets.call();
- }
-
- if (!Array.isArray(targets))
- {
- targets = [ targets ];
- }
-
- return targets;
-};
-
-module.exports = GetTargets;
-
-
-/***/ }),
-/* 103 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Class = __webpack_require__(0);
-var GetFastValue = __webpack_require__(1);
+var GetFastValue = __webpack_require__(2);
/**
* @classdesc
@@ -18942,7 +12954,7 @@ var GetFastValue = __webpack_require__(1);
* itself.
*
* @class MapData
- * @memberOf Phaser.Tilemaps
+ * @memberof Phaser.Tilemaps
* @constructor
* @since 3.0.0
*
@@ -19037,6 +13049,15 @@ var MapData = new Class({
*/
this.orientation = GetFastValue(config, 'orientation', 'orthogonal');
+ /**
+ * [description]
+ *
+ * @name Phaser.Tilemaps.MapData#renderOrder
+ * @type {string}
+ * @since 3.12.0
+ */
+ this.renderOrder = GetFastValue(config, 'renderOrder', 'right-down');
+
/**
* [description]
*
@@ -19125,7 +13146,7 @@ module.exports = MapData;
/***/ }),
-/* 104 */
+/* 78 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -19135,7 +13156,7 @@ module.exports = MapData;
*/
var Class = __webpack_require__(0);
-var GetFastValue = __webpack_require__(1);
+var GetFastValue = __webpack_require__(2);
/**
* @classdesc
@@ -19144,7 +13165,7 @@ var GetFastValue = __webpack_require__(1);
* to this data and use it to look up and perform operations on tiles.
*
* @class LayerData
- * @memberOf Phaser.Tilemaps
+ * @memberof Phaser.Tilemaps
* @constructor
* @since 3.0.0
*
@@ -19261,7 +13282,7 @@ var LayerData = new Class({
* [description]
*
* @name Phaser.Tilemaps.LayerData#alpha
- * @type {float}
+ * @type {number}
* @since 3.0.0
*/
this.alpha = GetFastValue(config, 'alpha', 1);
@@ -19345,7 +13366,7 @@ module.exports = LayerData;
/***/ }),
-/* 105 */
+/* 79 */
/***/ (function(module, exports) {
/**
@@ -19361,11 +13382,11 @@ module.exports = LayerData;
* @private
* @since 3.0.0
*
- * @param {integer} tileX - [description]
- * @param {integer} tileY - [description]
+ * @param {integer} tileX - The x coordinate, in tiles, not pixels.
+ * @param {integer} tileY - The y coordinate, in tiles, not pixels.
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
*
- * @return {boolean}
+ * @return {boolean} `true` if the tile coordinates are within the bounds of the layer, otherwise `false`.
*/
var IsInLayerBounds = function (tileX, tileY, layer)
{
@@ -19376,8 +13397,9 @@ module.exports = IsInLayerBounds;
/***/ }),
-/* 106 */,
-/* 107 */
+/* 80 */,
+/* 81 */,
+/* 82 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -19386,46 +13408,234 @@ module.exports = IsInLayerBounds;
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var Extend = __webpack_require__(17);
-var XHRSettings = __webpack_require__(75);
+var Utils = __webpack_require__(10);
/**
- * Takes two XHRSettings Objects and creates a new XHRSettings object from them.
+ * Renders a filled path for the given Shape.
*
- * The new object is seeded by the values given in the global settings, but any setting in
- * the local object overrides the global ones.
+ * @method Phaser.GameObjects.Shape#FillPathWebGL
+ * @since 3.13.0
+ * @private
*
- * @function Phaser.Loader.MergeXHRSettings
- * @since 3.0.0
- *
- * @param {XHRSettingsObject} global - The global XHRSettings object.
- * @param {XHRSettingsObject} local - The local XHRSettings object.
- *
- * @return {XHRSettingsObject} A newly formed XHRSettings object.
+ * @param {Phaser.Renderer.WebGL.WebGLPipeline} pipeline - The WebGL Pipeline used to render this Shape.
+ * @param {Phaser.GameObjects.Components.TransformMatrix} calcMatrix - The transform matrix used to get the position values.
+ * @param {Phaser.GameObjects.Shape} src - The Game Object shape being rendered in this call.
+ * @param {number} alpha - The base alpha value.
+ * @param {number} dx - The source displayOriginX.
+ * @param {number} dy - The source displayOriginY.
*/
-var MergeXHRSettings = function (global, local)
+var FillPathWebGL = function (pipeline, calcMatrix, src, alpha, dx, dy)
{
- var output = (global === undefined) ? XHRSettings() : Extend({}, global);
+ var fillTintColor = Utils.getTintAppendFloatAlphaAndSwap(src.fillColor, src.fillAlpha * alpha);
- if (local)
+ var path = src.pathData;
+ var pathIndexes = src.pathIndexes;
+
+ for (var i = 0; i < pathIndexes.length; i += 3)
{
- for (var setting in local)
- {
- if (local[setting] !== undefined)
- {
- output[setting] = local[setting];
- }
- }
- }
+ var p0 = pathIndexes[i] * 2;
+ var p1 = pathIndexes[i + 1] * 2;
+ var p2 = pathIndexes[i + 2] * 2;
- return output;
+ var x0 = path[p0 + 0] - dx;
+ var y0 = path[p0 + 1] - dy;
+ var x1 = path[p1 + 0] - dx;
+ var y1 = path[p1 + 1] - dy;
+ var x2 = path[p2 + 0] - dx;
+ var y2 = path[p2 + 1] - dy;
+
+ var tx0 = calcMatrix.getX(x0, y0);
+ var ty0 = calcMatrix.getY(x0, y0);
+
+ var tx1 = calcMatrix.getX(x1, y1);
+ var ty1 = calcMatrix.getY(x1, y1);
+
+ var tx2 = calcMatrix.getX(x2, y2);
+ var ty2 = calcMatrix.getY(x2, y2);
+
+ pipeline.setTexture2D();
+
+ pipeline.batchTri(tx0, ty0, tx1, ty1, tx2, ty2, 0, 0, 1, 1, fillTintColor, fillTintColor, fillTintColor, pipeline.tintEffect);
+ }
};
-module.exports = MergeXHRSettings;
+module.exports = FillPathWebGL;
/***/ }),
-/* 108 */
+/* 83 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var TWEEN_CONST = {
+
+ /**
+ * TweenData state.
+ *
+ * @name Phaser.Tweens.CREATED
+ * @type {integer}
+ * @since 3.0.0
+ */
+ CREATED: 0,
+
+ /**
+ * TweenData state.
+ *
+ * @name Phaser.Tweens.INIT
+ * @type {integer}
+ * @since 3.0.0
+ */
+ INIT: 1,
+
+ /**
+ * TweenData state.
+ *
+ * @name Phaser.Tweens.DELAY
+ * @type {integer}
+ * @since 3.0.0
+ */
+ DELAY: 2,
+
+ /**
+ * TweenData state.
+ *
+ * @name Phaser.Tweens.OFFSET_DELAY
+ * @type {integer}
+ * @since 3.0.0
+ */
+ OFFSET_DELAY: 3,
+
+ /**
+ * TweenData state.
+ *
+ * @name Phaser.Tweens.PENDING_RENDER
+ * @type {integer}
+ * @since 3.0.0
+ */
+ PENDING_RENDER: 4,
+
+ /**
+ * TweenData state.
+ *
+ * @name Phaser.Tweens.PLAYING_FORWARD
+ * @type {integer}
+ * @since 3.0.0
+ */
+ PLAYING_FORWARD: 5,
+
+ /**
+ * TweenData state.
+ *
+ * @name Phaser.Tweens.PLAYING_BACKWARD
+ * @type {integer}
+ * @since 3.0.0
+ */
+ PLAYING_BACKWARD: 6,
+
+ /**
+ * TweenData state.
+ *
+ * @name Phaser.Tweens.HOLD_DELAY
+ * @type {integer}
+ * @since 3.0.0
+ */
+ HOLD_DELAY: 7,
+
+ /**
+ * TweenData state.
+ *
+ * @name Phaser.Tweens.REPEAT_DELAY
+ * @type {integer}
+ * @since 3.0.0
+ */
+ REPEAT_DELAY: 8,
+
+ /**
+ * TweenData state.
+ *
+ * @name Phaser.Tweens.COMPLETE
+ * @type {integer}
+ * @since 3.0.0
+ */
+ COMPLETE: 9,
+
+ // Tween specific (starts from 20 to cleanly allow extra TweenData consts in the future)
+
+ /**
+ * Tween state.
+ *
+ * @name Phaser.Tweens.PENDING_ADD
+ * @type {integer}
+ * @since 3.0.0
+ */
+ PENDING_ADD: 20,
+
+ /**
+ * Tween state.
+ *
+ * @name Phaser.Tweens.PAUSED
+ * @type {integer}
+ * @since 3.0.0
+ */
+ PAUSED: 21,
+
+ /**
+ * Tween state.
+ *
+ * @name Phaser.Tweens.LOOP_DELAY
+ * @type {integer}
+ * @since 3.0.0
+ */
+ LOOP_DELAY: 22,
+
+ /**
+ * Tween state.
+ *
+ * @name Phaser.Tweens.ACTIVE
+ * @type {integer}
+ * @since 3.0.0
+ */
+ ACTIVE: 23,
+
+ /**
+ * Tween state.
+ *
+ * @name Phaser.Tweens.COMPLETE_DELAY
+ * @type {integer}
+ * @since 3.0.0
+ */
+ COMPLETE_DELAY: 24,
+
+ /**
+ * Tween state.
+ *
+ * @name Phaser.Tweens.PENDING_REMOVE
+ * @type {integer}
+ * @since 3.0.0
+ */
+ PENDING_REMOVE: 25,
+
+ /**
+ * Tween state.
+ *
+ * @name Phaser.Tweens.REMOVED
+ * @type {integer}
+ * @since 3.0.0
+ */
+ REMOVED: 26
+
+};
+
+module.exports = TWEEN_CONST;
+
+
+/***/ }),
+/* 84 */
/***/ (function(module, exports) {
/**
@@ -19435,1637 +13645,38 @@ module.exports = MergeXHRSettings;
*/
/**
- * Given a File and a baseURL value this returns the URL the File will use to download from.
+ * Retrieves the value of the given key from an object.
*
- * @function Phaser.Loader.GetURL
+ * @function Phaser.Tweens.Builders.GetBoolean
* @since 3.0.0
*
- * @param {Phaser.Loader.File} file - The File object.
- * @param {string} baseURL - A default base URL.
+ * @param {object} source - The object to retrieve the value from.
+ * @param {string} key - The key to look for in the `source` object.
+ * @param {*} defaultValue - The default value to return if the `key` doesn't exist or if no `source` object is provided.
*
- * @return {string} The URL the File will use.
+ * @return {*} The retrieved value.
*/
-var GetURL = function (file, baseURL)
+var GetBoolean = function (source, key, defaultValue)
{
- if (!file.url)
+ if (!source)
{
- return false;
+ return defaultValue;
}
-
- if (file.url.match(/^(?:blob:|data:|http:\/\/|https:\/\/|\/\/)/))
+ else if (source.hasOwnProperty(key))
{
- return file.url;
+ return source[key];
}
else
{
- return baseURL + file.url;
+ return defaultValue;
}
};
-module.exports = GetURL;
+module.exports = GetBoolean;
/***/ }),
-/* 109 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Keyboard Codes.
- *
- * @name Phaser.Input.Keyboard.KeyCodes
- * @enum {integer}
- * @memberOf Phaser.Input.Keyboard
- * @readOnly
- * @since 3.0.0
- */
-
-var KeyCodes = {
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.BACKSPACE
- */
- BACKSPACE: 8,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.TAB
- */
- TAB: 9,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.ENTER
- */
- ENTER: 13,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.SHIFT
- */
- SHIFT: 16,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.CTRL
- */
- CTRL: 17,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.ALT
- */
- ALT: 18,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.PAUSE
- */
- PAUSE: 19,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.CAPS_LOCK
- */
- CAPS_LOCK: 20,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.ESC
- */
- ESC: 27,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.SPACE
- */
- SPACE: 32,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.PAGE_UP
- */
- PAGE_UP: 33,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.PAGE_DOWN
- */
- PAGE_DOWN: 34,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.END
- */
- END: 35,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.HOME
- */
- HOME: 36,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.LEFT
- */
- LEFT: 37,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.UP
- */
- UP: 38,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.RIGHT
- */
- RIGHT: 39,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.DOWN
- */
- DOWN: 40,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.PRINT_SCREEN
- */
- PRINT_SCREEN: 42,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.INSERT
- */
- INSERT: 45,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.DELETE
- */
- DELETE: 46,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.ZERO
- */
- ZERO: 48,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.ONE
- */
- ONE: 49,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.TWO
- */
- TWO: 50,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.THREE
- */
- THREE: 51,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.FOUR
- */
- FOUR: 52,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.FIVE
- */
- FIVE: 53,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.SIX
- */
- SIX: 54,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.SEVEN
- */
- SEVEN: 55,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.EIGHT
- */
- EIGHT: 56,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.NINE
- */
- NINE: 57,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ZERO
- */
- NUMPAD_ZERO: 96,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ONE
- */
- NUMPAD_ONE: 97,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_TWO
- */
- NUMPAD_TWO: 98,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_THREE
- */
- NUMPAD_THREE: 99,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FOUR
- */
- NUMPAD_FOUR: 100,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FIVE
- */
- NUMPAD_FIVE: 101,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SIX
- */
- NUMPAD_SIX: 102,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SEVEN
- */
- NUMPAD_SEVEN: 103,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_EIGHT
- */
- NUMPAD_EIGHT: 104,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_NINE
- */
- NUMPAD_NINE: 105,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.A
- */
- A: 65,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.B
- */
- B: 66,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.C
- */
- C: 67,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.D
- */
- D: 68,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.E
- */
- E: 69,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.F
- */
- F: 70,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.G
- */
- G: 71,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.H
- */
- H: 72,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.I
- */
- I: 73,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.J
- */
- J: 74,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.K
- */
- K: 75,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.L
- */
- L: 76,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.M
- */
- M: 77,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.N
- */
- N: 78,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.O
- */
- O: 79,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.P
- */
- P: 80,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.Q
- */
- Q: 81,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.R
- */
- R: 82,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.S
- */
- S: 83,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.T
- */
- T: 84,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.U
- */
- U: 85,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.V
- */
- V: 86,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.W
- */
- W: 87,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.X
- */
- X: 88,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.Y
- */
- Y: 89,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.Z
- */
- Z: 90,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.F1
- */
- F1: 112,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.F2
- */
- F2: 113,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.F3
- */
- F3: 114,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.F4
- */
- F4: 115,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.F5
- */
- F5: 116,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.F6
- */
- F6: 117,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.F7
- */
- F7: 118,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.F8
- */
- F8: 119,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.F9
- */
- F9: 120,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.F10
- */
- F10: 121,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.F11
- */
- F11: 122,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.F12
- */
- F12: 123,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON
- */
- SEMICOLON: 186,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.PLUS
- */
- PLUS: 187,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.COMMA
- */
- COMMA: 188,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.MINUS
- */
- MINUS: 189,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.PERIOD
- */
- PERIOD: 190,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.FORWARD_SLASH
- */
- FORWARD_SLASH: 191,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.BACK_SLASH
- */
- BACK_SLASH: 220,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.QUOTES
- */
- QUOTES: 222,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.BACKTICK
- */
- BACKTICK: 192,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.OPEN_BRACKET
- */
- OPEN_BRACKET: 219,
-
- /**
- * @name Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET
- */
- CLOSED_BRACKET: 221
-
-};
-
-module.exports = KeyCodes;
-
-
-/***/ }),
-/* 110 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var AddToDOM = __webpack_require__(130);
-var CanvasPool = __webpack_require__(22);
-var Class = __webpack_require__(0);
-var Components = __webpack_require__(15);
-var CONST = __webpack_require__(20);
-var GameObject = __webpack_require__(2);
-var GetTextSize = __webpack_require__(417);
-var GetValue = __webpack_require__(4);
-var RemoveFromDOM = __webpack_require__(269);
-var TextRender = __webpack_require__(416);
-var TextStyle = __webpack_require__(413);
-
-/**
- * @classdesc
- * [description]
- *
- * @class Text
- * @extends Phaser.GameObjects.GameObject
- * @memberOf Phaser.GameObjects
- * @constructor
- * @since 3.0.0
- *
- * @extends Phaser.GameObjects.Components.Alpha
- * @extends Phaser.GameObjects.Components.BlendMode
- * @extends Phaser.GameObjects.Components.ComputedSize
- * @extends Phaser.GameObjects.Components.Depth
- * @extends Phaser.GameObjects.Components.Flip
- * @extends Phaser.GameObjects.Components.GetBounds
- * @extends Phaser.GameObjects.Components.Mask
- * @extends Phaser.GameObjects.Components.Origin
- * @extends Phaser.GameObjects.Components.Pipeline
- * @extends Phaser.GameObjects.Components.ScaleMode
- * @extends Phaser.GameObjects.Components.ScrollFactor
- * @extends Phaser.GameObjects.Components.Tint
- * @extends Phaser.GameObjects.Components.Transform
- * @extends Phaser.GameObjects.Components.Visible
- *
- * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time.
- * @param {number} x - The horizontal position of this Game Object in the world.
- * @param {number} y - The vertical position of this Game Object in the world.
- * @param {(string|string[])} text - The text this Text object will display.
- * @param {object} style - The text style configuration object.
- */
-var Text = new Class({
-
- Extends: GameObject,
-
- Mixins: [
- Components.Alpha,
- Components.BlendMode,
- Components.ComputedSize,
- Components.Depth,
- Components.Flip,
- Components.GetBounds,
- Components.Mask,
- Components.Origin,
- Components.Pipeline,
- Components.ScaleMode,
- Components.ScrollFactor,
- Components.Tint,
- Components.Transform,
- Components.Visible,
- TextRender
- ],
-
- initialize:
-
- function Text (scene, x, y, text, style)
- {
- if (x === undefined) { x = 0; }
- if (y === undefined) { y = 0; }
-
- GameObject.call(this, scene, 'Text');
-
- this.setPosition(x, y);
- this.setOrigin(0, 0);
- this.initPipeline('TextureTintPipeline');
-
- /**
- * The canvas element that the text is rendered to.
- *
- * @name Phaser.GameObjects.Text#canvas
- * @type {HTMLCanvasElement}
- * @since 3.0.0
- */
- this.canvas = CanvasPool.create(this);
-
- /**
- * The context of the canvas element that the text is rendered to.
- *
- * @name Phaser.GameObjects.Text#context
- * @type {CanvasRenderingContext2D}
- * @since 3.0.0
- */
- this.context = this.canvas.getContext('2d');
-
- /**
- * [description]
- *
- * @name Phaser.GameObjects.Text#style
- * @type {Phaser.GameObjects.Text.TextStyle}
- * @since 3.0.0
- */
- this.style = new TextStyle(this, style);
-
- /**
- * [description]
- *
- * @name Phaser.GameObjects.Text#autoRound
- * @type {boolean}
- * @default true
- * @since 3.0.0
- */
- this.autoRound = true;
-
- /**
- * The Regular Expression that is used to split the text up into lines, in
- * multi-line text. By default this is `/(?:\r\n|\r|\n)/`.
- * You can change this RegExp to be anything else that you may need.
- *
- * @name Phaser.GameObjects.Text#splitRegExp
- * @type {object}
- * @since 3.0.0
- */
- this.splitRegExp = /(?:\r\n|\r|\n)/;
-
- /**
- * [description]
- *
- * @name Phaser.GameObjects.Text#text
- * @type {string}
- * @since 3.0.0
- */
- this.text = '';
-
- /**
- * [description]
- *
- * @name Phaser.GameObjects.Text#resolution
- * @type {number}
- * @default 1
- * @since 3.0.0
- */
- this.resolution = 1;
-
- /**
- * Specify a padding value which is added to the line width and height when calculating the Text size.
- * Allows you to add extra spacing if the browser is unable to accurately determine the true font dimensions.
- *
- * @name Phaser.GameObjects.Text#padding
- * @type {{left:number,right:number,top:number,bottom:number}}
- * @since 3.0.0
- */
- this.padding = { left: 0, right: 0, top: 0, bottom: 0 };
-
- /**
- * [description]
- *
- * @name Phaser.GameObjects.Text#width
- * @type {number}
- * @default 1
- * @since 3.0.0
- */
- this.width = 1;
-
- /**
- * [description]
- *
- * @name Phaser.GameObjects.Text#height
- * @type {number}
- * @default 1
- * @since 3.0.0
- */
- this.height = 1;
-
- /**
- * [description]
- *
- * @name Phaser.GameObjects.Text#canvasTexture
- * @type {HTMLCanvasElement}
- * @default null
- * @since 3.0.0
- */
- this.canvasTexture = null;
-
- /**
- * [description]
- *
- * @name Phaser.GameObjects.Text#dirty
- * @type {boolean}
- * @default false
- * @since 3.0.0
- */
- this.dirty = false;
-
- this.initRTL();
-
- if (style && style.padding)
- {
- this.setPadding(style.padding);
- }
-
- if (style && style.lineSpacing)
- {
- this._lineSpacing = style.lineSpacing;
- }
-
- this.setText(text);
-
- if (scene.sys.game.config.renderType === CONST.WEBGL)
- {
- scene.sys.game.renderer.onContextRestored(function ()
- {
- this.canvasTexture = null;
- this.dirty = true;
- }, this);
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#initRTL
- * @since 3.0.0
- */
- initRTL: function ()
- {
- if (!this.style.rtl)
- {
- return;
- }
-
- // Here is where the crazy starts.
- //
- // Due to browser implementation issues, you cannot fillText BiDi text to a canvas
- // that is not part of the DOM. It just completely ignores the direction property.
-
- this.canvas.dir = 'rtl';
-
- // Experimental atm, but one day ...
- this.context.direction = 'rtl';
-
- // Add it to the DOM, but hidden within the parent canvas.
- this.canvas.style.display = 'none';
-
- AddToDOM(this.canvas, this.scene.sys.canvas);
-
- // And finally we set the x origin
- this.originX = 1;
- },
-
- /**
- * Greedy wrapping algorithm that will wrap words as the line grows longer than its horizontal
- * bounds.
- *
- * @method Phaser.GameObjects.Text#runWordWrap
- * @since 3.0.0
- *
- * @param {string} text - The text to perform word wrap detection against.
- *
- * @return {string} The text after wrapping has been applied.
- */
- runWordWrap: function (text)
- {
- var style = this.style;
-
- if (style.wordWrapCallback)
- {
- var wrappedLines = style.wordWrapCallback.call(style.wordWrapCallbackScope, text, this);
-
- if (Array.isArray(wrappedLines))
- {
- wrappedLines = wrappedLines.join('\n');
- }
-
- return wrappedLines;
- }
- else if (style.wordWrapWidth)
- {
- if (style.wordWrapUseAdvanced)
- {
- return this.advancedWordWrap(text, this.context, this.style.wordWrapWidth);
- }
- else
- {
- return this.basicWordWrap(text, this.context, this.style.wordWrapWidth);
- }
- }
- else
- {
- return text;
- }
- },
-
- /**
- * Advanced wrapping algorithm that will wrap words as the line grows longer than its horizontal
- * bounds. Consecutive spaces will be collapsed and replaced with a single space. Lines will be
- * trimmed of white space before processing. Throws an error if wordWrapWidth is less than a
- * single character.
- *
- * @method Phaser.GameObjects.Text#advancedWordWrap
- * @since 3.0.0
- *
- * @param {string} text - The text to perform word wrap detection against.
- * @param {CanvasRenderingContext2D} context - [description]
- * @param {number} wordWrapWidth - [description]
- *
- * @return {string} The wrapped text.
- */
- advancedWordWrap: function (text, context, wordWrapWidth)
- {
- var output = '';
-
- // Condense consecutive spaces and split into lines
- var lines = text
- .replace(/ +/gi, ' ')
- .split(this.splitRegExp);
-
- var linesCount = lines.length;
-
- for (var i = 0; i < linesCount; i++)
- {
- var line = lines[i];
- var out = '';
-
- // Trim whitespace
- line = line.replace(/^ *|\s*$/gi, '');
-
- // If entire line is less than wordWrapWidth append the entire line and exit early
- var lineWidth = context.measureText(line).width;
-
- if (lineWidth < wordWrapWidth)
- {
- output += line + '\n';
- continue;
- }
-
- // Otherwise, calculate new lines
- var currentLineWidth = wordWrapWidth;
-
- // Split into words
- var words = line.split(' ');
-
- for (var j = 0; j < words.length; j++)
- {
- var word = words[j];
- var wordWithSpace = word + ' ';
- var wordWidth = context.measureText(wordWithSpace).width;
-
- if (wordWidth > currentLineWidth)
- {
- // Break word
- if (j === 0)
- {
- // Shave off letters from word until it's small enough
- var newWord = wordWithSpace;
-
- while (newWord.length)
- {
- newWord = newWord.slice(0, -1);
- wordWidth = context.measureText(newWord).width;
-
- if (wordWidth <= currentLineWidth)
- {
- break;
- }
- }
-
- // If wordWrapWidth is too small for even a single letter, shame user
- // failure with a fatal error
- if (!newWord.length)
- {
- throw new Error('This text\'s wordWrapWidth setting is less than a single character!');
- }
-
- // Replace current word in array with remainder
- var secondPart = word.substr(newWord.length);
-
- words[j] = secondPart;
-
- // Append first piece to output
- out += newWord;
- }
-
- // If existing word length is 0, don't include it
- var offset = (words[j].length) ? j : j + 1;
-
- // Collapse rest of sentence and remove any trailing white space
- var remainder = words.slice(offset).join(' ')
- .replace(/[ \n]*$/gi, '');
-
- // Prepend remainder to next line
- lines[i + 1] = remainder + ' ' + (lines[i + 1] || '');
- linesCount = lines.length;
-
- break; // Processing on this line
-
- // Append word with space to output
- }
- else
- {
- out += wordWithSpace;
- currentLineWidth -= wordWidth;
- }
- }
-
- // Append processed line to output
- output += out.replace(/[ \n]*$/gi, '') + '\n';
- }
-
- // Trim the end of the string
- output = output.replace(/[\s|\n]*$/gi, '');
-
- return output;
- },
-
- /**
- * Greedy wrapping algorithm that will wrap words as the line grows longer than its horizontal
- * bounds. Spaces are not collapsed and whitespace is not trimmed.
- *
- * @method Phaser.GameObjects.Text#basicWordWrap
- * @since 3.0.0
- *
- * @param {string} text - The text to perform word wrap detection against.
- * @param {CanvasRenderingContext2D} context - [description]
- * @param {number} wordWrapWidth - [description]
- *
- * @return {string} The wrapped text.
- */
- basicWordWrap: function (text, context, wordWrapWidth)
- {
- var result = '';
- var lines = text.split(this.splitRegExp);
-
- for (var i = 0; i < lines.length; i++)
- {
- var spaceLeft = wordWrapWidth;
- var words = lines[i].split(' ');
-
- for (var j = 0; j < words.length; j++)
- {
- var wordWidth = context.measureText(words[j]).width;
- var wordWidthWithSpace = wordWidth + context.measureText(' ').width;
-
- if (wordWidthWithSpace > spaceLeft)
- {
- // Skip printing the newline if it's the first word of the line that is greater
- // than the word wrap width.
- if (j > 0)
- {
- result += '\n';
- }
-
- result += words[j] + ' ';
- spaceLeft = wordWrapWidth - wordWidth;
- }
- else
- {
- spaceLeft -= wordWidthWithSpace;
- result += words[j];
-
- if (j < (words.length - 1))
- {
- result += ' ';
- }
- }
- }
-
- if (i < lines.length - 1)
- {
- result += '\n';
- }
- }
-
- return result;
- },
-
- /**
- * Runs the given text through this Text objects word wrapping and returns the results as an
- * array, where each element of the array corresponds to a wrapped line of text.
- *
- * @method Phaser.GameObjects.Text#getWrappedText
- * @since 3.0.0
- *
- * @param {string} text - The text for which the wrapping will be calculated. If unspecified, the Text objects current text will be used.
- *
- * @return {string[]} An array of strings with the pieces of wrapped text.
- */
- getWrappedText: function (text)
- {
- if (text === undefined) { text = this.text; }
-
- this.style.syncFont(this.canvas, this.context);
-
- var wrappedLines = this.runWordWrap(text);
-
- return wrappedLines.split(this.splitRegExp);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setText
- * @since 3.0.0
- *
- * @param {(string|string[])} value - The string, or array of strings, to be set as the content of this Text object.
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setText: function (value)
- {
- if (!value && value !== 0)
- {
- value = '';
- }
-
- if (Array.isArray(value))
- {
- value = value.join('\n');
- }
-
- if (value !== this.text)
- {
- this.text = value.toString();
-
- this.updateText();
- }
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setStyle
- * @since 3.0.0
- *
- * @param {object} style - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setStyle: function (style)
- {
- return this.style.setStyle(style);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setFont
- * @since 3.0.0
- *
- * @param {string} font - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setFont: function (font)
- {
- return this.style.setFont(font);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setFontFamily
- * @since 3.0.0
- *
- * @param {string} family - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setFontFamily: function (family)
- {
- return this.style.setFontFamily(family);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setFontSize
- * @since 3.0.0
- *
- * @param {number} size - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setFontSize: function (size)
- {
- return this.style.setFontSize(size);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setFontStyle
- * @since 3.0.0
- *
- * @param {string} style - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setFontStyle: function (style)
- {
- return this.style.setFontStyle(style);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setFixedSize
- * @since 3.0.0
- *
- * @param {number} width - [description]
- * @param {number} height - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setFixedSize: function (width, height)
- {
- return this.style.setFixedSize(width, height);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setBackgroundColor
- * @since 3.0.0
- *
- * @param {string} color - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setBackgroundColor: function (color)
- {
- return this.style.setBackgroundColor(color);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setFill
- * @since 3.0.0
- *
- * @param {string} color - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setFill: function (color)
- {
- return this.style.setFill(color);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setColor
- * @since 3.0.0
- *
- * @param {string} color - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setColor: function (color)
- {
- return this.style.setColor(color);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setStroke
- * @since 3.0.0
- *
- * @param {string} color - [description]
- * @param {number} thickness - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setStroke: function (color, thickness)
- {
- return this.style.setStroke(color, thickness);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setShadow
- * @since 3.0.0
- *
- * @param {number} x - [description]
- * @param {number} y - [description]
- * @param {string} color - [description]
- * @param {number} blur - [description]
- * @param {boolean} shadowStroke - [description]
- * @param {boolean} shadowFill - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setShadow: function (x, y, color, blur, shadowStroke, shadowFill)
- {
- return this.style.setShadow(x, y, color, blur, shadowStroke, shadowFill);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setShadowOffset
- * @since 3.0.0
- *
- * @param {number} x - [description]
- * @param {number} y - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setShadowOffset: function (x, y)
- {
- return this.style.setShadowOffset(x, y);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setShadowColor
- * @since 3.0.0
- *
- * @param {string} color - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setShadowColor: function (color)
- {
- return this.style.setShadowColor(color);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setShadowBlur
- * @since 3.0.0
- *
- * @param {number} blur - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setShadowBlur: function (blur)
- {
- return this.style.setShadowBlur(blur);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setShadowStroke
- * @since 3.0.0
- *
- * @param {boolean} enabled - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setShadowStroke: function (enabled)
- {
- return this.style.setShadowStroke(enabled);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setShadowFill
- * @since 3.0.0
- *
- * @param {boolean} enabled - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setShadowFill: function (enabled)
- {
- return this.style.setShadowFill(enabled);
- },
-
- /**
- * Set the width (in pixels) to use for wrapping lines. Pass in null to remove wrapping by width.
- *
- * @method Phaser.GameObjects.Text#setWordWrapWidth
- * @since 3.0.0
- *
- * @param {?number} width - The maximum width of a line in pixels. Set to null to remove wrapping.
- * @param {boolean} [useAdvancedWrap=false] - 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.
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setWordWrapWidth: function (width, useAdvancedWrap)
- {
- return this.style.setWordWrapWidth(width, useAdvancedWrap);
- },
-
- /**
- * Set a custom callback for wrapping lines. Pass in null to remove wrapping by callback.
- *
- * @method Phaser.GameObjects.Text#setWordWrapCallback
- * @since 3.0.0
- *
- * @param {TextStyleWordWrapCallback} 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 {object} [scope=null] - The scope that will be applied when the callback is invoked.
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setWordWrapCallback: function (callback, scope)
- {
- return this.style.setWordWrapCallback(callback, scope);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setAlign
- * @since 3.0.0
- *
- * @param {string} align - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setAlign: function (align)
- {
- return this.style.setAlign(align);
- },
-
- /**
- * 'left' can be an object.
- * If only 'left' and 'top' are given they are treated as 'x' and 'y'
- *
- * @method Phaser.GameObjects.Text#setPadding
- * @since 3.0.0
- *
- * @param {(number|object)} left - [description]
- * @param {number} top - [description]
- * @param {number} right - [description]
- * @param {number} bottom - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setPadding: function (left, top, right, bottom)
- {
- if (typeof left === 'object')
- {
- var config = left;
-
- // If they specify x and/or y this applies to all
- var x = GetValue(config, 'x', null);
-
- if (x !== null)
- {
- left = x;
- right = x;
- }
- else
- {
- left = GetValue(config, 'left', 0);
- right = GetValue(config, 'right', left);
- }
-
- var y = GetValue(config, 'y', null);
-
- if (y !== null)
- {
- top = y;
- bottom = y;
- }
- else
- {
- top = GetValue(config, 'top', 0);
- bottom = GetValue(config, 'bottom', top);
- }
- }
- else
- {
- if (left === undefined) { left = 0; }
- if (top === undefined) { top = left; }
- if (right === undefined) { right = left; }
- if (bottom === undefined) { bottom = top; }
- }
-
- this.padding.left = left;
- this.padding.top = top;
- this.padding.right = right;
- this.padding.bottom = bottom;
-
- return this.updateText();
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#setMaxLines
- * @since 3.0.0
- *
- * @param {integer} [max=0] - [description]
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- setMaxLines: function (max)
- {
- return this.style.setMaxLines(max);
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#updateText
- * @since 3.0.0
- *
- * @return {Phaser.GameObjects.Text} This Text object.
- */
- updateText: function ()
- {
- var canvas = this.canvas;
- var context = this.context;
- var style = this.style;
- var resolution = this.resolution;
- var size = style.metrics;
-
- style.syncFont(canvas, context);
-
- var outputText = this.text;
-
- if (style.wordWrapWidth || style.wordWrapCallback)
- {
- outputText = this.runWordWrap(this.text);
- }
-
- // Split text into lines
- var lines = outputText.split(this.splitRegExp);
-
- var textSize = GetTextSize(this, size, lines);
-
- var padding = this.padding;
-
- var w = textSize.width + padding.left + padding.right;
- var h = textSize.height + padding.top + padding.bottom;
-
- if (style.fixedWidth === 0)
- {
- this.width = w;
- }
-
- if (style.fixedHeight === 0)
- {
- this.height = h;
- }
-
- this.updateDisplayOrigin();
-
- w *= resolution;
- h *= resolution;
-
- w = Math.max(w, 1);
- h = Math.max(h, 1);
-
- if (canvas.width !== w || canvas.height !== h)
- {
- canvas.width = w;
- canvas.height = h;
- style.syncFont(canvas, context); // Resizing resets the context
- }
- else
- {
- context.clearRect(0, 0, w, h);
- }
-
- context.save();
-
- // context.scale(resolution, resolution);
-
- if (style.backgroundColor)
- {
- context.fillStyle = style.backgroundColor;
- context.fillRect(0, 0, w, h);
- }
-
- style.syncStyle(canvas, context);
-
- context.textBaseline = 'alphabetic';
-
- // Apply padding
- context.translate(padding.left, padding.top);
-
- var linePositionX;
- var linePositionY;
-
- // Draw text line by line
- for (var i = 0; i < textSize.lines; i++)
- {
- linePositionX = style.strokeThickness / 2;
- linePositionY = (style.strokeThickness / 2 + i * textSize.lineHeight) + size.ascent;
-
- if (i > 0)
- {
- linePositionY += (textSize.lineSpacing * i);
- }
-
- if (style.rtl)
- {
- linePositionX = w - linePositionX;
- }
- else if (style.align === 'right')
- {
- linePositionX += textSize.width - textSize.lineWidths[i];
- }
- else if (style.align === 'center')
- {
- linePositionX += (textSize.width - textSize.lineWidths[i]) / 2;
- }
-
- if (this.autoRound)
- {
- linePositionX = Math.round(linePositionX);
- linePositionY = Math.round(linePositionY);
- }
-
- if (style.strokeThickness)
- {
- this.style.syncShadow(context, style.shadowStroke);
-
- context.strokeText(lines[i], linePositionX, linePositionY);
- }
-
- if (style.color)
- {
- this.style.syncShadow(context, style.shadowFill);
-
- context.fillText(lines[i], linePositionX, linePositionY);
- }
- }
-
- context.restore();
-
- this.dirty = true;
-
- return this;
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#getTextMetrics
- * @since 3.0.0
- *
- * @return {object} [description]
- */
- getTextMetrics: function ()
- {
- return this.style.getTextMetrics();
- },
-
- /**
- * [description]
- *
- * @method Phaser.GameObjects.Text#toJSON
- * @since 3.0.0
- *
- * @return {JSONGameObject} A JSON representation of the Game Object.
- */
- toJSON: function ()
- {
- var out = Components.ToJSON(this);
-
- // Extra Text data is added here
-
- var data = {
- autoRound: this.autoRound,
- text: this.text,
- style: this.style.toJSON(),
- resolution: this.resolution,
- padding: {
- left: this.padding.left,
- right: this.padding.right,
- top: this.padding.top,
- bottom: this.padding.bottom
- }
- };
-
- out.data = data;
-
- return out;
- },
-
- /**
- * Internal destroy handler, called as part of the destroy process.
- *
- * @method Phaser.GameObjects.Text#preDestroy
- * @protected
- * @since 3.0.0
- */
- preDestroy: function ()
- {
- if (this.style.rtl)
- {
- RemoveFromDOM(this.canvas);
- }
-
- CanvasPool.remove(this.canvas);
- }
-
-});
-
-module.exports = Text;
-
-
-/***/ }),
-/* 111 */
+/* 85 */
/***/ (function(module, exports) {
/**
@@ -21077,7 +13688,7 @@ module.exports = Text;
/**
* [description]
*
- * @function Phaser.Utils.Object.HasValue
+ * @function Phaser.Utils.Objects.HasValue
* @since 3.0.0
*
* @param {object} source - [description]
@@ -21094,7 +13705,69 @@ module.exports = HasValue;
/***/ }),
-/* 112 */
+/* 86 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var EaseMap = __webpack_require__(174);
+
+/**
+ * [description]
+ *
+ * @function Phaser.Tweens.Builders.GetEaseFunction
+ * @since 3.0.0
+ *
+ * @param {(string|function)} ease - [description]
+ * @param {array} easeParams - [description]
+ *
+ * @return {function} [description]
+ */
+var GetEaseFunction = function (ease, easeParams)
+{
+ if (typeof ease === 'string' && EaseMap.hasOwnProperty(ease))
+ {
+ if (easeParams)
+ {
+ var cloneParams = easeParams.slice(0);
+
+ cloneParams.unshift(0);
+
+ return function (v)
+ {
+ cloneParams[0] = v;
+
+ return EaseMap[ease].apply(this, cloneParams);
+ };
+ }
+ else
+ {
+ // String based look-up
+ return EaseMap[ease];
+ }
+ }
+ else if (typeof ease === 'function')
+ {
+ // Custom function
+ return ease;
+ }
+ else if (Array.isArray(ease) && ease.length === 4)
+ {
+ // Bezier function (TODO)
+ }
+
+ return EaseMap.Power0;
+};
+
+module.exports = GetEaseFunction;
+
+
+/***/ }),
+/* 87 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -21103,13 +13776,117 @@ module.exports = HasValue;
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var Actions = __webpack_require__(599);
var Class = __webpack_require__(0);
-var GetFastValue = __webpack_require__(1);
+var Components = __webpack_require__(14);
+var GameObject = __webpack_require__(19);
+var ImageRender = __webpack_require__(826);
+
+/**
+ * @classdesc
+ * An Image Game Object.
+ *
+ * An Image is a light-weight Game Object useful for the display of static images in your game,
+ * such as logos, backgrounds, scenery or other non-animated elements. Images can have input
+ * events and physics bodies, or be tweened, tinted or scrolled. The main difference between an
+ * Image and a Sprite is that you cannot animate an Image as they do not have the Animation component.
+ *
+ * @class Image
+ * @extends Phaser.GameObjects.GameObject
+ * @memberof Phaser.GameObjects
+ * @constructor
+ * @since 3.0.0
+ *
+ * @extends Phaser.GameObjects.Components.Alpha
+ * @extends Phaser.GameObjects.Components.BlendMode
+ * @extends Phaser.GameObjects.Components.Depth
+ * @extends Phaser.GameObjects.Components.Flip
+ * @extends Phaser.GameObjects.Components.GetBounds
+ * @extends Phaser.GameObjects.Components.Mask
+ * @extends Phaser.GameObjects.Components.Origin
+ * @extends Phaser.GameObjects.Components.Pipeline
+ * @extends Phaser.GameObjects.Components.ScaleMode
+ * @extends Phaser.GameObjects.Components.ScrollFactor
+ * @extends Phaser.GameObjects.Components.Size
+ * @extends Phaser.GameObjects.Components.TextureCrop
+ * @extends Phaser.GameObjects.Components.Tint
+ * @extends Phaser.GameObjects.Components.Transform
+ * @extends Phaser.GameObjects.Components.Visible
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time.
+ * @param {number} x - The horizontal position of this Game Object in the world.
+ * @param {number} y - The vertical position of this Game Object in the world.
+ * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
+ * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
+ */
+var Image = new Class({
+
+ Extends: GameObject,
+
+ Mixins: [
+ Components.Alpha,
+ Components.BlendMode,
+ Components.Depth,
+ Components.Flip,
+ Components.GetBounds,
+ Components.Mask,
+ Components.Origin,
+ Components.Pipeline,
+ Components.ScaleMode,
+ Components.ScrollFactor,
+ Components.Size,
+ Components.TextureCrop,
+ Components.Tint,
+ Components.Transform,
+ Components.Visible,
+ ImageRender
+ ],
+
+ initialize:
+
+ function Image (scene, x, y, texture, frame)
+ {
+ GameObject.call(this, scene, 'Image');
+
+ /**
+ * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method.
+ *
+ * @name Phaser.GameObjects.Image#_crop
+ * @type {object}
+ * @private
+ * @since 3.11.0
+ */
+ this._crop = this.resetCropObject();
+
+ this.setTexture(texture, frame);
+ this.setPosition(x, y);
+ this.setSizeToFrame();
+ this.setOriginFromFrame();
+ this.initPipeline();
+ }
+
+});
+
+module.exports = Image;
+
+
+/***/ }),
+/* 88 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Actions = __webpack_require__(417);
+var Class = __webpack_require__(0);
+var GetFastValue = __webpack_require__(2);
var GetValue = __webpack_require__(4);
-var Range = __webpack_require__(254);
-var Set = __webpack_require__(70);
-var Sprite = __webpack_require__(34);
+var IsPlainObject = __webpack_require__(8);
+var Range = __webpack_require__(312);
+var Set = __webpack_require__(95);
+var Sprite = __webpack_require__(61);
/**
* @callback GroupCallback
@@ -21199,11 +13976,11 @@ var Sprite = __webpack_require__(34);
* Groups themselves aren't displayable, and can't be positioned, rotated, scaled, or hidden.
*
* @class Group
- * @memberOf Phaser.GameObjects
+ * @memberof Phaser.GameObjects
* @constructor
* @since 3.0.0
* @param {Phaser.Scene} scene - The scene this group belongs to.
- * @param {(Phaser.GameObjects.GameObject[]|GroupConfig)} [children] - Game objects to add to this group; or the `config` argument.
+ * @param {(Phaser.GameObjects.GameObject[]|GroupConfig|GroupCreateConfig)} [children] - Game Objects to add to this group; or the `config` argument.
* @param {GroupConfig|GroupCreateConfig} [config] - Settings for this group. If `key` is set, Phaser.GameObjects.Group#createMultiple is also called with these settings.
*
* @see Phaser.Physics.Arcade.Group
@@ -21215,8 +13992,38 @@ var Group = new Class({
function Group (scene, children, config)
{
- if (config === undefined && !Array.isArray(children) && typeof children === 'object')
+ // They can pass in any of the following as the first argument:
+
+ // 1) A single child
+ // 2) An array of children
+ // 3) A config object
+ // 4) An array of config objects
+
+ // Or they can pass in a child, or array of children AND a config object
+
+ if (config)
{
+ // config has been set, are the children an array?
+
+ if (children && !Array.isArray(children))
+ {
+ children = [ children ];
+ }
+ }
+ else if (Array.isArray(children))
+ {
+ // No config, so let's check the children argument
+
+ if (IsPlainObject(children[0]))
+ {
+ // It's an array of plain config objects
+ config = children;
+ children = null;
+ }
+ }
+ else if (IsPlainObject(children))
+ {
+ // Children isn't an array. Is it a config object though?
config = children;
children = null;
}
@@ -21419,18 +14226,16 @@ var Group = new Class({
config = [ config ];
}
- if (config[0].key === undefined)
- {
- return [];
- }
-
var output = [];
- for (var i = 0; i < config.length; i++)
+ if (config[0].key)
{
- var entries = this.createFromConfig(config[i]);
-
- output = output.concat(entries);
+ for (var i = 0; i < config.length; i++)
+ {
+ var entries = this.createFromConfig(config[i]);
+
+ output = output.concat(entries);
+ }
}
return output;
@@ -22287,8 +15092,8 @@ module.exports = Group;
/***/ }),
-/* 113 */
-/***/ (function(module, exports, __webpack_require__) {
+/* 89 */
+/***/ (function(module, exports) {
/**
* @author Richard Davey
@@ -22296,40 +15101,40 @@ module.exports = Group;
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var Point = __webpack_require__(5);
-
/**
- * Returns a Point object containing the coordinates of a point on the circumference of the Ellipse based on the given angle.
+ * Check to see if the Ellipse contains the given x / y coordinates.
*
- * @function Phaser.Geom.Ellipse.CircumferencePoint
+ * @function Phaser.Geom.Ellipse.Contains
* @since 3.0.0
*
- * @generic {Phaser.Geom.Point} O - [out,$return]
+ * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to check.
+ * @param {number} x - The x coordinate to check within the ellipse.
+ * @param {number} y - The y coordinate to check within the ellipse.
*
- * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the circumference point on.
- * @param {number} angle - The angle from the center of the Ellipse to the circumference to return the point from. Given in radians.
- * @param {(Phaser.Geom.Point|object)} [out] - A Point, or point-like object, to store the results in. If not given a Point will be created.
- *
- * @return {(Phaser.Geom.Point|object)} A Point object where the `x` and `y` properties are the point on the circumference.
+ * @return {boolean} True if the coordinates are within the ellipse, otherwise false.
*/
-var CircumferencePoint = function (ellipse, angle, out)
+var Contains = function (ellipse, x, y)
{
- if (out === undefined) { out = new Point(); }
+ if (ellipse.width <= 0 || ellipse.height <= 0)
+ {
+ return false;
+ }
- var halfWidth = ellipse.width / 2;
- var halfHeight = ellipse.height / 2;
+ // Normalize the coords to an ellipse with center 0,0 and a radius of 0.5
+ var normx = ((x - ellipse.x) / ellipse.width);
+ var normy = ((y - ellipse.y) / ellipse.height);
- out.x = ellipse.x + halfWidth * Math.cos(angle);
- out.y = ellipse.y + halfHeight * Math.sin(angle);
+ normx *= normx;
+ normy *= normy;
- return out;
+ return (normx + normy < 0.25);
};
-module.exports = CircumferencePoint;
+module.exports = Contains;
/***/ }),
-/* 114 */
+/* 90 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -22339,10 +15144,10 @@ module.exports = CircumferencePoint;
*/
var Class = __webpack_require__(0);
-var Contains = __webpack_require__(54);
-var GetPoint = __webpack_require__(179);
-var GetPoints = __webpack_require__(178);
-var Random = __webpack_require__(134);
+var Contains = __webpack_require__(89);
+var GetPoint = __webpack_require__(308);
+var GetPoints = __webpack_require__(307);
+var Random = __webpack_require__(185);
/**
* @classdesc
@@ -22353,7 +15158,7 @@ var Random = __webpack_require__(134);
* To render an Ellipse you should look at the capabilities of the Graphics class.
*
* @class Ellipse
- * @memberOf Phaser.Geom
+ * @memberof Phaser.Geom
* @constructor
* @since 3.0.0
*
@@ -22440,7 +15245,7 @@ var Ellipse = new Class({
*
* @generic {Phaser.Geom.Point} O - [out,$return]
*
- * @param {float} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the ellipse.
+ * @param {number} position - A value between 0 and 1, where 0 equals 0 degrees, 0.5 equals 180 degrees and 1 equals 360 around the ellipse.
* @param {(Phaser.Geom.Point|object)} [out] - An object to store the return values in. If not given a Point object will be created.
*
* @return {(Phaser.Geom.Point|object)} A Point, or point-like object, containing the coordinates of the point around the ellipse.
@@ -22697,7 +15502,323 @@ module.exports = Ellipse;
/***/ }),
-/* 115 */
+/* 91 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Removes a single item from an array and returns it without creating gc, like the native splice does.
+ * Based on code by Mike Reinstein.
+ *
+ * @function Phaser.Utils.Array.SpliceOne
+ * @since 3.0.0
+ *
+ * @param {array} array - [description]
+ * @param {integer} index - [description]
+ *
+ * @return {*} [description]
+ */
+var SpliceOne = function (array, index)
+{
+ if (index >= array.length)
+ {
+ return;
+ }
+
+ var len = array.length - 1;
+
+ var item = array[index];
+
+ for (var i = index; i < len; i++)
+ {
+ array[i] = array[i + 1];
+ }
+
+ array.length = len;
+
+ return item;
+};
+
+module.exports = SpliceOne;
+
+
+/***/ }),
+/* 92 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/* WEBPACK VAR INJECTION */(function(process) {/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Determines the operating system of the device running this Phaser Game instance.
+ * These values are read-only and populated during the boot sequence of the game.
+ * They are then referenced by internal game systems and are available for you to access
+ * via `this.sys.game.device.os` from within any Scene.
+ *
+ * @typedef {object} Phaser.Device.OS
+ * @since 3.0.0
+ *
+ * @property {boolean} android - Is running on android?
+ * @property {boolean} chromeOS - Is running on chromeOS?
+ * @property {boolean} cocoonJS - Is the game running under CocoonJS?
+ * @property {boolean} cocoonJSApp - Is this game running with CocoonJS.App?
+ * @property {boolean} cordova - Is the game running under Apache Cordova?
+ * @property {boolean} crosswalk - Is the game running under the Intel Crosswalk XDK?
+ * @property {boolean} desktop - Is running on a desktop?
+ * @property {boolean} ejecta - Is the game running under Ejecta?
+ * @property {boolean} electron - Is the game running under GitHub Electron?
+ * @property {boolean} iOS - Is running on iOS?
+ * @property {boolean} iPad - Is running on iPad?
+ * @property {boolean} iPhone - Is running on iPhone?
+ * @property {boolean} kindle - Is running on an Amazon Kindle?
+ * @property {boolean} linux - Is running on linux?
+ * @property {boolean} macOS - Is running on macOS?
+ * @property {boolean} node - Is the game running under Node.js?
+ * @property {boolean} nodeWebkit - Is the game running under Node-Webkit?
+ * @property {boolean} webApp - Set to true if running as a WebApp, i.e. within a WebView
+ * @property {boolean} windows - Is running on windows?
+ * @property {boolean} windowsPhone - Is running on a Windows Phone?
+ * @property {number} iOSVersion - If running in iOS this will contain the major version number.
+ * @property {number} pixelRatio - PixelRatio of the host device?
+ */
+var OS = {
+
+ android: false,
+ chromeOS: false,
+ cocoonJS: false,
+ cocoonJSApp: false,
+ cordova: false,
+ crosswalk: false,
+ desktop: false,
+ ejecta: false,
+ electron: false,
+ iOS: false,
+ iOSVersion: 0,
+ iPad: false,
+ iPhone: false,
+ kindle: false,
+ linux: false,
+ macOS: false,
+ node: false,
+ nodeWebkit: false,
+ pixelRatio: 1,
+ webApp: false,
+ windows: false,
+ windowsPhone: false
+
+};
+
+function init ()
+{
+ var ua = navigator.userAgent;
+
+ if (/Windows/.test(ua))
+ {
+ OS.windows = true;
+ }
+ else if (/Mac OS/.test(ua) && !(/like Mac OS/.test(ua)))
+ {
+ OS.macOS = true;
+ }
+ else if (/Android/.test(ua))
+ {
+ OS.android = true;
+ }
+ else if (/Linux/.test(ua))
+ {
+ OS.linux = true;
+ }
+ else if (/iP[ao]d|iPhone/i.test(ua))
+ {
+ OS.iOS = true;
+
+ (navigator.appVersion).match(/OS (\d+)/);
+
+ OS.iOSVersion = parseInt(RegExp.$1, 10);
+
+ OS.iPhone = ua.toLowerCase().indexOf('iphone') !== -1;
+ OS.iPad = ua.toLowerCase().indexOf('ipad') !== -1;
+ }
+ else if (/Kindle/.test(ua) || (/\bKF[A-Z][A-Z]+/).test(ua) || (/Silk.*Mobile Safari/).test(ua))
+ {
+ OS.kindle = true;
+
+ // This will NOT detect early generations of Kindle Fire, I think there is no reliable way...
+ // E.g. "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-80) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true"
+ }
+ else if (/CrOS/.test(ua))
+ {
+ OS.chromeOS = true;
+ }
+
+ if (/Windows Phone/i.test(ua) || (/IEMobile/i).test(ua))
+ {
+ OS.android = false;
+ OS.iOS = false;
+ OS.macOS = false;
+ OS.windows = true;
+ OS.windowsPhone = true;
+ }
+
+ var silk = (/Silk/).test(ua);
+
+ if (OS.windows || OS.macOS || (OS.linux && !silk) || OS.chromeOS)
+ {
+ OS.desktop = true;
+ }
+
+ // Windows Phone / Table reset
+ if (OS.windowsPhone || ((/Windows NT/i.test(ua)) && (/Touch/i.test(ua))))
+ {
+ OS.desktop = false;
+ }
+
+ // WebApp mode in iOS
+ if (navigator.standalone)
+ {
+ OS.webApp = true;
+ }
+
+ if (window.cordova !== undefined)
+ {
+ OS.cordova = true;
+ }
+
+ if (typeof process !== 'undefined' && process.versions && process.versions.node)
+ {
+ OS.node = true;
+ }
+
+ if (OS.node && typeof process.versions === 'object')
+ {
+ OS.nodeWebkit = !!process.versions['node-webkit'];
+
+ OS.electron = !!process.versions.electron;
+ }
+
+ if (navigator.isCocoonJS)
+ {
+ OS.cocoonJS = true;
+
+ try
+ {
+ OS.cocoonJSApp = (typeof CocoonJS !== 'undefined');
+ }
+ catch (error)
+ {
+ OS.cocoonJSApp = false;
+ }
+ }
+
+ if (window.ejecta !== undefined)
+ {
+ OS.ejecta = true;
+ }
+
+ if ((/Crosswalk/).test(ua))
+ {
+ OS.crosswalk = true;
+ }
+
+ OS.pixelRatio = window['devicePixelRatio'] || 1;
+
+ return OS;
+}
+
+module.exports = init();
+
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(907)))
+
+/***/ }),
+/* 93 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Clamp = __webpack_require__(23);
+
+/**
+ * Return a value based on the range between `min` and `max` and the percentage given.
+ *
+ * @function Phaser.Math.FromPercent
+ * @since 3.0.0
+ *
+ * @param {number} percent - A value between 0 and 1 representing the percentage.
+ * @param {number} min - The minimum value.
+ * @param {number} [max] - The maximum value.
+ *
+ * @return {number} The value that is `percent` percent between `min` and `max`.
+ */
+var FromPercent = function (percent, min, max)
+{
+ percent = Clamp(percent, 0, 1);
+
+ return (max - min) * percent;
+};
+
+module.exports = FromPercent;
+
+
+/***/ }),
+/* 94 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Phaser Scale Modes.
+ *
+ * @name Phaser.ScaleModes
+ * @enum {integer}
+ * @memberof Phaser
+ * @readonly
+ * @since 3.0.0
+ */
+
+module.exports = {
+
+ /**
+ * Default Scale Mode (Linear).
+ *
+ * @name Phaser.ScaleModes.DEFAULT
+ */
+ DEFAULT: 0,
+
+ /**
+ * Linear Scale Mode.
+ *
+ * @name Phaser.ScaleModes.LINEAR
+ */
+ LINEAR: 0,
+
+ /**
+ * Nearest Scale Mode.
+ *
+ * @name Phaser.ScaleModes.NEAREST
+ */
+ NEAREST: 1
+
+};
+
+
+/***/ }),
+/* 95 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -22706,24 +15827,17031 @@ module.exports = Ellipse;
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var Camera = __webpack_require__(123);
var Class = __webpack_require__(0);
-var Commands = __webpack_require__(119);
-var Components = __webpack_require__(15);
-var Ellipse = __webpack_require__(249);
-var GameObject = __webpack_require__(2);
+
+/**
+ * @callback EachSetCallback
+ * @generic E - [entry]
+ *
+ * @param {*} entry - [description]
+ * @param {number} index - [description]
+ *
+ * @return {?boolean} [description]
+ */
+
+/**
+ * @classdesc
+ * A Set is a collection of unique elements.
+ *
+ * @class Set
+ * @memberof Phaser.Structs
+ * @constructor
+ * @since 3.0.0
+ *
+ * @generic T
+ * @genericUse {T[]} - [elements]
+ *
+ * @param {Array.<*>} [elements] - An optional array of elements to insert into this Set.
+ */
+var Set = new Class({
+
+ initialize:
+
+ function Set (elements)
+ {
+ /**
+ * The entries of this Set. Stored internally as an array.
+ *
+ * @genericUse {T[]} - [$type]
+ *
+ * @name Phaser.Structs.Set#entries
+ * @type {Array.<*>}
+ * @default []
+ * @since 3.0.0
+ */
+ this.entries = [];
+
+ if (Array.isArray(elements))
+ {
+ for (var i = 0; i < elements.length; i++)
+ {
+ this.set(elements[i]);
+ }
+ }
+ },
+
+ /**
+ * Inserts the provided value into this Set. If the value is already contained in this Set this method will have no effect.
+ *
+ * @method Phaser.Structs.Set#set
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [value]
+ * @genericUse {Phaser.Structs.Set.} - [$return]
+ *
+ * @param {*} value - The value to insert into this Set.
+ *
+ * @return {Phaser.Structs.Set} This Set object.
+ */
+ set: function (value)
+ {
+ if (this.entries.indexOf(value) === -1)
+ {
+ this.entries.push(value);
+ }
+
+ return this;
+ },
+
+ /**
+ * Get an element of this Set which has a property of the specified name, if that property is equal to the specified value.
+ * If no elements of this Set satisfy the condition then this method will return `null`.
+ *
+ * @method Phaser.Structs.Set#get
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [value,$return]
+ *
+ * @param {string} property - The property name to check on the elements of this Set.
+ * @param {*} value - The value to check for.
+ *
+ * @return {*} The first element of this Set that meets the required condition, or `null` if this Set contains no elements that meet the condition.
+ */
+ get: function (property, value)
+ {
+ for (var i = 0; i < this.entries.length; i++)
+ {
+ var entry = this.entries[i];
+
+ if (entry[property] === value)
+ {
+ return entry;
+ }
+ }
+ },
+
+ /**
+ * Returns an array containing all the values in this Set.
+ *
+ * @method Phaser.Structs.Set#getArray
+ * @since 3.0.0
+ *
+ * @genericUse {T[]} - [$return]
+ *
+ * @return {Array.<*>} An array containing all the values in this Set.
+ */
+ getArray: function ()
+ {
+ return this.entries.slice(0);
+ },
+
+ /**
+ * Removes the given value from this Set if this Set contains that value.
+ *
+ * @method Phaser.Structs.Set#delete
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [value]
+ * @genericUse {Phaser.Structs.Set.} - [$return]
+ *
+ * @param {*} value - The value to remove from the Set.
+ *
+ * @return {Phaser.Structs.Set} This Set object.
+ */
+ delete: function (value)
+ {
+ var index = this.entries.indexOf(value);
+
+ if (index > -1)
+ {
+ this.entries.splice(index, 1);
+ }
+
+ return this;
+ },
+
+ /**
+ * Dumps the contents of this Set to the console via `console.group`.
+ *
+ * @method Phaser.Structs.Set#dump
+ * @since 3.0.0
+ */
+ dump: function ()
+ {
+ // eslint-disable-next-line no-console
+ console.group('Set');
+
+ for (var i = 0; i < this.entries.length; i++)
+ {
+ var entry = this.entries[i];
+ console.log(entry);
+ }
+
+ // eslint-disable-next-line no-console
+ console.groupEnd();
+ },
+
+ /**
+ * Passes each value in this Set to the given callback.
+ * Use this function when you know this Set will be modified during the iteration, otherwise use `iterate`.
+ *
+ * @method Phaser.Structs.Set#each
+ * @since 3.0.0
+ *
+ * @genericUse {EachSetCallback.} - [callback]
+ * @genericUse {Phaser.Structs.Set.} - [$return]
+ *
+ * @param {EachSetCallback} callback - The callback to be invoked and passed each value this Set contains.
+ * @param {*} callbackScope - The scope of the callback.
+ *
+ * @return {Phaser.Structs.Set} This Set object.
+ */
+ each: function (callback, callbackScope)
+ {
+ var i;
+ var temp = this.entries.slice();
+ var len = temp.length;
+
+ if (callbackScope)
+ {
+ for (i = 0; i < len; i++)
+ {
+ if (callback.call(callbackScope, temp[i], i) === false)
+ {
+ break;
+ }
+ }
+ }
+ else
+ {
+ for (i = 0; i < len; i++)
+ {
+ if (callback(temp[i], i) === false)
+ {
+ break;
+ }
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Passes each value in this Set to the given callback.
+ * For when you absolutely know this Set won't be modified during the iteration.
+ *
+ * @method Phaser.Structs.Set#iterate
+ * @since 3.0.0
+ *
+ * @genericUse {EachSetCallback.} - [callback]
+ * @genericUse {Phaser.Structs.Set.} - [$return]
+ *
+ * @param {EachSetCallback} callback - The callback to be invoked and passed each value this Set contains.
+ * @param {*} callbackScope - The scope of the callback.
+ *
+ * @return {Phaser.Structs.Set} This Set object.
+ */
+ iterate: function (callback, callbackScope)
+ {
+ var i;
+ var len = this.entries.length;
+
+ if (callbackScope)
+ {
+ for (i = 0; i < len; i++)
+ {
+ if (callback.call(callbackScope, this.entries[i], i) === false)
+ {
+ break;
+ }
+ }
+ }
+ else
+ {
+ for (i = 0; i < len; i++)
+ {
+ if (callback(this.entries[i], i) === false)
+ {
+ break;
+ }
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Goes through each entry in this Set and invokes the given function on them, passing in the arguments.
+ *
+ * @method Phaser.Structs.Set#iterateLocal
+ * @since 3.0.0
+ *
+ * @genericUse {Phaser.Structs.Set.} - [$return]
+ *
+ * @param {string} callbackKey - The key of the function to be invoked on each Set entry.
+ * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
+ *
+ * @return {Phaser.Structs.Set} This Set object.
+ */
+ iterateLocal: function (callbackKey)
+ {
+ var i;
+ var args = [];
+
+ for (i = 1; i < arguments.length; i++)
+ {
+ args.push(arguments[i]);
+ }
+
+ var len = this.entries.length;
+
+ for (i = 0; i < len; i++)
+ {
+ var entry = this.entries[i];
+
+ entry[callbackKey].apply(entry, args);
+ }
+
+ return this;
+ },
+
+ /**
+ * Clears this Set so that it no longer contains any values.
+ *
+ * @method Phaser.Structs.Set#clear
+ * @since 3.0.0
+ *
+ * @genericUse {Phaser.Structs.Set.} - [$return]
+ *
+ * @return {Phaser.Structs.Set} This Set object.
+ */
+ clear: function ()
+ {
+ this.entries.length = 0;
+
+ return this;
+ },
+
+ /**
+ * Returns `true` if this Set contains the given value, otherwise returns `false`.
+ *
+ * @method Phaser.Structs.Set#contains
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [value]
+ *
+ * @param {*} value - The value to check for in this Set.
+ *
+ * @return {boolean} `true` if the given value was found in this Set, otherwise `false`.
+ */
+ contains: function (value)
+ {
+ return (this.entries.indexOf(value) > -1);
+ },
+
+ /**
+ * Returns a new Set containing all values that are either in this Set or in the Set provided as an argument.
+ *
+ * @method Phaser.Structs.Set#union
+ * @since 3.0.0
+ *
+ * @genericUse {Phaser.Structs.Set.} - [set,$return]
+ *
+ * @param {Phaser.Structs.Set} set - The Set to perform the union with.
+ *
+ * @return {Phaser.Structs.Set} A new Set containing all the values in this Set and the Set provided as an argument.
+ */
+ union: function (set)
+ {
+ var newSet = new Set();
+
+ set.entries.forEach(function (value)
+ {
+ newSet.set(value);
+ });
+
+ this.entries.forEach(function (value)
+ {
+ newSet.set(value);
+ });
+
+ return newSet;
+ },
+
+ /**
+ * Returns a new Set that contains only the values which are in this Set and that are also in the given Set.
+ *
+ * @method Phaser.Structs.Set#intersect
+ * @since 3.0.0
+ *
+ * @genericUse {Phaser.Structs.Set.} - [set,$return]
+ *
+ * @param {Phaser.Structs.Set} set - The Set to intersect this set with.
+ *
+ * @return {Phaser.Structs.Set} The result of the intersection, as a new Set.
+ */
+ intersect: function (set)
+ {
+ var newSet = new Set();
+
+ this.entries.forEach(function (value)
+ {
+ if (set.contains(value))
+ {
+ newSet.set(value);
+ }
+ });
+
+ return newSet;
+ },
+
+ /**
+ * Returns a new Set containing all the values in this Set which are *not* also in the given Set.
+ *
+ * @method Phaser.Structs.Set#difference
+ * @since 3.0.0
+ *
+ * @genericUse {Phaser.Structs.Set.} - [set,$return]
+ *
+ * @param {Phaser.Structs.Set} set - The Set to perform the difference with.
+ *
+ * @return {Phaser.Structs.Set} A new Set containing all the values in this Set that are not also in the Set provided as an argument to this method.
+ */
+ difference: function (set)
+ {
+ var newSet = new Set();
+
+ this.entries.forEach(function (value)
+ {
+ if (!set.contains(value))
+ {
+ newSet.set(value);
+ }
+ });
+
+ return newSet;
+ },
+
+ /**
+ * The size of this Set. This is the number of entries within it.
+ * Changing the size will truncate the Set if the given value is smaller than the current size.
+ * Increasing the size larger than the current size has no effect.
+ *
+ * @name Phaser.Structs.Set#size
+ * @type {integer}
+ * @since 3.0.0
+ */
+ size: {
+
+ get: function ()
+ {
+ return this.entries.length;
+ },
+
+ set: function (value)
+ {
+ if (value < this.entries.length)
+ {
+ return this.entries.length = value;
+ }
+ else
+ {
+ return this.entries.length;
+ }
+ }
+
+ }
+
+});
+
+module.exports = Set;
+
+
+/***/ }),
+/* 96 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Clone = __webpack_require__(63);
+
+/**
+ * Creates a new Object using all values from obj1 and obj2.
+ * If a value exists in both obj1 and obj2, the value in obj1 is used.
+ *
+ * @function Phaser.Utils.Objects.Merge
+ * @since 3.0.0
+ *
+ * @param {object} obj1 - [description]
+ * @param {object} obj2 - [description]
+ *
+ * @return {object} [description]
+ */
+var Merge = function (obj1, obj2)
+{
+ var clone = Clone(obj1);
+
+ for (var key in obj2)
+ {
+ if (!clone.hasOwnProperty(key))
+ {
+ clone[key] = obj2[key];
+ }
+ }
+
+ return clone;
+};
+
+module.exports = Merge;
+
+
+/***/ }),
+/* 97 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Defaults = __webpack_require__(129);
+var GetAdvancedValue = __webpack_require__(12);
+var GetBoolean = __webpack_require__(84);
+var GetEaseFunction = __webpack_require__(86);
+var GetNewValue = __webpack_require__(98);
+var GetProps = __webpack_require__(205);
+var GetTargets = __webpack_require__(131);
+var GetValue = __webpack_require__(4);
+var GetValueOp = __webpack_require__(130);
+var Tween = __webpack_require__(128);
+var TweenData = __webpack_require__(127);
+
+/**
+ * [description]
+ *
+ * @function Phaser.Tweens.Builders.TweenBuilder
+ * @since 3.0.0
+ *
+ * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description]
+ * @param {object} config - [description]
+ * @param {Phaser.Tweens.TweenConfigDefaults} defaults - [description]
+ *
+ * @return {Phaser.Tweens.Tween} [description]
+ */
+var TweenBuilder = function (parent, config, defaults)
+{
+ if (defaults === undefined)
+ {
+ defaults = Defaults;
+ }
+
+ // Create arrays of the Targets and the Properties
+ var targets = (defaults.targets) ? defaults.targets : GetTargets(config);
+
+ // var props = (defaults.props) ? defaults.props : GetProps(config);
+ var props = GetProps(config);
+
+ // Default Tween values
+ var delay = GetNewValue(config, 'delay', defaults.delay);
+ var duration = GetNewValue(config, 'duration', defaults.duration);
+ var easeParams = GetValue(config, 'easeParams', defaults.easeParams);
+ var ease = GetEaseFunction(GetValue(config, 'ease', defaults.ease), easeParams);
+ var hold = GetNewValue(config, 'hold', defaults.hold);
+ var repeat = GetNewValue(config, 'repeat', defaults.repeat);
+ var repeatDelay = GetNewValue(config, 'repeatDelay', defaults.repeatDelay);
+ var yoyo = GetBoolean(config, 'yoyo', defaults.yoyo);
+ var flipX = GetBoolean(config, 'flipX', defaults.flipX);
+ var flipY = GetBoolean(config, 'flipY', defaults.flipY);
+
+ var data = [];
+
+ // Loop through every property defined in the Tween, i.e.: props { x, y, alpha }
+ for (var p = 0; p < props.length; p++)
+ {
+ var key = props[p].key;
+ var value = props[p].value;
+
+ // Create 1 TweenData per target, per property
+ for (var t = 0; t < targets.length; t++)
+ {
+ var ops = GetValueOp(key, value);
+
+ var tweenData = TweenData(
+ targets[t],
+ key,
+ ops.getEnd,
+ ops.getStart,
+ GetEaseFunction(GetValue(value, 'ease', ease), easeParams),
+ GetNewValue(value, 'delay', delay),
+ GetNewValue(value, 'duration', duration),
+ GetBoolean(value, 'yoyo', yoyo),
+ GetNewValue(value, 'hold', hold),
+ GetNewValue(value, 'repeat', repeat),
+ GetNewValue(value, 'repeatDelay', repeatDelay),
+ GetBoolean(value, 'flipX', flipX),
+ GetBoolean(value, 'flipY', flipY)
+ );
+
+ data.push(tweenData);
+ }
+ }
+
+ var tween = new Tween(parent, data, targets);
+
+ tween.offset = GetAdvancedValue(config, 'offset', null);
+ tween.completeDelay = GetAdvancedValue(config, 'completeDelay', 0);
+ tween.loop = Math.round(GetAdvancedValue(config, 'loop', 0));
+ tween.loopDelay = Math.round(GetAdvancedValue(config, 'loopDelay', 0));
+ tween.paused = GetBoolean(config, 'paused', false);
+ tween.useFrames = GetBoolean(config, 'useFrames', false);
+
+ // Set the Callbacks
+ var scope = GetValue(config, 'callbackScope', tween);
+
+ // Callback parameters: 0 = a reference to the Tween itself, 1 = the target/s of the Tween, ... your own params
+ var tweenArray = [ tween, null ];
+
+ var callbacks = Tween.TYPES;
+
+ for (var i = 0; i < callbacks.length; i++)
+ {
+ var type = callbacks[i];
+
+ var callback = GetValue(config, type, false);
+
+ if (callback)
+ {
+ var callbackScope = GetValue(config, type + 'Scope', scope);
+ var callbackParams = GetValue(config, type + 'Params', []);
+
+ // The null is reset to be the Tween target
+ tween.setCallback(type, callback, tweenArray.concat(callbackParams), callbackScope);
+ }
+ }
+
+ return tween;
+};
+
+module.exports = TweenBuilder;
+
+
+/***/ }),
+/* 98 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * [description]
+ *
+ * @function Phaser.Tweens.Builders.GetNewValue
+ * @since 3.0.0
+ *
+ * @param {object} source - [description]
+ * @param {string} key - [description]
+ * @param {*} defaultValue - [description]
+ *
+ * @return {function} [description]
+ */
+var GetNewValue = function (source, key, defaultValue)
+{
+ var valueCallback;
+
+ if (source.hasOwnProperty(key))
+ {
+ var t = typeof(source[key]);
+
+ if (t === 'function')
+ {
+ valueCallback = function (index, totalTargets, target)
+ {
+ return source[key](index, totalTargets, target);
+ };
+ }
+ else
+ {
+ valueCallback = function ()
+ {
+ return source[key];
+ };
+ }
+ }
+ else if (typeof defaultValue === 'function')
+ {
+ valueCallback = defaultValue;
+ }
+ else
+ {
+ valueCallback = function ()
+ {
+ return defaultValue;
+ };
+ }
+
+ return valueCallback;
+};
+
+module.exports = GetNewValue;
+
+
+/***/ }),
+/* 99 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+
+/**
+ * @classdesc
+ * A Tileset is a combination of an image containing the tiles and a container for data about
+ * each tile.
+ *
+ * @class Tileset
+ * @memberof Phaser.Tilemaps
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {string} name - The name of the tileset in the map data.
+ * @param {integer} firstgid - The first tile index this tileset contains.
+ * @param {integer} [tileWidth=32] - Width of each tile (in pixels).
+ * @param {integer} [tileHeight=32] - Height of each tile (in pixels).
+ * @param {integer} [tileMargin=0] - The margin around all tiles in the sheet (in pixels).
+ * @param {integer} [tileSpacing=0] - The spacing between each tile in the sheet (in pixels).
+ * @param {object} [tileProperties={}] - Custom properties defined per tile in the Tileset.
+ * These typically are custom properties created in Tiled when editing a tileset.
+ * @param {object} [tileData={}] - Data stored per tile. These typically are created in Tiled
+ * when editing a tileset, e.g. from Tiled's tile collision editor or terrain editor.
+ */
+var Tileset = new Class({
+
+ initialize:
+
+ function Tileset (name, firstgid, tileWidth, tileHeight, tileMargin, tileSpacing, tileProperties, tileData)
+ {
+ if (tileWidth === undefined || tileWidth <= 0) { tileWidth = 32; }
+ if (tileHeight === undefined || tileHeight <= 0) { tileHeight = 32; }
+ if (tileMargin === undefined) { tileMargin = 0; }
+ if (tileSpacing === undefined) { tileSpacing = 0; }
+ if (tileProperties === undefined) { tileProperties = {}; }
+ if (tileData === undefined) { tileData = {}; }
+
+ /**
+ * The name of the Tileset.
+ *
+ * @name Phaser.Tilemaps.Tileset#name
+ * @type {string}
+ * @since 3.0.0
+ */
+ this.name = name;
+
+ /**
+ * The starting index of the first tile index this Tileset contains.
+ *
+ * @name Phaser.Tilemaps.Tileset#firstgid
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.firstgid = firstgid;
+
+ /**
+ * The width of each tile (in pixels). Use setTileSize to change.
+ *
+ * @name Phaser.Tilemaps.Tileset#tileWidth
+ * @type {integer}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.tileWidth = tileWidth;
+
+ /**
+ * The height of each tile (in pixels). Use setTileSize to change.
+ *
+ * @name Phaser.Tilemaps.Tileset#tileHeight
+ * @type {integer}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.tileHeight = tileHeight;
+
+ /**
+ * The margin around the tiles in the sheet (in pixels). Use `setSpacing` to change.
+ *
+ * @name Phaser.Tilemaps.Tileset#tileMargin
+ * @type {integer}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.tileMargin = tileMargin;
+
+ /**
+ * The spacing between each the tile in the sheet (in pixels). Use `setSpacing` to change.
+ *
+ * @name Phaser.Tilemaps.Tileset#tileSpacing
+ * @type {integer}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.tileSpacing = tileSpacing;
+
+ /**
+ * Tileset-specific properties per tile that are typically defined in the Tiled editor in the
+ * Tileset editor.
+ *
+ * @name Phaser.Tilemaps.Tileset#tileProperties
+ * @type {object}
+ * @since 3.0.0
+ */
+ this.tileProperties = tileProperties;
+
+ /**
+ * Tileset-specific data per tile that are typically defined in the Tiled editor, e.g. within
+ * the Tileset collision editor. This is where collision objects and terrain are stored.
+ *
+ * @name Phaser.Tilemaps.Tileset#tileData
+ * @type {object}
+ * @since 3.0.0
+ */
+ this.tileData = tileData;
+
+ /**
+ * The cached image that contains the individual tiles. Use setImage to set.
+ *
+ * @name Phaser.Tilemaps.Tileset#image
+ * @type {?Phaser.Textures.Texture}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.image = null;
+
+ /**
+ * The gl texture used by the WebGL renderer.
+ *
+ * @name Phaser.Tilemaps.Tileset#glTexture
+ * @type {?WebGLTexture}
+ * @readonly
+ * @since 3.11.0
+ */
+ this.glTexture = null;
+
+ /**
+ * The number of tile rows in the the tileset.
+ *
+ * @name Phaser.Tilemaps.Tileset#rows
+ * @type {integer}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.rows = 0;
+
+ /**
+ * The number of tile columns in the tileset.
+ *
+ * @name Phaser.Tilemaps.Tileset#columns
+ * @type {integer}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.columns = 0;
+
+ /**
+ * The total number of tiles in the tileset.
+ *
+ * @name Phaser.Tilemaps.Tileset#total
+ * @type {integer}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.total = 0;
+
+ /**
+ * The look-up table to specific tile image texture coordinates (UV in pixels). Each element
+ * contains the coordinates for a tile in an object of the form {x, y}.
+ *
+ * @name Phaser.Tilemaps.Tileset#texCoordinates
+ * @type {object[]}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.texCoordinates = [];
+ },
+
+ /**
+ * Get a tiles properties that are stored in the Tileset. Returns null if tile index is not
+ * contained in this Tileset. This is typically defined in Tiled under the Tileset editor.
+ *
+ * @method Phaser.Tilemaps.Tileset#getTileProperties
+ * @since 3.0.0
+ *
+ * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map.
+ *
+ * @return {?(object|undefined)}
+ */
+ getTileProperties: function (tileIndex)
+ {
+ if (!this.containsTileIndex(tileIndex)) { return null; }
+
+ return this.tileProperties[tileIndex - this.firstgid];
+ },
+
+ /**
+ * Get a tile's data that is stored in the Tileset. Returns null if tile index is not contained
+ * in this Tileset. This is typically defined in Tiled and will contain both Tileset collision
+ * info and terrain mapping.
+ *
+ * @method Phaser.Tilemaps.Tileset#getTileData
+ * @since 3.0.0
+ *
+ * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map.
+ *
+ * @return {?object|undefined}
+ */
+ getTileData: function (tileIndex)
+ {
+ if (!this.containsTileIndex(tileIndex)) { return null; }
+
+ return this.tileData[tileIndex - this.firstgid];
+ },
+
+ /**
+ * Get a tile's collision group that is stored in the Tileset. Returns null if tile index is not
+ * contained in this Tileset. This is typically defined within Tiled's tileset collision editor.
+ *
+ * @method Phaser.Tilemaps.Tileset#getTileCollisionGroup
+ * @since 3.0.0
+ *
+ * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map.
+ *
+ * @return {?object}
+ */
+ getTileCollisionGroup: function (tileIndex)
+ {
+ var data = this.getTileData(tileIndex);
+
+ return (data && data.objectgroup) ? data.objectgroup : null;
+ },
+
+ /**
+ * Returns true if and only if this Tileset contains the given tile index.
+ *
+ * @method Phaser.Tilemaps.Tileset#containsTileIndex
+ * @since 3.0.0
+ *
+ * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map.
+ *
+ * @return {boolean}
+ */
+ containsTileIndex: function (tileIndex)
+ {
+ return (
+ tileIndex >= this.firstgid &&
+ tileIndex < (this.firstgid + this.total)
+ );
+ },
+
+ /**
+ * Returns the texture coordinates (UV in pixels) in the Tileset image for the given tile index.
+ * Returns null if tile index is not contained in this Tileset.
+ *
+ * @method Phaser.Tilemaps.Tileset#getTileTextureCoordinates
+ * @since 3.0.0
+ *
+ * @param {integer} tileIndex - The unique id of the tile across all tilesets in the map.
+ *
+ * @return {?object} Object in the form { x, y } representing the top-left UV coordinate
+ * within the Tileset image.
+ */
+ getTileTextureCoordinates: function (tileIndex)
+ {
+ if (!this.containsTileIndex(tileIndex)) { return null; }
+
+ return this.texCoordinates[tileIndex - this.firstgid];
+ },
+
+ /**
+ * Sets the image associated with this Tileset and updates the tile data (rows, columns, etc.).
+ *
+ * @method Phaser.Tilemaps.Tileset#setImage
+ * @since 3.0.0
+ *
+ * @param {Phaser.Textures.Texture} texture - The image that contains the tiles.
+ *
+ * @return {Phaser.Tilemaps.Tileset} This Tileset object.
+ */
+ setImage: function (texture)
+ {
+ this.image = texture;
+
+ this.glTexture = texture.get().source.glTexture;
+
+ this.updateTileData(this.image.source[0].width, this.image.source[0].height);
+
+ return this;
+ },
+
+ /**
+ * Sets the tile width & height and updates the tile data (rows, columns, etc.).
+ *
+ * @method Phaser.Tilemaps.Tileset#setTileSize
+ * @since 3.0.0
+ *
+ * @param {integer} [tileWidth] - The width of a tile in pixels.
+ * @param {integer} [tileHeight] - The height of a tile in pixels.
+ *
+ * @return {Phaser.Tilemaps.Tileset} This Tileset object.
+ */
+ setTileSize: function (tileWidth, tileHeight)
+ {
+ if (tileWidth !== undefined) { this.tileWidth = tileWidth; }
+ if (tileHeight !== undefined) { this.tileHeight = tileHeight; }
+
+ if (this.image)
+ {
+ this.updateTileData(this.image.source[0].width, this.image.source[0].height);
+ }
+
+ return this;
+ },
+
+ /**
+ * Sets the tile margin & spacing and updates the tile data (rows, columns, etc.).
+ *
+ * @method Phaser.Tilemaps.Tileset#setSpacing
+ * @since 3.0.0
+ *
+ * @param {integer} [margin] - The margin around the tiles in the sheet (in pixels).
+ * @param {integer} [spacing] - The spacing between the tiles in the sheet (in pixels).
+ *
+ * @return {Phaser.Tilemaps.Tileset} This Tileset object.
+ */
+ setSpacing: function (margin, spacing)
+ {
+ if (margin !== undefined) { this.tileMargin = margin; }
+ if (spacing !== undefined) { this.tileSpacing = spacing; }
+
+ if (this.image)
+ {
+ this.updateTileData(this.image.source[0].width, this.image.source[0].height);
+ }
+
+ return this;
+ },
+
+ /**
+ * Updates tile texture coordinates and tileset data.
+ *
+ * @method Phaser.Tilemaps.Tileset#updateTileData
+ * @since 3.0.0
+ *
+ * @param {integer} imageWidth - The (expected) width of the image to slice.
+ * @param {integer} imageHeight - The (expected) height of the image to slice.
+ *
+ * @return {Phaser.Tilemaps.Tileset} This Tileset object.
+ */
+ updateTileData: function (imageWidth, imageHeight)
+ {
+ var rowCount = (imageHeight - this.tileMargin * 2 + this.tileSpacing) / (this.tileHeight + this.tileSpacing);
+ var colCount = (imageWidth - this.tileMargin * 2 + this.tileSpacing) / (this.tileWidth + this.tileSpacing);
+
+ if (rowCount % 1 !== 0 || colCount % 1 !== 0)
+ {
+ console.warn('Image tile area not tile size multiple in: ' + this.name);
+ }
+
+ // In Tiled a tileset image that is not an even multiple of the tile dimensions is truncated
+ // - hence the floor when calculating the rows/columns.
+ rowCount = Math.floor(rowCount);
+ colCount = Math.floor(colCount);
+
+ this.rows = rowCount;
+ this.columns = colCount;
+
+ // In Tiled, "empty" spaces in a tileset count as tiles and hence count towards the gid
+ this.total = rowCount * colCount;
+
+ this.texCoordinates.length = 0;
+
+ var tx = this.tileMargin;
+ var ty = this.tileMargin;
+
+ for (var y = 0; y < this.rows; y++)
+ {
+ for (var x = 0; x < this.columns; x++)
+ {
+ this.texCoordinates.push({ x: tx, y: ty });
+ tx += this.tileWidth + this.tileSpacing;
+ }
+
+ tx = this.tileMargin;
+ ty += this.tileHeight + this.tileSpacing;
+ }
+
+ return this;
+ }
+
+});
+
+module.exports = Tileset;
+
+
+/***/ }),
+/* 100 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the
+ * layer's position, scale and scroll.
+ *
+ * @function Phaser.Tilemaps.Components.TileToWorldY
+ * @private
+ * @since 3.0.0
+ *
+ * @param {integer} tileY - The x coordinate, in tiles, not pixels.
+ * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
+ * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
+ *
+ * @return {number}
+ */
+var TileToWorldY = function (tileY, camera, layer)
+{
+ var tileHeight = layer.baseTileHeight;
+ var tilemapLayer = layer.tilemapLayer;
+ var layerWorldY = 0;
+
+ if (tilemapLayer)
+ {
+ if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; }
+
+ layerWorldY = (tilemapLayer.y + camera.scrollY * (1 - tilemapLayer.scrollFactorY));
+
+ tileHeight *= tilemapLayer.scaleY;
+ }
+
+ return layerWorldY + tileY * tileHeight;
+};
+
+module.exports = TileToWorldY;
+
+
+/***/ }),
+/* 101 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the
+ * layer's position, scale and scroll.
+ *
+ * @function Phaser.Tilemaps.Components.TileToWorldX
+ * @private
+ * @since 3.0.0
+ *
+ * @param {integer} tileX - The x coordinate, in tiles, not pixels.
+ * @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
+ * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
+ *
+ * @return {number}
+ */
+var TileToWorldX = function (tileX, camera, layer)
+{
+ var tileWidth = layer.baseTileWidth;
+ var tilemapLayer = layer.tilemapLayer;
+ var layerWorldX = 0;
+
+ if (tilemapLayer)
+ {
+ if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; }
+
+ layerWorldX = tilemapLayer.x + camera.scrollX * (1 - tilemapLayer.scrollFactorX);
+
+ tileWidth *= tilemapLayer.scaleX;
+ }
+
+ return layerWorldX + tileX * tileWidth;
+};
+
+module.exports = TileToWorldX;
+
+
+/***/ }),
+/* 102 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var IsInLayerBounds = __webpack_require__(79);
+
+/**
+ * Gets a tile at the given tile coordinates from the given layer.
+ *
+ * @function Phaser.Tilemaps.Components.GetTileAt
+ * @private
+ * @since 3.0.0
+ *
+ * @param {integer} tileX - X position to get the tile from (given in tile units, not pixels).
+ * @param {integer} tileY - Y position to get the tile from (given in tile units, not pixels).
+ * @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile object with an index of -1.
+ * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
+ *
+ * @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates
+ * were invalid.
+ */
+var GetTileAt = function (tileX, tileY, nonNull, layer)
+{
+ if (nonNull === undefined) { nonNull = false; }
+
+ if (IsInLayerBounds(tileX, tileY, layer))
+ {
+ var tile = layer.data[tileY][tileX];
+ if (tile === null)
+ {
+ return null;
+ }
+ else if (tile.index === -1)
+ {
+ return nonNull ? tile : null;
+ }
+ else
+ {
+ return tile;
+ }
+ }
+ else
+ {
+ return null;
+ }
+};
+
+module.exports = GetTileAt;
+
+
+/***/ }),
+/* 103 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @namespace Phaser.Tilemaps.Components
+ */
+
+module.exports = {
+
+ CalculateFacesAt: __webpack_require__(136),
+ CalculateFacesWithin: __webpack_require__(34),
+ Copy: __webpack_require__(489),
+ CreateFromTiles: __webpack_require__(488),
+ CullTiles: __webpack_require__(487),
+ Fill: __webpack_require__(486),
+ FilterTiles: __webpack_require__(485),
+ FindByIndex: __webpack_require__(484),
+ FindTile: __webpack_require__(483),
+ ForEachTile: __webpack_require__(482),
+ GetTileAt: __webpack_require__(102),
+ GetTileAtWorldXY: __webpack_require__(481),
+ GetTilesWithin: __webpack_require__(17),
+ GetTilesWithinShape: __webpack_require__(480),
+ GetTilesWithinWorldXY: __webpack_require__(479),
+ HasTileAt: __webpack_require__(219),
+ HasTileAtWorldXY: __webpack_require__(478),
+ IsInLayerBounds: __webpack_require__(79),
+ PutTileAt: __webpack_require__(135),
+ PutTileAtWorldXY: __webpack_require__(477),
+ PutTilesAt: __webpack_require__(476),
+ Randomize: __webpack_require__(475),
+ RemoveTileAt: __webpack_require__(218),
+ RemoveTileAtWorldXY: __webpack_require__(474),
+ RenderDebug: __webpack_require__(473),
+ ReplaceByIndex: __webpack_require__(220),
+ SetCollision: __webpack_require__(472),
+ SetCollisionBetween: __webpack_require__(471),
+ SetCollisionByExclusion: __webpack_require__(470),
+ SetCollisionByProperty: __webpack_require__(469),
+ SetCollisionFromCollisionGroup: __webpack_require__(468),
+ SetTileIndexCallback: __webpack_require__(467),
+ SetTileLocationCallback: __webpack_require__(466),
+ Shuffle: __webpack_require__(465),
+ SwapByIndex: __webpack_require__(464),
+ TileToWorldX: __webpack_require__(101),
+ TileToWorldXY: __webpack_require__(463),
+ TileToWorldY: __webpack_require__(100),
+ WeightedRandomize: __webpack_require__(462),
+ WorldToTileX: __webpack_require__(50),
+ WorldToTileXY: __webpack_require__(461),
+ WorldToTileY: __webpack_require__(49)
+
+};
+
+
+/***/ }),
+/* 104 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var Components = __webpack_require__(236);
+var Sprite = __webpack_require__(61);
+
+/**
+ * @classdesc
+ * An Arcade 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.
+ *
+ * @class Sprite
+ * @extends Phaser.GameObjects.Sprite
+ * @memberof Phaser.Physics.Arcade
+ * @constructor
+ * @since 3.0.0
+ *
+ * @extends Phaser.Physics.Arcade.Components.Acceleration
+ * @extends Phaser.Physics.Arcade.Components.Angular
+ * @extends Phaser.Physics.Arcade.Components.Bounce
+ * @extends Phaser.Physics.Arcade.Components.Debug
+ * @extends Phaser.Physics.Arcade.Components.Drag
+ * @extends Phaser.Physics.Arcade.Components.Enable
+ * @extends Phaser.Physics.Arcade.Components.Friction
+ * @extends Phaser.Physics.Arcade.Components.Gravity
+ * @extends Phaser.Physics.Arcade.Components.Immovable
+ * @extends Phaser.Physics.Arcade.Components.Mass
+ * @extends Phaser.Physics.Arcade.Components.Size
+ * @extends Phaser.Physics.Arcade.Components.Velocity
+ * @extends Phaser.GameObjects.Components.Alpha
+ * @extends Phaser.GameObjects.Components.BlendMode
+ * @extends Phaser.GameObjects.Components.Depth
+ * @extends Phaser.GameObjects.Components.Flip
+ * @extends Phaser.GameObjects.Components.GetBounds
+ * @extends Phaser.GameObjects.Components.Origin
+ * @extends Phaser.GameObjects.Components.Pipeline
+ * @extends Phaser.GameObjects.Components.ScaleMode
+ * @extends Phaser.GameObjects.Components.ScrollFactor
+ * @extends Phaser.GameObjects.Components.Size
+ * @extends Phaser.GameObjects.Components.Texture
+ * @extends Phaser.GameObjects.Components.Tint
+ * @extends Phaser.GameObjects.Components.Transform
+ * @extends Phaser.GameObjects.Components.Visible
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time.
+ * @param {number} x - The horizontal position of this Game Object in the world.
+ * @param {number} y - The vertical position of this Game Object in the world.
+ * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
+ * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
+ */
+var ArcadeSprite = new Class({
+
+ Extends: Sprite,
+
+ Mixins: [
+ Components.Acceleration,
+ Components.Angular,
+ Components.Bounce,
+ Components.Debug,
+ Components.Drag,
+ Components.Enable,
+ Components.Friction,
+ Components.Gravity,
+ Components.Immovable,
+ Components.Mass,
+ Components.Size,
+ Components.Velocity
+ ],
+
+ initialize:
+
+ function ArcadeSprite (scene, x, y, texture, frame)
+ {
+ Sprite.call(this, scene, x, y, texture, frame);
+
+ /**
+ * This Game Object's Physics Body.
+ *
+ * @name Phaser.Physics.Arcade.Sprite#body
+ * @type {?(Phaser.Physics.Arcade.Body|Phaser.Physics.Arcade.StaticBody)}
+ * @default null
+ * @since 3.0.0
+ */
+ this.body = null;
+ }
+
+});
+
+module.exports = ArcadeSprite;
+
+
+/***/ }),
+/* 105 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @typedef {object} XHRSettingsObject
+ *
+ * @property {XMLHttpRequestResponseType} responseType - The response type of the XHR request, i.e. `blob`, `text`, etc.
+ * @property {boolean} [async=true] - Should the XHR request use async or not?
+ * @property {string} [user=''] - Optional username for the XHR request.
+ * @property {string} [password=''] - Optional password for the XHR request.
+ * @property {integer} [timeout=0] - Optional XHR timeout value.
+ * @property {(string|undefined)} [header] - This value is used to populate the XHR `setRequestHeader` and is undefined by default.
+ * @property {(string|undefined)} [headerValue] - This value is used to populate the XHR `setRequestHeader` and is undefined by default.
+ * @property {(string|undefined)} [requestedWith] - This value is used to populate the XHR `setRequestHeader` and is undefined by default.
+ * @property {(string|undefined)} [overrideMimeType] - Provide a custom mime-type to use instead of the default.
+ */
+
+/**
+ * Creates an XHRSettings Object with default values.
+ *
+ * @function Phaser.Loader.XHRSettings
+ * @since 3.0.0
+ *
+ * @param {XMLHttpRequestResponseType} [responseType=''] - The responseType, such as 'text'.
+ * @param {boolean} [async=true] - Should the XHR request use async or not?
+ * @param {string} [user=''] - Optional username for the XHR request.
+ * @param {string} [password=''] - Optional password for the XHR request.
+ * @param {integer} [timeout=0] - Optional XHR timeout value.
+ *
+ * @return {XHRSettingsObject} The XHRSettings object as used by the Loader.
+ */
+var XHRSettings = function (responseType, async, user, password, timeout)
+{
+ if (responseType === undefined) { responseType = ''; }
+ if (async === undefined) { async = true; }
+ if (user === undefined) { user = ''; }
+ if (password === undefined) { password = ''; }
+ if (timeout === undefined) { timeout = 0; }
+
+ // Before sending a request, set the xhr.responseType to "text",
+ // "arraybuffer", "blob", or "document", depending on your data needs.
+ // Note, setting xhr.responseType = '' (or omitting) will default the response to "text".
+
+ return {
+
+ // Ignored by the Loader, only used by File.
+ responseType: responseType,
+
+ async: async,
+
+ // credentials
+ user: user,
+ password: password,
+
+ // timeout in ms (0 = no timeout)
+ timeout: timeout,
+
+ // setRequestHeader
+ header: undefined,
+ headerValue: undefined,
+ requestedWith: false,
+
+ // overrideMimeType
+ overrideMimeType: undefined
+
+ };
+};
+
+module.exports = XHRSettings;
+
+
+/***/ }),
+/* 106 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var GetValue = __webpack_require__(4);
+
+// Contains the plugins that Phaser uses globally and locally.
+// These are the source objects, not instantiated.
+var inputPlugins = {};
+
+/**
+ * @typedef {object} InputPluginContainer
+ *
+ * @property {string} key - The unique name of this plugin in the input plugin cache.
+ * @property {function} plugin - The plugin to be stored. Should be the source object, not instantiated.
+ * @property {string} [mapping] - If this plugin is to be injected into the Input Plugin, this is the property key map used.
+ */
+
+var 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)
+ *
+ * @method Phaser.Input.InputPluginCache.register
+ * @since 3.10.0
+ *
+ * @param {string} key - A reference used to get this plugin from the plugin cache.
+ * @param {function} plugin - The plugin to be stored. Should be the core object, not instantiated.
+ * @param {string} mapping - If this plugin is to be injected into the Input Plugin, this is the property key used.
+ * @param {string} settingsKey - The key in the Scene Settings to check to see if this plugin should install or not.
+ * @param {string} configKey - The key in the Game Config to check to see if this plugin should install or not.
+ */
+InputPluginCache.register = function (key, plugin, mapping, settingsKey, configKey)
+{
+ inputPlugins[key] = { plugin: plugin, mapping: mapping, settingsKey: settingsKey, configKey: configKey };
+};
+
+/**
+ * Returns the input plugin object from the cache based on the given key.
+ *
+ * @method Phaser.Input.InputPluginCache.getCore
+ * @since 3.10.0
+ *
+ * @param {string} key - The key of the input plugin to get.
+ *
+ * @return {InputPluginContainer} The input plugin object.
+ */
+InputPluginCache.getPlugin = function (key)
+{
+ return inputPlugins[key];
+};
+
+/**
+ * Installs all of the registered Input Plugins into the given target.
+ *
+ * @method Phaser.Input.InputPluginCache.install
+ * @since 3.10.0
+ *
+ * @param {Phaser.Input.InputPlugin} target - The target InputPlugin to install the plugins into.
+ */
+InputPluginCache.install = function (target)
+{
+ var sys = target.scene.sys;
+ var settings = sys.settings.input;
+ var config = sys.game.config;
+
+ for (var key in inputPlugins)
+ {
+ var source = inputPlugins[key].plugin;
+ var mapping = inputPlugins[key].mapping;
+ var settingsKey = inputPlugins[key].settingsKey;
+ var configKey = inputPlugins[key].configKey;
+
+ if (GetValue(settings, settingsKey, config[configKey]))
+ {
+ target[mapping] = new source(target);
+ }
+ }
+};
+
+/**
+ * Removes an input plugin based on the given key.
+ *
+ * @method Phaser.Input.InputPluginCache.remove
+ * @since 3.10.0
+ *
+ * @param {string} key - The key of the input plugin to remove.
+ */
+InputPluginCache.remove = function (key)
+{
+ if (inputPlugins.hasOwnProperty(key))
+ {
+ delete inputPlugins[key];
+ }
+};
+
+module.exports = InputPluginCache;
+
+
+/***/ }),
+/* 107 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Point = __webpack_require__(6);
+
+// This is based off an explanation and expanded math presented by Paul Bourke:
+// See http:'local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/
+
+/**
+ * Checks if two Lines intersect. If the Lines are identical, they will be treated as parallel and thus non-intersecting.
+ *
+ * @function Phaser.Geom.Intersects.LineToLine
+ * @since 3.0.0
+ *
+ * @param {Phaser.Geom.Line} line1 - The first Line to check.
+ * @param {Phaser.Geom.Line} line2 - The second Line to check.
+ * @param {Phaser.Geom.Point} [out] - A Point in which to optionally store the point of intersection.
+ *
+ * @return {boolean} `true` if the two Lines intersect, and the `out` object will be populated, if given. Otherwise, `false`.
+ */
+var LineToLine = function (line1, line2, out)
+{
+ if (out === undefined) { out = new Point(); }
+
+ var x1 = line1.x1;
+ var y1 = line1.y1;
+ var x2 = line1.x2;
+ var y2 = line1.y2;
+
+ var x3 = line2.x1;
+ var y3 = line2.y1;
+ var x4 = line2.x2;
+ var y4 = line2.y2;
+
+ var numA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
+ var numB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
+ var deNom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
+
+ // Make sure there is not a division by zero - this also indicates that the lines are parallel.
+ // If numA and numB were both equal to zero the lines would be on top of each other (coincidental).
+ // This check is not done because it is not necessary for this implementation (the parallel check accounts for this).
+
+ if (deNom === 0)
+ {
+ return false;
+ }
+
+ // Calculate the intermediate fractional point that the lines potentially intersect.
+
+ var uA = numA / deNom;
+ var uB = numB / deNom;
+
+ // The fractional point will be between 0 and 1 inclusive if the lines intersect.
+ // If the fractional calculation is larger than 1 or smaller than 0 the lines would need to be longer to intersect.
+
+ if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1)
+ {
+ out.x = x1 + (uA * (x2 - x1));
+ out.y = y1 + (uA * (y2 - y1));
+
+ return true;
+ }
+
+ return false;
+};
+
+module.exports = LineToLine;
+
+
+/***/ }),
+/* 108 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var Components = __webpack_require__(14);
+var GameObject = __webpack_require__(19);
+var MeshRender = __webpack_require__(731);
+
+/**
+ * @classdesc
+ * A Mesh Game Object.
+ *
+ * @class Mesh
+ * @extends Phaser.GameObjects.GameObject
+ * @memberof Phaser.GameObjects
+ * @constructor
+ * @webglOnly
+ * @since 3.0.0
+ *
+ * @extends Phaser.GameObjects.Components.Alpha
+ * @extends Phaser.GameObjects.Components.BlendMode
+ * @extends Phaser.GameObjects.Components.Depth
+ * @extends Phaser.GameObjects.Components.Flip
+ * @extends Phaser.GameObjects.Components.GetBounds
+ * @extends Phaser.GameObjects.Components.Mask
+ * @extends Phaser.GameObjects.Components.Origin
+ * @extends Phaser.GameObjects.Components.Pipeline
+ * @extends Phaser.GameObjects.Components.ScaleMode
+ * @extends Phaser.GameObjects.Components.Size
+ * @extends Phaser.GameObjects.Components.Texture
+ * @extends Phaser.GameObjects.Components.Transform
+ * @extends Phaser.GameObjects.Components.Visible
+ * @extends Phaser.GameObjects.Components.ScrollFactor
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time.
+ * @param {number} x - The horizontal position of this Game Object in the world.
+ * @param {number} y - The vertical position of this Game Object in the world.
+ * @param {number[]} vertices - An array containing the vertices data for this Mesh.
+ * @param {number[]} uv - An array containing the uv data for this Mesh.
+ * @param {number[]} colors - An array containing the color data for this Mesh.
+ * @param {number[]} alphas - An array containing the alpha data for this Mesh.
+ * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
+ * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
+ */
+var Mesh = new Class({
+
+ Extends: GameObject,
+
+ Mixins: [
+ Components.Alpha,
+ Components.BlendMode,
+ Components.Depth,
+ Components.Flip,
+ Components.GetBounds,
+ Components.Mask,
+ Components.Origin,
+ Components.Pipeline,
+ Components.ScaleMode,
+ Components.Size,
+ Components.Texture,
+ Components.Transform,
+ Components.Visible,
+ Components.ScrollFactor,
+ MeshRender
+ ],
+
+ initialize:
+
+ function Mesh (scene, x, y, vertices, uv, colors, alphas, texture, frame)
+ {
+ GameObject.call(this, scene, 'Mesh');
+
+ if (vertices.length !== uv.length)
+ {
+ throw new Error('Mesh Vertex count must match UV count');
+ }
+
+ var verticesUB = (vertices.length / 2) | 0;
+
+ if (colors.length > 0 && colors.length < verticesUB)
+ {
+ throw new Error('Mesh Color count must match Vertex count');
+ }
+
+ if (alphas.length > 0 && alphas.length < verticesUB)
+ {
+ throw new Error('Mesh Alpha count must match Vertex count');
+ }
+
+ var i;
+
+ if (colors.length === 0)
+ {
+ for (i = 0; i < verticesUB; ++i)
+ {
+ colors[i] = 0xFFFFFF;
+ }
+ }
+
+ if (alphas.length === 0)
+ {
+ for (i = 0; i < verticesUB; ++i)
+ {
+ alphas[i] = 1.0;
+ }
+ }
+
+ /**
+ * An array containing the vertices data for this Mesh.
+ *
+ * @name Phaser.GameObjects.Mesh#vertices
+ * @type {Float32Array}
+ * @since 3.0.0
+ */
+ this.vertices = new Float32Array(vertices);
+
+ /**
+ * An array containing the uv data for this Mesh.
+ *
+ * @name Phaser.GameObjects.Mesh#uv
+ * @type {Float32Array}
+ * @since 3.0.0
+ */
+ this.uv = new Float32Array(uv);
+
+ /**
+ * An array containing the color data for this Mesh.
+ *
+ * @name Phaser.GameObjects.Mesh#colors
+ * @type {Uint32Array}
+ * @since 3.0.0
+ */
+ this.colors = new Uint32Array(colors);
+
+ /**
+ * An array containing the alpha data for this Mesh.
+ *
+ * @name Phaser.GameObjects.Mesh#alphas
+ * @type {Float32Array}
+ * @since 3.0.0
+ */
+ this.alphas = new Float32Array(alphas);
+
+ /**
+ * Fill or additive mode used when blending the color values?
+ *
+ * @name Phaser.GameObjects.Mesh#tintFill
+ * @type {boolean}
+ * @default false
+ * @since 3.11.0
+ */
+ this.tintFill = false;
+
+ this.setTexture(texture, frame);
+ this.setPosition(x, y);
+ this.setSizeToFrame();
+ this.setOrigin();
+ this.initPipeline();
+ }
+
+});
+
+module.exports = Mesh;
+
+
+/***/ }),
+/* 109 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var Components = __webpack_require__(14);
+var GameObject = __webpack_require__(19);
+var GetBitmapTextSize = __webpack_require__(846);
+var ParseFromAtlas = __webpack_require__(845);
+var Render = __webpack_require__(844);
+
+/**
+ * The font data for an individual character of a Bitmap Font.
+ *
+ * Describes the character's position, size, offset and kerning.
+ *
+ * @typedef {object} BitmapFontCharacterData
+ *
+ * @property {number} x - The x position of the character.
+ * @property {number} y - The y position of the character.
+ * @property {number} width - The width of the character.
+ * @property {number} height - The height of the character.
+ * @property {number} centerX - The center x position of the character.
+ * @property {number} centerY - The center y position of the character.
+ * @property {number} xOffset - The x offset of the character.
+ * @property {number} yOffset - The y offset of the character.
+ * @property {object} data - Extra data for the character.
+ * @property {Object.} kerning - Kerning values, keyed by character code.
+ */
+
+/**
+ * Bitmap Font data that can be used by a BitmapText Game Object.
+ *
+ * @typedef {object} BitmapFontData
+ *
+ * @property {string} font - The name of the font.
+ * @property {number} size - The size of the font.
+ * @property {number} lineHeight - The line height of the font.
+ * @property {boolean} retroFont - Whether this font is a retro font (monospace).
+ * @property {Object.} chars - The character data of the font, keyed by character code. Each character datum includes a position, size, offset and more.
+ */
+
+/**
+ * @typedef {object} JSONBitmapText
+ * @extends {JSONGameObject}
+ *
+ * @property {string} font - The name of the font.
+ * @property {string} text - The text that this Bitmap Text displays.
+ * @property {number} fontSize - The size of the font.
+ * @property {number} letterSpacing - Adds / Removes spacing between characters.
+ * @property {integer} align - The alignment of the text in a multi-line BitmapText object.
+ */
+
+/**
+ * @classdesc
+ * 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
+ *
+ * @class BitmapText
+ * @extends Phaser.GameObjects.GameObject
+ * @memberof Phaser.GameObjects
+ * @constructor
+ * @since 3.0.0
+ *
+ * @extends Phaser.GameObjects.Components.Alpha
+ * @extends Phaser.GameObjects.Components.BlendMode
+ * @extends Phaser.GameObjects.Components.Depth
+ * @extends Phaser.GameObjects.Components.Mask
+ * @extends Phaser.GameObjects.Components.Origin
+ * @extends Phaser.GameObjects.Components.Pipeline
+ * @extends Phaser.GameObjects.Components.ScaleMode
+ * @extends Phaser.GameObjects.Components.ScrollFactor
+ * @extends Phaser.GameObjects.Components.Texture
+ * @extends Phaser.GameObjects.Components.Tint
+ * @extends Phaser.GameObjects.Components.Transform
+ * @extends Phaser.GameObjects.Components.Visible
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time.
+ * @param {number} x - The x coordinate of this Game Object in world space.
+ * @param {number} y - The y coordinate of this Game Object in world space.
+ * @param {string} font - The key of the font to use from the Bitmap Font cache.
+ * @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text.
+ * @param {number} [size] - The font size of this Bitmap Text.
+ * @param {integer} [align=0] - The alignment of the text in a multi-line BitmapText object.
+ */
+var BitmapText = new Class({
+
+ Extends: GameObject,
+
+ Mixins: [
+ Components.Alpha,
+ Components.BlendMode,
+ Components.Depth,
+ Components.Mask,
+ Components.Origin,
+ Components.Pipeline,
+ Components.ScaleMode,
+ Components.ScrollFactor,
+ Components.Texture,
+ Components.Tint,
+ Components.Transform,
+ Components.Visible,
+ Render
+ ],
+
+ initialize:
+
+ function BitmapText (scene, x, y, font, text, size, align)
+ {
+ if (text === undefined) { text = ''; }
+ if (align === undefined) { align = 0; }
+
+ GameObject.call(this, scene, 'BitmapText');
+
+ /**
+ * The key of the Bitmap Font used by this Bitmap Text.
+ * To change the font after creation please use `setFont`.
+ *
+ * @name Phaser.GameObjects.BitmapText#font
+ * @type {string}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.font = font;
+
+ var entry = this.scene.sys.cache.bitmapFont.get(font);
+
+ /**
+ * The data of the Bitmap Font used by this Bitmap Text.
+ *
+ * @name Phaser.GameObjects.BitmapText#fontData
+ * @type {BitmapFontData}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.fontData = entry.data;
+
+ /**
+ * The text that this Bitmap Text object displays.
+ *
+ * @name Phaser.GameObjects.BitmapText#_text
+ * @type {string}
+ * @private
+ * @since 3.0.0
+ */
+ this._text = '';
+
+ /**
+ * The font size of this Bitmap Text.
+ *
+ * @name Phaser.GameObjects.BitmapText#_fontSize
+ * @type {number}
+ * @private
+ * @since 3.0.0
+ */
+ this._fontSize = size || this.fontData.size;
+
+ /**
+ * Adds / Removes spacing between characters.
+ *
+ * Can be a negative or positive number.
+ *
+ * @name Phaser.GameObjects.BitmapText#_letterSpacing
+ * @type {number}
+ * @private
+ * @since 3.4.0
+ */
+ this._letterSpacing = 0;
+
+ /**
+ * Controls the alignment of each line of text in this BitmapText object.
+ * Only has any effect when this BitmapText contains multiple lines of text, split with carriage-returns.
+ * Has no effect with single-lines of text.
+ *
+ * See the methods `setLeftAlign`, `setCenterAlign` and `setRightAlign`.
+ *
+ * 0 = Left aligned (default)
+ * 1 = Middle aligned
+ * 2 = Right aligned
+ *
+ * The alignment position is based on the longest line of text.
+ *
+ * @name Phaser.GameObjects.BitmapText#_align
+ * @type {integer}
+ * @private
+ * @since 3.11.0
+ */
+ this._align = align;
+
+ /**
+ * An object that describes the size of this Bitmap Text.
+ *
+ * @name Phaser.GameObjects.BitmapText#_bounds
+ * @type {BitmapTextSize}
+ * @private
+ * @since 3.0.0
+ */
+ this._bounds = GetBitmapTextSize(this, false, this._bounds);
+
+ /**
+ * An internal dirty flag for bounds calculation.
+ *
+ * @name Phaser.GameObjects.BitmapText#_dirty
+ * @type {boolean}
+ * @private
+ * @since 3.11.0
+ */
+ this._dirty = false;
+
+ this.setTexture(entry.texture, entry.frame);
+ this.setPosition(x, y);
+ this.setOrigin(0, 0);
+ this.initPipeline();
+
+ this.setText(text);
+ },
+
+ /**
+ * Set the lines of text in this BitmapText to be left-aligned.
+ * This only has any effect if this BitmapText contains more than one line of text.
+ *
+ * @method Phaser.GameObjects.BitmapText#setLeftAlign
+ * @since 3.11.0
+ *
+ * @return {this} This BitmapText Object.
+ */
+ setLeftAlign: function ()
+ {
+ this._align = BitmapText.ALIGN_LEFT;
+
+ this._dirty = true;
+
+ return this;
+ },
+
+ /**
+ * Set the lines of text in this BitmapText to be center-aligned.
+ * This only has any effect if this BitmapText contains more than one line of text.
+ *
+ * @method Phaser.GameObjects.BitmapText#setCenterAlign
+ * @since 3.11.0
+ *
+ * @return {this} This BitmapText Object.
+ */
+ setCenterAlign: function ()
+ {
+ this._align = BitmapText.ALIGN_CENTER;
+
+ this._dirty = true;
+
+ return this;
+ },
+
+ /**
+ * Set the lines of text in this BitmapText to be right-aligned.
+ * This only has any effect if this BitmapText contains more than one line of text.
+ *
+ * @method Phaser.GameObjects.BitmapText#setRightAlign
+ * @since 3.11.0
+ *
+ * @return {this} This BitmapText Object.
+ */
+ setRightAlign: function ()
+ {
+ this._align = BitmapText.ALIGN_RIGHT;
+
+ this._dirty = true;
+
+ return this;
+ },
+
+ /**
+ * Set the font size of this Bitmap Text.
+ *
+ * @method Phaser.GameObjects.BitmapText#setFontSize
+ * @since 3.0.0
+ *
+ * @param {number} size - The font size to set.
+ *
+ * @return {this} This BitmapText Object.
+ */
+ setFontSize: function (size)
+ {
+ this._fontSize = size;
+
+ this._dirty = true;
+
+ return this;
+ },
+
+ /**
+ * Sets the letter spacing between each character of this Bitmap Text.
+ * Can be a positive value to increase the space, or negative to reduce it.
+ * Spacing is applied after the kerning values have been set.
+ *
+ * @method Phaser.GameObjects.BitmapText#setLetterSpacing
+ * @since 3.4.0
+ *
+ * @param {number} [spacing=0] - The amount of horizontal space to add between each character.
+ *
+ * @return {this} This BitmapText Object.
+ */
+ setLetterSpacing: function (spacing)
+ {
+ if (spacing === undefined) { spacing = 0; }
+
+ this._letterSpacing = spacing;
+
+ this._dirty = true;
+
+ return this;
+ },
+
+ /**
+ * Set the textual content of this BitmapText.
+ *
+ * An array of strings will be converted into multi-line text. Use the align methods to change multi-line alignment.
+ *
+ * @method Phaser.GameObjects.BitmapText#setText
+ * @since 3.0.0
+ *
+ * @param {(string|string[])} value - The string, or array of strings, to be set as the content of this BitmapText.
+ *
+ * @return {this} This BitmapText Object.
+ */
+ setText: function (value)
+ {
+ if (!value && value !== 0)
+ {
+ value = '';
+ }
+
+ if (Array.isArray(value))
+ {
+ value = value.join('\n');
+ }
+
+ if (value !== this.text)
+ {
+ this._text = value.toString();
+
+ this._dirty = true;
+
+ this.updateDisplayOrigin();
+ }
+
+ return this;
+ },
+
+ /**
+ * Calculate the bounds of this Bitmap Text.
+ *
+ * An object is returned that contains the position, width and height of the Bitmap Text in local and global
+ * contexts.
+ *
+ * Local size is based on just the font size and a [0, 0] position.
+ *
+ * Global size takes into account the Game Object's scale, world position and display origin.
+ *
+ * Also in the object is data regarding the length of each line, should this be a multi-line BitmapText.
+ *
+ * @method Phaser.GameObjects.BitmapText#getTextBounds
+ * @since 3.0.0
+ *
+ * @param {boolean} [round] - Whether to round the results to the nearest integer.
+ *
+ * @return {BitmapTextSize} An object that describes the size of this Bitmap Text.
+ */
+ getTextBounds: function (round)
+ {
+ // local = The BitmapText based on fontSize and 0x0 coords
+ // global = The BitmapText, taking into account scale and world position
+ // lines = The BitmapText line data
+
+ if (this._dirty)
+ {
+ GetBitmapTextSize(this, round, this._bounds);
+ }
+
+ return this._bounds;
+ },
+
+ /**
+ * Changes the font this BitmapText is using to render.
+ *
+ * The new texture is loaded and applied to the BitmapText. The existing test, size and alignment are preserved,
+ * unless overridden via the arguments.
+ *
+ * @method Phaser.GameObjects.BitmapText#setFont
+ * @since 3.11.0
+ *
+ * @param {string} font - The key of the font to use from the Bitmap Font cache.
+ * @param {number} [size] - The font size of this Bitmap Text. If not specified the current size will be used.
+ * @param {integer} [align=0] - The alignment of the text in a multi-line BitmapText object. If not specified the current alignment will be used.
+ *
+ * @return {this} This BitmapText Object.
+ */
+ setFont: function (key, size, align)
+ {
+ if (size === undefined) { size = this._fontSize; }
+ if (align === undefined) { align = this._align; }
+
+ if (key !== this.font)
+ {
+ var entry = this.scene.sys.cache.bitmapFont.get(key);
+
+ if (entry)
+ {
+ this.font = key;
+ this.fontData = entry.data;
+ this._fontSize = size;
+ this._align = align;
+
+ this.setTexture(entry.texture, entry.frame);
+
+ GetBitmapTextSize(this, false, this._bounds);
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Controls the alignment of each line of text in this BitmapText object.
+ *
+ * Only has any effect when this BitmapText contains multiple lines of text, split with carriage-returns.
+ * Has no effect with single-lines of text.
+ *
+ * See the methods `setLeftAlign`, `setCenterAlign` and `setRightAlign`.
+ *
+ * 0 = Left aligned (default)
+ * 1 = Middle aligned
+ * 2 = Right aligned
+ *
+ * The alignment position is based on the longest line of text.
+ *
+ * @name Phaser.GameObjects.BitmapText#align
+ * @type {integer}
+ * @since 3.11.0
+ */
+ align: {
+
+ set: function (value)
+ {
+ this._align = value;
+ this._dirty = true;
+ },
+
+ get: function ()
+ {
+ return this._align;
+ }
+
+ },
+
+ /**
+ * The text that this Bitmap Text object displays.
+ *
+ * You can also use the method `setText` if you want a chainable way to change the text content.
+ *
+ * @name Phaser.GameObjects.BitmapText#text
+ * @type {string}
+ * @since 3.0.0
+ */
+ text: {
+
+ set: function (value)
+ {
+ this.setText(value);
+ },
+
+ get: function ()
+ {
+ return this._text;
+ }
+
+ },
+
+ /**
+ * The font size of this Bitmap Text.
+ *
+ * You can also use the method `setFontSize` if you want a chainable way to change the font size.
+ *
+ * @name Phaser.GameObjects.BitmapText#fontSize
+ * @type {number}
+ * @since 3.0.0
+ */
+ fontSize: {
+
+ set: function (value)
+ {
+ this._fontSize = value;
+ this._dirty = true;
+ },
+
+ get: function ()
+ {
+ return this._fontSize;
+ }
+
+ },
+
+ /**
+ * Adds / Removes spacing between characters.
+ *
+ * Can be a negative or positive number.
+ *
+ * You can also use the method `setLetterSpacing` if you want a chainable way to change the letter spacing.
+ *
+ * @name Phaser.GameObjects.BitmapText#letterSpacing
+ * @type {number}
+ * @since 3.0.0
+ */
+ letterSpacing: {
+
+ set: function (value)
+ {
+ this._letterSpacing = value;
+ this._dirty = true;
+ },
+
+ get: function ()
+ {
+ return this._letterSpacing;
+ }
+
+ },
+
+ /**
+ * The width of this Bitmap Text.
+ *
+ * @name Phaser.GameObjects.BitmapText#width
+ * @type {number}
+ * @readonly
+ * @since 3.0.0
+ */
+ width: {
+
+ get: function ()
+ {
+ this.getTextBounds(false);
+
+ return this._bounds.global.width;
+ }
+
+ },
+
+ /**
+ * The height of this bitmap text.
+ *
+ * @name Phaser.GameObjects.BitmapText#height
+ * @type {number}
+ * @readonly
+ * @since 3.0.0
+ */
+ height: {
+
+ get: function ()
+ {
+ this.getTextBounds(false);
+
+ return this._bounds.global.height;
+ }
+
+ },
+
+ /**
+ * Build a JSON representation of this Bitmap Text.
+ *
+ * @method Phaser.GameObjects.BitmapText#toJSON
+ * @since 3.0.0
+ *
+ * @return {JSONBitmapText} A JSON representation of this Bitmap Text.
+ */
+ toJSON: function ()
+ {
+ var out = Components.ToJSON(this);
+
+ // Extra data is added here
+
+ var data = {
+ font: this.font,
+ text: this.text,
+ fontSize: this.fontSize,
+ letterSpacing: this.letterSpacing,
+ align: this.align
+ };
+
+ out.data = data;
+
+ return out;
+ }
+
+});
+
+/**
+ * Left align the text characters in a multi-line BitmapText object.
+ *
+ * @name Phaser.GameObjects.BitmapText.ALIGN_LEFT
+ * @type {integer}
+ * @since 3.11.0
+ */
+BitmapText.ALIGN_LEFT = 0;
+
+/**
+ * Center align the text characters in a multi-line BitmapText object.
+ *
+ * @name Phaser.GameObjects.BitmapText.ALIGN_CENTER
+ * @type {integer}
+ * @since 3.11.0
+ */
+BitmapText.ALIGN_CENTER = 1;
+
+/**
+ * Right align the text characters in a multi-line BitmapText object.
+ *
+ * @name Phaser.GameObjects.BitmapText.ALIGN_RIGHT
+ * @type {integer}
+ * @since 3.11.0
+ */
+BitmapText.ALIGN_RIGHT = 2;
+
+BitmapText.ParseFromAtlas = ParseFromAtlas;
+
+module.exports = BitmapText;
+
+
+/***/ }),
+/* 110 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+//! stable.js 0.1.6, https://github.com/Two-Screen/stable
+//! © 2017 Angry Bytes and contributors. MIT licensed.
+
+(function() {
+
+// A stable array sort, because `Array#sort()` is not guaranteed stable.
+// This is an implementation of merge sort, without recursion.
+
+var stable = function(arr, comp) {
+ return exec(arr.slice(), comp);
+};
+
+stable.inplace = function(arr, comp) {
+ var result = exec(arr, comp);
+
+ // This simply copies back if the result isn't in the original array,
+ // which happens on an odd number of passes.
+ if (result !== arr) {
+ pass(result, null, arr.length, arr);
+ }
+
+ return arr;
+};
+
+// Execute the sort using the input array and a second buffer as work space.
+// Returns one of those two, containing the final result.
+function exec(arr, comp) {
+ if (typeof(comp) !== 'function') {
+ comp = function(a, b) {
+ return String(a).localeCompare(b);
+ };
+ }
+
+ // Short-circuit when there's nothing to sort.
+ var len = arr.length;
+ if (len <= 1) {
+ return arr;
+ }
+
+ // Rather than dividing input, simply iterate chunks of 1, 2, 4, 8, etc.
+ // Chunks are the size of the left or right hand in merge sort.
+ // Stop when the left-hand covers all of the array.
+ var buffer = new Array(len);
+ for (var chk = 1; chk < len; chk *= 2) {
+ pass(arr, comp, chk, buffer);
+
+ var tmp = arr;
+ arr = buffer;
+ buffer = tmp;
+ }
+
+ return arr;
+}
+
+// Run a single pass with the given chunk size.
+var pass = function(arr, comp, chk, result) {
+ var len = arr.length;
+ var i = 0;
+ // Step size / double chunk size.
+ var dbl = chk * 2;
+ // Bounds of the left and right chunks.
+ var l, r, e;
+ // Iterators over the left and right chunk.
+ var li, ri;
+
+ // Iterate over pairs of chunks.
+ for (l = 0; l < len; l += dbl) {
+ r = l + chk;
+ e = r + chk;
+ if (r > len) r = len;
+ if (e > len) e = len;
+
+ // Iterate both chunks in parallel.
+ li = l;
+ ri = r;
+ while (true) {
+ // Compare the chunks.
+ if (li < r && ri < e) {
+ // This works for a regular `sort()` compatible comparator,
+ // but also for a simple comparator like: `a > b`
+ if (comp(arr[li], arr[ri]) <= 0) {
+ result[i++] = arr[li++];
+ }
+ else {
+ result[i++] = arr[ri++];
+ }
+ }
+ // Nothing to compare, just flush what's left.
+ else if (li < r) {
+ result[i++] = arr[li++];
+ }
+ else if (ri < e) {
+ result[i++] = arr[ri++];
+ }
+ // Both iterators are at the chunk ends.
+ else {
+ break;
+ }
+ }
+ }
+};
+
+// Export using CommonJS or to the window.
+if (true) {
+ module.exports = stable;
+}
+else {}
+
+})();
+
+/***/ }),
+/* 111 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+// Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}.
+
+var CheckMatrix = __webpack_require__(163);
+var TransposeMatrix = __webpack_require__(315);
+
+/**
+ * [description]
+ *
+ * @function Phaser.Utils.Array.Matrix.RotateMatrix
+ * @since 3.0.0
+ *
+ * @param {array} matrix - The array to rotate.
+ * @param {(number|string)} [direction=90] - The amount to rotate the matrix by. The value can be given in degrees: 90, -90, 270, -270 or 180, or a string command: `rotateLeft`, `rotateRight` or `rotate180`.
+ *
+ * @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix.
+ */
+var RotateMatrix = function (matrix, direction)
+{
+ if (direction === undefined) { direction = 90; }
+
+ if (!CheckMatrix(matrix))
+ {
+ return null;
+ }
+
+ if (typeof direction !== 'string')
+ {
+ direction = ((direction % 360) + 360) % 360;
+ }
+
+ if (direction === 90 || direction === -270 || direction === 'rotateLeft')
+ {
+ matrix = TransposeMatrix(matrix);
+ matrix.reverse();
+ }
+ else if (direction === -90 || direction === 270 || direction === 'rotateRight')
+ {
+ matrix.reverse();
+ matrix = TransposeMatrix(matrix);
+ }
+ else if (Math.abs(direction) === 180 || direction === 'rotate180')
+ {
+ for (var i = 0; i < matrix.length; i++)
+ {
+ matrix[i].reverse();
+ }
+
+ matrix.reverse();
+ }
+
+ return matrix;
+};
+
+module.exports = RotateMatrix;
+
+
+/***/ }),
+/* 112 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var ArrayUtils = __webpack_require__(164);
+var Class = __webpack_require__(0);
+var NOOP = __webpack_require__(1);
+var StableSort = __webpack_require__(110);
+
+/**
+ * @callback EachListCallback
+ * @generic I - [item]
+ *
+ * @param {*} item - The item which is currently being processed.
+ * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
+ */
+
+/**
+ * @classdesc
+ * List is a generic implementation of an ordered list which contains utility methods for retrieving, manipulating, and iterating items.
+ *
+ * @class List
+ * @memberof Phaser.Structs
+ * @constructor
+ * @since 3.0.0
+ *
+ * @generic T
+ *
+ * @param {*} parent - The parent of this list.
+ */
+var List = new Class({
+
+ initialize:
+
+ function List (parent)
+ {
+ /**
+ * The parent of this list.
+ *
+ * @name Phaser.Structs.List#parent
+ * @type {*}
+ * @since 3.0.0
+ */
+ this.parent = parent;
+
+ /**
+ * The objects that belong to this collection.
+ *
+ * @genericUse {T[]} - [$type]
+ *
+ * @name Phaser.Structs.List#list
+ * @type {Array.<*>}
+ * @default []
+ * @since 3.0.0
+ */
+ this.list = [];
+
+ /**
+ * The index of the current element.
+ *
+ * This is used internally when iterating through the list with the {@link #first}, {@link #last}, {@link #get}, and {@link #previous} properties.
+ *
+ * @name Phaser.Structs.List#position
+ * @type {integer}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.position = 0;
+
+ /**
+ * A callback that is invoked every time a child is added to this list.
+ *
+ * @name Phaser.Structs.List#addCallback
+ * @type {function}
+ * @since 3.4.0
+ */
+ this.addCallback = NOOP;
+
+ /**
+ * A callback that is invoked every time a child is removed from this list.
+ *
+ * @name Phaser.Structs.List#removeCallback
+ * @type {function}
+ * @since 3.4.0
+ */
+ this.removeCallback = NOOP;
+
+ /**
+ * The property key to sort by.
+ *
+ * @name Phaser.Structs.List#_sortKey
+ * @type {string}
+ * @since 3.4.0
+ */
+ this._sortKey = '';
+ },
+
+ /**
+ * Adds the given item to the end of the list. Each item must be unique.
+ *
+ * @method Phaser.Structs.List#add
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [child,$return]
+ *
+ * @param {*|Array.<*>} child - The item, or array of items, to add to the list.
+ * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully.
+ *
+ * @return {*} The list's underlying array.
+ */
+ add: function (child, skipCallback)
+ {
+ if (skipCallback)
+ {
+ return ArrayUtils.Add(this.list, child);
+ }
+ else
+ {
+ return ArrayUtils.Add(this.list, child, 0, this.addCallback, this);
+ }
+ },
+
+ /**
+ * Adds an item to list, starting at a specified index. Each item must be unique within the list.
+ *
+ * @method Phaser.Structs.List#addAt
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [child,$return]
+ *
+ * @param {*} child - The item, or array of items, to add to the list.
+ * @param {integer} [index=0] - The index in the list at which the element(s) will be inserted.
+ * @param {boolean} [skipCallback=false] - Skip calling the List.addCallback if this child is added successfully.
+ *
+ * @return {*} The List's underlying array.
+ */
+ addAt: function (child, index, skipCallback)
+ {
+ if (skipCallback)
+ {
+ return ArrayUtils.AddAt(this.list, child, index);
+ }
+ else
+ {
+ return ArrayUtils.AddAt(this.list, child, index, 0, this.addCallback, this);
+ }
+ },
+
+ /**
+ * Retrieves the item at a given position inside the List.
+ *
+ * @method Phaser.Structs.List#getAt
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [$return]
+ *
+ * @param {integer} index - The index of the item.
+ *
+ * @return {*} The retrieved item, or `undefined` if it's outside the List's bounds.
+ */
+ getAt: function (index)
+ {
+ return this.list[index];
+ },
+
+ /**
+ * Locates an item within the List and returns its index.
+ *
+ * @method Phaser.Structs.List#getIndex
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [child]
+ *
+ * @param {*} child - The item to locate.
+ *
+ * @return {integer} The index of the item within the List, or -1 if it's not in the List.
+ */
+ getIndex: function (child)
+ {
+ // Return -1 if given child isn't a child of this display list
+ return this.list.indexOf(child);
+ },
+
+ /**
+ * Sort the contents of this List so the items are in order based
+ * on the given property. For example, `sort('alpha')` would sort the List
+ * contents based on the value of their `alpha` property.
+ *
+ * @method Phaser.Structs.List#sort
+ * @since 3.0.0
+ *
+ * @genericUse {T[]} - [children,$return]
+ *
+ * @param {string} property - The property to lexically sort by.
+ *
+ * @return {Phaser.Structs.List} This List object.
+ */
+ sort: function (property)
+ {
+ if (property)
+ {
+ this._sortKey = property;
+
+ StableSort.inplace(this.list, this.sortHandler);
+ }
+
+ return this;
+ },
+
+ /**
+ * Internal handler for the {@link #sort} method which compares two items.
+ *
+ * @method Phaser.Structs.List#sortHandler
+ * @private
+ * @since 3.4.0
+ *
+ * @genericUse {T} - [childA,childB]
+ *
+ * @param {*} childA - The first item to compare.
+ * @param {*} childB - The second item to compare.
+ *
+ * @return {integer} The result of the comparison, which will be negative if the first item is smaller then second, positive if the first item is larger than the second, or 0 if they're equal.
+ */
+ sortHandler: function (childA, childB)
+ {
+ return childA[this._sortKey] - childB[this._sortKey];
+ },
+
+ /**
+ * Searches for the first instance of a child with its `name`
+ * property matching the given argument. Should more than one child have
+ * the same name only the first is returned.
+ *
+ * @method Phaser.Structs.List#getByName
+ * @since 3.0.0
+ *
+ * @genericUse {T | null} - [$return]
+ *
+ * @param {string} name - The name to search for.
+ *
+ * @return {?*} The first child with a matching name, or null if none were found.
+ */
+ getByName: function (name)
+ {
+ return ArrayUtils.GetFirst(this.list, 'name', name);
+ },
+
+ /**
+ * Returns a random child from the group.
+ *
+ * @method Phaser.Structs.List#getRandom
+ * @since 3.0.0
+ *
+ * @genericUse {T | null} - [$return]
+ *
+ * @param {integer} [startIndex=0] - Offset from the front of the group (lowest child).
+ * @param {integer} [length=(to top)] - Restriction on the number of values you want to randomly select from.
+ *
+ * @return {?*} A random child of this Group.
+ */
+ getRandom: function (startIndex, length)
+ {
+ return ArrayUtils.GetRandom(this.list, startIndex, length);
+ },
+
+ /**
+ * Returns the first element in a given part of the List which matches a specific criterion.
+ *
+ * @method Phaser.Structs.List#getFirst
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [value]
+ * @genericUse {T | null} - [$return]
+ *
+ * @param {string} property - The name of the property to test or a falsey value to have no criterion.
+ * @param {*} value - The value to test the `property` against, or `undefined` to allow any value and only check for existence.
+ * @param {number} [startIndex=0] - The position in the List to start the search at.
+ * @param {number} [endIndex] - The position in the List to optionally stop the search at. It won't be checked.
+ *
+ * @return {?*} The first item which matches the given criterion, or `null` if no such item exists.
+ */
+ getFirst: function (property, value, startIndex, endIndex)
+ {
+ return ArrayUtils.GetFirstElement(this.list, property, value, startIndex, endIndex);
+ },
+
+ /**
+ * Returns all children in this List.
+ *
+ * You can optionally specify a matching criteria using the `property` and `value` arguments.
+ *
+ * For example: `getAll('parent')` would return only children that have a property called `parent`.
+ *
+ * You can also specify a value to compare the property to:
+ *
+ * `getAll('visible', true)` would return only children that have their visible property set to `true`.
+ *
+ * Optionally you can specify a start and end index. For example if this List had 100 children,
+ * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only
+ * the first 50 children in the List.
+ *
+ * @method Phaser.Structs.List#getAll
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [value]
+ * @genericUse {T[]} - [$return]
+ *
+ * @param {string} [property] - An optional property to test against the value argument.
+ * @param {*} [value] - If property is set then Child.property must strictly equal this value to be included in the results.
+ * @param {integer} [startIndex] - The first child index to start the search from.
+ * @param {integer} [endIndex] - The last child index to search up until.
+ *
+ * @return {Array.<*>} All items of the List which match the given criterion, if any.
+ */
+ getAll: function (property, value, startIndex, endIndex)
+ {
+ return ArrayUtils.GetAll(this.list, property, value, startIndex, endIndex);
+ },
+
+ /**
+ * Returns the total number of items in the List which have a property matching the given value.
+ *
+ * @method Phaser.Structs.List#count
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [value]
+ *
+ * @param {string} property - The property to test on each item.
+ * @param {*} value - The value to test the property against.
+ *
+ * @return {integer} The total number of matching elements.
+ */
+ count: function (property, value)
+ {
+ return ArrayUtils.CountAllMatching(this.list, property, value);
+ },
+
+ /**
+ * Swaps the positions of two items in the list.
+ *
+ * @method Phaser.Structs.List#swap
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [child1,child2]
+ *
+ * @param {*} child1 - The first item to swap.
+ * @param {*} child2 - The second item to swap.
+ */
+ swap: function (child1, child2)
+ {
+ ArrayUtils.Swap(this.list, child1, child2);
+ },
+
+ /**
+ * Moves an item in the List to a new position.
+ *
+ * @method Phaser.Structs.List#moveTo
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [child,$return]
+ *
+ * @param {*} child - The item to move.
+ * @param {integer} index - Moves an item in the List to a new position.
+ *
+ * @return {*} The item that was moved.
+ */
+ moveTo: function (child, index)
+ {
+ return ArrayUtils.MoveTo(this.list, child, index);
+ },
+
+ /**
+ * Removes one or many items from the List.
+ *
+ * @method Phaser.Structs.List#remove
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [child,$return]
+ *
+ * @param {*} child - The item, or array of items, to remove.
+ * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback.
+ *
+ * @return {*} The item, or array of items, which were successfully removed from the List.
+ */
+ remove: function (child, skipCallback)
+ {
+ if (skipCallback)
+ {
+ return ArrayUtils.Remove(this.list, child);
+ }
+ else
+ {
+ return ArrayUtils.Remove(this.list, child, this.removeCallback, this);
+ }
+ },
+
+ /**
+ * Removes the item at the given position in the List.
+ *
+ * @method Phaser.Structs.List#removeAt
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [$return]
+ *
+ * @param {integer} index - The position to remove the item from.
+ * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback.
+ *
+ * @return {*} The item that was removed.
+ */
+ removeAt: function (index, skipCallback)
+ {
+ if (skipCallback)
+ {
+ return ArrayUtils.RemoveAt(this.list, index);
+ }
+ else
+ {
+ return ArrayUtils.RemoveAt(this.list, index, this.removeCallback, this);
+ }
+ },
+
+ /**
+ * Removes the items within the given range in the List.
+ *
+ * @method Phaser.Structs.List#removeBetween
+ * @since 3.0.0
+ *
+ * @genericUse {T[]} - [$return]
+ *
+ * @param {integer} [startIndex=0] - The index to start removing from.
+ * @param {integer} [endIndex] - The position to stop removing at. The item at this position won't be removed.
+ * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback.
+ *
+ * @return {Array.<*>} An array of the items which were removed.[description]
+ */
+ removeBetween: function (startIndex, endIndex, skipCallback)
+ {
+ if (skipCallback)
+ {
+ return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex);
+ }
+ else
+ {
+ return ArrayUtils.RemoveBetween(this.list, startIndex, endIndex, this.removeCallback, this);
+ }
+ },
+
+ /**
+ * Removes all the items.
+ *
+ * @method Phaser.Structs.List#removeAll
+ * @since 3.0.0
+ *
+ * @genericUse {Phaser.Structs.List.} - [$return]
+ *
+ * @param {boolean} [skipCallback=false] - Skip calling the List.removeCallback.
+ *
+ * @return {Phaser.Structs.List} This List object.
+ */
+ removeAll: function (skipCallback)
+ {
+ var i = this.list.length;
+
+ while (i--)
+ {
+ this.remove(this.list[i], skipCallback);
+ }
+
+ return this;
+ },
+
+ /**
+ * Brings the given child to the top of this List.
+ *
+ * @method Phaser.Structs.List#bringToTop
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [child,$return]
+ *
+ * @param {*} child - The item to bring to the top of the List.
+ *
+ * @return {*} The item which was moved.
+ */
+ bringToTop: function (child)
+ {
+ return ArrayUtils.BringToTop(this.list, child);
+ },
+
+ /**
+ * Sends the given child to the bottom of this List.
+ *
+ * @method Phaser.Structs.List#sendToBack
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [child,$return]
+ *
+ * @param {*} child - The item to send to the back of the list.
+ *
+ * @return {*} The item which was moved.
+ */
+ sendToBack: function (child)
+ {
+ return ArrayUtils.SendToBack(this.list, child);
+ },
+
+ /**
+ * Moves the given child up one place in this group unless it's already at the top.
+ *
+ * @method Phaser.Structs.List#moveUp
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [child,$return]
+ *
+ * @param {*} child - The item to move up.
+ *
+ * @return {*} The item which was moved.
+ */
+ moveUp: function (child)
+ {
+ ArrayUtils.MoveUp(this.list, child);
+
+ return child;
+ },
+
+ /**
+ * Moves the given child down one place in this group unless it's already at the bottom.
+ *
+ * @method Phaser.Structs.List#moveDown
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [child,$return]
+ *
+ * @param {*} child - The item to move down.
+ *
+ * @return {*} The item which was moved.
+ */
+ moveDown: function (child)
+ {
+ ArrayUtils.MoveDown(this.list, child);
+
+ return child;
+ },
+
+ /**
+ * Reverses the order of all children in this List.
+ *
+ * @method Phaser.Structs.List#reverse
+ * @since 3.0.0
+ *
+ * @genericUse {Phaser.Structs.List.} - [$return]
+ *
+ * @return {Phaser.Structs.List} This List object.
+ */
+ reverse: function ()
+ {
+ this.list.reverse();
+
+ return this;
+ },
+
+ /**
+ * Shuffles the items in the list.
+ *
+ * @method Phaser.Structs.List#shuffle
+ * @since 3.0.0
+ *
+ * @genericUse {Phaser.Structs.List.} - [$return]
+ *
+ * @return {Phaser.Structs.List} This List object.
+ */
+ shuffle: function ()
+ {
+ ArrayUtils.Shuffle(this.list);
+
+ return this;
+ },
+
+ /**
+ * Replaces a child of this List with the given newChild. The newChild cannot be a member of this List.
+ *
+ * @method Phaser.Structs.List#replace
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [oldChild,newChild,$return]
+ *
+ * @param {*} oldChild - The child in this List that will be replaced.
+ * @param {*} newChild - The child to be inserted into this List.
+ *
+ * @return {*} Returns the oldChild that was replaced within this group.
+ */
+ replace: function (oldChild, newChild)
+ {
+ return ArrayUtils.Replace(this.list, oldChild, newChild);
+ },
+
+ /**
+ * Checks if an item exists within the List.
+ *
+ * @method Phaser.Structs.List#exists
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [child]
+ *
+ * @param {*} child - The item to check for the existence of.
+ *
+ * @return {boolean} `true` if the item is found in the list, otherwise `false`.
+ */
+ exists: function (child)
+ {
+ return (this.list.indexOf(child) > -1);
+ },
+
+ /**
+ * Sets the property `key` to the given value on all members of this List.
+ *
+ * @method Phaser.Structs.List#setAll
+ * @since 3.0.0
+ *
+ * @genericUse {T} - [value]
+ *
+ * @param {string} property - The name of the property to set.
+ * @param {*} value - The value to set the property to.
+ * @param {integer} [startIndex] - The first child index to start the search from.
+ * @param {integer} [endIndex] - The last child index to search up until.
+ */
+ setAll: function (property, value, startIndex, endIndex)
+ {
+ ArrayUtils.SetAll(this.list, property, value, startIndex, endIndex);
+
+ return this;
+ },
+
+ /**
+ * Passes all children to the given callback.
+ *
+ * @method Phaser.Structs.List#each
+ * @since 3.0.0
+ *
+ * @genericUse {EachListCallback.} - [callback]
+ *
+ * @param {EachListCallback} callback - The function to call.
+ * @param {*} [context] - Value to use as `this` when executing callback.
+ * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
+ */
+ each: function (callback, context)
+ {
+ var args = [ null ];
+
+ for (var i = 2; i < arguments.length; i++)
+ {
+ args.push(arguments[i]);
+ }
+
+ for (i = 0; i < this.list.length; i++)
+ {
+ args[0] = this.list[i];
+
+ callback.apply(context, args);
+ }
+ },
+
+ /**
+ * Clears the List and recreates its internal array.
+ *
+ * @method Phaser.Structs.List#shutdown
+ * @since 3.0.0
+ */
+ shutdown: function ()
+ {
+ this.removeAll();
+
+ this.list = [];
+ },
+
+ /**
+ * Destroys this List.
+ *
+ * @method Phaser.Structs.List#destroy
+ * @since 3.0.0
+ */
+ destroy: function ()
+ {
+ this.removeAll();
+
+ this.parent = null;
+ this.addCallback = null;
+ this.removeCallback = null;
+ },
+
+ /**
+ * The number of items inside the List.
+ *
+ * @name Phaser.Structs.List#length
+ * @type {integer}
+ * @readonly
+ * @since 3.0.0
+ */
+ length: {
+
+ get: function ()
+ {
+ return this.list.length;
+ }
+
+ },
+
+ /**
+ * The first item in the List or `null` for an empty List.
+ *
+ * @name Phaser.Structs.List#first
+ * @type {integer}
+ * @readonly
+ * @since 3.0.0
+ */
+ first: {
+
+ get: function ()
+ {
+ this.position = 0;
+
+ if (this.list.length > 0)
+ {
+ return this.list[0];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ },
+
+ /**
+ * The last item in the List, or `null` for an empty List.
+ *
+ * @name Phaser.Structs.List#last
+ * @type {integer}
+ * @readonly
+ * @since 3.0.0
+ */
+ last: {
+
+ get: function ()
+ {
+ if (this.list.length > 0)
+ {
+ this.position = this.list.length - 1;
+
+ return this.list[this.position];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ },
+
+ /**
+ * The next item in the List, or `null` if the entire List has been traversed.
+ *
+ * This property can be read successively after reading {@link #first} or manually setting the {@link #position} to iterate the List.
+ *
+ * @name Phaser.Structs.List#next
+ * @type {integer}
+ * @readonly
+ * @since 3.0.0
+ */
+ next: {
+
+ get: function ()
+ {
+ if (this.position < this.list.length)
+ {
+ this.position++;
+
+ return this.list[this.position];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ },
+
+ /**
+ * The previous item in the List, or `null` if the entire List has been traversed.
+ *
+ * This property can be read successively after reading {@link #last} or manually setting the {@link #position} to iterate the List backwards.
+ *
+ * @name Phaser.Structs.List#previous
+ * @type {integer}
+ * @readonly
+ * @since 3.0.0
+ */
+ previous: {
+
+ get: function ()
+ {
+ if (this.position > 0)
+ {
+ this.position--;
+
+ return this.list[this.position];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ }
+
+});
+
+module.exports = List;
+
+
+/***/ }),
+/* 113 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var Clamp = __webpack_require__(23);
+var Extend = __webpack_require__(20);
+
+/**
+ * @classdesc
+ * A Frame is a section of a Texture.
+ *
+ * @class Frame
+ * @memberof Phaser.Textures
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {Phaser.Textures.Texture} texture - The Texture this Frame is a part of.
+ * @param {(integer|string)} name - The name of this Frame. The name is unique within the Texture.
+ * @param {integer} sourceIndex - The index of the TextureSource that this Frame is a part of.
+ * @param {number} x - The x coordinate of the top-left of this Frame.
+ * @param {number} y - The y coordinate of the top-left of this Frame.
+ * @param {number} width - The width of this Frame.
+ * @param {number} height - The height of this Frame.
+ */
+var Frame = new Class({
+
+ initialize:
+
+ function Frame (texture, name, sourceIndex, x, y, width, height)
+ {
+ /**
+ * The Texture this Frame is a part of.
+ *
+ * @name Phaser.Textures.Frame#texture
+ * @type {Phaser.Textures.Texture}
+ * @since 3.0.0
+ */
+ this.texture = texture;
+
+ /**
+ * The name of this Frame.
+ * The name is unique within the Texture.
+ *
+ * @name Phaser.Textures.Frame#name
+ * @type {string}
+ * @since 3.0.0
+ */
+ this.name = name;
+
+ /**
+ * The TextureSource this Frame is part of.
+ *
+ * @name Phaser.Textures.Frame#source
+ * @type {Phaser.Textures.TextureSource}
+ * @since 3.0.0
+ */
+ this.source = texture.source[sourceIndex];
+
+ /**
+ * The index of the TextureSource in the Texture sources array.
+ *
+ * @name Phaser.Textures.Frame#sourceIndex
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.sourceIndex = sourceIndex;
+
+ /**
+ * A reference to the Texture Source WebGL Texture that this Frame is using.
+ *
+ * @name Phaser.Textures.Frame#glTexture
+ * @type {?WebGLTexture}
+ * @default null
+ * @since 3.11.0
+ */
+ this.glTexture = this.source.glTexture;
+
+ /**
+ * X position within the source image to cut from.
+ *
+ * @name Phaser.Textures.Frame#cutX
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.cutX;
+
+ /**
+ * Y position within the source image to cut from.
+ *
+ * @name Phaser.Textures.Frame#cutY
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.cutY;
+
+ /**
+ * The width of the area in the source image to cut.
+ *
+ * @name Phaser.Textures.Frame#cutWidth
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.cutWidth;
+
+ /**
+ * The height of the area in the source image to cut.
+ *
+ * @name Phaser.Textures.Frame#cutHeight
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.cutHeight;
+
+ /**
+ * The X rendering offset of this Frame, taking trim into account.
+ *
+ * @name Phaser.Textures.Frame#x
+ * @type {integer}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.x = 0;
+
+ /**
+ * The Y rendering offset of this Frame, taking trim into account.
+ *
+ * @name Phaser.Textures.Frame#y
+ * @type {integer}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.y = 0;
+
+ /**
+ * The rendering width of this Frame, taking trim into account.
+ *
+ * @name Phaser.Textures.Frame#width
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.width;
+
+ /**
+ * The rendering height of this Frame, taking trim into account.
+ *
+ * @name Phaser.Textures.Frame#height
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.height;
+
+ /**
+ * Half the width, floored.
+ * Precalculated for the renderer.
+ *
+ * @name Phaser.Textures.Frame#halfWidth
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.halfWidth;
+
+ /**
+ * Half the height, floored.
+ * Precalculated for the renderer.
+ *
+ * @name Phaser.Textures.Frame#halfHeight
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.halfHeight;
+
+ /**
+ * The x center of this frame, floored.
+ *
+ * @name Phaser.Textures.Frame#centerX
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.centerX;
+
+ /**
+ * The y center of this frame, floored.
+ *
+ * @name Phaser.Textures.Frame#centerY
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.centerY;
+
+ /**
+ * The horizontal pivot point of this Frame.
+ *
+ * @name Phaser.Textures.Frame#pivotX
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.pivotX = 0;
+
+ /**
+ * The vertical pivot point of this Frame.
+ *
+ * @name Phaser.Textures.Frame#pivotY
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.pivotY = 0;
+
+ /**
+ * Does this Frame have a custom pivot point?
+ *
+ * @name Phaser.Textures.Frame#customPivot
+ * @type {boolean}
+ * @default false
+ * @since 3.0.0
+ */
+ this.customPivot = false;
+
+ /**
+ * **CURRENTLY UNSUPPORTED**
+ *
+ * Is this frame is rotated or not in the Texture?
+ * Rotation allows you to use rotated frames in texture atlas packing.
+ * It has nothing to do with Sprite rotation.
+ *
+ * @name Phaser.Textures.Frame#rotated
+ * @type {boolean}
+ * @default false
+ * @since 3.0.0
+ */
+ this.rotated = false;
+
+ /**
+ * Over-rides the Renderer setting.
+ * -1 = use Renderer Setting
+ * 0 = No rounding
+ * 1 = Round
+ *
+ * @name Phaser.Textures.Frame#autoRound
+ * @type {integer}
+ * @default -1
+ * @since 3.0.0
+ */
+ this.autoRound = -1;
+
+ /**
+ * Any Frame specific custom data can be stored here.
+ *
+ * @name Phaser.Textures.Frame#customData
+ * @type {object}
+ * @since 3.0.0
+ */
+ this.customData = {};
+
+ /**
+ * WebGL UV u0 value.
+ *
+ * @name Phaser.Textures.Frame#u0
+ * @type {number}
+ * @default 0
+ * @since 3.11.0
+ */
+ this.u0 = 0;
+
+ /**
+ * WebGL UV v0 value.
+ *
+ * @name Phaser.Textures.Frame#v0
+ * @type {number}
+ * @default 0
+ * @since 3.11.0
+ */
+ this.v0 = 0;
+
+ /**
+ * WebGL UV u1 value.
+ *
+ * @name Phaser.Textures.Frame#u1
+ * @type {number}
+ * @default 0
+ * @since 3.11.0
+ */
+ this.u1 = 0;
+
+ /**
+ * WebGL UV v1 value.
+ *
+ * @name Phaser.Textures.Frame#v1
+ * @type {number}
+ * @default 0
+ * @since 3.11.0
+ */
+ this.v1 = 0;
+
+ /**
+ * The un-modified source frame, trim and UV data.
+ *
+ * @name Phaser.Textures.Frame#data
+ * @type {object}
+ * @private
+ * @since 3.0.0
+ */
+ this.data = {
+ cut: {
+ x: 0,
+ y: 0,
+ w: 0,
+ h: 0,
+ r: 0,
+ b: 0
+ },
+ trim: false,
+ sourceSize: {
+ w: 0,
+ h: 0
+ },
+ spriteSourceSize: {
+ x: 0,
+ y: 0,
+ w: 0,
+ h: 0,
+ r: 0,
+ b: 0
+ },
+ radius: 0,
+ drawImage: {
+ x: 0,
+ y: 0,
+ width: 0,
+ height: 0
+ }
+ };
+
+ this.setSize(width, height, x, y);
+ },
+
+ /**
+ * Sets the width, height, x and y of this Frame.
+ *
+ * This is called automatically by the constructor
+ * and should rarely be changed on-the-fly.
+ *
+ * @method Phaser.Textures.Frame#setSize
+ * @since 3.7.0
+ *
+ * @param {integer} width - The width of the frame before being trimmed.
+ * @param {integer} height - The height of the frame before being trimmed.
+ * @param {integer} [x=0] - The x coordinate of the top-left of this Frame.
+ * @param {integer} [y=0] - The y coordinate of the top-left of this Frame.
+ *
+ * @return {Phaser.Textures.Frame} This Frame object.
+ */
+ setSize: function (width, height, x, y)
+ {
+ if (x === undefined) { x = 0; }
+ if (y === undefined) { y = 0; }
+
+ this.cutX = x;
+ this.cutY = y;
+ this.cutWidth = width;
+ this.cutHeight = height;
+
+ this.width = width;
+ this.height = height;
+
+ this.halfWidth = Math.floor(width * 0.5);
+ this.halfHeight = Math.floor(height * 0.5);
+
+ this.centerX = Math.floor(width / 2);
+ this.centerY = Math.floor(height / 2);
+
+ var data = this.data;
+ var cut = data.cut;
+
+ cut.x = x;
+ cut.y = y;
+ cut.w = width;
+ cut.h = height;
+ cut.r = x + width;
+ cut.b = y + height;
+
+ data.sourceSize.w = width;
+ data.sourceSize.h = height;
+
+ data.spriteSourceSize.w = width;
+ data.spriteSourceSize.h = height;
+
+ data.radius = 0.5 * Math.sqrt(width * width + height * height);
+
+ var drawImage = data.drawImage;
+
+ drawImage.x = x;
+ drawImage.y = y;
+ drawImage.width = width;
+ drawImage.height = height;
+
+ return this.updateUVs();
+ },
+
+ /**
+ * If the frame was trimmed when added to the Texture Atlas, this records the trim and source data.
+ *
+ * @method Phaser.Textures.Frame#setTrim
+ * @since 3.0.0
+ *
+ * @param {number} actualWidth - The width of the frame before being trimmed.
+ * @param {number} actualHeight - The height of the frame before being trimmed.
+ * @param {number} destX - The destination X position of the trimmed frame for display.
+ * @param {number} destY - The destination Y position of the trimmed frame for display.
+ * @param {number} destWidth - The destination width of the trimmed frame for display.
+ * @param {number} destHeight - The destination height of the trimmed frame for display.
+ *
+ * @return {Phaser.Textures.Frame} This Frame object.
+ */
+ setTrim: function (actualWidth, actualHeight, destX, destY, destWidth, destHeight)
+ {
+ var data = this.data;
+ var ss = data.spriteSourceSize;
+
+ // Store actual values
+
+ data.trim = true;
+
+ data.sourceSize.w = actualWidth;
+ data.sourceSize.h = actualHeight;
+
+ ss.x = destX;
+ ss.y = destY;
+ ss.w = destWidth;
+ ss.h = destHeight;
+ ss.r = destX + destWidth;
+ ss.b = destY + destHeight;
+
+ // Adjust properties
+ this.x = destX;
+ this.y = destY;
+
+ this.width = destWidth;
+ this.height = destHeight;
+
+ this.halfWidth = destWidth * 0.5;
+ this.halfHeight = destHeight * 0.5;
+
+ this.centerX = Math.floor(destWidth / 2);
+ this.centerY = Math.floor(destHeight / 2);
+
+ return this.updateUVs();
+ },
+
+ /**
+ * Takes a crop data object and, based on the rectangular region given, calculates the
+ * required UV coordinates in order to crop this Frame for WebGL and Canvas rendering.
+ *
+ * This is called directly by the Game Object Texture Components `setCrop` method.
+ * Please use that method to crop a Game Object.
+ *
+ * @method Phaser.Textures.Frame#setCropUVs
+ * @since 3.11.0
+ *
+ * @param {object} crop - The crop data object. This is the `GameObject._crop` property.
+ * @param {number} x - The x coordinate to start the crop from. Cannot be negative or exceed the Frame width.
+ * @param {number} y - The y coordinate to start the crop from. Cannot be negative or exceed the Frame height.
+ * @param {number} width - The width of the crop rectangle. Cannot exceed the Frame width.
+ * @param {number} height - The height of the crop rectangle. Cannot exceed the Frame height.
+ * @param {boolean} flipX - Does the parent Game Object have flipX set?
+ * @param {boolean} flipY - Does the parent Game Object have flipY set?
+ *
+ * @return {object} The updated crop data object.
+ */
+ setCropUVs: function (crop, x, y, width, height, flipX, flipY)
+ {
+ // Clamp the input values
+
+ var cx = this.cutX;
+ var cy = this.cutY;
+ var cw = this.cutWidth;
+ var ch = this.cutHeight;
+ var rw = this.realWidth;
+ var rh = this.realHeight;
+
+ x = Clamp(x, 0, rw);
+ y = Clamp(y, 0, rh);
+
+ width = Clamp(width, 0, rw - x);
+ height = Clamp(height, 0, rh - y);
+
+ var ox = cx + x;
+ var oy = cy + y;
+ var ow = width;
+ var oh = height;
+
+ var data = this.data;
+
+ if (data.trim)
+ {
+ var ss = data.spriteSourceSize;
+
+ // Need to check for intersection between the cut area and the crop area
+ // If there is none, we set UV to be empty, otherwise set it to be the intersection area
+
+ width = Clamp(width, 0, cw - x);
+ height = Clamp(height, 0, ch - y);
+
+ var cropRight = x + width;
+ var cropBottom = y + height;
+
+ var intersects = !(ss.r < x || ss.b < y || ss.x > cropRight || ss.y > cropBottom);
+
+ if (intersects)
+ {
+ var ix = Math.max(ss.x, x);
+ var iy = Math.max(ss.y, y);
+ var iw = Math.min(ss.r, cropRight) - ix;
+ var ih = Math.min(ss.b, cropBottom) - iy;
+
+ ow = iw;
+ oh = ih;
+
+ if (flipX)
+ {
+ ox = cx + (cw - (ix - ss.x) - iw);
+ }
+ else
+ {
+ ox = cx + (ix - ss.x);
+ }
+
+ if (flipY)
+ {
+ oy = cy + (ch - (iy - ss.y) - ih);
+ }
+ else
+ {
+ oy = cy + (iy - ss.y);
+ }
+
+ x = ix;
+ y = iy;
+
+ width = iw;
+ height = ih;
+ }
+ else
+ {
+ ox = 0;
+ oy = 0;
+ ow = 0;
+ oh = 0;
+ }
+ }
+ else
+ {
+ if (flipX)
+ {
+ ox = cx + (cw - x - width);
+ }
+
+ if (flipY)
+ {
+ oy = cy + (ch - y - height);
+ }
+ }
+
+ var tw = this.source.width;
+ var th = this.source.height;
+
+ // Map the given coordinates into UV space, clamping to the 0-1 range.
+
+ crop.u0 = Math.max(0, ox / tw);
+ crop.v0 = Math.max(0, oy / th);
+ crop.u1 = Math.min(1, (ox + ow) / tw);
+ crop.v1 = Math.min(1, (oy + oh) / th);
+
+ crop.x = x;
+ crop.y = y;
+
+ crop.cx = ox;
+ crop.cy = oy;
+ crop.cw = ow;
+ crop.ch = oh;
+
+ crop.width = width;
+ crop.height = height;
+
+ crop.flipX = flipX;
+ crop.flipY = flipY;
+
+ return crop;
+ },
+
+ /**
+ * Takes a crop data object and recalculates the UVs based on the dimensions inside the crop object.
+ * Called automatically by `setFrame`.
+ *
+ * @method Phaser.Textures.Frame#updateCropUVs
+ * @since 3.11.0
+ *
+ * @param {object} crop - The crop data object. This is the `GameObject._crop` property.
+ * @param {boolean} flipX - Does the parent Game Object have flipX set?
+ * @param {boolean} flipY - Does the parent Game Object have flipY set?
+ *
+ * @return {object} The updated crop data object.
+ */
+ updateCropUVs: function (crop, flipX, flipY)
+ {
+ return this.setCropUVs(crop, crop.x, crop.y, crop.width, crop.height, flipX, flipY);
+ },
+
+ /**
+ * Updates the internal WebGL UV cache and the drawImage cache.
+ *
+ * @method Phaser.Textures.Frame#updateUVs
+ * @since 3.0.0
+ *
+ * @return {Phaser.Textures.Frame} This Frame object.
+ */
+ updateUVs: function ()
+ {
+ var cx = this.cutX;
+ var cy = this.cutY;
+ var cw = this.cutWidth;
+ var ch = this.cutHeight;
+
+ // Canvas data
+
+ var cd = this.data.drawImage;
+
+ cd.width = cw;
+ cd.height = ch;
+
+ // WebGL data
+
+ var tw = this.source.width;
+ var th = this.source.height;
+
+ this.u0 = cx / tw;
+ this.v0 = cy / th;
+
+ this.u1 = (cx + cw) / tw;
+ this.v1 = (cy + ch) / th;
+
+ return this;
+ },
+
+ /**
+ * Updates the internal WebGL UV cache.
+ *
+ * @method Phaser.Textures.Frame#updateUVsInverted
+ * @since 3.0.0
+ *
+ * @return {Phaser.Textures.Frame} This Frame object.
+ */
+ updateUVsInverted: function ()
+ {
+ var tw = this.source.width;
+ var th = this.source.height;
+
+ this.u0 = (this.cutX + this.cutHeight) / tw;
+ this.v0 = this.cutY / th;
+
+ this.u1 = this.cutX / tw;
+ this.v1 = (this.cutY + this.cutWidth) / th;
+
+ return this;
+ },
+
+ /**
+ * Clones this Frame into a new Frame object.
+ *
+ * @method Phaser.Textures.Frame#clone
+ * @since 3.0.0
+ *
+ * @return {Phaser.Textures.Frame} A clone of this Frame.
+ */
+ clone: function ()
+ {
+ var clone = new Frame(this.texture, this.name, this.sourceIndex);
+
+ clone.cutX = this.cutX;
+ clone.cutY = this.cutY;
+ clone.cutWidth = this.cutWidth;
+ clone.cutHeight = this.cutHeight;
+
+ clone.x = this.x;
+ clone.y = this.y;
+
+ clone.width = this.width;
+ clone.height = this.height;
+
+ clone.halfWidth = this.halfWidth;
+ clone.halfHeight = this.halfHeight;
+
+ clone.centerX = this.centerX;
+ clone.centerY = this.centerY;
+
+ clone.rotated = this.rotated;
+
+ clone.data = Extend(true, clone.data, this.data);
+
+ clone.updateUVs();
+
+ return clone;
+ },
+
+ /**
+ * Destroys this Frames references.
+ *
+ * @method Phaser.Textures.Frame#destroy
+ * @since 3.0.0
+ */
+ destroy: function ()
+ {
+ this.texture = null;
+
+ this.source = null;
+ },
+
+ /**
+ * The width of the Frame in its un-trimmed, un-padded state, as prepared in the art package,
+ * before being packed.
+ *
+ * @name Phaser.Textures.Frame#realWidth
+ * @type {number}
+ * @readonly
+ * @since 3.0.0
+ */
+ realWidth: {
+
+ get: function ()
+ {
+ return this.data.sourceSize.w;
+ }
+
+ },
+
+ /**
+ * The height of the Frame in its un-trimmed, un-padded state, as prepared in the art package,
+ * before being packed.
+ *
+ * @name Phaser.Textures.Frame#realHeight
+ * @type {number}
+ * @readonly
+ * @since 3.0.0
+ */
+ realHeight: {
+
+ get: function ()
+ {
+ return this.data.sourceSize.h;
+ }
+
+ },
+
+ /**
+ * The radius of the Frame (derived from sqrt(w * w + h * h) / 2)
+ *
+ * @name Phaser.Textures.Frame#radius
+ * @type {number}
+ * @readonly
+ * @since 3.0.0
+ */
+ radius: {
+
+ get: function ()
+ {
+ return this.data.radius;
+ }
+
+ },
+
+ /**
+ * Is the Frame trimmed or not?
+ *
+ * @name Phaser.Textures.Frame#trimmed
+ * @type {boolean}
+ * @readonly
+ * @since 3.0.0
+ */
+ trimmed: {
+
+ get: function ()
+ {
+ return this.data.trim;
+ }
+
+ },
+
+ /**
+ * The Canvas drawImage data object.
+ *
+ * @name Phaser.Textures.Frame#canvasData
+ * @type {object}
+ * @readonly
+ * @since 3.0.0
+ */
+ canvasData: {
+
+ get: function ()
+ {
+ return this.data.drawImage;
+ }
+
+ }
+
+});
+
+module.exports = Frame;
+
+
+/***/ }),
+/* 114 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @author Pavle Goloskokovic (http://prunegames.com)
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var EventEmitter = __webpack_require__(11);
+var Extend = __webpack_require__(20);
+var NOOP = __webpack_require__(1);
+
+/**
+ * @classdesc
+ * Class containing all the shared state and behavior of a sound object, independent of the implementation.
+ *
+ * @class BaseSound
+ * @extends Phaser.Events.EventEmitter
+ * @memberof Phaser.Sound
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {Phaser.Sound.BaseSoundManager} manager - Reference to the current sound manager instance.
+ * @param {string} key - Asset key for the sound.
+ * @param {SoundConfig} [config] - An optional config object containing default sound settings.
+ */
+var BaseSound = new Class({
+
+ Extends: EventEmitter,
+
+ initialize:
+
+ function BaseSound (manager, key, config)
+ {
+ EventEmitter.call(this);
+
+ /**
+ * Local reference to the sound manager.
+ *
+ * @name Phaser.Sound.BaseSound#manager
+ * @type {Phaser.Sound.BaseSoundManager}
+ * @private
+ * @since 3.0.0
+ */
+ this.manager = manager;
+
+ /**
+ * Asset key for the sound.
+ *
+ * @name Phaser.Sound.BaseSound#key
+ * @type {string}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.key = key;
+
+ /**
+ * Flag indicating if sound is currently playing.
+ *
+ * @name Phaser.Sound.BaseSound#isPlaying
+ * @type {boolean}
+ * @default false
+ * @readonly
+ * @since 3.0.0
+ */
+ this.isPlaying = false;
+
+ /**
+ * Flag indicating if sound is currently paused.
+ *
+ * @name Phaser.Sound.BaseSound#isPaused
+ * @type {boolean}
+ * @default false
+ * @readonly
+ * @since 3.0.0
+ */
+ this.isPaused = false;
+
+ /**
+ * A property that holds the value of sound's actual playback rate,
+ * after its rate and detune values has been combined with global
+ * rate and detune values.
+ *
+ * @name Phaser.Sound.BaseSound#totalRate
+ * @type {number}
+ * @default 1
+ * @readonly
+ * @since 3.0.0
+ */
+ this.totalRate = 1;
+
+ /**
+ * A value representing the duration, in seconds.
+ * It could be total sound duration or a marker duration.
+ *
+ * @name Phaser.Sound.BaseSound#duration
+ * @type {number}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.duration = this.duration || 0;
+
+ /**
+ * The total duration of the sound in seconds.
+ *
+ * @name Phaser.Sound.BaseSound#totalDuration
+ * @type {number}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.totalDuration = this.totalDuration || 0;
+
+ /**
+ * A config object used to store default sound settings' values.
+ * Default values will be set by properties' setters.
+ *
+ * @name Phaser.Sound.BaseSound#config
+ * @type {SoundConfig}
+ * @private
+ * @since 3.0.0
+ */
+ this.config = {
+
+ mute: false,
+ volume: 1,
+ rate: 1,
+ detune: 0,
+ seek: 0,
+ loop: false,
+ delay: 0
+
+ };
+
+ /**
+ * Reference to the currently used config.
+ * It could be default config or marker config.
+ *
+ * @name Phaser.Sound.BaseSound#currentConfig
+ * @type {SoundConfig}
+ * @private
+ * @since 3.0.0
+ */
+ this.currentConfig = this.config;
+
+ this.config = Extend(this.config, config);
+
+ /**
+ * Object containing markers definitions.
+ *
+ * @name Phaser.Sound.BaseSound#markers
+ * @type {Object.}
+ * @default {}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.markers = {};
+
+ /**
+ * Currently playing marker.
+ * 'null' if whole sound is playing.
+ *
+ * @name Phaser.Sound.BaseSound#currentMarker
+ * @type {SoundMarker}
+ * @default null
+ * @readonly
+ * @since 3.0.0
+ */
+ this.currentMarker = null;
+
+ /**
+ * Flag indicating if destroy method was called on this sound.
+ *
+ * @name Phaser.Sound.BaseSound#pendingRemove
+ * @type {boolean}
+ * @private
+ * @default false
+ * @since 3.0.0
+ */
+ this.pendingRemove = false;
+ },
+
+ /**
+ * Adds a marker into the current sound. A marker is represented by name, start time, duration, and optionally config object.
+ * This allows you to bundle multiple sounds together into a single audio file and use markers to jump between them for playback.
+ *
+ * @method Phaser.Sound.BaseSound#addMarker
+ * @since 3.0.0
+ *
+ * @param {SoundMarker} marker - Marker object.
+ *
+ * @return {boolean} Whether the marker was added successfully.
+ */
+ addMarker: function (marker)
+ {
+ if (!marker || !marker.name || typeof marker.name !== 'string')
+ {
+ return false;
+ }
+
+ if (this.markers[marker.name])
+ {
+ // eslint-disable-next-line no-console
+ console.error('addMarker ' + marker.name + ' already exists in Sound');
+
+ return false;
+ }
+
+ marker = Extend(true, {
+ name: '',
+ start: 0,
+ duration: this.totalDuration - (marker.start || 0),
+ config: {
+ mute: false,
+ volume: 1,
+ rate: 1,
+ detune: 0,
+ seek: 0,
+ loop: false,
+ delay: 0
+ }
+ }, marker);
+
+ this.markers[marker.name] = marker;
+
+ return true;
+ },
+
+ /**
+ * Updates previously added marker.
+ *
+ * @method Phaser.Sound.BaseSound#updateMarker
+ * @since 3.0.0
+ *
+ * @param {SoundMarker} marker - Marker object with updated values.
+ *
+ * @return {boolean} Whether the marker was updated successfully.
+ */
+ updateMarker: function (marker)
+ {
+ if (!marker || !marker.name || typeof marker.name !== 'string')
+ {
+ return false;
+ }
+
+ if (!this.markers[marker.name])
+ {
+ // eslint-disable-next-line no-console
+ console.warn('Audio Marker: ' + marker.name + ' missing in Sound: ' + this.key);
+
+ return false;
+ }
+
+ this.markers[marker.name] = Extend(true, this.markers[marker.name], marker);
+
+ return true;
+ },
+
+ /**
+ * Removes a marker from the sound.
+ *
+ * @method Phaser.Sound.BaseSound#removeMarker
+ * @since 3.0.0
+ *
+ * @param {string} markerName - The name of the marker to remove.
+ *
+ * @return {?SoundMarker} Removed marker object or 'null' if there was no marker with provided name.
+ */
+ removeMarker: function (markerName)
+ {
+ var marker = this.markers[markerName];
+
+ if (!marker)
+ {
+ return null;
+ }
+
+ this.markers[markerName] = null;
+
+ return marker;
+ },
+
+ /**
+ * Play this sound, or a marked section of it.
+ * It always plays the sound from the start. If you want to start playback from a specific time
+ * you can set 'seek' setting of the config object, provided to this call, to that value.
+ *
+ * @method Phaser.Sound.BaseSound#play
+ * @since 3.0.0
+ *
+ * @param {string} [markerName=''] - If you want to play a marker then provide the marker name here, otherwise omit it to play the full sound.
+ * @param {SoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound.
+ *
+ * @return {boolean} Whether the sound started playing successfully.
+ */
+ play: function (markerName, config)
+ {
+ if (markerName === undefined) { markerName = ''; }
+
+ if (typeof markerName === 'object')
+ {
+ config = markerName;
+ markerName = '';
+ }
+
+ if (typeof markerName !== 'string')
+ {
+ return false;
+ }
+
+ if (!markerName)
+ {
+ this.currentMarker = null;
+ this.currentConfig = this.config;
+ this.duration = this.totalDuration;
+ }
+ else
+ {
+ if (!this.markers[markerName])
+ {
+ // eslint-disable-next-line no-console
+ console.warn('Marker: ' + markerName + ' missing in Sound: ' + this.key);
+
+ return false;
+ }
+
+ this.currentMarker = this.markers[markerName];
+ this.currentConfig = this.currentMarker.config;
+ this.duration = this.currentMarker.duration;
+ }
+
+ this.resetConfig();
+
+ this.currentConfig = Extend(this.currentConfig, config);
+
+ this.isPlaying = true;
+ this.isPaused = false;
+
+ return true;
+ },
+
+ /**
+ * Pauses the sound.
+ *
+ * @method Phaser.Sound.BaseSound#pause
+ * @since 3.0.0
+ *
+ * @return {boolean} Whether the sound was paused successfully.
+ */
+ pause: function ()
+ {
+ if (this.isPaused || !this.isPlaying)
+ {
+ return false;
+ }
+
+ this.isPlaying = false;
+ this.isPaused = true;
+
+ return true;
+ },
+
+ /**
+ * Resumes the sound.
+ *
+ * @method Phaser.Sound.BaseSound#resume
+ * @since 3.0.0
+ *
+ * @return {boolean} Whether the sound was resumed successfully.
+ */
+ resume: function ()
+ {
+ if (!this.isPaused || this.isPlaying)
+ {
+ return false;
+ }
+
+ this.isPlaying = true;
+ this.isPaused = false;
+
+ return true;
+ },
+
+ /**
+ * Stop playing this sound.
+ *
+ * @method Phaser.Sound.BaseSound#stop
+ * @since 3.0.0
+ *
+ * @return {boolean} Whether the sound was stopped successfully.
+ */
+ stop: function ()
+ {
+ if (!this.isPaused && !this.isPlaying)
+ {
+ return false;
+ }
+
+ this.isPlaying = false;
+ this.isPaused = false;
+
+ this.resetConfig();
+
+ return true;
+ },
+
+ /**
+ * Method used internally for applying config values to some of the sound properties.
+ *
+ * @method Phaser.Sound.BaseSound#applyConfig
+ * @protected
+ * @since 3.0.0
+ */
+ applyConfig: function ()
+ {
+ this.mute = this.currentConfig.mute;
+ this.volume = this.currentConfig.volume;
+ this.rate = this.currentConfig.rate;
+ this.detune = this.currentConfig.detune;
+ this.loop = this.currentConfig.loop;
+ },
+
+ /**
+ * Method used internally for resetting values of some of the config properties.
+ *
+ * @method Phaser.Sound.BaseSound#resetConfig
+ * @protected
+ * @since 3.0.0
+ */
+ resetConfig: function ()
+ {
+ this.currentConfig.seek = 0;
+ this.currentConfig.delay = 0;
+ },
+
+ /**
+ * Update method called automatically by sound manager on every game step.
+ *
+ * @method Phaser.Sound.BaseSound#update
+ * @override
+ * @protected
+ * @since 3.0.0
+ *
+ * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout.
+ * @param {number} delta - The delta time elapsed since the last frame.
+ */
+ update: NOOP,
+
+ /**
+ * Method used internally to calculate total playback rate of the sound.
+ *
+ * @method Phaser.Sound.BaseSound#calculateRate
+ * @protected
+ * @since 3.0.0
+ */
+ calculateRate: function ()
+ {
+ var cent = 1.0005777895065548; // Math.pow(2, 1/1200);
+ var totalDetune = this.currentConfig.detune + this.manager.detune;
+ var detuneRate = Math.pow(cent, totalDetune);
+
+ this.totalRate = this.currentConfig.rate * this.manager.rate * detuneRate;
+ },
+
+ /**
+ * Destroys this sound and all associated events and marks it for removal from the sound manager.
+ *
+ * @method Phaser.Sound.BaseSound#destroy
+ * @since 3.0.0
+ */
+ destroy: function ()
+ {
+ if (this.pendingRemove)
+ {
+ return;
+ }
+
+ this.emit('destroy', this);
+ this.pendingRemove = true;
+ this.manager = null;
+ this.key = '';
+ this.removeAllListeners();
+ this.isPlaying = false;
+ this.isPaused = false;
+ this.config = null;
+ this.currentConfig = null;
+ this.markers = null;
+ this.currentMarker = null;
+ }
+
+});
+
+module.exports = BaseSound;
+
+
+/***/ }),
+/* 115 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @author Pavle Goloskokovic (http://prunegames.com)
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var Clone = __webpack_require__(63);
+var EventEmitter = __webpack_require__(11);
+var NOOP = __webpack_require__(1);
+
+/**
+ * @callback EachActiveSoundCallback
+ *
+ * @param {Phaser.Sound.BaseSoundManager} manager - The SoundManager
+ * @param {Phaser.Sound.BaseSound} sound - The current active Sound
+ * @param {number} index - The index of the current active Sound
+ * @param {Phaser.Sound.BaseSound[]} sounds - All sounds
+ */
+
+/**
+ * Audio sprite sound type.
+ *
+ * @typedef {Phaser.Sound.BaseSound} Phaser.Sound.BaseSound.AudioSpriteSound
+ *
+ * @property {object} spritemap - Local reference to 'spritemap' object form json file generated by audiosprite tool.
+ */
+
+/**
+ * @classdesc
+ * The sound manager is responsible for playing back audio via Web Audio API or HTML Audio tag as fallback.
+ * The audio file type and the encoding of those files are extremely important.
+ *
+ * Not all browsers can play all audio formats.
+ *
+ * There is a good guide to what's supported [here](https://developer.mozilla.org/en-US/Apps/Fundamentals/Audio_and_video_delivery/Cross-browser_audio_basics#Audio_Codec_Support).
+ *
+ * @class BaseSoundManager
+ * @extends Phaser.Events.EventEmitter
+ * @memberof Phaser.Sound
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {Phaser.Game} game - Reference to the current game instance.
+ */
+var BaseSoundManager = new Class({
+
+ Extends: EventEmitter,
+
+ initialize:
+
+ function BaseSoundManager (game)
+ {
+ EventEmitter.call(this);
+
+ /**
+ * Local reference to game.
+ *
+ * @name Phaser.Sound.BaseSoundManager#game
+ * @type {Phaser.Game}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.game = game;
+
+ /**
+ * Local reference to the JSON Cache, as used by Audio Sprites.
+ *
+ * @name Phaser.Sound.BaseSoundManager#jsonCache
+ * @type {Phaser.Cache.BaseCache}
+ * @readonly
+ * @since 3.7.0
+ */
+ this.jsonCache = game.cache.json;
+
+ /**
+ * An array containing all added sounds.
+ *
+ * @name Phaser.Sound.BaseSoundManager#sounds
+ * @type {Phaser.Sound.BaseSound[]}
+ * @default []
+ * @private
+ * @since 3.0.0
+ */
+ this.sounds = [];
+
+ /**
+ * Global mute setting.
+ *
+ * @name Phaser.Sound.BaseSoundManager#mute
+ * @type {boolean}
+ * @default false
+ * @since 3.0.0
+ */
+ this.mute = false;
+
+ /**
+ * Global volume setting.
+ *
+ * @name Phaser.Sound.BaseSoundManager#volume
+ * @type {number}
+ * @default 1
+ * @since 3.0.0
+ */
+ this.volume = 1;
+
+ /**
+ * Flag indicating if sounds should be paused when game looses focus,
+ * for instance when user switches to another tab/program/app.
+ *
+ * @name Phaser.Sound.BaseSoundManager#pauseOnBlur
+ * @type {boolean}
+ * @default true
+ * @since 3.0.0
+ */
+ this.pauseOnBlur = true;
+
+ /**
+ * Property that actually holds the value of global playback rate.
+ *
+ * @name Phaser.Sound.BaseSoundManager#_rate
+ * @type {number}
+ * @private
+ * @default 1
+ * @since 3.0.0
+ */
+ this._rate = 1;
+
+ /**
+ * Property that actually holds the value of global detune.
+ *
+ * @name Phaser.Sound.BaseSoundManager#_detune
+ * @type {number}
+ * @private
+ * @default 0
+ * @since 3.0.0
+ */
+ this._detune = 0;
+
+ /**
+ * Mobile devices require sounds to be triggered from an explicit user action,
+ * such as a tap, before any sound can be loaded/played on a web page.
+ * Set to true if the audio system is currently locked awaiting user interaction.
+ *
+ * @name Phaser.Sound.BaseSoundManager#locked
+ * @type {boolean}
+ * @readonly
+ * @since 3.0.0
+ */
+ this.locked = this.locked || false;
+
+ /**
+ * Flag used internally for handling when the audio system
+ * has been unlocked, if there ever was a need for it.
+ *
+ * @name Phaser.Sound.BaseSoundManager#unlocked
+ * @type {boolean}
+ * @default false
+ * @private
+ * @since 3.0.0
+ */
+ this.unlocked = false;
+
+ game.events.on('blur', function ()
+ {
+ if (this.pauseOnBlur)
+ {
+ this.onBlur();
+ }
+ }, this);
+
+ game.events.on('focus', function ()
+ {
+ if (this.pauseOnBlur)
+ {
+ this.onFocus();
+ }
+ }, this);
+
+ game.events.on('prestep', this.update, this);
+ game.events.once('destroy', this.destroy, this);
+ },
+
+ /**
+ * Adds a new sound into the sound manager.
+ *
+ * @method Phaser.Sound.BaseSoundManager#add
+ * @override
+ * @since 3.0.0
+ *
+ * @param {string} key - Asset key for the sound.
+ * @param {SoundConfig} [config] - An optional config object containing default sound settings.
+ *
+ * @return {Phaser.Sound.BaseSound} The new sound instance.
+ */
+ add: NOOP,
+
+ /**
+ * Adds a new audio sprite sound into the sound manager.
+ * Audio Sprites are a combination of audio files and a JSON configuration.
+ * The JSON follows the format of that created by https://github.com/tonistiigi/audiosprite
+ *
+ * @method Phaser.Sound.BaseSoundManager#addAudioSprite
+ * @since 3.0.0
+ *
+ * @param {string} key - Asset key for the sound.
+ * @param {SoundConfig} [config] - An optional config object containing default sound settings.
+ *
+ * @return {Phaser.Sound.BaseSound.AudioSpriteSound} The new audio sprite sound instance.
+ */
+ addAudioSprite: function (key, config)
+ {
+ if (config === undefined) { config = {}; }
+
+ var sound = this.add(key, config);
+
+ sound.spritemap = this.jsonCache.get(key).spritemap;
+
+ for (var markerName in sound.spritemap)
+ {
+ if (!sound.spritemap.hasOwnProperty(markerName))
+ {
+ continue;
+ }
+
+ var markerConfig = Clone(config);
+
+ var marker = sound.spritemap[markerName];
+
+ markerConfig.loop = (marker.hasOwnProperty('loop')) ? marker.loop : false;
+
+ sound.addMarker({
+ name: markerName,
+ start: marker.start,
+ duration: marker.end - marker.start,
+ config: markerConfig
+ });
+ }
+
+ return sound;
+ },
+
+ /**
+ * Enables playing sound on the fly without the need to keep a reference to it.
+ * Sound will auto destroy once its playback ends.
+ *
+ * @method Phaser.Sound.BaseSoundManager#play
+ * @since 3.0.0
+ *
+ * @param {string} key - Asset key for the sound.
+ * @param {(SoundConfig|SoundMarker)} [extra] - An optional additional object containing settings to be applied to the sound. It could be either config or marker object.
+ *
+ * @return {boolean} Whether the sound started playing successfully.
+ */
+ play: function (key, extra)
+ {
+ var sound = this.add(key);
+
+ sound.once('ended', sound.destroy, sound);
+
+ if (extra)
+ {
+ if (extra.name)
+ {
+ sound.addMarker(extra);
+
+ return sound.play(extra.name);
+ }
+ else
+ {
+ return sound.play(extra);
+ }
+ }
+ else
+ {
+ return sound.play();
+ }
+ },
+
+ /**
+ * Enables playing audio sprite sound on the fly without the need to keep a reference to it.
+ * Sound will auto destroy once its playback ends.
+ *
+ * @method Phaser.Sound.BaseSoundManager#playAudioSprite
+ * @since 3.0.0
+ *
+ * @param {string} key - Asset key for the sound.
+ * @param {string} spriteName - The name of the sound sprite to play.
+ * @param {SoundConfig} [config] - An optional config object containing default sound settings.
+ *
+ * @return {boolean} Whether the audio sprite sound started playing successfully.
+ */
+ playAudioSprite: function (key, spriteName, config)
+ {
+ var sound = this.addAudioSprite(key);
+
+ sound.once('ended', sound.destroy, sound);
+
+ return sound.play(spriteName, config);
+ },
+
+ /**
+ * Removes a sound from the sound manager.
+ * The removed sound is destroyed before removal.
+ *
+ * @method Phaser.Sound.BaseSoundManager#remove
+ * @since 3.0.0
+ *
+ * @param {Phaser.Sound.BaseSound} sound - The sound object to remove.
+ *
+ * @return {boolean} True if the sound was removed successfully, otherwise false.
+ */
+ remove: function (sound)
+ {
+ var index = this.sounds.indexOf(sound);
+
+ if (index !== -1)
+ {
+ sound.destroy();
+
+ this.sounds.splice(index, 1);
+
+ return true;
+ }
+
+ return false;
+ },
+
+ /**
+ * Removes all sounds from the sound manager that have an asset key matching the given value.
+ * The removed sounds are destroyed before removal.
+ *
+ * @method Phaser.Sound.BaseSoundManager#removeByKey
+ * @since 3.0.0
+ *
+ * @param {string} key - The key to match when removing sound objects.
+ *
+ * @return {number} The number of matching sound objects that were removed.
+ */
+ removeByKey: function (key)
+ {
+ var removed = 0;
+
+ for (var i = this.sounds.length - 1; i >= 0; i--)
+ {
+ var sound = this.sounds[i];
+
+ if (sound.key === key)
+ {
+ sound.destroy();
+
+ this.sounds.splice(i, 1);
+
+ removed++;
+ }
+ }
+
+ return removed;
+ },
+
+ /**
+ * @event Phaser.Sound.BaseSoundManager#pauseall
+ * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event.
+ */
+
+ /**
+ * Pauses all the sounds in the game.
+ *
+ * @method Phaser.Sound.BaseSoundManager#pauseAll
+ * @fires Phaser.Sound.BaseSoundManager#pauseall
+ * @since 3.0.0
+ */
+ pauseAll: function ()
+ {
+ this.forEachActiveSound(function (sound)
+ {
+ sound.pause();
+ });
+
+ this.emit('pauseall', this);
+ },
+
+ /**
+ * @event Phaser.Sound.BaseSoundManager#resumeall
+ * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event.
+ */
+
+ /**
+ * Resumes all the sounds in the game.
+ *
+ * @method Phaser.Sound.BaseSoundManager#resumeAll
+ * @fires Phaser.Sound.BaseSoundManager#resumeall
+ * @since 3.0.0
+ */
+ resumeAll: function ()
+ {
+ this.forEachActiveSound(function (sound)
+ {
+ sound.resume();
+ });
+
+ this.emit('resumeall', this);
+ },
+
+ /**
+ * @event Phaser.Sound.BaseSoundManager#stopall
+ * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event.
+ */
+
+ /**
+ * Stops all the sounds in the game.
+ *
+ * @method Phaser.Sound.BaseSoundManager#stopAll
+ * @fires Phaser.Sound.BaseSoundManager#stopall
+ * @since 3.0.0
+ */
+ stopAll: function ()
+ {
+ this.forEachActiveSound(function (sound)
+ {
+ sound.stop();
+ });
+
+ this.emit('stopall', this);
+ },
+
+ /**
+ * Method used internally for unlocking audio playback on devices that
+ * require user interaction before any sound can be played on a web page.
+ *
+ * Read more about how this issue is handled here in [this article](https://medium.com/@pgoloskokovic/unlocking-web-audio-the-smarter-way-8858218c0e09).
+ *
+ * @method Phaser.Sound.BaseSoundManager#unlock
+ * @override
+ * @protected
+ * @since 3.0.0
+ */
+ unlock: NOOP,
+
+ /**
+ * Method used internally for pausing sound manager if
+ * Phaser.Sound.BaseSoundManager#pauseOnBlur is set to true.
+ *
+ * @method Phaser.Sound.BaseSoundManager#onBlur
+ * @override
+ * @protected
+ * @since 3.0.0
+ */
+ onBlur: NOOP,
+
+ /**
+ * Method used internally for resuming sound manager if
+ * Phaser.Sound.BaseSoundManager#pauseOnBlur is set to true.
+ *
+ * @method Phaser.Sound.BaseSoundManager#onFocus
+ * @override
+ * @protected
+ * @since 3.0.0
+ */
+ onFocus: NOOP,
+
+ /**
+ * Update method called on every game step.
+ * Removes destroyed sounds and updates every active sound in the game.
+ *
+ * @method Phaser.Sound.BaseSoundManager#update
+ * @protected
+ * @since 3.0.0
+ *
+ * @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout.
+ * @param {number} delta - The delta time elapsed since the last frame.
+ */
+ update: function (time, delta)
+ {
+ if (this.unlocked)
+ {
+ this.unlocked = false;
+ this.locked = false;
+
+ /**
+ * @event Phaser.Sound.BaseSoundManager#unlocked
+ * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event.
+ */
+ this.emit('unlocked', this);
+ }
+
+ for (var i = this.sounds.length - 1; i >= 0; i--)
+ {
+ if (this.sounds[i].pendingRemove)
+ {
+ this.sounds.splice(i, 1);
+ }
+ }
+
+ this.sounds.forEach(function (sound)
+ {
+ sound.update(time, delta);
+ });
+ },
+
+ /**
+ * Destroys all the sounds in the game and all associated events.
+ *
+ * @method Phaser.Sound.BaseSoundManager#destroy
+ * @since 3.0.0
+ */
+ destroy: function ()
+ {
+ this.removeAllListeners();
+
+ this.forEachActiveSound(function (sound)
+ {
+ sound.destroy();
+ });
+
+ this.sounds.length = 0;
+ this.sounds = null;
+
+ this.game = null;
+ },
+
+ /**
+ * Method used internally for iterating only over active sounds and skipping sounds that are marked for removal.
+ *
+ * @method Phaser.Sound.BaseSoundManager#forEachActiveSound
+ * @private
+ * @since 3.0.0
+ *
+ * @param {EachActiveSoundCallback} callback - Callback function. (manager: Phaser.Sound.BaseSoundManager, sound: Phaser.Sound.BaseSound, index: number, sounds: Phaser.Manager.BaseSound[]) => void
+ * @param {*} [scope] - Callback context.
+ */
+ forEachActiveSound: function (callback, scope)
+ {
+ var _this = this;
+
+ this.sounds.forEach(function (sound, index)
+ {
+ if (!sound.pendingRemove)
+ {
+ callback.call(scope || _this, sound, index, _this.sounds);
+ }
+ });
+ },
+
+ /**
+ * @event Phaser.Sound.BaseSoundManager#rate
+ * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event.
+ * @param {number} value - An updated value of Phaser.Sound.BaseSoundManager#rate property.
+ */
+
+ /**
+ * Sets the global playback rate at which all the sounds will be played.
+ *
+ * For example, a value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed
+ * and 2.0 doubles the audios playback speed.
+ *
+ * @method Phaser.Sound.BaseSoundManager#setRate
+ * @fires Phaser.Sound.BaseSoundManager#rate
+ * @since 3.3.0
+ *
+ * @param {number} value - Global playback rate at which all the sounds will be played.
+ *
+ * @return {Phaser.Sound.BaseSoundManager} This Sound Manager.
+ */
+ setRate: function (value)
+ {
+ this.rate = value;
+
+ return this;
+ },
+
+ /**
+ * Global playback rate at which all the sounds will be played.
+ * Value of 1.0 plays the audio at full speed, 0.5 plays the audio at half speed
+ * and 2.0 doubles the audio's playback speed.
+ *
+ * @name Phaser.Sound.BaseSoundManager#rate
+ * @type {number}
+ * @default 1
+ * @since 3.0.0
+ */
+ rate: {
+
+ get: function ()
+ {
+ return this._rate;
+ },
+
+ set: function (value)
+ {
+ this._rate = value;
+
+ this.forEachActiveSound(function (sound)
+ {
+ sound.calculateRate();
+ });
+
+ this.emit('rate', this, value);
+ }
+
+ },
+
+ /**
+ * Sets the global detuning of all sounds in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29).
+ * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent).
+ *
+ * @method Phaser.Sound.BaseSoundManager#setDetune
+ * @fires Phaser.Sound.BaseSoundManager#detune
+ * @since 3.3.0
+ *
+ * @param {number} value - The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent).
+ *
+ * @return {Phaser.Sound.BaseSoundManager} This Sound Manager.
+ */
+ setDetune: function (value)
+ {
+ this.detune = value;
+
+ return this;
+ },
+
+ /**
+ * @event Phaser.Sound.BaseSoundManager#detune
+ * @param {Phaser.Sound.BaseSoundManager} soundManager - Reference to the sound manager that emitted event.
+ * @param {number} value - An updated value of Phaser.Sound.BaseSoundManager#detune property.
+ */
+
+ /**
+ * Global detuning of all sounds in [cents](https://en.wikipedia.org/wiki/Cent_%28music%29).
+ * The range of the value is -1200 to 1200, but we recommend setting it to [50](https://en.wikipedia.org/wiki/50_Cent).
+ *
+ * @name Phaser.Sound.BaseSoundManager#detune
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ detune: {
+
+ get: function ()
+ {
+ return this._detune;
+ },
+
+ set: function (value)
+ {
+ this._detune = value;
+
+ this.forEachActiveSound(function (sound)
+ {
+ sound.calculateRate();
+ });
+
+ this.emit('detune', this, value);
+ }
+
+ }
+
+});
+
+module.exports = BaseSoundManager;
+
+
+/***/ }),
+/* 116 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Scene consts.
+ *
+ * @ignore
+ */
+
+var CONST = {
+
+ /**
+ * Scene state.
+ *
+ * @name Phaser.Scenes.PENDING
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ PENDING: 0,
+
+ /**
+ * Scene state.
+ *
+ * @name Phaser.Scenes.INIT
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ INIT: 1,
+
+ /**
+ * Scene state.
+ *
+ * @name Phaser.Scenes.START
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ START: 2,
+
+ /**
+ * Scene state.
+ *
+ * @name Phaser.Scenes.LOADING
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ LOADING: 3,
+
+ /**
+ * Scene state.
+ *
+ * @name Phaser.Scenes.CREATING
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ CREATING: 4,
+
+ /**
+ * Scene state.
+ *
+ * @name Phaser.Scenes.RUNNING
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ RUNNING: 5,
+
+ /**
+ * Scene state.
+ *
+ * @name Phaser.Scenes.PAUSED
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ PAUSED: 6,
+
+ /**
+ * Scene state.
+ *
+ * @name Phaser.Scenes.SLEEPING
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ SLEEPING: 7,
+
+ /**
+ * Scene state.
+ *
+ * @name Phaser.Scenes.SHUTDOWN
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ SHUTDOWN: 8,
+
+ /**
+ * Scene state.
+ *
+ * @name Phaser.Scenes.DESTROYED
+ * @readonly
+ * @type {integer}
+ * @since 3.0.0
+ */
+ DESTROYED: 9
+
+};
+
+module.exports = CONST;
+
+
+/***/ }),
+/* 117 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Checks if the given `width` and `height` are a power of two.
+ * Useful for checking texture dimensions.
+ *
+ * @function Phaser.Math.Pow2.IsSizePowerOfTwo
+ * @since 3.0.0
+ *
+ * @param {number} width - The width.
+ * @param {number} height - The height.
+ *
+ * @return {boolean} `true` if `width` and `height` are a power of two, otherwise `false`.
+ */
+var IsSizePowerOfTwo = function (width, height)
+{
+ return (width > 0 && (width & (width - 1)) === 0 && height > 0 && (height & (height - 1)) === 0);
+};
+
+module.exports = IsSizePowerOfTwo;
+
+
+/***/ }),
+/* 118 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var OS = __webpack_require__(92);
+
+/**
+ * Determines the browser type and version running this Phaser Game instance.
+ * These values are read-only and populated during the boot sequence of the game.
+ * They are then referenced by internal game systems and are available for you to access
+ * via `this.sys.game.device.browser` from within any Scene.
+ *
+ * @typedef {object} Phaser.Device.Browser
+ * @since 3.0.0
+ *
+ * @property {boolean} chrome - Set to true if running in Chrome.
+ * @property {boolean} edge - Set to true if running in Microsoft Edge browser.
+ * @property {boolean} firefox - Set to true if running in Firefox.
+ * @property {boolean} ie - Set to true if running in Internet Explorer 11 or less (not Edge).
+ * @property {boolean} mobileSafari - Set to true if running in Mobile Safari.
+ * @property {boolean} opera - Set to true if running in Opera.
+ * @property {boolean} safari - Set to true if running in Safari.
+ * @property {boolean} silk - Set to true if running in the Silk browser (as used on the Amazon Kindle)
+ * @property {boolean} trident - Set to true if running a Trident version of Internet Explorer (IE11+)
+ * @property {number} chromeVersion - If running in Chrome this will contain the major version number.
+ * @property {number} firefoxVersion - If running in Firefox this will contain the major version number.
+ * @property {number} ieVersion - If running in Internet Explorer this will contain the major version number. Beyond IE10 you should use Browser.trident and Browser.tridentVersion.
+ * @property {number} safariVersion - If running in Safari this will contain the major version number.
+ * @property {number} tridentVersion - If running in Internet Explorer 11 this will contain the major version number. See {@link http://msdn.microsoft.com/en-us/library/ie/ms537503(v=vs.85).aspx}
+ */
+var Browser = {
+
+ chrome: false,
+ chromeVersion: 0,
+ edge: false,
+ firefox: false,
+ firefoxVersion: 0,
+ ie: false,
+ ieVersion: 0,
+ mobileSafari: false,
+ opera: false,
+ safari: false,
+ safariVersion: 0,
+ silk: false,
+ trident: false,
+ tridentVersion: 0
+
+};
+
+function init ()
+{
+ var ua = navigator.userAgent;
+
+ if (/Edge\/\d+/.test(ua))
+ {
+ Browser.edge = true;
+ }
+ else if ((/Chrome\/(\d+)/).test(ua) && !OS.windowsPhone)
+ {
+ Browser.chrome = true;
+ Browser.chromeVersion = parseInt(RegExp.$1, 10);
+ }
+ else if ((/Firefox\D+(\d+)/).test(ua))
+ {
+ Browser.firefox = true;
+ Browser.firefoxVersion = parseInt(RegExp.$1, 10);
+ }
+ else if ((/AppleWebKit/).test(ua) && OS.iOS)
+ {
+ Browser.mobileSafari = true;
+ }
+ else if ((/MSIE (\d+\.\d+);/).test(ua))
+ {
+ Browser.ie = true;
+ Browser.ieVersion = parseInt(RegExp.$1, 10);
+ }
+ else if ((/Opera/).test(ua))
+ {
+ Browser.opera = true;
+ }
+ else if ((/Safari/).test(ua) && !OS.windowsPhone)
+ {
+ Browser.safari = true;
+ }
+ else if ((/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/).test(ua))
+ {
+ Browser.ie = true;
+ Browser.trident = true;
+ Browser.tridentVersion = parseInt(RegExp.$1, 10);
+ Browser.ieVersion = parseInt(RegExp.$3, 10);
+ }
+
+ // Silk gets its own if clause because its ua also contains 'Safari'
+ if ((/Silk/).test(ua))
+ {
+ Browser.silk = true;
+ }
+
+ return Browser;
+}
+
+module.exports = init();
+
+
+/***/ }),
+/* 119 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Calculates a linear (interpolation) value over t.
+ *
+ * @function Phaser.Math.Linear
+ * @since 3.0.0
+ *
+ * @param {number} p0 - The first point.
+ * @param {number} p1 - The second point.
+ * @param {number} t - The percentage between p0 and p1 to return, represented as a number between 0 and 1.
+ *
+ * @return {number} The step t% of the way between p0 and p1.
+ */
+var Linear = function (p0, p1, t)
+{
+ return (p1 - p0) * t + p0;
+};
+
+module.exports = Linear;
+
+
+/***/ }),
+/* 120 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+// Browser specific prefix, so not going to change between contexts, only between browsers
+var prefix = '';
+
+/**
+ * @namespace Phaser.Display.Canvas.Smoothing
+ * @since 3.0.0
+ */
+var Smoothing = function ()
+{
+ /**
+ * Gets the Smoothing Enabled vendor prefix being used on the given context, or null if not set.
+ *
+ * @function Phaser.Display.Canvas.Smoothing.getPrefix
+ * @since 3.0.0
+ *
+ * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description]
+ *
+ * @return {string} [description]
+ */
+ var getPrefix = function (context)
+ {
+ var vendors = [ 'i', 'webkitI', 'msI', 'mozI', 'oI' ];
+
+ for (var i = 0; i < vendors.length; i++)
+ {
+ var s = vendors[i] + 'mageSmoothingEnabled';
+
+ if (s in context)
+ {
+ return s;
+ }
+ }
+
+ return null;
+ };
+
+ /**
+ * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing.
+ * By default browsers have image smoothing enabled, which isn't always what you visually want, especially
+ * when using pixel art in a game. Note that this sets the property on the context itself, so that any image
+ * drawn to the context will be affected. This sets the property across all current browsers but support is
+ * patchy on earlier browsers, especially on mobile.
+ *
+ * @function Phaser.Display.Canvas.Smoothing.enable
+ * @since 3.0.0
+ *
+ * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description]
+ *
+ * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} [description]
+ */
+ var enable = function (context)
+ {
+ if (prefix === '')
+ {
+ prefix = getPrefix(context);
+ }
+
+ if (prefix)
+ {
+ context[prefix] = true;
+ }
+
+ return context;
+ };
+
+ /**
+ * Sets the Image Smoothing property on the given context. Set to false to disable image smoothing.
+ * By default browsers have image smoothing enabled, which isn't always what you visually want, especially
+ * when using pixel art in a game. Note that this sets the property on the context itself, so that any image
+ * drawn to the context will be affected. This sets the property across all current browsers but support is
+ * patchy on earlier browsers, especially on mobile.
+ *
+ * @function Phaser.Display.Canvas.Smoothing.disable
+ * @since 3.0.0
+ *
+ * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description]
+ *
+ * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} [description]
+ */
+ var disable = function (context)
+ {
+ if (prefix === '')
+ {
+ prefix = getPrefix(context);
+ }
+
+ if (prefix)
+ {
+ context[prefix] = false;
+ }
+
+ return context;
+ };
+
+ /**
+ * Returns `true` if the given context has image smoothing enabled, otherwise returns `false`.
+ * Returns null if no smoothing prefix is available.
+ *
+ * @function Phaser.Display.Canvas.Smoothing.isEnabled
+ * @since 3.0.0
+ *
+ * @param {(CanvasRenderingContext2D|WebGLRenderingContext)} context - [description]
+ *
+ * @return {?boolean} [description]
+ */
+ var isEnabled = function (context)
+ {
+ return (prefix !== null) ? context[prefix] : null;
+ };
+
+ return {
+ disable: disable,
+ enable: enable,
+ getPrefix: getPrefix,
+ isEnabled: isEnabled
+ };
+
+};
+
+module.exports = Smoothing();
+
+
+/***/ }),
+/* 121 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var Components = __webpack_require__(14);
+var DegToRad = __webpack_require__(31);
+var EventEmitter = __webpack_require__(11);
+var Rectangle = __webpack_require__(9);
+var TransformMatrix = __webpack_require__(38);
+var ValueToColor = __webpack_require__(178);
+var Vector2 = __webpack_require__(3);
+
+/**
+ * @typedef {object} JSONCameraBounds
+ * @property {number} x - The horizontal position of camera
+ * @property {number} y - The vertical position of camera
+ * @property {number} width - The width size of camera
+ * @property {number} height - The height size of camera
+ */
+
+/**
+ * @typedef {object} JSONCamera
+ *
+ * @property {string} name - The name of the camera
+ * @property {number} x - The horizontal position of camera
+ * @property {number} y - The vertical position of camera
+ * @property {number} width - The width size of camera
+ * @property {number} height - The height size of camera
+ * @property {number} zoom - The zoom of camera
+ * @property {number} rotation - The rotation of camera
+ * @property {boolean} roundPixels - The round pixels st status of camera
+ * @property {number} scrollX - The horizontal scroll of camera
+ * @property {number} scrollY - The vertical scroll of camera
+ * @property {string} backgroundColor - The background color of camera
+ * @property {(JSONCameraBounds|undefined)} [bounds] - The bounds of camera
+ */
+
+/**
+ * @classdesc
+ * A Base Camera class.
+ *
+ * The Camera is the way in which all games are rendered in Phaser. They provide a view into your game world,
+ * and can be positioned, rotated, zoomed and scrolled accordingly.
+ *
+ * A Camera consists of two elements: The viewport and the scroll values.
+ *
+ * The viewport is the physical position and size of the Camera within your game. Cameras, by default, are
+ * created the same size as your game, but their position and size can be set to anything. This means if you
+ * wanted to create a camera that was 320x200 in size, positioned in the bottom-right corner of your game,
+ * you'd adjust the viewport to do that (using methods like `setViewport` and `setSize`).
+ *
+ * If you wish to change where the Camera is looking in your game, then you scroll it. You can do this
+ * via the properties `scrollX` and `scrollY` or the method `setScroll`. Scrolling has no impact on the
+ * viewport, and changing the viewport has no impact on the scrolling.
+ *
+ * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method,
+ * allowing you to filter Game Objects out on a per-Camera basis.
+ *
+ * The Base Camera is extended by the Camera class, which adds in special effects including Fade,
+ * Flash and Camera Shake, as well as the ability to follow Game Objects.
+ *
+ * The Base Camera was introduced in Phaser 3.12. It was split off from the Camera class, to allow
+ * you to isolate special effects as needed. Therefore the 'since' values for properties of this class relate
+ * to when they were added to the Camera class.
+ *
+ * @class BaseCamera
+ * @memberof Phaser.Cameras.Scene2D
+ * @constructor
+ * @since 3.12.0
+ *
+ * @extends Phaser.Events.EventEmitter
+ * @extends Phaser.GameObjects.Components.Alpha
+ * @extends Phaser.GameObjects.Components.Visible
+ *
+ * @param {number} x - The x position of the Camera, relative to the top-left of the game canvas.
+ * @param {number} y - The y position of the Camera, relative to the top-left of the game canvas.
+ * @param {number} width - The width of the Camera, in pixels.
+ * @param {number} height - The height of the Camera, in pixels.
+ */
+var BaseCamera = new Class({
+
+ Extends: EventEmitter,
+
+ Mixins: [
+ Components.Alpha,
+ Components.Visible
+ ],
+
+ initialize:
+
+ function BaseCamera (x, y, width, height)
+ {
+ if (x === undefined) { x = 0; }
+ if (y === undefined) { y = 0; }
+ if (width === undefined) { width = 0; }
+ if (height === undefined) { height = 0; }
+
+ EventEmitter.call(this);
+
+ /**
+ * A reference to the Scene this camera belongs to.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#scene
+ * @type {Phaser.Scene}
+ * @since 3.0.0
+ */
+ this.scene;
+
+ /**
+ * A reference to the Game Scene Manager.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#sceneManager
+ * @type {Phaser.Scenes.SceneManager}
+ * @since 3.12.0
+ */
+ this.sceneManager;
+
+ /**
+ * A reference to the Game Config.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#config
+ * @type {object}
+ * @readonly
+ * @since 3.12.0
+ */
+ this.config;
+
+ /**
+ * The Camera ID. Assigned by the Camera Manager and used to handle camera exclusion.
+ * This value is a bitmask.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#id
+ * @type {integer}
+ * @readonly
+ * @since 3.11.0
+ */
+ this.id = 0;
+
+ /**
+ * The name of the Camera. This is left empty for your own use.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#name
+ * @type {string}
+ * @default ''
+ * @since 3.0.0
+ */
+ this.name = '';
+
+ /**
+ * The resolution of the Game, used in most Camera calculations.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#resolution
+ * @type {number}
+ * @readonly
+ * @since 3.12.0
+ */
+ this.resolution = 1;
+
+ /**
+ * Should this camera round its pixel values to integers?
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#roundPixels
+ * @type {boolean}
+ * @default false
+ * @since 3.0.0
+ */
+ this.roundPixels = false;
+
+ /**
+ * Is this Camera visible or not?
+ *
+ * A visible camera will render and perform input tests.
+ * An invisible camera will not render anything and will skip input tests.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#visible
+ * @type {boolean}
+ * @default true
+ * @since 3.10.0
+ */
+
+ /**
+ * Is this Camera using a bounds to restrict scrolling movement?
+ *
+ * Set this property along with the bounds via `Camera.setBounds`.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#useBounds
+ * @type {boolean}
+ * @default false
+ * @since 3.0.0
+ */
+ this.useBounds = false;
+
+ /**
+ * The World View is a Rectangle that defines the area of the 'world' the Camera is currently looking at.
+ * This factors in the Camera viewport size, zoom and scroll position and is updated in the Camera preRender step.
+ * If you have enabled Camera bounds the worldview will be clamped to those bounds accordingly.
+ * You can use it for culling or intersection checks.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#worldView
+ * @type {Phaser.Geom.Rectangle}
+ * @readonly
+ * @since 3.11.0
+ */
+ this.worldView = new Rectangle();
+
+ /**
+ * Is this Camera dirty?
+ *
+ * A dirty Camera has had either its viewport size, bounds, scroll, rotation or zoom levels changed since the last frame.
+ *
+ * This flag is cleared during the `postRenderCamera` method of the renderer.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#dirty
+ * @type {boolean}
+ * @default true
+ * @since 3.11.0
+ */
+ this.dirty = true;
+
+ /**
+ * The x position of the Camera viewport, relative to the top-left of the game canvas.
+ * The viewport is the area into which the camera renders.
+ * To adjust the position the camera is looking at in the game world, see the `scrollX` value.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#x
+ * @type {number}
+ * @private
+ * @since 3.0.0
+ */
+ this._x = x;
+
+ /**
+ * The y position of the Camera, relative to the top-left of the game canvas.
+ * The viewport is the area into which the camera renders.
+ * To adjust the position the camera is looking at in the game world, see the `scrollY` value.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#y
+ * @type {number}
+ * @private
+ * @since 3.0.0
+ */
+ this._y = y;
+
+ /**
+ * Internal Camera X value multiplied by the resolution.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#_cx
+ * @type {number}
+ * @private
+ * @since 3.12.0
+ */
+ this._cx = 0;
+
+ /**
+ * Internal Camera Y value multiplied by the resolution.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#_cy
+ * @type {number}
+ * @private
+ * @since 3.12.0
+ */
+ this._cy = 0;
+
+ /**
+ * Internal Camera Width value multiplied by the resolution.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#_cw
+ * @type {number}
+ * @private
+ * @since 3.12.0
+ */
+ this._cw = 0;
+
+ /**
+ * Internal Camera Height value multiplied by the resolution.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#_ch
+ * @type {number}
+ * @private
+ * @since 3.12.0
+ */
+ this._ch = 0;
+
+ /**
+ * The width of the Camera viewport, in pixels.
+ *
+ * The viewport is the area into which the Camera renders. Setting the viewport does
+ * not restrict where the Camera can scroll to.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#_width
+ * @type {number}
+ * @private
+ * @since 3.11.0
+ */
+ this._width = width;
+
+ /**
+ * The height of the Camera viewport, in pixels.
+ *
+ * The viewport is the area into which the Camera renders. Setting the viewport does
+ * not restrict where the Camera can scroll to.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#_height
+ * @type {number}
+ * @private
+ * @since 3.11.0
+ */
+ this._height = height;
+
+ /**
+ * The bounds the camera is restrained to during scrolling.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#_bounds
+ * @type {Phaser.Geom.Rectangle}
+ * @private
+ * @since 3.0.0
+ */
+ this._bounds = new Rectangle();
+
+ /**
+ * The horizontal scroll position of this Camera.
+ *
+ * Change this value to cause the Camera to scroll around your Scene.
+ *
+ * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method,
+ * will automatically adjust the Camera scroll values accordingly.
+ *
+ * You can set the bounds within which the Camera can scroll via the `setBounds` method.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#_scrollX
+ * @type {number}
+ * @private
+ * @default 0
+ * @since 3.11.0
+ */
+ this._scrollX = 0;
+
+ /**
+ * The vertical scroll position of this Camera.
+ *
+ * Change this value to cause the Camera to scroll around your Scene.
+ *
+ * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method,
+ * will automatically adjust the Camera scroll values accordingly.
+ *
+ * You can set the bounds within which the Camera can scroll via the `setBounds` method.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#_scrollY
+ * @type {number}
+ * @private
+ * @default 0
+ * @since 3.11.0
+ */
+ this._scrollY = 0;
+
+ /**
+ * The Camera zoom value. Change this value to zoom in, or out of, a Scene.
+ *
+ * A value of 0.5 would zoom the Camera out, so you can now see twice as much
+ * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel
+ * now takes up 2 pixels when rendered.
+ *
+ * Set to 1 to return to the default zoom level.
+ *
+ * Be careful to never set this value to zero.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#_zoom
+ * @type {number}
+ * @private
+ * @default 1
+ * @since 3.11.0
+ */
+ this._zoom = 1;
+
+ /**
+ * The rotation of the Camera in radians.
+ *
+ * Camera rotation always takes place based on the Camera viewport. By default, rotation happens
+ * in the center of the viewport. You can adjust this with the `originX` and `originY` properties.
+ *
+ * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not
+ * rotate the Camera viewport itself, which always remains an axis-aligned rectangle.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#_rotation
+ * @type {number}
+ * @private
+ * @default 0
+ * @since 3.11.0
+ */
+ this._rotation = 0;
+
+ /**
+ * A local transform matrix used for internal calculations.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#matrix
+ * @type {Phaser.GameObjects.Components.TransformMatrix}
+ * @private
+ * @since 3.0.0
+ */
+ this.matrix = new TransformMatrix();
+
+ /**
+ * Does this Camera have a transparent background?
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#transparent
+ * @type {boolean}
+ * @default true
+ * @since 3.0.0
+ */
+ this.transparent = true;
+
+ /**
+ * The background color of this Camera. Only used if `transparent` is `false`.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#backgroundColor
+ * @type {Phaser.Display.Color}
+ * @since 3.0.0
+ */
+ this.backgroundColor = ValueToColor('rgba(0,0,0,0)');
+
+ /**
+ * The Camera alpha value. Setting this property impacts every single object that this Camera
+ * renders. You can either set the property directly, i.e. via a Tween, to fade a Camera in or out,
+ * or via the chainable `setAlpha` method instead.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#alpha
+ * @type {number}
+ * @default 1
+ * @since 3.11.0
+ */
+
+ /**
+ * Should the camera cull Game Objects before checking them for input hit tests?
+ * In some special cases it may be beneficial to disable this.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#disableCull
+ * @type {boolean}
+ * @default false
+ * @since 3.0.0
+ */
+ this.disableCull = false;
+
+ /**
+ * A temporary array of culled objects.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#culledObjects
+ * @type {Phaser.GameObjects.GameObject[]}
+ * @default []
+ * @private
+ * @since 3.0.0
+ */
+ this.culledObjects = [];
+
+ /**
+ * The mid-point of the Camera in 'world' coordinates.
+ *
+ * Use it to obtain exactly where in the world the center of the camera is currently looking.
+ *
+ * This value is updated in the preRender method, after the scroll values and follower
+ * have been processed.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#midPoint
+ * @type {Phaser.Math.Vector2}
+ * @readonly
+ * @since 3.11.0
+ */
+ this.midPoint = new Vector2(width / 2, height / 2);
+
+ /**
+ * The horizontal origin of rotation for this Camera.
+ *
+ * By default the camera rotates around the center of the viewport.
+ *
+ * Changing the origin allows you to adjust the point in the viewport from which rotation happens.
+ * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right.
+ *
+ * See `setOrigin` to set both origins in a single, chainable call.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#originX
+ * @type {number}
+ * @default 0.5
+ * @since 3.11.0
+ */
+ this.originX = 0.5;
+
+ /**
+ * The vertical origin of rotation for this Camera.
+ *
+ * By default the camera rotates around the center of the viewport.
+ *
+ * Changing the origin allows you to adjust the point in the viewport from which rotation happens.
+ * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right.
+ *
+ * See `setOrigin` to set both origins in a single, chainable call.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#originY
+ * @type {number}
+ * @default 0.5
+ * @since 3.11.0
+ */
+ this.originY = 0.5;
+
+ /**
+ * Does this Camera have a custom viewport?
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#_customViewport
+ * @type {boolean}
+ * @private
+ * @default false
+ * @since 3.12.0
+ */
+ this._customViewport = false;
+ },
+
+ /**
+ * Set the Alpha level of this Camera. The alpha controls the opacity of the Camera as it renders.
+ * Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#setAlpha
+ * @since 3.11.0
+ *
+ * @param {number} [value=1] - The Camera alpha value.
+ *
+ * @return {this} This Camera instance.
+ */
+
+ /**
+ * Sets the rotation origin of this Camera.
+ *
+ * The values are given in the range 0 to 1 and are only used when calculating Camera rotation.
+ *
+ * By default the camera rotates around the center of the viewport.
+ *
+ * Changing the origin allows you to adjust the point in the viewport from which rotation happens.
+ * A value of 0 would rotate from the top-left of the viewport. A value of 1 from the bottom right.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#setOrigin
+ * @since 3.11.0
+ *
+ * @param {number} [x=0.5] - The horizontal origin value.
+ * @param {number} [y=x] - The vertical origin value. If not defined it will be set to the value of `x`.
+ *
+ * @return {this} This Camera instance.
+ */
+ setOrigin: function (x, y)
+ {
+ if (x === undefined) { x = 0.5; }
+ if (y === undefined) { y = x; }
+
+ this.originX = x;
+ this.originY = y;
+
+ return this;
+ },
+
+ /**
+ * Calculates what the Camera.scrollX and scrollY values would need to be in order to move
+ * the Camera so it is centered on the given x and y coordinates, without actually moving
+ * the Camera there. The results are clamped based on the Camera bounds, if set.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#getScroll
+ * @since 3.11.0
+ *
+ * @param {number} x - The horizontal coordinate to center on.
+ * @param {number} y - The vertical coordinate to center on.
+ * @param {Phaser.Math.Vector2} [out] - A Vec2 to store the values in. If not given a new Vec2 is created.
+ *
+ * @return {Phaser.Math.Vector2} The scroll coordinates stored in the `x` abd `y` properties.
+ */
+ getScroll: function (x, y, out)
+ {
+ if (out === undefined) { out = new Vector2(); }
+
+ var originX = this.width * 0.5;
+ var originY = this.height * 0.5;
+
+ out.x = x - originX;
+ out.y = y - originY;
+
+ if (this.useBounds)
+ {
+ out.x = this.clampX(out.x);
+ out.y = this.clampY(out.y);
+ }
+
+ return out;
+ },
+
+ /**
+ * Moves the Camera so that it is centered on the given coordinates, bounds allowing.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#centerOn
+ * @since 3.11.0
+ *
+ * @param {number} x - The horizontal coordinate to center on.
+ * @param {number} y - The vertical coordinate to center on.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ centerOn: function (x, y)
+ {
+ var originX = this.width * 0.5;
+ var originY = this.height * 0.5;
+
+ this.midPoint.set(x, y);
+
+ this.scrollX = x - originX;
+ this.scrollY = y - originY;
+
+ if (this.useBounds)
+ {
+ this.scrollX = this.clampX(this.scrollX);
+ this.scrollY = this.clampY(this.scrollY);
+ }
+
+ return this;
+ },
+
+ /**
+ * Moves the Camera so that it is looking at the center of the Camera Bounds, if enabled.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#centerToBounds
+ * @since 3.0.0
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ centerToBounds: function ()
+ {
+ if (this.useBounds)
+ {
+ var bounds = this._bounds;
+ var originX = this.width * 0.5;
+ var originY = this.height * 0.5;
+
+ this.midPoint.set(bounds.centerX, bounds.centerY);
+
+ this.scrollX = bounds.centerX - originX;
+ this.scrollY = bounds.centerY - originY;
+ }
+
+ return this;
+ },
+
+ /**
+ * Moves the Camera so that it is re-centered based on its viewport size.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#centerToSize
+ * @since 3.0.0
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ centerToSize: function ()
+ {
+ this.scrollX = this.width * 0.5;
+ this.scrollY = this.height * 0.5;
+
+ return this;
+ },
+
+ /**
+ * Takes an array of Game Objects and returns a new array featuring only those objects
+ * visible by this camera.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#cull
+ * @since 3.0.0
+ *
+ * @generic {Phaser.GameObjects.GameObject[]} G - [renderableObjects,$return]
+ *
+ * @param {Phaser.GameObjects.GameObject[]} renderableObjects - An array of Game Objects to cull.
+ *
+ * @return {Phaser.GameObjects.GameObject[]} An array of Game Objects visible to this Camera.
+ */
+ cull: function (renderableObjects)
+ {
+ if (this.disableCull)
+ {
+ return renderableObjects;
+ }
+
+ var cameraMatrix = this.matrix.matrix;
+
+ var mva = cameraMatrix[0];
+ var mvb = cameraMatrix[1];
+ var mvc = cameraMatrix[2];
+ var mvd = cameraMatrix[3];
+
+ /* First Invert Matrix */
+ var determinant = (mva * mvd) - (mvb * mvc);
+
+ if (!determinant)
+ {
+ return renderableObjects;
+ }
+
+ var mve = cameraMatrix[4];
+ var mvf = cameraMatrix[5];
+
+ var scrollX = this.scrollX;
+ var scrollY = this.scrollY;
+ var cameraW = this.width;
+ var cameraH = this.height;
+ var culledObjects = this.culledObjects;
+ var length = renderableObjects.length;
+
+ determinant = 1 / determinant;
+
+ culledObjects.length = 0;
+
+ for (var index = 0; index < length; ++index)
+ {
+ var object = renderableObjects[index];
+
+ if (!object.hasOwnProperty('width') || object.parentContainer)
+ {
+ culledObjects.push(object);
+ continue;
+ }
+
+ var objectW = object.width;
+ var objectH = object.height;
+ var objectX = (object.x - (scrollX * object.scrollFactorX)) - (objectW * object.originX);
+ var objectY = (object.y - (scrollY * object.scrollFactorY)) - (objectH * object.originY);
+ var tx = (objectX * mva + objectY * mvc + mve);
+ var ty = (objectX * mvb + objectY * mvd + mvf);
+ var tw = ((objectX + objectW) * mva + (objectY + objectH) * mvc + mve);
+ var th = ((objectX + objectW) * mvb + (objectY + objectH) * mvd + mvf);
+ var cullW = cameraW + objectW;
+ var cullH = cameraH + objectH;
+
+ if (tx > -objectW && ty > -objectH && tx < cullW && ty < cullH &&
+ tw > -objectW && th > -objectH && tw < cullW && th < cullH)
+ {
+ culledObjects.push(object);
+ }
+ }
+
+ return culledObjects;
+ },
+
+ /**
+ * Converts the given `x` and `y` coordinates into World space, based on this Cameras transform.
+ * You can optionally provide a Vector2, or similar object, to store the results in.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#getWorldPoint
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Math.Vector2} O - [output,$return]
+ *
+ * @param {number} x - The x position to convert to world space.
+ * @param {number} y - The y position to convert to world space.
+ * @param {(object|Phaser.Math.Vector2)} [output] - An optional object to store the results in. If not provided a new Vector2 will be created.
+ *
+ * @return {Phaser.Math.Vector2} An object holding the converted values in its `x` and `y` properties.
+ */
+ getWorldPoint: function (x, y, output)
+ {
+ if (output === undefined) { output = new Vector2(); }
+
+ var cameraMatrix = this.matrix.matrix;
+
+ var mva = cameraMatrix[0];
+ var mvb = cameraMatrix[1];
+ var mvc = cameraMatrix[2];
+ var mvd = cameraMatrix[3];
+ var mve = cameraMatrix[4];
+ var mvf = cameraMatrix[5];
+
+ // Invert Matrix
+ var determinant = (mva * mvd) - (mvb * mvc);
+
+ if (!determinant)
+ {
+ output.x = x;
+ output.y = y;
+
+ return output;
+ }
+
+ determinant = 1 / determinant;
+
+ var ima = mvd * determinant;
+ var imb = -mvb * determinant;
+ var imc = -mvc * determinant;
+ var imd = mva * determinant;
+ var ime = (mvc * mvf - mvd * mve) * determinant;
+ var imf = (mvb * mve - mva * mvf) * determinant;
+
+ var c = Math.cos(this.rotation);
+ var s = Math.sin(this.rotation);
+
+ var zoom = this.zoom;
+ var res = this.resolution;
+
+ var scrollX = this.scrollX;
+ var scrollY = this.scrollY;
+
+ // Works for zoom of 1 with any resolution, but resolution > 1 and zoom !== 1 breaks
+ var sx = x + ((scrollX * c - scrollY * s) * zoom);
+ var sy = y + ((scrollX * s + scrollY * c) * zoom);
+
+ // Apply transform to point
+ output.x = (sx * ima + sy * imc) * res + ime;
+ output.y = (sx * imb + sy * imd) * res + imf;
+
+ return output;
+ },
+
+ /**
+ * Given a Game Object, or an array of Game Objects, it will update all of their camera filter settings
+ * so that they are ignored by this Camera. This means they will not be rendered by this Camera.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#ignore
+ * @since 3.0.0
+ *
+ * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]|Phaser.GameObjects.Group)} entries - The Game Object, or array of Game Objects, to be ignored by this Camera.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ ignore: function (entries)
+ {
+ var id = this.id;
+
+ if (!Array.isArray(entries))
+ {
+ entries = [ entries ];
+ }
+
+ for (var i = 0; i < entries.length; i++)
+ {
+ var entry = entries[i];
+
+ if (Array.isArray(entry))
+ {
+ this.ignore(entry);
+ }
+ else if (entry.isParent)
+ {
+ this.ignore(entry.getChildren());
+ }
+ else
+ {
+ entry.cameraFilter |= id;
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Internal preRender step.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#preRender
+ * @protected
+ * @since 3.0.0
+ *
+ * @param {number} baseScale - The base scale, as set in the Camera Manager.
+ * @param {number} resolution - The game resolution.
+ */
+ preRender: function (baseScale, resolution)
+ {
+ var width = this.width;
+ var height = this.height;
+
+ var halfWidth = width * 0.5;
+ var halfHeight = height * 0.5;
+
+ var zoom = this.zoom * baseScale;
+ var matrix = this.matrix;
+
+ var originX = width * this.originX;
+ var originY = height * this.originY;
+
+ var sx = this.scrollX;
+ var sy = this.scrollY;
+
+ if (this.useBounds)
+ {
+ sx = this.clampX(sx);
+ sy = this.clampY(sy);
+ }
+
+ if (this.roundPixels)
+ {
+ originX = Math.round(originX);
+ originY = Math.round(originY);
+ }
+
+ // Values are in pixels and not impacted by zooming the Camera
+ this.scrollX = sx;
+ this.scrollY = sy;
+
+ var midX = sx + halfWidth;
+ var midY = sy + halfHeight;
+
+ // The center of the camera, in world space, so taking zoom into account
+ // Basically the pixel value of what it's looking at in the middle of the cam
+ this.midPoint.set(midX, midY);
+
+ var displayWidth = width / zoom;
+ var displayHeight = height / zoom;
+
+ this.worldView.setTo(
+ midX - (displayWidth / 2),
+ midY - (displayHeight / 2),
+ displayWidth,
+ displayHeight
+ );
+
+ matrix.loadIdentity();
+ matrix.scale(resolution, resolution);
+ matrix.translate(this.x + originX, this.y + originY);
+ matrix.rotate(this.rotation);
+ matrix.scale(zoom, zoom);
+ matrix.translate(-originX, -originY);
+ },
+
+ /**
+ * Takes an x value and checks it's within the range of the Camera bounds, adjusting if required.
+ * Do not call this method if you are not using camera bounds.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#clampX
+ * @since 3.11.0
+ *
+ * @param {number} x - The value to horizontally scroll clamp.
+ *
+ * @return {number} The adjusted value to use as scrollX.
+ */
+ clampX: function (x)
+ {
+ var bounds = this._bounds;
+
+ var dw = this.displayWidth;
+
+ var bx = bounds.x + ((dw - this.width) / 2);
+ var bw = Math.max(bx, bx + bounds.width - dw);
+
+ if (x < bx)
+ {
+ x = bx;
+ }
+ else if (x > bw)
+ {
+ x = bw;
+ }
+
+ return x;
+ },
+
+ /**
+ * Takes a y value and checks it's within the range of the Camera bounds, adjusting if required.
+ * Do not call this method if you are not using camera bounds.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#clampY
+ * @since 3.11.0
+ *
+ * @param {number} y - The value to vertically scroll clamp.
+ *
+ * @return {number} The adjusted value to use as scrollY.
+ */
+ clampY: function (y)
+ {
+ var bounds = this._bounds;
+
+ var dh = this.displayHeight;
+
+ var by = bounds.y + ((dh - this.height) / 2);
+ var bh = Math.max(by, by + bounds.height - dh);
+
+ if (y < by)
+ {
+ y = by;
+ }
+ else if (y > bh)
+ {
+ y = bh;
+ }
+
+ return y;
+ },
+
+ /*
+ var gap = this._zoomInversed;
+ return gap * Math.round((src.x - this.scrollX * src.scrollFactorX) / gap);
+ */
+
+ /**
+ * If this Camera has previously had movement bounds set on it, this will remove them.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#removeBounds
+ * @since 3.0.0
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ removeBounds: function ()
+ {
+ this.useBounds = false;
+
+ this.dirty = true;
+
+ this._bounds.setEmpty();
+
+ return this;
+ },
+
+ /**
+ * Set the rotation of this Camera. This causes everything it renders to appear rotated.
+ *
+ * Rotating a camera does not rotate the viewport itself, it is applied during rendering.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#setAngle
+ * @since 3.0.0
+ *
+ * @param {number} [value=0] - The cameras angle of rotation, given in degrees.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ setAngle: function (value)
+ {
+ if (value === undefined) { value = 0; }
+
+ this.rotation = DegToRad(value);
+
+ return this;
+ },
+
+ /**
+ * Sets the background color for this Camera.
+ *
+ * By default a Camera has a transparent background but it can be given a solid color, with any level
+ * of transparency, via this method.
+ *
+ * The color value can be specified using CSS color notation, hex or numbers.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#setBackgroundColor
+ * @since 3.0.0
+ *
+ * @param {(string|number|InputColorObject)} [color='rgba(0,0,0,0)'] - The color value. In CSS, hex or numeric color notation.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ setBackgroundColor: function (color)
+ {
+ if (color === undefined) { color = 'rgba(0,0,0,0)'; }
+
+ this.backgroundColor = ValueToColor(color);
+
+ this.transparent = (this.backgroundColor.alpha === 0);
+
+ return this;
+ },
+
+ /**
+ * Set the bounds of the Camera. The bounds are an axis-aligned rectangle.
+ *
+ * The Camera bounds controls where the Camera can scroll to, stopping it from scrolling off the
+ * edges and into blank space. It does not limit the placement of Game Objects, or where
+ * the Camera viewport can be positioned.
+ *
+ * Temporarily disable the bounds by changing the boolean `Camera.useBounds`.
+ *
+ * Clear the bounds entirely by calling `Camera.removeBounds`.
+ *
+ * If you set bounds that are smaller than the viewport it will stop the Camera from being
+ * able to scroll. The bounds can be positioned where-ever you wish. By default they are from
+ * 0x0 to the canvas width x height. This means that the coordinate 0x0 is the top left of
+ * the Camera bounds. However, you can position them anywhere. So if you wanted a game world
+ * that was 2048x2048 in size, with 0x0 being the center of it, you can set the bounds x/y
+ * to be -1024, -1024, with a width and height of 2048. Depending on your game you may find
+ * it easier for 0x0 to be the top-left of the bounds, or you may wish 0x0 to be the middle.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#setBounds
+ * @since 3.0.0
+ *
+ * @param {integer} x - The top-left x coordinate of the bounds.
+ * @param {integer} y - The top-left y coordinate of the bounds.
+ * @param {integer} width - The width of the bounds, in pixels.
+ * @param {integer} height - The height of the bounds, in pixels.
+ * @param {boolean} [centerOn] - If `true` the Camera will automatically be centered on the new bounds.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ setBounds: function (x, y, width, height, centerOn)
+ {
+ this._bounds.setTo(x, y, width, height);
+
+ this.dirty = true;
+ this.useBounds = true;
+
+ if (centerOn)
+ {
+ this.centerToBounds();
+ }
+ else
+ {
+ this.scrollX = this.clampX(this.scrollX);
+ this.scrollY = this.clampY(this.scrollY);
+ }
+
+ return this;
+ },
+
+ /**
+ * Sets the name of this Camera.
+ * This value is for your own use and isn't used internally.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#setName
+ * @since 3.0.0
+ *
+ * @param {string} [value=''] - The name of the Camera.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ setName: function (value)
+ {
+ if (value === undefined) { value = ''; }
+
+ this.name = value;
+
+ return this;
+ },
+
+ /**
+ * Set the position of the Camera viewport within the game.
+ *
+ * This does not change where the camera is 'looking'. See `setScroll` to control that.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#setPosition
+ * @since 3.0.0
+ *
+ * @param {number} x - The top-left x coordinate of the Camera viewport.
+ * @param {number} [y=x] - The top-left y coordinate of the Camera viewport.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ setPosition: function (x, y)
+ {
+ if (y === undefined) { y = x; }
+
+ this.x = x;
+ this.y = y;
+
+ return this;
+ },
+
+ /**
+ * Set the rotation of this Camera. This causes everything it renders to appear rotated.
+ *
+ * Rotating a camera does not rotate the viewport itself, it is applied during rendering.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#setRotation
+ * @since 3.0.0
+ *
+ * @param {number} [value=0] - The rotation of the Camera, in radians.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ setRotation: function (value)
+ {
+ if (value === undefined) { value = 0; }
+
+ this.rotation = value;
+
+ return this;
+ },
+
+ /**
+ * Should the Camera round pixel values to whole integers when rendering Game Objects?
+ *
+ * In some types of game, especially with pixel art, this is required to prevent sub-pixel aliasing.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#setRoundPixels
+ * @since 3.0.0
+ *
+ * @param {boolean} value - `true` to round Camera pixels, `false` to not.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ setRoundPixels: function (value)
+ {
+ this.roundPixels = value;
+
+ return this;
+ },
+
+ /**
+ * Sets the Scene the Camera is bound to.
+ *
+ * Also populates the `resolution` property and updates the internal size values.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#setScene
+ * @since 3.0.0
+ *
+ * @param {Phaser.Scene} scene - The Scene the camera is bound to.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ setScene: function (scene)
+ {
+ if (this.scene && this._customViewport)
+ {
+ this.sceneManager.customViewports--;
+ }
+
+ this.scene = scene;
+
+ this.config = scene.sys.game.config;
+ this.sceneManager = scene.sys.game.scene;
+
+ var res = this.config.resolution;
+
+ this.resolution = res;
+
+ this._cx = this._x * res;
+ this._cy = this._y * res;
+ this._cw = this._width * res;
+ this._ch = this._height * res;
+
+ this.updateSystem();
+
+ return this;
+ },
+
+ /**
+ * Set the position of where the Camera is looking within the game.
+ * You can also modify the properties `Camera.scrollX` and `Camera.scrollY` directly.
+ * Use this method, or the scroll properties, to move your camera around the game world.
+ *
+ * This does not change where the camera viewport is placed. See `setPosition` to control that.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#setScroll
+ * @since 3.0.0
+ *
+ * @param {number} x - The x coordinate of the Camera in the game world.
+ * @param {number} [y=x] - The y coordinate of the Camera in the game world.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ setScroll: function (x, y)
+ {
+ if (y === undefined) { y = x; }
+
+ this.scrollX = x;
+ this.scrollY = y;
+
+ return this;
+ },
+
+ /**
+ * Set the size of the Camera viewport.
+ *
+ * By default a Camera is the same size as the game, but can be made smaller via this method,
+ * allowing you to create mini-cam style effects by creating and positioning a smaller Camera
+ * viewport within your game.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#setSize
+ * @since 3.0.0
+ *
+ * @param {integer} width - The width of the Camera viewport.
+ * @param {integer} [height=width] - The height of the Camera viewport.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ setSize: function (width, height)
+ {
+ if (height === undefined) { height = width; }
+
+ this.width = width;
+ this.height = height;
+
+ return this;
+ },
+
+ /**
+ * This method sets the position and size of the Camera viewport in a single call.
+ *
+ * If you're trying to change where the Camera is looking at in your game, then see
+ * the method `Camera.setScroll` instead. This method is for changing the viewport
+ * itself, not what the camera can see.
+ *
+ * By default a Camera is the same size as the game, but can be made smaller via this method,
+ * allowing you to create mini-cam style effects by creating and positioning a smaller Camera
+ * viewport within your game.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#setViewport
+ * @since 3.0.0
+ *
+ * @param {number} x - The top-left x coordinate of the Camera viewport.
+ * @param {number} y - The top-left y coordinate of the Camera viewport.
+ * @param {integer} width - The width of the Camera viewport.
+ * @param {integer} [height=width] - The height of the Camera viewport.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ setViewport: function (x, y, width, height)
+ {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+
+ return this;
+ },
+
+ /**
+ * Set the zoom value of the Camera.
+ *
+ * Changing to a smaller value, such as 0.5, will cause the camera to 'zoom out'.
+ * Changing to a larger value, such as 2, will cause the camera to 'zoom in'.
+ *
+ * A value of 1 means 'no zoom' and is the default.
+ *
+ * Changing the zoom does not impact the Camera viewport in any way, it is only applied during rendering.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#setZoom
+ * @since 3.0.0
+ *
+ * @param {number} [value=1] - The zoom value of the Camera. The minimum it can be is 0.001.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ setZoom: function (value)
+ {
+ if (value === undefined) { value = 1; }
+
+ if (value === 0)
+ {
+ value = 0.001;
+ }
+
+ this.zoom = value;
+
+ return this;
+ },
+
+ /**
+ * Sets the visibility of this Camera.
+ *
+ * An invisible Camera will skip rendering and input tests of everything it can see.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#setVisible
+ * @since 3.10.0
+ *
+ * @param {boolean} value - The visible state of the Camera.
+ *
+ * @return {this} This Camera instance.
+ */
+
+ /**
+ * Returns an Object suitable for JSON storage containing all of the Camera viewport and rendering properties.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#toJSON
+ * @since 3.0.0
+ *
+ * @return {JSONCamera} A well-formed object suitable for conversion to JSON.
+ */
+ toJSON: function ()
+ {
+ var output = {
+ name: this.name,
+ x: this.x,
+ y: this.y,
+ width: this.width,
+ height: this.height,
+ zoom: this.zoom,
+ rotation: this.rotation,
+ roundPixels: this.roundPixels,
+ scrollX: this.scrollX,
+ scrollY: this.scrollY,
+ backgroundColor: this.backgroundColor.rgba
+ };
+
+ if (this.useBounds)
+ {
+ output['bounds'] = {
+ x: this._bounds.x,
+ y: this._bounds.y,
+ width: this._bounds.width,
+ height: this._bounds.height
+ };
+ }
+
+ return output;
+ },
+
+ /**
+ * Internal method called automatically by the Camera Manager.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#update
+ * @protected
+ * @since 3.0.0
+ *
+ * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout.
+ * @param {number} delta - The delta time, in ms, elapsed since the last frame.
+ */
+ update: function ()
+ {
+ // NOOP
+ },
+
+ /**
+ * Internal method called automatically when the viewport changes.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#updateSystem
+ * @private
+ * @since 3.12.0
+ */
+ updateSystem: function ()
+ {
+ if (!this.config)
+ {
+ return;
+ }
+
+ var custom = (this._x !== 0 || this._y !== 0 || this.config.width !== this._width || this.config.height !== this._height);
+
+ var sceneManager = this.sceneManager;
+
+ if (custom && !this._customViewport)
+ {
+ // We need a custom viewport for this Camera
+ sceneManager.customViewports++;
+ }
+ else if (!custom && this._customViewport)
+ {
+ // We're turning off a custom viewport for this Camera
+ sceneManager.customViewports--;
+ }
+
+ this.dirty = true;
+ this._customViewport = custom;
+ },
+
+ /**
+ * This event is fired when a camera is destroyed by the Camera Manager.
+ *
+ * @event CameraDestroyEvent
+ * @param {Phaser.Cameras.Scene2D.BaseCamera} camera - The camera that was destroyed.
+ */
+
+ /**
+ * Destroys this Camera instance and its internal properties and references.
+ * Once destroyed you cannot use this Camera again, even if re-added to a Camera Manager.
+ *
+ * This method is called automatically by `CameraManager.remove` if that methods `runDestroy` argument is `true`, which is the default.
+ *
+ * Unless you have a specific reason otherwise, always use `CameraManager.remove` and allow it to handle the camera destruction,
+ * rather than calling this method directly.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#destroy
+ * @fires CameraDestroyEvent
+ * @since 3.0.0
+ */
+ destroy: function ()
+ {
+ this.emit('cameradestroy', this);
+
+ this.removeAllListeners();
+
+ this.matrix.destroy();
+
+ this.culledObjects = [];
+
+ if (this._customViewport)
+ {
+ // We're turning off a custom viewport for this Camera
+ this.sceneManager.customViewports--;
+ }
+
+ this._bounds = null;
+
+ this.scene = null;
+ this.config = null;
+ this.sceneManager = null;
+ },
+
+ /**
+ * The x position of the Camera viewport, relative to the top-left of the game canvas.
+ * The viewport is the area into which the camera renders.
+ * To adjust the position the camera is looking at in the game world, see the `scrollX` value.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#x
+ * @type {number}
+ * @since 3.0.0
+ */
+ x: {
+
+ get: function ()
+ {
+ return this._x;
+ },
+
+ set: function (value)
+ {
+ this._x = value;
+ this._cx = value * this.resolution;
+ this.updateSystem();
+ }
+
+ },
+
+ /**
+ * The y position of the Camera viewport, relative to the top-left of the game canvas.
+ * The viewport is the area into which the camera renders.
+ * To adjust the position the camera is looking at in the game world, see the `scrollY` value.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#y
+ * @type {number}
+ * @since 3.0.0
+ */
+ y: {
+
+ get: function ()
+ {
+ return this._y;
+ },
+
+ set: function (value)
+ {
+ this._y = value;
+ this._cy = value * this.resolution;
+ this.updateSystem();
+ }
+
+ },
+
+ /**
+ * The width of the Camera viewport, in pixels.
+ *
+ * The viewport is the area into which the Camera renders. Setting the viewport does
+ * not restrict where the Camera can scroll to.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#width
+ * @type {number}
+ * @since 3.0.0
+ */
+ width: {
+
+ get: function ()
+ {
+ return this._width;
+ },
+
+ set: function (value)
+ {
+ this._width = value;
+ this._cw = value * this.resolution;
+ this.updateSystem();
+ }
+
+ },
+
+ /**
+ * The height of the Camera viewport, in pixels.
+ *
+ * The viewport is the area into which the Camera renders. Setting the viewport does
+ * not restrict where the Camera can scroll to.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#height
+ * @type {number}
+ * @since 3.0.0
+ */
+ height: {
+
+ get: function ()
+ {
+ return this._height;
+ },
+
+ set: function (value)
+ {
+ this._height = value;
+ this._ch = value * this.resolution;
+ this.updateSystem();
+ }
+
+ },
+
+ /**
+ * The horizontal scroll position of this Camera.
+ *
+ * Change this value to cause the Camera to scroll around your Scene.
+ *
+ * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method,
+ * will automatically adjust the Camera scroll values accordingly.
+ *
+ * You can set the bounds within which the Camera can scroll via the `setBounds` method.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#scrollX
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ scrollX: {
+
+ get: function ()
+ {
+ return this._scrollX;
+ },
+
+ set: function (value)
+ {
+ this._scrollX = value;
+ this.dirty = true;
+ }
+
+ },
+
+ /**
+ * The vertical scroll position of this Camera.
+ *
+ * Change this value to cause the Camera to scroll around your Scene.
+ *
+ * Alternatively, setting the Camera to follow a Game Object, via the `startFollow` method,
+ * will automatically adjust the Camera scroll values accordingly.
+ *
+ * You can set the bounds within which the Camera can scroll via the `setBounds` method.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#scrollY
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ scrollY: {
+
+ get: function ()
+ {
+ return this._scrollY;
+ },
+
+ set: function (value)
+ {
+ this._scrollY = value;
+ this.dirty = true;
+ }
+
+ },
+
+ /**
+ * The Camera zoom value. Change this value to zoom in, or out of, a Scene.
+ *
+ * A value of 0.5 would zoom the Camera out, so you can now see twice as much
+ * of the Scene as before. A value of 2 would zoom the Camera in, so every pixel
+ * now takes up 2 pixels when rendered.
+ *
+ * Set to 1 to return to the default zoom level.
+ *
+ * Be careful to never set this value to zero.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#zoom
+ * @type {number}
+ * @default 1
+ * @since 3.0.0
+ */
+ zoom: {
+
+ get: function ()
+ {
+ return this._zoom;
+ },
+
+ set: function (value)
+ {
+ this._zoom = value;
+ this.dirty = true;
+ }
+
+ },
+
+ /**
+ * The rotation of the Camera in radians.
+ *
+ * Camera rotation always takes place based on the Camera viewport. By default, rotation happens
+ * in the center of the viewport. You can adjust this with the `originX` and `originY` properties.
+ *
+ * Rotation influences the rendering of _all_ Game Objects visible by this Camera. However, it does not
+ * rotate the Camera viewport itself, which always remains an axis-aligned rectangle.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#rotation
+ * @type {number}
+ * @private
+ * @default 0
+ * @since 3.11.0
+ */
+ rotation: {
+
+ get: function ()
+ {
+ return this._rotation;
+ },
+
+ set: function (value)
+ {
+ this._rotation = value;
+ this.dirty = true;
+ }
+
+ },
+
+ /**
+ * The x position of the center of the Camera's viewport, relative to the top-left of the game canvas.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#centerX
+ * @type {number}
+ * @readonly
+ * @since 3.10.0
+ */
+ centerX: {
+
+ get: function ()
+ {
+ return this.x + (0.5 * this.width);
+ }
+
+ },
+
+ /**
+ * The y position of the center of the Camera's viewport, relative to the top-left of the game canvas.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#centerY
+ * @type {number}
+ * @readonly
+ * @since 3.10.0
+ */
+ centerY: {
+
+ get: function ()
+ {
+ return this.y + (0.5 * this.height);
+ }
+
+ },
+
+ /**
+ * The displayed width of the camera viewport, factoring in the camera zoom level.
+ *
+ * If a camera has a viewport width of 800 and a zoom of 0.5 then its display width
+ * would be 1600, as it's displaying twice as many pixels as zoom level 1.
+ *
+ * Equally, a camera with a width of 800 and zoom of 2 would have a display width
+ * of 400 pixels.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#displayWidth
+ * @type {number}
+ * @readonly
+ * @since 3.11.0
+ */
+ displayWidth: {
+
+ get: function ()
+ {
+ return this.width / this.zoom;
+ }
+
+ },
+
+ /**
+ * The displayed height of the camera viewport, factoring in the camera zoom level.
+ *
+ * If a camera has a viewport height of 600 and a zoom of 0.5 then its display height
+ * would be 1200, as it's displaying twice as many pixels as zoom level 1.
+ *
+ * Equally, a camera with a height of 600 and zoom of 2 would have a display height
+ * of 300 pixels.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#displayHeight
+ * @type {number}
+ * @readonly
+ * @since 3.11.0
+ */
+ displayHeight: {
+
+ get: function ()
+ {
+ return this.height / this.zoom;
+ }
+
+ }
+
+});
+
+module.exports = BaseCamera;
+
+
+/***/ }),
+/* 122 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Shuffles the contents of the given array using the Fisher-Yates implementation.
+ *
+ * The original array is modified directly and returned.
+ *
+ * @function Phaser.Utils.Array.Shuffle
+ * @since 3.0.0
+ *
+ * @param {array} array - The array to shuffle. This array is modified in place.
+ *
+ * @return {array} The shuffled array.
+ */
+var Shuffle = function (array)
+{
+ for (var i = array.length - 1; i > 0; i--)
+ {
+ var j = Math.floor(Math.random() * (i + 1));
+ var temp = array[i];
+ array[i] = array[j];
+ array[j] = temp;
+ }
+
+ return array;
+};
+
+module.exports = Shuffle;
+
+
+/***/ }),
+/* 123 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+
+/**
+ * @callback DataEachCallback
+ *
+ * @param {*} parent - The parent object of the DataManager.
+ * @param {string} key - The key of the value.
+ * @param {*} value - The value.
+ * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data.
+ */
+
+/**
+ * @classdesc
+ * The Data Component features a means to store pieces of data specific to a Game Object, System or Plugin.
+ * You can then search, query it, and retrieve the data. The parent must either extend EventEmitter,
+ * or have a property called `events` that is an instance of it.
+ *
+ * @class DataManager
+ * @memberof Phaser.Data
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {object} parent - The object that this DataManager belongs to.
+ * @param {Phaser.Events.EventEmitter} eventEmitter - The DataManager's event emitter.
+ */
+var DataManager = new Class({
+
+ initialize:
+
+ function DataManager (parent, eventEmitter)
+ {
+ /**
+ * The object that this DataManager belongs to.
+ *
+ * @name Phaser.Data.DataManager#parent
+ * @type {*}
+ * @since 3.0.0
+ */
+ this.parent = parent;
+
+ /**
+ * The DataManager's event emitter.
+ *
+ * @name Phaser.Data.DataManager#events
+ * @type {Phaser.Events.EventEmitter}
+ * @since 3.0.0
+ */
+ this.events = eventEmitter;
+
+ if (!eventEmitter)
+ {
+ this.events = (parent.events) ? parent.events : parent;
+ }
+
+ /**
+ * The data list.
+ *
+ * @name Phaser.Data.DataManager#list
+ * @type {Object.}
+ * @default {}
+ * @since 3.0.0
+ */
+ this.list = {};
+
+ /**
+ * The public values list. You can use this to access anything you have stored
+ * in this Data Manager. For example, if you set a value called `gold` you can
+ * access it via:
+ *
+ * ```javascript
+ * this.data.values.gold;
+ * ```
+ *
+ * You can also modify it directly:
+ *
+ * ```javascript
+ * this.data.values.gold += 1000;
+ * ```
+ *
+ * Doing so will emit a `setdata` event from the parent of this Data Manager.
+ *
+ * Do not modify this object directly. Adding properties directly to this object will not
+ * emit any events. Always use `DataManager.set` to create new items the first time around.
+ *
+ * @name Phaser.Data.DataManager#values
+ * @type {Object.}
+ * @default {}
+ * @since 3.10.0
+ */
+ this.values = {};
+
+ /**
+ * Whether setting data is frozen for this DataManager.
+ *
+ * @name Phaser.Data.DataManager#_frozen
+ * @type {boolean}
+ * @private
+ * @default false
+ * @since 3.0.0
+ */
+ this._frozen = false;
+
+ if (!parent.hasOwnProperty('sys') && this.events)
+ {
+ this.events.once('destroy', this.destroy, this);
+ }
+ },
+
+ /**
+ * Retrieves the value for the given key, 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
+ * this.data.get('gold');
+ * ```
+ *
+ * Or access the value directly:
+ *
+ * ```javascript
+ * this.data.values.gold;
+ * ```
+ *
+ * You can also pass in an array of keys, in which case an array of values will be returned:
+ *
+ * ```javascript
+ * this.data.get([ 'gold', 'armor', 'health' ]);
+ * ```
+ *
+ * This approach is useful for destructuring arrays in ES6.
+ *
+ * @method Phaser.Data.DataManager#get
+ * @since 3.0.0
+ *
+ * @param {(string|string[])} key - The key of the value to retrieve, or an array of keys.
+ *
+ * @return {*} The value belonging to the given key, or an array of values, the order of which will match the input array.
+ */
+ get: function (key)
+ {
+ var list = this.list;
+
+ if (Array.isArray(key))
+ {
+ var output = [];
+
+ for (var i = 0; i < key.length; i++)
+ {
+ output.push(list[key[i]]);
+ }
+
+ return output;
+ }
+ else
+ {
+ return list[key];
+ }
+ },
+
+ /**
+ * Retrieves all data values in a new object.
+ *
+ * @method Phaser.Data.DataManager#getAll
+ * @since 3.0.0
+ *
+ * @return {Object.} All data values.
+ */
+ getAll: function ()
+ {
+ var results = {};
+
+ for (var key in this.list)
+ {
+ if (this.list.hasOwnProperty(key))
+ {
+ results[key] = this.list[key];
+ }
+ }
+
+ return results;
+ },
+
+ /**
+ * Queries the DataManager for the values of keys matching the given regular expression.
+ *
+ * @method Phaser.Data.DataManager#query
+ * @since 3.0.0
+ *
+ * @param {RegExp} search - A regular expression object. If a non-RegExp object obj is passed, it is implicitly converted to a RegExp by using new RegExp(obj).
+ *
+ * @return {Object.} The values of the keys matching the search string.
+ */
+ query: function (search)
+ {
+ var results = {};
+
+ for (var key in this.list)
+ {
+ if (this.list.hasOwnProperty(key) && key.match(search))
+ {
+ results[key] = this.list[key];
+ }
+ }
+
+ return results;
+ },
+
+ /**
+ * Sets a value for the given key. If the key doesn't already exist in the Data Manager then it is created.
+ *
+ * ```javascript
+ * data.set('name', 'Red Gem Stone');
+ * ```
+ *
+ * You can also pass in an object of key value pairs as the first argument:
+ *
+ * ```javascript
+ * data.set({ name: 'Red Gem Stone', level: 2, owner: 'Link', gold: 50 });
+ * ```
+ *
+ * To get a value back again you can call `get`:
+ *
+ * ```javascript
+ * data.get('gold');
+ * ```
+ *
+ * Or you can access the value directly via the `values` property, where it works like any other variable:
+ *
+ * ```javascript
+ * data.values.gold += 50;
+ * ```
+ *
+ * When the value is first set, a `setdata` event is emitted.
+ *
+ * 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.
+ *
+ * @method Phaser.Data.DataManager#set
+ * @since 3.0.0
+ *
+ * @param {(string|object)} key - The key to set the value for. Or an object or 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.
+ *
+ * @return {Phaser.Data.DataManager} This DataManager object.
+ */
+ set: function (key, data)
+ {
+ if (this._frozen)
+ {
+ return this;
+ }
+
+ if (typeof key === 'string')
+ {
+ return this.setValue(key, data);
+ }
+ else
+ {
+ for (var entry in key)
+ {
+ this.setValue(entry, key[entry]);
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Internal value setter, called automatically by the `set` method.
+ *
+ * @method Phaser.Data.DataManager#setValue
+ * @private
+ * @since 3.10.0
+ *
+ * @param {string} key - The key to set the value for.
+ * @param {*} data - The value to set.
+ *
+ * @return {Phaser.Data.DataManager} This DataManager object.
+ */
+ setValue: function (key, data)
+ {
+ if (this._frozen)
+ {
+ return this;
+ }
+
+ if (this.has(key))
+ {
+ // Hit the key getter, which will in turn emit the events.
+ this.values[key] = data;
+ }
+ else
+ {
+ var _this = this;
+ var list = this.list;
+ var events = this.events;
+ var parent = this.parent;
+
+ Object.defineProperty(this.values, key, {
+
+ enumerable: true,
+
+ configurable: true,
+
+ get: function ()
+ {
+ return list[key];
+ },
+
+ set: function (value)
+ {
+ if (!_this._frozen)
+ {
+ var previousValue = list[key];
+ list[key] = value;
+
+ events.emit('changedata', parent, key, value, previousValue);
+ events.emit('changedata_' + key, parent, value, previousValue);
+ }
+ }
+
+ });
+
+ list[key] = data;
+
+ events.emit('setdata', parent, key, data);
+ }
+
+ return this;
+ },
+
+ /**
+ * Passes all data entries to the given callback.
+ *
+ * @method Phaser.Data.DataManager#each
+ * @since 3.0.0
+ *
+ * @param {DataEachCallback} callback - The function to call.
+ * @param {*} [context] - Value to use as `this` when executing callback.
+ * @param {...*} [args] - Additional arguments that will be passed to the callback, after the game object, key, and data.
+ *
+ * @return {Phaser.Data.DataManager} This DataManager object.
+ */
+ each: function (callback, context)
+ {
+ var args = [ this.parent, null, undefined ];
+
+ for (var i = 1; i < arguments.length; i++)
+ {
+ args.push(arguments[i]);
+ }
+
+ for (var key in this.list)
+ {
+ args[1] = key;
+ args[2] = this.list[key];
+
+ callback.apply(context, args);
+ }
+
+ return this;
+ },
+
+ /**
+ * Merge the given object of key value pairs into this DataManager.
+ *
+ * Any newly created values will emit a `setdata` event. Any updated values (see the `overwrite` argument)
+ * will emit a `changedata` event.
+ *
+ * @method Phaser.Data.DataManager#merge
+ * @since 3.0.0
+ *
+ * @param {Object.} data - The data to merge.
+ * @param {boolean} [overwrite=true] - Whether to overwrite existing data. Defaults to true.
+ *
+ * @return {Phaser.Data.DataManager} This DataManager object.
+ */
+ merge: function (data, overwrite)
+ {
+ if (overwrite === undefined) { overwrite = true; }
+
+ // Merge data from another component into this one
+ for (var key in data)
+ {
+ if (data.hasOwnProperty(key) && (overwrite || (!overwrite && !this.has(key))))
+ {
+ this.setValue(key, data[key]);
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Remove the value for the given key.
+ *
+ * If the key is found in this Data Manager it is removed from the internal lists and a
+ * `removedata` event is emitted.
+ *
+ * You can also pass in an array of keys, in which case all keys in the array will be removed:
+ *
+ * ```javascript
+ * this.data.remove([ 'gold', 'armor', 'health' ]);
+ * ```
+ *
+ * @method Phaser.Data.DataManager#remove
+ * @since 3.0.0
+ *
+ * @param {(string|string[])} key - The key to remove, or an array of keys to remove.
+ *
+ * @return {Phaser.Data.DataManager} This DataManager object.
+ */
+ remove: function (key)
+ {
+ if (this._frozen)
+ {
+ return this;
+ }
+
+ if (Array.isArray(key))
+ {
+ for (var i = 0; i < key.length; i++)
+ {
+ this.removeValue(key[i]);
+ }
+ }
+ else
+ {
+ return this.removeValue(key);
+ }
+
+ return this;
+ },
+
+ /**
+ * Internal value remover, called automatically by the `remove` method.
+ *
+ * @method Phaser.Data.DataManager#removeValue
+ * @private
+ * @since 3.10.0
+ *
+ * @param {string} key - The key to set the value for.
+ *
+ * @return {Phaser.Data.DataManager} This DataManager object.
+ */
+ removeValue: function (key)
+ {
+ if (this.has(key))
+ {
+ var data = this.list[key];
+
+ delete this.list[key];
+ delete this.values[key];
+
+ this.events.emit('removedata', this.parent, key, data);
+ }
+
+ return this;
+ },
+
+ /**
+ * Retrieves the data associated with the given 'key', deletes it from this Data Manager, then returns it.
+ *
+ * @method Phaser.Data.DataManager#pop
+ * @since 3.0.0
+ *
+ * @param {string} key - The key of the value to retrieve and delete.
+ *
+ * @return {*} The value of the given key.
+ */
+ pop: function (key)
+ {
+ var data = undefined;
+
+ if (!this._frozen && this.has(key))
+ {
+ data = this.list[key];
+
+ delete this.list[key];
+ delete this.values[key];
+
+ this.events.emit('removedata', this, key, data);
+ }
+
+ return data;
+ },
+
+ /**
+ * Determines whether the given key is set in this Data Manager.
+ *
+ * Please note that the 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.
+ *
+ * @method Phaser.Data.DataManager#has
+ * @since 3.0.0
+ *
+ * @param {string} key - The key to check.
+ *
+ * @return {boolean} Returns `true` if the key exists, otherwise `false`.
+ */
+ has: function (key)
+ {
+ return this.list.hasOwnProperty(key);
+ },
+
+ /**
+ * Freeze or unfreeze this Data Manager. A frozen Data Manager will block all attempts
+ * to create new values or update existing ones.
+ *
+ * @method Phaser.Data.DataManager#setFreeze
+ * @since 3.0.0
+ *
+ * @param {boolean} value - Whether to freeze or unfreeze the Data Manager.
+ *
+ * @return {Phaser.Data.DataManager} This DataManager object.
+ */
+ setFreeze: function (value)
+ {
+ this._frozen = value;
+
+ return this;
+ },
+
+ /**
+ * Delete all data in this Data Manager and unfreeze it.
+ *
+ * @method Phaser.Data.DataManager#reset
+ * @since 3.0.0
+ *
+ * @return {Phaser.Data.DataManager} This DataManager object.
+ */
+ reset: function ()
+ {
+ for (var key in this.list)
+ {
+ delete this.list[key];
+ delete this.values[key];
+ }
+
+ this._frozen = false;
+
+ return this;
+ },
+
+ /**
+ * Destroy this data manager.
+ *
+ * @method Phaser.Data.DataManager#destroy
+ * @since 3.0.0
+ */
+ destroy: function ()
+ {
+ this.reset();
+
+ this.events.off('changedata');
+ this.events.off('setdata');
+ this.events.off('removedata');
+
+ this.parent = null;
+ },
+
+ /**
+ * Gets or sets the frozen state of this Data Manager.
+ * A frozen Data Manager will block all attempts to create new values or update existing ones.
+ *
+ * @name Phaser.Data.DataManager#freeze
+ * @type {boolean}
+ * @since 3.0.0
+ */
+ freeze: {
+
+ get: function ()
+ {
+ return this._frozen;
+ },
+
+ set: function (value)
+ {
+ this._frozen = (value) ? true : false;
+ }
+
+ },
+
+ /**
+ * Return the total number of entries in this Data Manager.
+ *
+ * @name Phaser.Data.DataManager#count
+ * @type {integer}
+ * @since 3.0.0
+ */
+ count: {
+
+ get: function ()
+ {
+ var i = 0;
+
+ for (var key in this.list)
+ {
+ if (this.list[key] !== undefined)
+ {
+ i++;
+ }
+ }
+
+ return i;
+ }
+
+ }
+
+});
+
+module.exports = DataManager;
+
+
+/***/ }),
+/* 124 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * [description]
+ *
+ * @function Phaser.Geom.Rectangle.Perimeter
+ * @since 3.0.0
+ *
+ * @param {Phaser.Geom.Rectangle} rect - [description]
+ *
+ * @return {number} [description]
+ */
+var Perimeter = function (rect)
+{
+ return 2 * (rect.width + rect.height);
+};
+
+module.exports = Perimeter;
+
+
+/***/ }),
+/* 125 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var BlendModes = __webpack_require__(66);
+var Circle = __webpack_require__(71);
+var CircleContains = __webpack_require__(40);
+var Class = __webpack_require__(0);
+var Components = __webpack_require__(14);
+var GameObject = __webpack_require__(19);
+var Rectangle = __webpack_require__(9);
+var RectangleContains = __webpack_require__(39);
+
+/**
+ * @classdesc
+ * A Zone Game Object.
+ *
+ * A Zone is a non-rendering rectangular Game Object that has a position and size.
+ * It has no texture and never displays, but does live on the display list and
+ * can be moved, scaled and rotated like any other Game Object.
+ *
+ * Its primary use is for creating Drop Zones and Input Hit Areas and it has a couple of helper methods
+ * specifically for this. It is also useful for object overlap checks, or as a base for your own
+ * non-displaying Game Objects.
+
+ * The default origin is 0.5, the center of the Zone, the same as with Game Objects.
+ *
+ * @class Zone
+ * @extends Phaser.GameObjects.GameObject
+ * @memberof Phaser.GameObjects
+ * @constructor
+ * @since 3.0.0
+ *
+ * @extends Phaser.GameObjects.Components.Depth
+ * @extends Phaser.GameObjects.Components.GetBounds
+ * @extends Phaser.GameObjects.Components.Origin
+ * @extends Phaser.GameObjects.Components.ScaleMode
+ * @extends Phaser.GameObjects.Components.Transform
+ * @extends Phaser.GameObjects.Components.ScrollFactor
+ * @extends Phaser.GameObjects.Components.Visible
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs.
+ * @param {number} x - The horizontal position of this Game Object in the world.
+ * @param {number} y - The vertical position of this Game Object in the world.
+ * @param {number} [width=1] - The width of the Game Object.
+ * @param {number} [height=1] - The height of the Game Object.
+ */
+var Zone = new Class({
+
+ Extends: GameObject,
+
+ Mixins: [
+ Components.Depth,
+ Components.GetBounds,
+ Components.Origin,
+ Components.ScaleMode,
+ Components.Transform,
+ Components.ScrollFactor,
+ Components.Visible
+ ],
+
+ initialize:
+
+ function Zone (scene, x, y, width, height)
+ {
+ if (width === undefined) { width = 1; }
+ if (height === undefined) { height = width; }
+
+ GameObject.call(this, scene, 'Zone');
+
+ this.setPosition(x, y);
+
+ /**
+ * The native (un-scaled) width of this Game Object.
+ *
+ * @name Phaser.GameObjects.Zone#width
+ * @type {number}
+ * @since 3.0.0
+ */
+ this.width = width;
+
+ /**
+ * The native (un-scaled) height of this Game Object.
+ *
+ * @name Phaser.GameObjects.Zone#height
+ * @type {number}
+ * @since 3.0.0
+ */
+ this.height = height;
+
+ /**
+ * The Blend Mode of the Game Object.
+ * Although a Zone never renders, it still has a blend mode to allow it to fit seamlessly into
+ * display lists without causing a batch flush.
+ *
+ * @name Phaser.GameObjects.Zone#blendMode
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.blendMode = BlendModes.NORMAL;
+
+ this.updateDisplayOrigin();
+ },
+
+ /**
+ * The displayed width of this Game Object.
+ * This value takes into account the scale factor.
+ *
+ * @name Phaser.GameObjects.Zone#displayWidth
+ * @type {number}
+ * @since 3.0.0
+ */
+ displayWidth: {
+
+ get: function ()
+ {
+ return this.scaleX * this.width;
+ },
+
+ set: function (value)
+ {
+ this.scaleX = value / this.width;
+ }
+
+ },
+
+ /**
+ * The displayed height of this Game Object.
+ * This value takes into account the scale factor.
+ *
+ * @name Phaser.GameObjects.Zone#displayHeight
+ * @type {number}
+ * @since 3.0.0
+ */
+ displayHeight: {
+
+ get: function ()
+ {
+ return this.scaleY * this.height;
+ },
+
+ set: function (value)
+ {
+ this.scaleY = value / this.height;
+ }
+
+ },
+
+ /**
+ * Sets the size of this Game Object.
+ *
+ * @method Phaser.GameObjects.Zone#setSize
+ * @since 3.0.0
+ *
+ * @param {number} width - The width of this Game Object.
+ * @param {number} height - The height of this Game Object.
+ * @param {boolean} [resizeInput=true] - If this Zone has a Rectangle for a hit area this argument will resize the hit area as well.
+ *
+ * @return {Phaser.GameObjects.Zone} This Game Object.
+ */
+ setSize: function (width, height, resizeInput)
+ {
+ if (resizeInput === undefined) { resizeInput = true; }
+
+ this.width = width;
+ this.height = height;
+
+ if (resizeInput && this.input && this.input.hitArea instanceof Rectangle)
+ {
+ this.input.hitArea.width = width;
+ this.input.hitArea.height = height;
+ }
+
+ return this;
+ },
+
+ /**
+ * Sets the display size of this Game Object.
+ * Calling this will adjust the scale.
+ *
+ * @method Phaser.GameObjects.Zone#setDisplaySize
+ * @since 3.0.0
+ *
+ * @param {number} width - The width of this Game Object.
+ * @param {number} height - The height of this Game Object.
+ *
+ * @return {Phaser.GameObjects.Zone} This Game Object.
+ */
+ setDisplaySize: function (width, height)
+ {
+ this.displayWidth = width;
+ this.displayHeight = height;
+
+ return this;
+ },
+
+ /**
+ * Sets this Zone to be a Circular Drop Zone.
+ * The circle is centered on this Zones `x` and `y` coordinates.
+ *
+ * @method Phaser.GameObjects.Zone#setCircleDropZone
+ * @since 3.0.0
+ *
+ * @param {number} radius - The radius of the Circle that will form the Drop Zone.
+ *
+ * @return {Phaser.GameObjects.Zone} This Game Object.
+ */
+ setCircleDropZone: function (radius)
+ {
+ return this.setDropZone(new Circle(0, 0, radius), CircleContains);
+ },
+
+ /**
+ * Sets this Zone to be a Rectangle Drop Zone.
+ * The rectangle is centered on this Zones `x` and `y` coordinates.
+ *
+ * @method Phaser.GameObjects.Zone#setRectangleDropZone
+ * @since 3.0.0
+ *
+ * @param {number} width - The width of the rectangle drop zone.
+ * @param {number} height - The height of the rectangle drop zone.
+ *
+ * @return {Phaser.GameObjects.Zone} This Game Object.
+ */
+ setRectangleDropZone: function (width, height)
+ {
+ return this.setDropZone(new Rectangle(0, 0, width, height), RectangleContains);
+ },
+
+ /**
+ * Allows you to define your own Geometry shape to be used as a Drop Zone.
+ *
+ * @method Phaser.GameObjects.Zone#setDropZone
+ * @since 3.0.0
+ *
+ * @param {object} shape - A Geometry shape instance, such as Phaser.Geom.Ellipse, or your own custom shape.
+ * @param {HitAreaCallback} callback - A function that will return `true` if the given x/y coords it is sent are within the shape.
+ *
+ * @return {Phaser.GameObjects.Zone} This Game Object.
+ */
+ setDropZone: function (shape, callback)
+ {
+ if (shape === undefined)
+ {
+ this.setRectangleDropZone(this.width, this.height);
+ }
+ else if (!this.input)
+ {
+ this.setInteractive(shape, callback, true);
+ }
+
+ return this;
+ },
+
+ /**
+ * A NOOP method so you can pass a Zone to a Container.
+ * Calling this method will do nothing. It is intentionally empty.
+ *
+ * @method Phaser.GameObjects.Zone#setAlpha
+ * @private
+ * @since 3.11.0
+ */
+ setAlpha: function ()
+ {
+ },
+
+ /**
+ * A Zone does not render.
+ *
+ * @method Phaser.GameObjects.Zone#renderCanvas
+ * @private
+ * @since 3.0.0
+ */
+ renderCanvas: function ()
+ {
+ },
+
+ /**
+ * A Zone does not render.
+ *
+ * @method Phaser.GameObjects.Zone#renderWebGL
+ * @private
+ * @since 3.0.0
+ */
+ renderWebGL: function ()
+ {
+ }
+
+});
+
+module.exports = Zone;
+
+
+/***/ }),
+/* 126 */,
+/* 127 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @typedef {object} TweenDataGenConfig
+ *
+ * @property {function} delay - [description]
+ * @property {function} duration - [description]
+ * @property {function} hold - [description]
+ * @property {function} repeat - [description]
+ * @property {function} repeatDelay - [description]
+ */
+
+/**
+ * @typedef {object} Phaser.Tweens.TweenDataConfig
+ *
+ * @property {object} target - The target to tween.
+ * @property {string} key - The property of the target being tweened.
+ * @property {function} getEndValue - The returned value sets what the property will be at the END of the Tween.
+ * @property {function} getStartValue - The returned value sets what the property will be at the START of the Tween.
+ * @property {function} ease - The ease function this tween uses.
+ * @property {number} [duration=0] - Duration of the tween in ms/frames, excludes time for yoyo or repeats.
+ * @property {number} [totalDuration=0] - The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo)
+ * @property {number} [delay=0] - Time in ms/frames before tween will start.
+ * @property {boolean} [yoyo=false] - Cause the tween to return back to its start value after hold has expired.
+ * @property {number} [hold=0] - Time in ms/frames the tween will pause before running the yoyo or starting a repeat.
+ * @property {integer} [repeat=0] - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice.
+ * @property {number} [repeatDelay=0] - Time in ms/frames before the repeat will start.
+ * @property {boolean} [flipX=false] - Automatically call toggleFlipX when the TweenData yoyos or repeats
+ * @property {boolean} [flipY=false] - Automatically call toggleFlipY when the TweenData yoyos or repeats
+ * @property {number} [progress=0] - Between 0 and 1 showing completion of this TweenData.
+ * @property {number} [elapsed=0] - Delta counter
+ * @property {integer} [repeatCounter=0] - How many repeats are left to run?
+ * @property {number} [start=0] - Ease value data.
+ * @property {number} [current=0] - Ease value data.
+ * @property {number} [end=0] - Ease value data.
+ * @property {number} [t1=0] - Time duration 1.
+ * @property {number} [t2=0] - Time duration 2.
+ * @property {TweenDataGenConfig} [gen] - LoadValue generation functions.
+ * @property {integer} [state=0] - TWEEN_CONST.CREATED
+ */
+
+/**
+ * [description]
+ *
+ * @function Phaser.Tweens.TweenData
+ * @since 3.0.0
+ *
+ * @param {object} target - [description]
+ * @param {string} key - [description]
+ * @param {function} getEnd - [description]
+ * @param {function} getStart - [description]
+ * @param {function} ease - [description]
+ * @param {number} delay - [description]
+ * @param {number} duration - [description]
+ * @param {boolean} yoyo - [description]
+ * @param {number} hold - [description]
+ * @param {number} repeat - [description]
+ * @param {number} repeatDelay - [description]
+ * @param {boolean} flipX - [description]
+ * @param {boolean} flipY - [description]
+ *
+ * @return {TweenDataConfig} [description]
+ */
+var TweenData = function (target, key, getEnd, getStart, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY)
+{
+ return {
+
+ // The target to tween
+ target: target,
+
+ // The property of the target to tween
+ key: key,
+
+ // The returned value sets what the property will be at the END of the Tween.
+ getEndValue: getEnd,
+
+ // The returned value sets what the property will be at the START of the Tween.
+ getStartValue: getStart,
+
+ // The ease function this tween uses.
+ ease: ease,
+
+ // Duration of the tween in ms/frames, excludes time for yoyo or repeats.
+ duration: 0,
+
+ // The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo)
+ totalDuration: 0,
+
+ // Time in ms/frames before tween will start.
+ delay: 0,
+
+ // Cause the tween to return back to its start value after hold has expired.
+ yoyo: yoyo,
+
+ // Time in ms/frames the tween will pause before running the yoyo or starting a repeat.
+ hold: 0,
+
+ // Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice.
+ repeat: 0,
+
+ // Time in ms/frames before the repeat will start.
+ repeatDelay: 0,
+
+ // Automatically call toggleFlipX when the TweenData yoyos or repeats
+ flipX: flipX,
+
+ // Automatically call toggleFlipY when the TweenData yoyos or repeats
+ flipY: flipY,
+
+ // Between 0 and 1 showing completion of this TweenData.
+ progress: 0,
+
+ // Delta counter.
+ elapsed: 0,
+
+ // How many repeats are left to run?
+ repeatCounter: 0,
+
+ // Ease Value Data:
+
+ start: 0,
+ current: 0,
+ end: 0,
+
+ // Time Durations
+ t1: 0,
+ t2: 0,
+
+ // LoadValue generation functions
+ gen: {
+ delay: delay,
+ duration: duration,
+ hold: hold,
+ repeat: repeat,
+ repeatDelay: repeatDelay
+ },
+
+ // TWEEN_CONST.CREATED
+ state: 0
+ };
+};
+
+module.exports = TweenData;
+
+
+/***/ }),
+/* 128 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var GameObjectCreator = __webpack_require__(13);
+var GameObjectFactory = __webpack_require__(5);
+var TWEEN_CONST = __webpack_require__(83);
+
+/**
+ * @classdesc
+ * [description]
+ *
+ * @class Tween
+ * @memberof Phaser.Tweens
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description]
+ * @param {Phaser.Tweens.TweenDataConfig[]} data - [description]
+ * @param {array} targets - [description]
+ */
+var Tween = new Class({
+
+ initialize:
+
+ function Tween (parent, data, targets)
+ {
+ /**
+ * [description]
+ *
+ * @name Phaser.Tweens.Tween#parent
+ * @type {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)}
+ * @since 3.0.0
+ */
+ this.parent = parent;
+
+ /**
+ * Is the parent of this Tween a Timeline?
+ *
+ * @name Phaser.Tweens.Tween#parentIsTimeline
+ * @type {boolean}
+ * @since 3.0.0
+ */
+ this.parentIsTimeline = parent.hasOwnProperty('isTimeline');
+
+ /**
+ * An array of TweenData objects, each containing a unique property and target being tweened.
+ *
+ * @name Phaser.Tweens.Tween#data
+ * @type {Phaser.Tweens.TweenDataConfig[]}
+ * @since 3.0.0
+ */
+ this.data = data;
+
+ /**
+ * data array doesn't change, so we can cache the length
+ *
+ * @name Phaser.Tweens.Tween#totalData
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.totalData = data.length;
+
+ /**
+ * An array of references to the target/s this Tween is operating on
+ *
+ * @name Phaser.Tweens.Tween#targets
+ * @type {object[]}
+ * @since 3.0.0
+ */
+ this.targets = targets;
+
+ /**
+ * Cached target total (not necessarily the same as the data total)
+ *
+ * @name Phaser.Tweens.Tween#totalTargets
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.totalTargets = targets.length;
+
+ /**
+ * If true then duration, delay, etc values are all frame totals.
+ *
+ * @name Phaser.Tweens.Tween#useFrames
+ * @type {boolean}
+ * @default false
+ * @since 3.0.0
+ */
+ this.useFrames = false;
+
+ /**
+ * Scales the time applied to this Tween. 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 tween, it's a run-time delta adjustment only.
+ *
+ * @name Phaser.Tweens.Tween#timeScale
+ * @type {number}
+ * @default 1
+ * @since 3.0.0
+ */
+ this.timeScale = 1;
+
+ /**
+ * Loop this tween? Can be -1 for an infinite loop, or an integer.
+ * When enabled it will play through ALL TweenDatas again (use TweenData.repeat to loop a single TD)
+ *
+ * @name Phaser.Tweens.Tween#loop
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.loop = 0;
+
+ /**
+ * Time in ms/frames before the tween loops.
+ *
+ * @name Phaser.Tweens.Tween#loopDelay
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.loopDelay = 0;
+
+ /**
+ * How many loops are left to run?
+ *
+ * @name Phaser.Tweens.Tween#loopCounter
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.loopCounter = 0;
+
+ /**
+ * Time in ms/frames before the 'onComplete' event fires. This never fires if loop = -1 (as it never completes)
+ *
+ * @name Phaser.Tweens.Tween#completeDelay
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.completeDelay = 0;
+
+ /**
+ * Countdown timer (used by timeline offset, loopDelay and completeDelay)
+ *
+ * @name Phaser.Tweens.Tween#countdown
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.countdown = 0;
+
+ /**
+ * Set only if this Tween is part of a Timeline.
+ *
+ * @name Phaser.Tweens.Tween#offset
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.offset = 0;
+
+ /**
+ * Set only if this Tween is part of a Timeline. The calculated offset amount.
+ *
+ * @name Phaser.Tweens.Tween#calculatedOffset
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.calculatedOffset = 0;
+
+ /**
+ * The current state of the tween
+ *
+ * @name Phaser.Tweens.Tween#state
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.state = TWEEN_CONST.PENDING_ADD;
+
+ /**
+ * The state of the tween when it was paused (used by Resume)
+ *
+ * @name Phaser.Tweens.Tween#_pausedState
+ * @type {integer}
+ * @private
+ * @since 3.0.0
+ */
+ this._pausedState = TWEEN_CONST.PENDING_ADD;
+
+ /**
+ * Does the Tween start off paused? (if so it needs to be started with Tween.play)
+ *
+ * @name Phaser.Tweens.Tween#paused
+ * @type {boolean}
+ * @default false
+ * @since 3.0.0
+ */
+ this.paused = false;
+
+ /**
+ * Elapsed time in ms/frames of this run through the Tween.
+ *
+ * @name Phaser.Tweens.Tween#elapsed
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.elapsed = 0;
+
+ /**
+ * Total elapsed time in ms/frames of the entire Tween, including looping.
+ *
+ * @name Phaser.Tweens.Tween#totalElapsed
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.totalElapsed = 0;
+
+ /**
+ * Time in ms/frames for the whole Tween to play through once, excluding loop amounts and loop delays.
+ *
+ * @name Phaser.Tweens.Tween#duration
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.duration = 0;
+
+ /**
+ * Value between 0 and 1. The amount through the Tween, excluding loops.
+ *
+ * @name Phaser.Tweens.Tween#progress
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.progress = 0;
+
+ /**
+ * Time in ms/frames for the Tween to complete (including looping)
+ *
+ * @name Phaser.Tweens.Tween#totalDuration
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.totalDuration = 0;
+
+ /**
+ * Value between 0 and 1. The amount through the entire Tween, including looping.
+ *
+ * @name Phaser.Tweens.Tween#totalProgress
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.totalProgress = 0;
+
+ /**
+ * An object containing the various Tween callback references.
+ *
+ * @name Phaser.Tweens.Tween#callbacks
+ * @type {object}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.callbacks = {
+ onComplete: null,
+ onLoop: null,
+ onRepeat: null,
+ onStart: null,
+ onUpdate: null,
+ onYoyo: null
+ };
+
+ this.callbackScope;
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#getValue
+ * @since 3.0.0
+ *
+ * @return {number} [description]
+ */
+ getValue: function ()
+ {
+ return this.data[0].current;
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#setTimeScale
+ * @since 3.0.0
+ *
+ * @param {number} value - [description]
+ *
+ * @return {Phaser.Tweens.Tween} This Tween object.
+ */
+ setTimeScale: function (value)
+ {
+ this.timeScale = value;
+
+ return this;
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#getTimeScale
+ * @since 3.0.0
+ *
+ * @return {number} [description]
+ */
+ getTimeScale: function ()
+ {
+ return this.timeScale;
+ },
+
+ /**
+ * Checks if the Tween is currently active.
+ *
+ * @method Phaser.Tweens.Tween#isPlaying
+ * @since 3.0.0
+ *
+ * @return {boolean} `true` if the Tween is active, otherwise `false`.
+ */
+ isPlaying: function ()
+ {
+ return (this.state === TWEEN_CONST.ACTIVE);
+ },
+
+ /**
+ * Checks if the Tween is currently paused.
+ *
+ * @method Phaser.Tweens.Tween#isPaused
+ * @since 3.0.0
+ *
+ * @return {boolean} `true` if the Tween is paused, otherwise `false`.
+ */
+ isPaused: function ()
+ {
+ return (this.state === TWEEN_CONST.PAUSED);
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#hasTarget
+ * @since 3.0.0
+ *
+ * @param {object} target - [description]
+ *
+ * @return {boolean} [description]
+ */
+ hasTarget: function (target)
+ {
+ return (this.targets.indexOf(target) !== -1);
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#updateTo
+ * @since 3.0.0
+ *
+ * @param {string} key - [description]
+ * @param {*} value - [description]
+ * @param {boolean} startToCurrent - [description]
+ *
+ * @return {Phaser.Tweens.Tween} This Tween object.
+ */
+ updateTo: function (key, value, startToCurrent)
+ {
+ for (var i = 0; i < this.totalData; i++)
+ {
+ var tweenData = this.data[i];
+
+ if (tweenData.key === key)
+ {
+ tweenData.end = value;
+
+ if (startToCurrent)
+ {
+ tweenData.start = tweenData.current;
+ }
+
+ break;
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#restart
+ * @since 3.0.0
+ */
+ restart: function ()
+ {
+ if (this.state === TWEEN_CONST.REMOVED)
+ {
+ this.seek(0);
+ this.parent.makeActive(this);
+ }
+ else
+ {
+ this.stop();
+ this.play();
+ }
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#calcDuration
+ * @since 3.0.0
+ */
+ calcDuration: function ()
+ {
+ var max = 0;
+
+ var data = this.data;
+
+ for (var i = 0; i < this.totalData; i++)
+ {
+ var tweenData = data[i];
+
+ // Set t1 (duration + hold + yoyo)
+ tweenData.t1 = tweenData.duration + tweenData.hold;
+
+ if (tweenData.yoyo)
+ {
+ tweenData.t1 += tweenData.duration;
+ }
+
+ // Set t2 (repeatDelay + duration + hold + yoyo)
+ tweenData.t2 = tweenData.t1 + tweenData.repeatDelay;
+
+ // Total Duration
+ tweenData.totalDuration = tweenData.delay + tweenData.t1;
+
+ if (tweenData.repeat === -1)
+ {
+ tweenData.totalDuration += (tweenData.t2 * 999999999999);
+ }
+ else if (tweenData.repeat > 0)
+ {
+ tweenData.totalDuration += (tweenData.t2 * tweenData.repeat);
+ }
+
+ if (tweenData.totalDuration > max)
+ {
+ // Get the longest TweenData from the Tween, used to calculate the Tween TD
+ max = tweenData.totalDuration;
+ }
+ }
+
+ // Excludes loop values
+ this.duration = max;
+
+ this.loopCounter = (this.loop === -1) ? 999999999999 : this.loop;
+
+ if (this.loopCounter > 0)
+ {
+ this.totalDuration = this.duration + this.completeDelay + ((this.duration + this.loopDelay) * this.loopCounter);
+ }
+ else
+ {
+ this.totalDuration = this.duration + this.completeDelay;
+ }
+ },
+
+ /**
+ * Called by TweenManager.preUpdate as part of its loop to check pending and active tweens.
+ * Should not be called directly.
+ *
+ * @method Phaser.Tweens.Tween#init
+ * @since 3.0.0
+ *
+ * @return {boolean} Returns `true` if this Tween should be moved from the pending list to the active list by the Tween Manager.
+ */
+ init: function ()
+ {
+ var data = this.data;
+ var totalTargets = this.totalTargets;
+
+ for (var i = 0; i < this.totalData; i++)
+ {
+ var tweenData = data[i];
+ var target = tweenData.target;
+ var gen = tweenData.gen;
+
+ tweenData.delay = gen.delay(i, totalTargets, target);
+ tweenData.duration = gen.duration(i, totalTargets, target);
+ tweenData.hold = gen.hold(i, totalTargets, target);
+ tweenData.repeat = gen.repeat(i, totalTargets, target);
+ tweenData.repeatDelay = gen.repeatDelay(i, totalTargets, target);
+ }
+
+ this.calcDuration();
+
+ this.progress = 0;
+ this.totalProgress = 0;
+ this.elapsed = 0;
+ this.totalElapsed = 0;
+
+ // You can't have a paused Tween if it's part of a Timeline
+ if (this.paused && !this.parentIsTimeline)
+ {
+ this.state = TWEEN_CONST.PENDING_ADD;
+ this._pausedState = TWEEN_CONST.INIT;
+
+ return false;
+ }
+ else
+ {
+ this.state = TWEEN_CONST.INIT;
+
+ return true;
+ }
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#nextState
+ * @since 3.0.0
+ */
+ nextState: function ()
+ {
+ if (this.loopCounter > 0)
+ {
+ this.elapsed = 0;
+ this.progress = 0;
+ this.loopCounter--;
+
+ var onLoop = this.callbacks.onLoop;
+
+ if (onLoop)
+ {
+ onLoop.params[1] = this.targets;
+
+ onLoop.func.apply(onLoop.scope, onLoop.params);
+ }
+
+ this.resetTweenData(true);
+
+ if (this.loopDelay > 0)
+ {
+ this.countdown = this.loopDelay;
+ this.state = TWEEN_CONST.LOOP_DELAY;
+ }
+ else
+ {
+ this.state = TWEEN_CONST.ACTIVE;
+ }
+ }
+ else if (this.completeDelay > 0)
+ {
+ this.countdown = this.completeDelay;
+ this.state = TWEEN_CONST.COMPLETE_DELAY;
+ }
+ else
+ {
+ var onComplete = this.callbacks.onComplete;
+
+ if (onComplete)
+ {
+ onComplete.params[1] = this.targets;
+
+ onComplete.func.apply(onComplete.scope, onComplete.params);
+ }
+
+ this.state = TWEEN_CONST.PENDING_REMOVE;
+ }
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#pause
+ * @since 3.0.0
+ *
+ * @return {Phaser.Tweens.Tween} This Tween object.
+ */
+ pause: function ()
+ {
+ if (this.state === TWEEN_CONST.PAUSED)
+ {
+ return;
+ }
+
+ this.paused = true;
+
+ this._pausedState = this.state;
+
+ this.state = TWEEN_CONST.PAUSED;
+
+ return this;
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#play
+ * @since 3.0.0
+ *
+ * @param {boolean} resetFromTimeline - [description]
+ */
+ play: function (resetFromTimeline)
+ {
+ if (this.state === TWEEN_CONST.ACTIVE)
+ {
+ return;
+ }
+ else if (this.state === TWEEN_CONST.PENDING_REMOVE || this.state === TWEEN_CONST.REMOVED)
+ {
+ this.init();
+ this.parent.makeActive(this);
+ resetFromTimeline = true;
+ }
+
+ var onStart = this.callbacks.onStart;
+
+ if (this.parentIsTimeline)
+ {
+ this.resetTweenData(resetFromTimeline);
+
+ if (this.calculatedOffset === 0)
+ {
+ if (onStart)
+ {
+ onStart.params[1] = this.targets;
+
+ onStart.func.apply(onStart.scope, onStart.params);
+ }
+
+ this.state = TWEEN_CONST.ACTIVE;
+ }
+ else
+ {
+ this.countdown = this.calculatedOffset;
+
+ this.state = TWEEN_CONST.OFFSET_DELAY;
+ }
+ }
+ else if (this.paused)
+ {
+ this.paused = false;
+
+ this.parent.makeActive(this);
+ }
+ else
+ {
+ this.resetTweenData(resetFromTimeline);
+
+ this.state = TWEEN_CONST.ACTIVE;
+
+ if (onStart)
+ {
+ onStart.params[1] = this.targets;
+
+ onStart.func.apply(onStart.scope, onStart.params);
+ }
+
+ this.parent.makeActive(this);
+ }
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#resetTweenData
+ * @since 3.0.0
+ *
+ * @param {boolean} resetFromLoop - [description]
+ */
+ resetTweenData: function (resetFromLoop)
+ {
+ var data = this.data;
+
+ for (var i = 0; i < this.totalData; i++)
+ {
+ var tweenData = data[i];
+
+ tweenData.progress = 0;
+ tweenData.elapsed = 0;
+
+ tweenData.repeatCounter = (tweenData.repeat === -1) ? 999999999999 : tweenData.repeat;
+
+ if (resetFromLoop)
+ {
+ tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start);
+
+ tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.end);
+
+ tweenData.current = tweenData.start;
+
+ tweenData.state = TWEEN_CONST.PLAYING_FORWARD;
+ }
+ else if (tweenData.delay > 0)
+ {
+ tweenData.elapsed = tweenData.delay;
+ tweenData.state = TWEEN_CONST.DELAY;
+ }
+ else
+ {
+ tweenData.state = TWEEN_CONST.PENDING_RENDER;
+ }
+ }
+ },
+
+ /**
+ * Resumes the playback of a previously paused Tween.
+ *
+ * @method Phaser.Tweens.Tween#resume
+ * @since 3.0.0
+ *
+ * @return {Phaser.Tweens.Tween} This Tween object.
+ */
+ resume: function ()
+ {
+ if (this.state === TWEEN_CONST.PAUSED)
+ {
+ this.paused = false;
+
+ this.state = this._pausedState;
+ }
+ else
+ {
+ this.play();
+ }
+
+ return this;
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#seek
+ * @since 3.0.0
+ *
+ * @param {number} toPosition - A value between 0 and 1.
+ */
+ seek: function (toPosition)
+ {
+ var data = this.data;
+
+ for (var i = 0; i < this.totalData; i++)
+ {
+ // This won't work with loop > 0 yet
+ var ms = this.totalDuration * toPosition;
+
+ var tweenData = data[i];
+ var progress = 0;
+ var elapsed = 0;
+
+ if (ms <= tweenData.delay)
+ {
+ progress = 0;
+ elapsed = 0;
+ }
+ else if (ms >= tweenData.totalDuration)
+ {
+ progress = 1;
+ elapsed = tweenData.duration;
+ }
+ else if (ms > tweenData.delay && ms <= tweenData.t1)
+ {
+ // Keep it zero bound
+ ms = Math.max(0, ms - tweenData.delay);
+
+ // Somewhere in the first playthru range
+ progress = ms / tweenData.t1;
+ elapsed = tweenData.duration * progress;
+ }
+ else if (ms > tweenData.t1 && ms < tweenData.totalDuration)
+ {
+ // Somewhere in repeat land
+ ms -= tweenData.delay;
+ ms -= tweenData.t1;
+
+ // var repeats = Math.floor(ms / tweenData.t2);
+
+ // remainder
+ ms = ((ms / tweenData.t2) % 1) * tweenData.t2;
+
+ if (ms > tweenData.repeatDelay)
+ {
+ progress = ms / tweenData.t1;
+ elapsed = tweenData.duration * progress;
+ }
+ }
+
+ tweenData.progress = progress;
+ tweenData.elapsed = elapsed;
+
+ var v = tweenData.ease(tweenData.progress);
+
+ tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v);
+
+ // console.log(tweenData.key, 'Seek', tweenData.target[tweenData.key], 'to', tweenData.current, 'pro', tweenData.progress, 'marker', toPosition, progress);
+
+ // if (tweenData.current === 0)
+ // {
+ // console.log('zero', tweenData.start, tweenData.end, v, 'progress', progress);
+ // }
+
+ tweenData.target[tweenData.key] = tweenData.current;
+ }
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#setCallback
+ * @since 3.0.0
+ *
+ * @param {string} type - [description]
+ * @param {function} callback - [description]
+ * @param {array} [params] - [description]
+ * @param {object} [scope] - [description]
+ *
+ * @return {Phaser.Tweens.Tween} This Tween object.
+ */
+ setCallback: function (type, callback, params, scope)
+ {
+ this.callbacks[type] = { func: callback, scope: scope, params: params };
+
+ return this;
+ },
+
+ /**
+ * Flags the Tween as being complete, whatever stage of progress it is at.
+ *
+ * If an onComplete callback has been defined it will automatically invoke it, unless a `delay`
+ * argument is provided, in which case the Tween will delay for that period of time before calling the callback.
+ *
+ * If you don't need a delay, or have an onComplete callback, then call `Tween.stop` instead.
+ *
+ * @method Phaser.Tweens.Tween#complete
+ * @since 3.2.0
+ *
+ * @param {number} [delay=0] - The time to wait before invoking the complete callback. If zero it will fire immediately.
+ */
+ complete: function (delay)
+ {
+ if (delay === undefined) { delay = 0; }
+
+ if (delay)
+ {
+ this.countdown = delay;
+ this.state = TWEEN_CONST.COMPLETE_DELAY;
+ }
+ else
+ {
+ var onComplete = this.callbacks.onComplete;
+
+ if (onComplete)
+ {
+ onComplete.params[1] = this.targets;
+
+ onComplete.func.apply(onComplete.scope, onComplete.params);
+ }
+
+ this.state = TWEEN_CONST.PENDING_REMOVE;
+ }
+ },
+
+ /**
+ * Stops the Tween immediately, whatever stage of progress it is at and flags it for removal by the TweenManager.
+ *
+ * @method Phaser.Tweens.Tween#stop
+ * @since 3.0.0
+ *
+ * @param {number} [resetTo] - A value between 0 and 1.
+ */
+ stop: function (resetTo)
+ {
+ if (this.state === TWEEN_CONST.ACTIVE)
+ {
+ if (resetTo !== undefined)
+ {
+ this.seek(resetTo);
+ }
+ }
+
+ if (this.state !== TWEEN_CONST.REMOVED)
+ {
+ if (this.state === TWEEN_CONST.PAUSED || this.state === TWEEN_CONST.PENDING_ADD)
+ {
+ this.parent._destroy.push(this);
+ this.parent._toProcess++;
+ }
+
+ this.state = TWEEN_CONST.PENDING_REMOVE;
+ }
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#update
+ * @since 3.0.0
+ *
+ * @param {number} timestamp - [description]
+ * @param {number} delta - The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.
+ *
+ * @return {boolean} Returns `true` if this Tween has finished and should be removed from the Tween Manager, otherwise returns `false`.
+ */
+ update: function (timestamp, delta)
+ {
+ if (this.state === TWEEN_CONST.PAUSED)
+ {
+ return false;
+ }
+
+ if (this.useFrames)
+ {
+ delta = 1 * this.parent.timeScale;
+ }
+
+ delta *= this.timeScale;
+
+ this.elapsed += delta;
+ this.progress = Math.min(this.elapsed / this.duration, 1);
+
+ this.totalElapsed += delta;
+ this.totalProgress = Math.min(this.totalElapsed / this.totalDuration, 1);
+
+ switch (this.state)
+ {
+ case TWEEN_CONST.ACTIVE:
+
+ var stillRunning = false;
+
+ for (var i = 0; i < this.totalData; i++)
+ {
+ if (this.updateTweenData(this, this.data[i], delta))
+ {
+ stillRunning = true;
+ }
+ }
+
+ // Anything still running? If not, we're done
+ if (!stillRunning)
+ {
+ this.nextState();
+ }
+
+ break;
+
+ case TWEEN_CONST.LOOP_DELAY:
+
+ this.countdown -= delta;
+
+ if (this.countdown <= 0)
+ {
+ this.state = TWEEN_CONST.ACTIVE;
+ }
+
+ break;
+
+ case TWEEN_CONST.OFFSET_DELAY:
+
+ this.countdown -= delta;
+
+ if (this.countdown <= 0)
+ {
+ var onStart = this.callbacks.onStart;
+
+ if (onStart)
+ {
+ onStart.params[1] = this.targets;
+
+ onStart.func.apply(onStart.scope, onStart.params);
+ }
+
+ this.state = TWEEN_CONST.ACTIVE;
+ }
+
+ break;
+
+ case TWEEN_CONST.COMPLETE_DELAY:
+
+ this.countdown -= delta;
+
+ if (this.countdown <= 0)
+ {
+ var onComplete = this.callbacks.onComplete;
+
+ if (onComplete)
+ {
+ onComplete.func.apply(onComplete.scope, onComplete.params);
+ }
+
+ this.state = TWEEN_CONST.PENDING_REMOVE;
+ }
+
+ break;
+ }
+
+ return (this.state === TWEEN_CONST.PENDING_REMOVE);
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#setStateFromEnd
+ * @since 3.0.0
+ *
+ * @param {Phaser.Tweens.Tween} tween - [description]
+ * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description]
+ * @param {number} diff - [description]
+ *
+ * @return {integer} The state of this Tween.
+ */
+ setStateFromEnd: function (tween, tweenData, diff)
+ {
+ if (tweenData.yoyo)
+ {
+ // We've hit the end of a Playing Forward TweenData and we have a yoyo
+
+ // Account for any extra time we got from the previous frame
+ tweenData.elapsed = diff;
+ tweenData.progress = diff / tweenData.duration;
+
+ if (tweenData.flipX)
+ {
+ tweenData.target.toggleFlipX();
+ }
+
+ // Problem: The flip and callback and so on gets called for every TweenData that triggers it at the same time.
+ // If you're tweening several properties it can fire for all of them, at once.
+
+ if (tweenData.flipY)
+ {
+ tweenData.target.toggleFlipY();
+ }
+
+ var onYoyo = tween.callbacks.onYoyo;
+
+ if (onYoyo)
+ {
+ // Element 1 is reserved for the target of the yoyo (and needs setting here)
+ onYoyo.params[1] = tweenData.target;
+
+ onYoyo.func.apply(onYoyo.scope, onYoyo.params);
+ }
+
+ tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start);
+
+ return TWEEN_CONST.PLAYING_BACKWARD;
+ }
+ else if (tweenData.repeatCounter > 0)
+ {
+ // We've hit the end of a Playing Forward TweenData and we have a Repeat.
+ // So we're going to go right back to the start to repeat it again.
+
+ tweenData.repeatCounter--;
+
+ // Account for any extra time we got from the previous frame
+ tweenData.elapsed = diff;
+ tweenData.progress = diff / tweenData.duration;
+
+ if (tweenData.flipX)
+ {
+ tweenData.target.toggleFlipX();
+ }
+
+ if (tweenData.flipY)
+ {
+ tweenData.target.toggleFlipY();
+ }
+
+ var onRepeat = tween.callbacks.onRepeat;
+
+ if (onRepeat)
+ {
+ // Element 1 is reserved for the target of the repeat (and needs setting here)
+ onRepeat.params[1] = tweenData.target;
+
+ onRepeat.func.apply(onRepeat.scope, onRepeat.params);
+ }
+
+ tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.start);
+
+ tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start);
+
+ // Delay?
+ if (tweenData.repeatDelay > 0)
+ {
+ tweenData.elapsed = tweenData.repeatDelay - diff;
+
+ tweenData.current = tweenData.start;
+
+ tweenData.target[tweenData.key] = tweenData.current;
+
+ return TWEEN_CONST.REPEAT_DELAY;
+ }
+ else
+ {
+ return TWEEN_CONST.PLAYING_FORWARD;
+ }
+ }
+
+ return TWEEN_CONST.COMPLETE;
+ },
+
+ /**
+ * Was PLAYING_BACKWARD and has hit the start.
+ *
+ * @method Phaser.Tweens.Tween#setStateFromStart
+ * @since 3.0.0
+ *
+ * @param {Phaser.Tweens.Tween} tween - [description]
+ * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description]
+ * @param {number} diff - [description]
+ *
+ * @return {integer} The state of this Tween.
+ */
+ setStateFromStart: function (tween, tweenData, diff)
+ {
+ if (tweenData.repeatCounter > 0)
+ {
+ tweenData.repeatCounter--;
+
+ // Account for any extra time we got from the previous frame
+ tweenData.elapsed = diff;
+ tweenData.progress = diff / tweenData.duration;
+
+ if (tweenData.flipX)
+ {
+ tweenData.target.toggleFlipX();
+ }
+
+ if (tweenData.flipY)
+ {
+ tweenData.target.toggleFlipY();
+ }
+
+ var onRepeat = tween.callbacks.onRepeat;
+
+ if (onRepeat)
+ {
+ // Element 1 is reserved for the target of the repeat (and needs setting here)
+ onRepeat.params[1] = tweenData.target;
+
+ onRepeat.func.apply(onRepeat.scope, onRepeat.params);
+ }
+
+ tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start);
+
+ // Delay?
+ if (tweenData.repeatDelay > 0)
+ {
+ tweenData.elapsed = tweenData.repeatDelay - diff;
+
+ tweenData.current = tweenData.start;
+
+ tweenData.target[tweenData.key] = tweenData.current;
+
+ return TWEEN_CONST.REPEAT_DELAY;
+ }
+ else
+ {
+ return TWEEN_CONST.PLAYING_FORWARD;
+ }
+ }
+
+ return TWEEN_CONST.COMPLETE;
+ },
+
+ //
+ /**
+ * [description]
+ *
+ * @method Phaser.Tweens.Tween#updateTweenData
+ * @since 3.0.0
+ *
+ * @param {Phaser.Tweens.Tween} tween - [description]
+ * @param {Phaser.Tweens.TweenDataConfig} tweenData - [description]
+ * @param {number} delta - Either a value in ms, or 1 if Tween.useFrames is true
+ *
+ * @return {boolean} [description]
+ */
+ updateTweenData: function (tween, tweenData, delta)
+ {
+ switch (tweenData.state)
+ {
+ case TWEEN_CONST.PLAYING_FORWARD:
+ case TWEEN_CONST.PLAYING_BACKWARD:
+
+ if (!tweenData.target)
+ {
+ tweenData.state = TWEEN_CONST.COMPLETE;
+ break;
+ }
+
+ var elapsed = tweenData.elapsed;
+ var duration = tweenData.duration;
+ var diff = 0;
+
+ elapsed += delta;
+
+ if (elapsed > duration)
+ {
+ diff = elapsed - duration;
+ elapsed = duration;
+ }
+
+ var forward = (tweenData.state === TWEEN_CONST.PLAYING_FORWARD);
+ var progress = elapsed / duration;
+
+ var v;
+
+ if (forward)
+ {
+ v = tweenData.ease(progress);
+ }
+ else
+ {
+ v = tweenData.ease(1 - progress);
+ }
+
+ tweenData.current = tweenData.start + ((tweenData.end - tweenData.start) * v);
+
+ tweenData.target[tweenData.key] = tweenData.current;
+
+ tweenData.elapsed = elapsed;
+ tweenData.progress = progress;
+
+ var onUpdate = tween.callbacks.onUpdate;
+
+ if (onUpdate)
+ {
+ onUpdate.params[1] = tweenData.target;
+
+ onUpdate.func.apply(onUpdate.scope, onUpdate.params);
+ }
+
+ if (progress === 1)
+ {
+ if (forward)
+ {
+ if (tweenData.hold > 0)
+ {
+ tweenData.elapsed = tweenData.hold - diff;
+
+ tweenData.state = TWEEN_CONST.HOLD_DELAY;
+ }
+ else
+ {
+ tweenData.state = this.setStateFromEnd(tween, tweenData, diff);
+ }
+ }
+ else
+ {
+ tweenData.state = this.setStateFromStart(tween, tweenData, diff);
+ }
+ }
+
+ break;
+
+ case TWEEN_CONST.DELAY:
+
+ tweenData.elapsed -= delta;
+
+ if (tweenData.elapsed <= 0)
+ {
+ tweenData.elapsed = Math.abs(tweenData.elapsed);
+
+ tweenData.state = TWEEN_CONST.PENDING_RENDER;
+ }
+
+ break;
+
+ case TWEEN_CONST.REPEAT_DELAY:
+
+ tweenData.elapsed -= delta;
+
+ if (tweenData.elapsed <= 0)
+ {
+ tweenData.elapsed = Math.abs(tweenData.elapsed);
+
+ tweenData.state = TWEEN_CONST.PLAYING_FORWARD;
+ }
+
+ break;
+
+ case TWEEN_CONST.HOLD_DELAY:
+
+ tweenData.elapsed -= delta;
+
+ if (tweenData.elapsed <= 0)
+ {
+ tweenData.state = this.setStateFromEnd(tween, tweenData, Math.abs(tweenData.elapsed));
+ }
+
+ break;
+
+ case TWEEN_CONST.PENDING_RENDER:
+
+ if (tweenData.target)
+ {
+ tweenData.start = tweenData.getStartValue(tweenData.target, tweenData.key, tweenData.target[tweenData.key]);
+
+ tweenData.end = tweenData.getEndValue(tweenData.target, tweenData.key, tweenData.start);
+
+ tweenData.current = tweenData.start;
+
+ tweenData.target[tweenData.key] = tweenData.start;
+
+ tweenData.state = TWEEN_CONST.PLAYING_FORWARD;
+ }
+ else
+ {
+ tweenData.state = TWEEN_CONST.COMPLETE;
+ }
+
+ break;
+ }
+
+ // Return TRUE if this TweenData still playing, otherwise return FALSE
+ return (tweenData.state !== TWEEN_CONST.COMPLETE);
+ }
+
+});
+
+Tween.TYPES = [
+ 'onComplete',
+ 'onLoop',
+ 'onRepeat',
+ 'onStart',
+ 'onUpdate',
+ 'onYoyo'
+];
+
+/**
+ * Creates a new Tween object.
+ *
+ * Note: This method will only be available Tweens have been built into Phaser.
+ *
+ * @method Phaser.GameObjects.GameObjectFactory#tween
+ * @since 3.0.0
+ *
+ * @param {object} config - The Tween configuration.
+ *
+ * @return {Phaser.Tweens.Tween} The Tween that was created.
+ */
+GameObjectFactory.register('tween', function (config)
+{
+ return this.scene.sys.tweens.add(config);
+});
+
+// When registering a factory function 'this' refers to the GameObjectFactory context.
+//
+// There are several properties available to use:
+//
+// this.scene - a reference to the Scene that owns the GameObjectFactory
+// this.displayList - a reference to the Display List the Scene owns
+// this.updateList - a reference to the Update List the Scene owns
+
+/**
+ * Creates a new Tween object and returns it.
+ *
+ * Note: This method will only be available if Tweens have been built into Phaser.
+ *
+ * @method Phaser.GameObjects.GameObjectCreator#tween
+ * @since 3.0.0
+ *
+ * @param {object} config - The Tween configuration.
+ *
+ * @return {Phaser.Tweens.Tween} The Tween that was created.
+ */
+GameObjectCreator.register('tween', function (config)
+{
+ return this.scene.sys.tweens.create(config);
+});
+
+// When registering a factory function 'this' refers to the GameObjectCreator context.
+
+module.exports = Tween;
+
+
+/***/ }),
+/* 129 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @typedef {object} Phaser.Tweens.TweenConfigDefaults
+ *
+ * @property {(object|object[])} targets - The object, or an array of objects, to run the tween on.
+ * @property {number} [delay=0] - The number of milliseconds to delay before the tween will start.
+ * @property {number} [duration=1000] - The duration of the tween in milliseconds.
+ * @property {string} [ease='Power0'] - The easing equation to use for the tween.
+ * @property {array} [easeParams] - Optional easing parameters.
+ * @property {number} [hold=0] - The number of milliseconds to hold the tween for before yoyo'ing.
+ * @property {number} [repeat=0] - The number of times to repeat the tween.
+ * @property {number} [repeatDelay=0] - The number of milliseconds to pause before a tween will repeat.
+ * @property {boolean} [yoyo=false] - Should the tween complete, then reverse the values incrementally to get back to the starting tween values? The reverse tweening will also take `duration` milliseconds to complete.
+ * @property {boolean} [flipX=false] - Horizontally flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipX` property.
+ * @property {boolean} [flipY=false] - Vertically flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipY` property.
+ */
+
+var TWEEN_DEFAULTS = {
+ targets: null,
+ delay: 0,
+ duration: 1000,
+ ease: 'Power0',
+ easeParams: null,
+ hold: 0,
+ repeat: 0,
+ repeatDelay: 0,
+ yoyo: false,
+ flipX: false,
+ flipY: false
+};
+
+module.exports = TWEEN_DEFAULTS;
+
+
+/***/ }),
+/* 130 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+function hasGetStart (def)
+{
+ return (!!def.getStart && typeof def.getStart === 'function');
+}
+
+function hasGetEnd (def)
+{
+ return (!!def.getEnd && typeof def.getEnd === 'function');
+}
+
+function hasGetters (def)
+{
+ return hasGetStart(def) || hasGetEnd(def);
+}
+
+/**
+ * [description]
+ *
+ * @function Phaser.Tweens.Builders.GetValueOp
+ * @since 3.0.0
+ *
+ * @param {string} key - [description]
+ * @param {*} propertyValue - [description]
+ *
+ * @return {function} [description]
+ */
+var GetValueOp = function (key, propertyValue)
+{
+ var callbacks;
+
+ // The returned value sets what the property will be at the END of the Tween (usually called at the start of the Tween)
+ var getEnd = function (target, key, value) { return value; };
+
+ // The returned value sets what the property will be at the START of the Tween (usually called at the end of the Tween)
+ var getStart = function (target, key, value) { return value; };
+
+ var t = typeof(propertyValue);
+
+ if (t === 'number')
+ {
+ // props: {
+ // x: 400,
+ // y: 300
+ // }
+
+ getEnd = function ()
+ {
+ return propertyValue;
+ };
+ }
+ else if (t === 'string')
+ {
+ // props: {
+ // x: '+=400',
+ // y: '-=300',
+ // z: '*=2',
+ // w: '/=2'
+ // }
+
+ var op = propertyValue[0];
+ var num = parseFloat(propertyValue.substr(2));
+
+ switch (op)
+ {
+ case '+':
+ getEnd = function (target, key, value)
+ {
+ return value + num;
+ };
+ break;
+
+ case '-':
+ getEnd = function (target, key, value)
+ {
+ return value - num;
+ };
+ break;
+
+ case '*':
+ getEnd = function (target, key, value)
+ {
+ return value * num;
+ };
+ break;
+
+ case '/':
+ getEnd = function (target, key, value)
+ {
+ return value / num;
+ };
+ break;
+
+ default:
+ getEnd = function ()
+ {
+ return parseFloat(propertyValue);
+ };
+ }
+ }
+ else if (t === 'function')
+ {
+ // The same as setting just the getEnd function and no getStart
+
+ // props: {
+ // x: function (target, key, value) { return value + 50); },
+ // }
+
+ getEnd = propertyValue;
+ }
+ else if (t === 'object' && hasGetters(propertyValue))
+ {
+ /*
+ x: {
+ // Called at the start of the Tween. The returned value sets what the property will be at the END of the Tween.
+ getEnd: function (target, key, value)
+ {
+ return value;
+ },
+
+ // Called at the end of the Tween. The returned value sets what the property will be at the START of the Tween.
+ getStart: function (target, key, value)
+ {
+ return value;
+ }
+ }
+ */
+
+ if (hasGetEnd(propertyValue))
+ {
+ getEnd = propertyValue.getEnd;
+ }
+
+ if (hasGetStart(propertyValue))
+ {
+ getStart = propertyValue.getStart;
+ }
+ }
+ else if (propertyValue.hasOwnProperty('value'))
+ {
+ // Value may still be a string, function or a number
+ // props: {
+ // x: { value: 400, ... },
+ // y: { value: 300, ... }
+ // }
+
+ callbacks = GetValueOp(key, propertyValue.value);
+ }
+
+ // If callback not set by the else if block above then set it here and return it
+ if (!callbacks)
+ {
+ callbacks = {
+ getEnd: getEnd,
+ getStart: getStart
+ };
+ }
+
+ return callbacks;
+};
+
+module.exports = GetValueOp;
+
+
+/***/ }),
+/* 131 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var GetValue = __webpack_require__(4);
+
+/**
+ * [description]
+ *
+ * @function Phaser.Tweens.Builders.GetTargets
+ * @since 3.0.0
+ *
+ * @param {object} config - [description]
+ *
+ * @return {array} [description]
+ */
+var GetTargets = function (config)
+{
+ var targets = GetValue(config, 'targets', null);
+
+ if (targets === null)
+ {
+ return targets;
+ }
+
+ if (typeof targets === 'function')
+ {
+ targets = targets.call();
+ }
+
+ if (!Array.isArray(targets))
+ {
+ targets = [ targets ];
+ }
+
+ return targets;
+};
+
+module.exports = GetTargets;
+
+
+/***/ }),
+/* 132 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Formats = __webpack_require__(29);
+var MapData = __webpack_require__(77);
+var Parse = __webpack_require__(217);
+var Tilemap = __webpack_require__(209);
+
+/**
+ * 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
+ * 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.
+ *
+ * @function Phaser.Tilemaps.ParseToTilemap
+ * @since 3.0.0
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Tilemap belongs.
+ * @param {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data.
+ * @param {integer} [tileWidth=32] - The width of a tile in pixels.
+ * @param {integer} [tileHeight=32] - The height of a tile in pixels.
+ * @param {integer} [width=10] - The width of the map in tiles.
+ * @param {integer} [height=10] - The height of the map in tiles.
+ * @param {integer[][]} [data] - Instead of loading from the cache, you can also load directly from
+ * a 2D array of tile indexes.
+ * @param {boolean} [insertNull=false] - 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.
+ *
+ * @return {Phaser.Tilemaps.Tilemap}
+ */
+var ParseToTilemap = function (scene, key, tileWidth, tileHeight, width, height, data, insertNull)
+{
+ if (tileWidth === undefined) { tileWidth = 32; }
+ if (tileHeight === undefined) { tileHeight = 32; }
+ if (width === undefined) { width = 10; }
+ if (height === undefined) { height = 10; }
+ if (insertNull === undefined) { insertNull = false; }
+
+ var mapData = null;
+
+ if (Array.isArray(data))
+ {
+ var name = key !== undefined ? key : 'map';
+ mapData = Parse(name, Formats.ARRAY_2D, data, tileWidth, tileHeight, insertNull);
+ }
+ else if (key !== undefined)
+ {
+ var tilemapData = scene.cache.tilemap.get(key);
+
+ if (!tilemapData)
+ {
+ console.warn('No map data found for key ' + key);
+ }
+ else
+ {
+ mapData = Parse(key, tilemapData.format, tilemapData.data, tileWidth, tileHeight, insertNull);
+ }
+ }
+
+ if (mapData === null)
+ {
+ mapData = new MapData({
+ tileWidth: tileWidth,
+ tileHeight: tileHeight,
+ width: width,
+ height: height
+ });
+ }
+
+ return new Tilemap(scene, mapData);
+};
+
+module.exports = ParseToTilemap;
+
+
+/***/ }),
+/* 133 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Formats = __webpack_require__(29);
+var LayerData = __webpack_require__(78);
+var MapData = __webpack_require__(77);
+var Tile = __webpack_require__(55);
+
+/**
+ * Parses a 2D array of tile indexes into a new MapData object with a single layer.
+ *
+ * @function Phaser.Tilemaps.Parsers.Parse2DArray
+ * @since 3.0.0
+ *
+ * @param {string} name - The name of the tilemap, used to set the name on the MapData.
+ * @param {integer[][]} data - 2D array, CSV string or Tiled JSON object.
+ * @param {integer} tileWidth - The width of a tile in pixels.
+ * @param {integer} tileHeight - The height of a tile in pixels.
+ * @param {boolean} 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.
+ *
+ * @return {Phaser.Tilemaps.MapData} [description]
+ */
+var Parse2DArray = function (name, data, tileWidth, tileHeight, insertNull)
+{
+ var layerData = new LayerData({
+ tileWidth: tileWidth,
+ tileHeight: tileHeight
+ });
+
+ var mapData = new MapData({
+ name: name,
+ tileWidth: tileWidth,
+ tileHeight: tileHeight,
+ format: Formats.ARRAY_2D,
+ layers: [ layerData ]
+ });
+
+ var tiles = [];
+ var height = data.length;
+ var width = 0;
+
+ for (var y = 0; y < data.length; y++)
+ {
+ tiles[y] = [];
+ var row = data[y];
+
+ for (var x = 0; x < row.length; x++)
+ {
+ var tileIndex = parseInt(row[x], 10);
+
+ if (isNaN(tileIndex) || tileIndex === -1)
+ {
+ tiles[y][x] = insertNull
+ ? null
+ : new Tile(layerData, -1, x, y, tileWidth, tileHeight);
+ }
+ else
+ {
+ tiles[y][x] = new Tile(layerData, tileIndex, x, y, tileWidth, tileHeight);
+ }
+ }
+
+ if (width === 0)
+ {
+ width = row.length;
+ }
+ }
+
+ mapData.width = layerData.width = width;
+ mapData.height = layerData.height = height;
+ mapData.widthInPixels = layerData.widthInPixels = width * tileWidth;
+ mapData.heightInPixels = layerData.heightInPixels = height * tileHeight;
+ layerData.data = tiles;
+
+ return mapData;
+};
+
+module.exports = Parse2DArray;
+
+
+/***/ }),
+/* 134 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Internally used method to keep track of the tile indexes that collide within a layer. This
+ * updates LayerData.collideIndexes to either contain or not contain the given `tileIndex`.
+ *
+ * @function Phaser.Tilemaps.Components.SetLayerCollisionIndex
+ * @private
+ * @since 3.0.0
+ *
+ * @param {integer} tileIndex - The tile index to set the collision boolean for.
+ * @param {boolean} [collides=true] - Should the tile index collide or not?
+ * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
+ */
+var SetLayerCollisionIndex = function (tileIndex, collides, layer)
+{
+ var loc = layer.collideIndexes.indexOf(tileIndex);
+
+ if (collides && loc === -1)
+ {
+ layer.collideIndexes.push(tileIndex);
+ }
+ else if (!collides && loc !== -1)
+ {
+ layer.collideIndexes.splice(loc, 1);
+ }
+};
+
+module.exports = SetLayerCollisionIndex;
+
+
+/***/ }),
+/* 135 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Tile = __webpack_require__(55);
+var IsInLayerBounds = __webpack_require__(79);
+var CalculateFacesAt = __webpack_require__(136);
+var SetTileCollision = __webpack_require__(56);
+
+/**
+ * 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.
+ *
+ * @function Phaser.Tilemaps.Components.PutTileAt
+ * @private
+ * @since 3.0.0
+ *
+ * @param {(integer|Phaser.Tilemaps.Tile)} tile - The index of this tile to set or a Tile object.
+ * @param {integer} tileX - The x coordinate, in tiles, not pixels.
+ * @param {integer} tileY - The y coordinate, in tiles, not pixels.
+ * @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
+ * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
+ *
+ * @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map.
+ */
+var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer)
+{
+ if (!IsInLayerBounds(tileX, tileY, layer)) { return null; }
+ if (recalculateFaces === undefined) { recalculateFaces = true; }
+
+ var oldTile = layer.data[tileY][tileX];
+ var oldTileCollides = oldTile && oldTile.collides;
+
+ if (tile instanceof Tile)
+ {
+ if (layer.data[tileY][tileX] === null)
+ {
+ layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, tile.width, tile.height);
+ }
+ layer.data[tileY][tileX].copy(tile);
+ }
+ else
+ {
+ var index = tile;
+ if (layer.data[tileY][tileX] === null)
+ {
+ layer.data[tileY][tileX] = new Tile(layer, index, tileX, tileY, layer.tileWidth, layer.tileHeight);
+ }
+ else
+ {
+ layer.data[tileY][tileX].index = index;
+ }
+ }
+
+ // Updating colliding flag on the new tile
+ var newTile = layer.data[tileY][tileX];
+ var collides = layer.collideIndexes.indexOf(newTile.index) !== -1;
+ SetTileCollision(newTile, collides);
+
+ // Recalculate faces only if the colliding flag at (tileX, tileY) has changed
+ if (recalculateFaces && (oldTileCollides !== newTile.collides))
+ {
+ CalculateFacesAt(tileX, tileY, layer);
+ }
+
+ return newTile;
+};
+
+module.exports = PutTileAt;
+
+
+
+/***/ }),
+/* 136 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var GetTileAt = __webpack_require__(102);
+
+/**
+ * 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.
+ *
+ * @function Phaser.Tilemaps.Components.CalculateFacesAt
+ * @private
+ * @since 3.0.0
+ *
+ * @param {integer} tileX - The x coordinate.
+ * @param {integer} tileY - The y coordinate.
+ * @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
+ */
+var CalculateFacesAt = function (tileX, tileY, layer)
+{
+ var tile = GetTileAt(tileX, tileY, true, layer);
+ var above = GetTileAt(tileX, tileY - 1, true, layer);
+ var below = GetTileAt(tileX, tileY + 1, true, layer);
+ var left = GetTileAt(tileX - 1, tileY, true, layer);
+ var right = GetTileAt(tileX + 1, tileY, true, layer);
+ var tileCollides = tile && tile.collides;
+
+ // Assume the changed tile has all interesting edges
+ if (tileCollides)
+ {
+ tile.faceTop = true;
+ tile.faceBottom = true;
+ tile.faceLeft = true;
+ tile.faceRight = true;
+ }
+
+ // Reset edges that are shared between tile and its neighbors
+ if (above && above.collides)
+ {
+ if (tileCollides) { tile.faceTop = false; }
+ above.faceBottom = !tileCollides;
+ }
+
+ if (below && below.collides)
+ {
+ if (tileCollides) { tile.faceBottom = false; }
+ below.faceTop = !tileCollides;
+ }
+
+ if (left && left.collides)
+ {
+ if (tileCollides) { tile.faceLeft = false; }
+ left.faceRight = !tileCollides;
+ }
+
+ if (right && right.collides)
+ {
+ if (tileCollides) { tile.faceRight = false; }
+ right.faceLeft = !tileCollides;
+ }
+
+ if (tile && !tile.collides) { tile.resetFaces(); }
+
+ return tile;
+};
+
+module.exports = CalculateFacesAt;
+
+
+/***/ }),
+/* 137 */,
+/* 138 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+// Adapted from [gl-matrix](https://github.com/toji/gl-matrix) by toji
+// and [vecmath](https://github.com/mattdesl/vecmath) by mattdesl
+
+var Class = __webpack_require__(0);
+
+/**
+ * @classdesc
+ * A representation of a vector in 3D space.
+ *
+ * A three-component vector.
+ *
+ * @class Vector3
+ * @memberof Phaser.Math
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {number} [x] - The x component.
+ * @param {number} [y] - The y component.
+ * @param {number} [z] - The z component.
+ */
+var Vector3 = new Class({
+
+ initialize:
+
+ function Vector3 (x, y, z)
+ {
+ /**
+ * The x component of this Vector.
+ *
+ * @name Phaser.Math.Vector3#x
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.x = 0;
+
+ /**
+ * The y component of this Vector.
+ *
+ * @name Phaser.Math.Vector3#y
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.y = 0;
+
+ /**
+ * The z component of this Vector.
+ *
+ * @name Phaser.Math.Vector3#z
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.z = 0;
+
+ if (typeof x === 'object')
+ {
+ this.x = x.x || 0;
+ this.y = x.y || 0;
+ this.z = x.z || 0;
+ }
+ else
+ {
+ this.x = x || 0;
+ this.y = y || 0;
+ this.z = z || 0;
+ }
+ },
+
+ /**
+ * Set this Vector to point up.
+ *
+ * Sets the y component of the vector to 1, and the others to 0.
+ *
+ * @method Phaser.Math.Vector3#up
+ * @since 3.0.0
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ up: function ()
+ {
+ this.x = 0;
+ this.y = 1;
+ this.z = 0;
+
+ return this;
+ },
+
+ /**
+ * Make a clone of this Vector3.
+ *
+ * @method Phaser.Math.Vector3#clone
+ * @since 3.0.0
+ *
+ * @return {Phaser.Math.Vector3} A new Vector3 object containing this Vectors values.
+ */
+ clone: function ()
+ {
+ return new Vector3(this.x, this.y, this.z);
+ },
+
+ /**
+ * Calculate the cross (vector) product of two given Vectors.
+ *
+ * @method Phaser.Math.Vector3#crossVectors
+ * @since 3.0.0
+ *
+ * @param {Phaser.Math.Vector3} a - The first Vector to multiply.
+ * @param {Phaser.Math.Vector3} b - The second Vector to multiply.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ crossVectors: function (a, b)
+ {
+ var ax = a.x;
+ var ay = a.y;
+ var az = a.z;
+ var bx = b.x;
+ var by = b.y;
+ var bz = b.z;
+
+ this.x = ay * bz - az * by;
+ this.y = az * bx - ax * bz;
+ this.z = ax * by - ay * bx;
+
+ return this;
+ },
+
+ /**
+ * Check whether this Vector is equal to a given Vector.
+ *
+ * Performs a strict equality check against each Vector's components.
+ *
+ * @method Phaser.Math.Vector3#equals
+ * @since 3.0.0
+ *
+ * @param {Phaser.Math.Vector3} v - The Vector3 to compare against.
+ *
+ * @return {boolean} True if the two vectors strictly match, otherwise false.
+ */
+ equals: function (v)
+ {
+ return ((this.x === v.x) && (this.y === v.y) && (this.z === v.z));
+ },
+
+ /**
+ * Copy the components of a given Vector into this Vector.
+ *
+ * @method Phaser.Math.Vector3#copy
+ * @since 3.0.0
+ *
+ * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} src - The Vector to copy the components from.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ copy: function (src)
+ {
+ this.x = src.x;
+ this.y = src.y;
+ this.z = src.z || 0;
+
+ return this;
+ },
+
+ /**
+ * Set the `x`, `y`, and `z` components of this Vector to the given `x`, `y`, and `z` values.
+ *
+ * @method Phaser.Math.Vector3#set
+ * @since 3.0.0
+ *
+ * @param {(number|object)} x - The x value to set for this Vector, or an object containing x, y and z components.
+ * @param {number} [y] - The y value to set for this Vector.
+ * @param {number} [z] - The z value to set for this Vector.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ set: function (x, y, z)
+ {
+ if (typeof x === 'object')
+ {
+ this.x = x.x || 0;
+ this.y = x.y || 0;
+ this.z = x.z || 0;
+ }
+ else
+ {
+ this.x = x || 0;
+ this.y = y || 0;
+ this.z = z || 0;
+ }
+
+ return this;
+ },
+
+ /**
+ * Add a given Vector to this Vector. Addition is component-wise.
+ *
+ * @method Phaser.Math.Vector3#add
+ * @since 3.0.0
+ *
+ * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to add to this Vector.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ add: function (v)
+ {
+ this.x += v.x;
+ this.y += v.y;
+ this.z += v.z || 0;
+
+ return this;
+ },
+
+ /**
+ * Subtract the given Vector from this Vector. Subtraction is component-wise.
+ *
+ * @method Phaser.Math.Vector3#subtract
+ * @since 3.0.0
+ *
+ * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to subtract from this Vector.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ subtract: function (v)
+ {
+ this.x -= v.x;
+ this.y -= v.y;
+ this.z -= v.z || 0;
+
+ return this;
+ },
+
+ /**
+ * Perform a component-wise multiplication between this Vector and the given Vector.
+ *
+ * Multiplies this Vector by the given Vector.
+ *
+ * @method Phaser.Math.Vector3#multiply
+ * @since 3.0.0
+ *
+ * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to multiply this Vector by.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ multiply: function (v)
+ {
+ this.x *= v.x;
+ this.y *= v.y;
+ this.z *= v.z || 1;
+
+ return this;
+ },
+
+ /**
+ * Scale this Vector by the given value.
+ *
+ * @method Phaser.Math.Vector3#scale
+ * @since 3.0.0
+ *
+ * @param {number} scale - The value to scale this Vector by.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ scale: function (scale)
+ {
+ if (isFinite(scale))
+ {
+ this.x *= scale;
+ this.y *= scale;
+ this.z *= scale;
+ }
+ else
+ {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+ }
+
+ return this;
+ },
+
+ /**
+ * Perform a component-wise division between this Vector and the given Vector.
+ *
+ * Divides this Vector by the given Vector.
+ *
+ * @method Phaser.Math.Vector3#divide
+ * @since 3.0.0
+ *
+ * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to divide this Vector by.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ divide: function (v)
+ {
+ this.x /= v.x;
+ this.y /= v.y;
+ this.z /= v.z || 1;
+
+ return this;
+ },
+
+ /**
+ * Negate the `x`, `y` and `z` components of this Vector.
+ *
+ * @method Phaser.Math.Vector3#negate
+ * @since 3.0.0
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ negate: function ()
+ {
+ this.x = -this.x;
+ this.y = -this.y;
+ this.z = -this.z;
+
+ return this;
+ },
+
+ /**
+ * Calculate the distance between this Vector and the given Vector.
+ *
+ * @method Phaser.Math.Vector3#distance
+ * @since 3.0.0
+ *
+ * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to.
+ *
+ * @return {number} The distance from this Vector to the given Vector.
+ */
+ distance: function (v)
+ {
+ var dx = v.x - this.x;
+ var dy = v.y - this.y;
+ var dz = v.z - this.z || 0;
+
+ return Math.sqrt(dx * dx + dy * dy + dz * dz);
+ },
+
+ /**
+ * Calculate the distance between this Vector and the given Vector, squared.
+ *
+ * @method Phaser.Math.Vector3#distanceSq
+ * @since 3.0.0
+ *
+ * @param {(Phaser.Math.Vector2|Phaser.Math.Vector3)} v - The Vector to calculate the distance to.
+ *
+ * @return {number} The distance from this Vector to the given Vector, squared.
+ */
+ distanceSq: function (v)
+ {
+ var dx = v.x - this.x;
+ var dy = v.y - this.y;
+ var dz = v.z - this.z || 0;
+
+ return dx * dx + dy * dy + dz * dz;
+ },
+
+ /**
+ * Calculate the length (or magnitude) of this Vector.
+ *
+ * @method Phaser.Math.Vector3#length
+ * @since 3.0.0
+ *
+ * @return {number} The length of this Vector.
+ */
+ length: function ()
+ {
+ var x = this.x;
+ var y = this.y;
+ var z = this.z;
+
+ return Math.sqrt(x * x + y * y + z * z);
+ },
+
+ /**
+ * Calculate the length of this Vector squared.
+ *
+ * @method Phaser.Math.Vector3#lengthSq
+ * @since 3.0.0
+ *
+ * @return {number} The length of this Vector, squared.
+ */
+ lengthSq: function ()
+ {
+ var x = this.x;
+ var y = this.y;
+ var z = this.z;
+
+ return x * x + y * y + z * z;
+ },
+
+ /**
+ * Normalize this Vector.
+ *
+ * Makes the vector a unit length vector (magnitude of 1) in the same direction.
+ *
+ * @method Phaser.Math.Vector3#normalize
+ * @since 3.0.0
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ normalize: function ()
+ {
+ var x = this.x;
+ var y = this.y;
+ var z = this.z;
+ var len = x * x + y * y + z * z;
+
+ if (len > 0)
+ {
+ len = 1 / Math.sqrt(len);
+
+ this.x = x * len;
+ this.y = y * len;
+ this.z = z * len;
+ }
+
+ return this;
+ },
+
+ /**
+ * Calculate the dot product of this Vector and the given Vector.
+ *
+ * @method Phaser.Math.Vector3#dot
+ * @since 3.0.0
+ *
+ * @param {Phaser.Math.Vector3} v - The Vector3 to dot product with this Vector3.
+ *
+ * @return {number} The dot product of this Vector and `v`.
+ */
+ dot: function (v)
+ {
+ return this.x * v.x + this.y * v.y + this.z * v.z;
+ },
+
+ /**
+ * Calculate the cross (vector) product of this Vector (which will be modified) and the given Vector.
+ *
+ * @method Phaser.Math.Vector3#cross
+ * @since 3.0.0
+ *
+ * @param {Phaser.Math.Vector3} v - The Vector to cross product with.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ cross: function (v)
+ {
+ var ax = this.x;
+ var ay = this.y;
+ var az = this.z;
+ var bx = v.x;
+ var by = v.y;
+ var bz = v.z;
+
+ this.x = ay * bz - az * by;
+ this.y = az * bx - ax * bz;
+ this.z = ax * by - ay * bx;
+
+ return this;
+ },
+
+ /**
+ * Linearly interpolate between this Vector and the given Vector.
+ *
+ * Interpolates this Vector towards the given Vector.
+ *
+ * @method Phaser.Math.Vector3#lerp
+ * @since 3.0.0
+ *
+ * @param {Phaser.Math.Vector3} v - The Vector3 to interpolate towards.
+ * @param {number} [t=0] - The interpolation percentage, between 0 and 1.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ lerp: function (v, t)
+ {
+ if (t === undefined) { t = 0; }
+
+ var ax = this.x;
+ var ay = this.y;
+ var az = this.z;
+
+ this.x = ax + t * (v.x - ax);
+ this.y = ay + t * (v.y - ay);
+ this.z = az + t * (v.z - az);
+
+ return this;
+ },
+
+ /**
+ * Transform this Vector with the given Matrix.
+ *
+ * @method Phaser.Math.Vector3#transformMat3
+ * @since 3.0.0
+ *
+ * @param {Phaser.Math.Matrix3} mat - The Matrix3 to transform this Vector3 with.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ transformMat3: function (mat)
+ {
+ var x = this.x;
+ var y = this.y;
+ var z = this.z;
+ var m = mat.val;
+
+ this.x = x * m[0] + y * m[3] + z * m[6];
+ this.y = x * m[1] + y * m[4] + z * m[7];
+ this.z = x * m[2] + y * m[5] + z * m[8];
+
+ return this;
+ },
+
+ /**
+ * Transform this Vector with the given Matrix.
+ *
+ * @method Phaser.Math.Vector3#transformMat4
+ * @since 3.0.0
+ *
+ * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ transformMat4: function (mat)
+ {
+ var x = this.x;
+ var y = this.y;
+ var z = this.z;
+ var m = mat.val;
+
+ this.x = m[0] * x + m[4] * y + m[8] * z + m[12];
+ this.y = m[1] * x + m[5] * y + m[9] * z + m[13];
+ this.z = m[2] * x + m[6] * y + m[10] * z + m[14];
+
+ return this;
+ },
+
+ /**
+ * [description]
+ *
+ * @method Phaser.Math.Vector3#transformCoordinates
+ * @since 3.0.0
+ *
+ * @param {Phaser.Math.Matrix4} mat - The Matrix4 to transform this Vector3 with.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ transformCoordinates: function (mat)
+ {
+ var x = this.x;
+ var y = this.y;
+ var z = this.z;
+ var m = mat.val;
+
+ var tx = (x * m[0]) + (y * m[4]) + (z * m[8]) + m[12];
+ var ty = (x * m[1]) + (y * m[5]) + (z * m[9]) + m[13];
+ var tz = (x * m[2]) + (y * m[6]) + (z * m[10]) + m[14];
+ var tw = (x * m[3]) + (y * m[7]) + (z * m[11]) + m[15];
+
+ this.x = tx / tw;
+ this.y = ty / tw;
+ this.z = tz / tw;
+
+ return this;
+ },
+
+ /**
+ * Transform this Vector with the given Quaternion.
+ *
+ * @method Phaser.Math.Vector3#transformQuat
+ * @since 3.0.0
+ *
+ * @param {Phaser.Math.Quaternion} q - The Quaternion to transform this Vector with.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ transformQuat: function (q)
+ {
+ // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations
+ var x = this.x;
+ var y = this.y;
+ var z = this.z;
+ var qx = q.x;
+ var qy = q.y;
+ var qz = q.z;
+ var qw = q.w;
+
+ // calculate quat * vec
+ var ix = qw * x + qy * z - qz * y;
+ var iy = qw * y + qz * x - qx * z;
+ var iz = qw * z + qx * y - qy * x;
+ var iw = -qx * x - qy * y - qz * z;
+
+ // calculate result * inverse quat
+ this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;
+ this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;
+ this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;
+
+ return this;
+ },
+
+ /**
+ * Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection,
+ * e.g. unprojecting a 2D point into 3D space.
+ *
+ * @method Phaser.Math.Vector3#project
+ * @since 3.0.0
+ *
+ * @param {Phaser.Math.Matrix4} mat - The Matrix4 to multiply this Vector3 with.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ project: function (mat)
+ {
+ var x = this.x;
+ var y = this.y;
+ var z = this.z;
+ var m = mat.val;
+
+ var a00 = m[0];
+ var a01 = m[1];
+ var a02 = m[2];
+ var a03 = m[3];
+ var a10 = m[4];
+ var a11 = m[5];
+ var a12 = m[6];
+ var a13 = m[7];
+ var a20 = m[8];
+ var a21 = m[9];
+ var a22 = m[10];
+ var a23 = m[11];
+ var a30 = m[12];
+ var a31 = m[13];
+ var a32 = m[14];
+ var a33 = m[15];
+
+ var lw = 1 / (x * a03 + y * a13 + z * a23 + a33);
+
+ this.x = (x * a00 + y * a10 + z * a20 + a30) * lw;
+ this.y = (x * a01 + y * a11 + z * a21 + a31) * lw;
+ this.z = (x * a02 + y * a12 + z * a22 + a32) * lw;
+
+ return this;
+ },
+
+ /**
+ * Unproject this point from 2D space to 3D space.
+ * The point should have its x and y properties set to
+ * 2D screen space, and the z either at 0 (near plane)
+ * or 1 (far plane). The provided matrix is assumed to already
+ * be combined, i.e. projection * view * model.
+ *
+ * After this operation, this vector's (x, y, z) components will
+ * represent the unprojected 3D coordinate.
+ *
+ * @method Phaser.Math.Vector3#unproject
+ * @since 3.0.0
+ *
+ * @param {Phaser.Math.Vector4} viewport - Screen x, y, width and height in pixels.
+ * @param {Phaser.Math.Matrix4} invProjectionView - Combined projection and view matrix.
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ unproject: function (viewport, invProjectionView)
+ {
+ var viewX = viewport.x;
+ var viewY = viewport.y;
+ var viewWidth = viewport.z;
+ var viewHeight = viewport.w;
+
+ var x = this.x - viewX;
+ var y = (viewHeight - this.y - 1) - viewY;
+ var z = this.z;
+
+ this.x = (2 * x) / viewWidth - 1;
+ this.y = (2 * y) / viewHeight - 1;
+ this.z = 2 * z - 1;
+
+ return this.project(invProjectionView);
+ },
+
+ /**
+ * Make this Vector the zero vector (0, 0, 0).
+ *
+ * @method Phaser.Math.Vector3#reset
+ * @since 3.0.0
+ *
+ * @return {Phaser.Math.Vector3} This Vector3.
+ */
+ reset: function ()
+ {
+ this.x = 0;
+ this.y = 0;
+ this.z = 0;
+
+ return this;
+ }
+
+});
+
+/*
+Vector3.Zero = function ()
+{
+ return new Vector3(0, 0, 0);
+};
+
+Vector3.Up = function ()
+{
+ return new Vector3(0, 1.0, 0);
+};
+
+Vector3.Copy = function (source)
+{
+ return new Vector3(source.x, source.y, source.z);
+};
+
+Vector3.TransformCoordinates = function (vector, transformation)
+{
+ var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]) + (vector.z * transformation.m[8]) + transformation.m[12];
+ var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]) + (vector.z * transformation.m[9]) + transformation.m[13];
+ var z = (vector.x * transformation.m[2]) + (vector.y * transformation.m[6]) + (vector.z * transformation.m[10]) + transformation.m[14];
+ var w = (vector.x * transformation.m[3]) + (vector.y * transformation.m[7]) + (vector.z * transformation.m[11]) + transformation.m[15];
+
+ return new Vector3(x / w, y / w, z / w);
+};
+
+Vector3.TransformNormal = function (vector, transformation)
+{
+ var x = (vector.x * transformation.m[0]) + (vector.y * transformation.m[4]) + (vector.z * transformation.m[8]);
+ var y = (vector.x * transformation.m[1]) + (vector.y * transformation.m[5]) + (vector.z * transformation.m[9]);
+ var z = (vector.x * transformation.m[2]) + (vector.y * transformation.m[6]) + (vector.z * transformation.m[10]);
+
+ return new Vector3(x, y, z);
+};
+
+Vector3.Dot = function (left, right)
+{
+ return (left.x * right.x + left.y * right.y + left.z * right.z);
+};
+
+Vector3.Cross = function (left, right)
+{
+ var x = left.y * right.z - left.z * right.y;
+ var y = left.z * right.x - left.x * right.z;
+ var z = left.x * right.y - left.y * right.x;
+
+ return new Vector3(x, y, z);
+};
+
+Vector3.Normalize = function (vector)
+{
+ var newVector = Vector3.Copy(vector);
+ newVector.normalize();
+
+ return newVector;
+};
+
+Vector3.Distance = function (value1, value2)
+{
+ return Math.sqrt(Vector3.DistanceSquared(value1, value2));
+};
+
+Vector3.DistanceSquared = function (value1, value2)
+{
+ var x = value1.x - value2.x;
+ var y = value1.y - value2.y;
+ var z = value1.z - value2.z;
+
+ return (x * x) + (y * y) + (z * z);
+};
+*/
+
+module.exports = Vector3;
+
+
+/***/ }),
+/* 139 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var CONST = __webpack_require__(18);
+var File = __webpack_require__(21);
+var FileTypesManager = __webpack_require__(7);
+var GetFastValue = __webpack_require__(2);
+var IsPlainObject = __webpack_require__(8);
+var ParseXML = __webpack_require__(343);
+
+/**
+ * @typedef {object} Phaser.Loader.FileTypes.XMLFileConfig
+ *
+ * @property {string} key - The key of the file. Must be unique within both the Loader and the Text Cache.
+ * @property {string} [url] - The absolute or relative URL to load the file from.
+ * @property {string} [extension='xml'] - The default file extension to use if no url is provided.
+ * @property {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file.
+ */
+
+/**
+ * @classdesc
+ * 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
+ * @memberof Phaser.Loader.FileTypes
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {Phaser.Loader.LoaderPlugin} loader - A reference to the Loader that is responsible for this file.
+ * @param {(string|Phaser.Loader.FileTypes.XMLFileConfig)} key - The key to use for this file, or a file configuration object.
+ * @param {string} [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 {XHRSettingsObject} [xhrSettings] - Extra XHR Settings specifically for this file.
+ */
+var XMLFile = new Class({
+
+ Extends: File,
+
+ initialize:
+
+ function XMLFile (loader, key, url, xhrSettings)
+ {
+ var extension = 'xml';
+
+ if (IsPlainObject(key))
+ {
+ var config = key;
+
+ key = GetFastValue(config, 'key');
+ url = GetFastValue(config, 'url');
+ xhrSettings = GetFastValue(config, 'xhrSettings');
+ extension = GetFastValue(config, 'extension', extension);
+ }
+
+ var fileConfig = {
+ type: 'xml',
+ cache: loader.cacheManager.xml,
+ extension: extension,
+ responseType: 'text',
+ key: key,
+ url: url,
+ xhrSettings: xhrSettings
+ };
+
+ File.call(this, loader, fileConfig);
+ },
+
+ /**
+ * Called automatically by Loader.nextFile.
+ * This method controls what extra work this File does with its loaded data.
+ *
+ * @method Phaser.Loader.FileTypes.XMLFile#onProcess
+ * @since 3.7.0
+ */
+ onProcess: function ()
+ {
+ this.state = CONST.FILE_PROCESSING;
+
+ this.data = ParseXML(this.xhrLoader.responseText);
+
+ if (this.data)
+ {
+ this.onProcessComplete();
+ }
+ else
+ {
+ console.warn('Invalid XMLFile: ' + this.key);
+
+ this.onProcessError();
+ }
+ }
+
+});
+
+/**
+ * Adds an XML file, or array of XML files, to the current load queue.
+ *
+ * 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.xml('wavedata', 'files/AlienWaveData.xml');
+ * }
+ * ```
+ *
+ * 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 XML Cache upon a successful load.
+ * The key should be unique both in terms of files being loaded and files already present in the XML Cache.
+ * 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 XML Cache first, before loading a new one.
+ *
+ * Instead of passing arguments you can pass a configuration object, such as:
+ *
+ * ```javascript
+ * this.load.xml({
+ * key: 'wavedata',
+ * url: 'files/AlienWaveData.xml'
+ * });
+ * ```
+ *
+ * See the documentation for `Phaser.Loader.FileTypes.XMLFileConfig` for more details.
+ *
+ * Once the file has finished loading you can access it from its Cache using its key:
+ *
+ * ```javascript
+ * this.load.xml('wavedata', 'files/AlienWaveData.xml');
+ * // and later in your game ...
+ * var data = this.cache.xml.get('wavedata');
+ * ```
+ *
+ * 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 `LEVEL1.` and the key was `Waves` the final key will be `LEVEL1.Waves` and
+ * this is what you would use to retrieve the text from the XML Cache.
+ *
+ * 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 "data"
+ * and no URL is given then the Loader will set the URL to be "data.xml". It will always add `.xml` 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.
+ *
+ * Note: The ability to load this type of file will only be available if the XML File type has been built into Phaser.
+ * It is available in the default build but can be excluded from custom builds.
+ *
+ * @method Phaser.Loader.LoaderPlugin#xml
+ * @fires Phaser.Loader.LoaderPlugin#addFileEvent
+ * @since 3.0.0
+ *
+ * @param {(string|Phaser.Loader.FileTypes.XMLFileConfig|Phaser.Loader.FileTypes.XMLFileConfig[])} key - The key to use for this file, or a file configuration object, or array of them.
+ * @param {string} [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 {XHRSettingsObject} [xhrSettings] - An XHR Settings configuration object. Used in replacement of the Loaders default XHR Settings.
+ *
+ * @return {Phaser.Loader.LoaderPlugin} The Loader instance.
+ */
+FileTypesManager.register('xml', function (key, url, xhrSettings)
+{
+ if (Array.isArray(key))
+ {
+ for (var i = 0; i < key.length; i++)
+ {
+ // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object
+ this.addFile(new XMLFile(this, key[i]));
+ }
+ }
+ else
+ {
+ this.addFile(new XMLFile(this, key, url, xhrSettings));
+ }
+
+ return this;
+});
+
+module.exports = XMLFile;
+
+
+/***/ }),
+/* 140 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Extend = __webpack_require__(20);
+var XHRSettings = __webpack_require__(105);
+
+/**
+ * Takes two XHRSettings Objects and creates a new XHRSettings object from them.
+ *
+ * The new object is seeded by the values given in the global settings, but any setting in
+ * the local object overrides the global ones.
+ *
+ * @function Phaser.Loader.MergeXHRSettings
+ * @since 3.0.0
+ *
+ * @param {XHRSettingsObject} global - The global XHRSettings object.
+ * @param {XHRSettingsObject} local - The local XHRSettings object.
+ *
+ * @return {XHRSettingsObject} A newly formed XHRSettings object.
+ */
+var MergeXHRSettings = function (global, local)
+{
+ var output = (global === undefined) ? XHRSettings() : Extend({}, global);
+
+ if (local)
+ {
+ for (var setting in local)
+ {
+ if (local[setting] !== undefined)
+ {
+ output[setting] = local[setting];
+ }
+ }
+ }
+
+ return output;
+};
+
+module.exports = MergeXHRSettings;
+
+
+/***/ }),
+/* 141 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Given a File and a baseURL value this returns the URL the File will use to download from.
+ *
+ * @function Phaser.Loader.GetURL
+ * @since 3.0.0
+ *
+ * @param {Phaser.Loader.File} file - The File object.
+ * @param {string} baseURL - A default base URL.
+ *
+ * @return {string} The URL the File will use.
+ */
+var GetURL = function (file, baseURL)
+{
+ if (!file.url)
+ {
+ return false;
+ }
+
+ if (file.url.match(/^(?:blob:|data:|http:\/\/|https:\/\/|\/\/)/))
+ {
+ return file.url;
+ }
+ else
+ {
+ return baseURL + file.url;
+ }
+};
+
+module.exports = GetURL;
+
+
+/***/ }),
+/* 142 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * 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`.
+ *
+ * @function Phaser.Math.Snap.Floor
+ * @since 3.0.0
+ *
+ * @param {number} value - The value to snap.
+ * @param {number} gap - The interval gap of the grid.
+ * @param {number} [start=0] - Optional starting offset for gap.
+ * @param {boolean} [divide=false] - If `true` it will divide the snapped value by the gap before returning.
+ *
+ * @return {number} The snapped value.
+ */
+var SnapFloor = function (value, gap, start, divide)
+{
+ if (start === undefined) { start = 0; }
+
+ if (gap === 0)
+ {
+ return value;
+ }
+
+ value -= start;
+ value = gap * Math.floor(value / gap);
+
+ return (divide) ? (start + value) / gap : start + value;
+};
+
+module.exports = SnapFloor;
+
+
+/***/ }),
+/* 143 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Keyboard Codes.
+ *
+ * @name Phaser.Input.Keyboard.KeyCodes
+ * @enum {integer}
+ * @memberof Phaser.Input.Keyboard
+ * @readonly
+ * @since 3.0.0
+ */
+
+var KeyCodes = {
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.BACKSPACE
+ */
+ BACKSPACE: 8,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.TAB
+ */
+ TAB: 9,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.ENTER
+ */
+ ENTER: 13,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.SHIFT
+ */
+ SHIFT: 16,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.CTRL
+ */
+ CTRL: 17,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.ALT
+ */
+ ALT: 18,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.PAUSE
+ */
+ PAUSE: 19,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.CAPS_LOCK
+ */
+ CAPS_LOCK: 20,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.ESC
+ */
+ ESC: 27,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.SPACE
+ */
+ SPACE: 32,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.PAGE_UP
+ */
+ PAGE_UP: 33,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.PAGE_DOWN
+ */
+ PAGE_DOWN: 34,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.END
+ */
+ END: 35,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.HOME
+ */
+ HOME: 36,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.LEFT
+ */
+ LEFT: 37,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.UP
+ */
+ UP: 38,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.RIGHT
+ */
+ RIGHT: 39,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.DOWN
+ */
+ DOWN: 40,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.PRINT_SCREEN
+ */
+ PRINT_SCREEN: 42,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.INSERT
+ */
+ INSERT: 45,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.DELETE
+ */
+ DELETE: 46,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.ZERO
+ */
+ ZERO: 48,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.ONE
+ */
+ ONE: 49,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.TWO
+ */
+ TWO: 50,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.THREE
+ */
+ THREE: 51,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.FOUR
+ */
+ FOUR: 52,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.FIVE
+ */
+ FIVE: 53,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.SIX
+ */
+ SIX: 54,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.SEVEN
+ */
+ SEVEN: 55,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.EIGHT
+ */
+ EIGHT: 56,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.NINE
+ */
+ NINE: 57,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ZERO
+ */
+ NUMPAD_ZERO: 96,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_ONE
+ */
+ NUMPAD_ONE: 97,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_TWO
+ */
+ NUMPAD_TWO: 98,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_THREE
+ */
+ NUMPAD_THREE: 99,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FOUR
+ */
+ NUMPAD_FOUR: 100,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_FIVE
+ */
+ NUMPAD_FIVE: 101,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SIX
+ */
+ NUMPAD_SIX: 102,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_SEVEN
+ */
+ NUMPAD_SEVEN: 103,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_EIGHT
+ */
+ NUMPAD_EIGHT: 104,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.NUMPAD_NINE
+ */
+ NUMPAD_NINE: 105,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.A
+ */
+ A: 65,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.B
+ */
+ B: 66,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.C
+ */
+ C: 67,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.D
+ */
+ D: 68,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.E
+ */
+ E: 69,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.F
+ */
+ F: 70,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.G
+ */
+ G: 71,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.H
+ */
+ H: 72,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.I
+ */
+ I: 73,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.J
+ */
+ J: 74,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.K
+ */
+ K: 75,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.L
+ */
+ L: 76,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.M
+ */
+ M: 77,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.N
+ */
+ N: 78,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.O
+ */
+ O: 79,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.P
+ */
+ P: 80,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.Q
+ */
+ Q: 81,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.R
+ */
+ R: 82,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.S
+ */
+ S: 83,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.T
+ */
+ T: 84,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.U
+ */
+ U: 85,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.V
+ */
+ V: 86,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.W
+ */
+ W: 87,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.X
+ */
+ X: 88,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.Y
+ */
+ Y: 89,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.Z
+ */
+ Z: 90,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.F1
+ */
+ F1: 112,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.F2
+ */
+ F2: 113,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.F3
+ */
+ F3: 114,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.F4
+ */
+ F4: 115,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.F5
+ */
+ F5: 116,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.F6
+ */
+ F6: 117,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.F7
+ */
+ F7: 118,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.F8
+ */
+ F8: 119,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.F9
+ */
+ F9: 120,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.F10
+ */
+ F10: 121,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.F11
+ */
+ F11: 122,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.F12
+ */
+ F12: 123,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON
+ */
+ SEMICOLON: 186,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.PLUS
+ */
+ PLUS: 187,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.COMMA
+ */
+ COMMA: 188,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.MINUS
+ */
+ MINUS: 189,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.PERIOD
+ */
+ PERIOD: 190,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.FORWARD_SLASH
+ */
+ FORWARD_SLASH: 191,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.BACK_SLASH
+ */
+ BACK_SLASH: 220,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.QUOTES
+ */
+ QUOTES: 222,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.BACKTICK
+ */
+ BACKTICK: 192,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.OPEN_BRACKET
+ */
+ OPEN_BRACKET: 219,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET
+ */
+ CLOSED_BRACKET: 221
+
+};
+
+module.exports = KeyCodes;
+
+
+/***/ }),
+/* 144 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * [description]
+ *
+ * @function Phaser.Geom.Triangle.RotateAroundXY
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Geom.Triangle} O - [triangle,$return]
+ *
+ * @param {Phaser.Geom.Triangle} triangle - [description]
+ * @param {number} x - [description]
+ * @param {number} y - [description]
+ * @param {number} angle - [description]
+ *
+ * @return {Phaser.Geom.Triangle} [description]
+ */
+var RotateAroundXY = function (triangle, x, y, angle)
+{
+ var c = Math.cos(angle);
+ var s = Math.sin(angle);
+
+ var tx = triangle.x1 - x;
+ var ty = triangle.y1 - y;
+
+ triangle.x1 = tx * c - ty * s + x;
+ triangle.y1 = tx * s + ty * c + y;
+
+ tx = triangle.x2 - x;
+ ty = triangle.y2 - y;
+
+ triangle.x2 = tx * c - ty * s + x;
+ triangle.y2 = tx * s + ty * c + y;
+
+ tx = triangle.x3 - x;
+ ty = triangle.y3 - y;
+
+ triangle.x3 = tx * c - ty * s + x;
+ triangle.y3 = tx * s + ty * c + y;
+
+ return triangle;
+};
+
+module.exports = RotateAroundXY;
+
+
+/***/ }),
+/* 145 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * [description]
+ *
+ * @function Phaser.Geom.Rectangle.GetAspectRatio
+ * @since 3.0.0
+ *
+ * @param {Phaser.Geom.Rectangle} rect - [description]
+ *
+ * @return {number} [description]
+ */
+var GetAspectRatio = function (rect)
+{
+ return (rect.height === 0) ? NaN : rect.width / rect.height;
+};
+
+module.exports = GetAspectRatio;
+
+
+/***/ }),
+/* 146 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Rotate a line around the given coordinates by the given angle in radians.
+ *
+ * @function Phaser.Geom.Line.RotateAroundXY
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Geom.Line} O - [line,$return]
+ *
+ * @param {Phaser.Geom.Line} line - The line to rotate.
+ * @param {number} x - The horizontal coordinate to rotate the line around.
+ * @param {number} y - The vertical coordinate to rotate the line around.
+ * @param {number} angle - The angle of rotation in radians.
+ *
+ * @return {Phaser.Geom.Line} The rotated line.
+ */
+var RotateAroundXY = function (line, x, y, angle)
+{
+ var c = Math.cos(angle);
+ var s = Math.sin(angle);
+
+ var tx = line.x1 - x;
+ var ty = line.y1 - y;
+
+ line.x1 = tx * c - ty * s + x;
+ line.y1 = tx * s + ty * c + y;
+
+ tx = line.x2 - x;
+ ty = line.y2 - y;
+
+ line.x2 = tx * c - ty * s + x;
+ line.y2 = tx * s + ty * c + y;
+
+ return line;
+};
+
+module.exports = RotateAroundXY;
+
+
+/***/ }),
+/* 147 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+// http://www.blackpawn.com/texts/pointinpoly/
+
+// points is an array of Point-like objects with public x/y properties
+// returns an array containing all points that are within the triangle, or an empty array if none
+// if 'returnFirst' is true it will return after the first point within the triangle is found
+
+/**
+ * Filters an array of point-like objects to only those contained within a triangle.
+ * If `returnFirst` is true, will return an array containing only the first point in the provided array that is within the triangle (or an empty array if there are no such points).
+ *
+ * @function Phaser.Geom.Triangle.ContainsArray
+ * @since 3.0.0
+ *
+ * @param {Phaser.Geom.Triangle} triangle - The triangle that the points are being checked in.
+ * @param {Phaser.Geom.Point[]} points - An array of point-like objects (objects that have an `x` and `y` property)
+ * @param {boolean} [returnFirst=false] - If `true`, return an array containing only the first point found that is within the triangle.
+ * @param {array} [out] - If provided, the points that are within the triangle will be appended to this array instead of being added to a new array. If `returnFirst` is true, only the first point found within the triangle will be appended. This array will also be returned by this function.
+ *
+ * @return {Phaser.Geom.Point[]} An array containing all the points from `points` that are within the triangle, if an array was provided as `out`, points will be appended to that array and it will also be returned here.
+ */
+var ContainsArray = function (triangle, points, returnFirst, out)
+{
+ if (returnFirst === undefined) { returnFirst = false; }
+ if (out === undefined) { out = []; }
+
+ var v0x = triangle.x3 - triangle.x1;
+ var v0y = triangle.y3 - triangle.y1;
+
+ var v1x = triangle.x2 - triangle.x1;
+ var v1y = triangle.y2 - triangle.y1;
+
+ var dot00 = (v0x * v0x) + (v0y * v0y);
+ var dot01 = (v0x * v1x) + (v0y * v1y);
+ var dot11 = (v1x * v1x) + (v1y * v1y);
+
+ // Compute barycentric coordinates
+ var b = ((dot00 * dot11) - (dot01 * dot01));
+ var inv = (b === 0) ? 0 : (1 / b);
+
+ var u;
+ var v;
+ var v2x;
+ var v2y;
+ var dot02;
+ var dot12;
+
+ var x1 = triangle.x1;
+ var y1 = triangle.y1;
+
+ for (var i = 0; i < points.length; i++)
+ {
+ v2x = points[i].x - x1;
+ v2y = points[i].y - y1;
+
+ dot02 = (v0x * v2x) + (v0y * v2y);
+ dot12 = (v1x * v2x) + (v1y * v2y);
+
+ u = ((dot11 * dot02) - (dot01 * dot12)) * inv;
+ v = ((dot00 * dot12) - (dot01 * dot02)) * inv;
+
+ if (u >= 0 && v >= 0 && (u + v < 1))
+ {
+ out.push({ x: points[i].x, y: points[i].y });
+
+ if (returnFirst)
+ {
+ break;
+ }
+ }
+ }
+
+ return out;
+};
+
+module.exports = ContainsArray;
+
+
+/***/ }),
+/* 148 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * [description]
+ *
+ * @function Phaser.Geom.Intersects.RectangleToRectangle
+ * @since 3.0.0
+ *
+ * @param {Phaser.Geom.Rectangle} rectA - [description]
+ * @param {Phaser.Geom.Rectangle} rectB - [description]
+ *
+ * @return {boolean} [description]
+ */
+var RectangleToRectangle = function (rectA, rectB)
+{
+ if (rectA.width <= 0 || rectA.height <= 0 || rectB.width <= 0 || rectB.height <= 0)
+ {
+ return false;
+ }
+
+ return !(rectA.right < rectB.x || rectA.bottom < rectB.y || rectA.x > rectB.right || rectA.y > rectB.bottom);
+};
+
+module.exports = RectangleToRectangle;
+
+
+/***/ }),
+/* 149 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var Mesh = __webpack_require__(108);
+
+/**
+ * @classdesc
+ * A Quad Game Object.
+ *
+ * A Quad is a Mesh Game Object pre-configured with two triangles arranged into a rectangle, with a single
+ * texture spread across them.
+ *
+ * You can manipulate the corner points of the quad via the getters and setters such as `topLeftX`, and also
+ * change their alpha and color values. The quad itself can be moved by adjusting the `x` and `y` properties.
+ *
+ * @class Quad
+ * @extends Phaser.GameObjects.Mesh
+ * @memberof Phaser.GameObjects
+ * @constructor
+ * @webglOnly
+ * @since 3.0.0
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Quad belongs.
+ * @param {number} x - The horizontal position of this Game Object in the world.
+ * @param {number} y - The vertical position of this Game Object in the world.
+ * @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
+ * @param {(string|integer)} [frame] - An optional frame from the Texture this Game Object is rendering with.
+ */
+var Quad = new Class({
+
+ Extends: Mesh,
+
+ initialize:
+
+ function Quad (scene, x, y, texture, frame)
+ {
+ // 0----3
+ // |\ B|
+ // | \ |
+ // | \ |
+ // | A \|
+ // | \
+ // 1----2
+
+ var vertices = [
+ 0, 0, // tl
+ 0, 0, // bl
+ 0, 0, // br
+ 0, 0, // tl
+ 0, 0, // br
+ 0, 0 // tr
+ ];
+
+ var uv = [
+ 0, 0, // tl
+ 0, 1, // bl
+ 1, 1, // br
+ 0, 0, // tl
+ 1, 1, // br
+ 1, 0 // tr
+ ];
+
+ var colors = [
+ 0xffffff, // tl
+ 0xffffff, // bl
+ 0xffffff, // br
+ 0xffffff, // tl
+ 0xffffff, // br
+ 0xffffff // tr
+ ];
+
+ var alphas = [
+ 1, // tl
+ 1, // bl
+ 1, // br
+ 1, // tl
+ 1, // br
+ 1 // tr
+ ];
+
+ Mesh.call(this, scene, x, y, vertices, uv, colors, alphas, texture, frame);
+
+ this.resetPosition();
+ },
+
+ /**
+ * Sets the frame this Game Object will use to render with.
+ *
+ * The Frame has to belong to the current Texture being used.
+ *
+ * It can be either a string or an index.
+ *
+ * Calling `setFrame` will modify the `width` and `height` properties of your Game Object.
+ * It will also change the `origin` if the Frame has a custom pivot point, as exported from packages like Texture Packer.
+ *
+ * @method Phaser.GameObjects.Quad#setFrame
+ * @since 3.11.0
+ *
+ * @param {(string|integer)} frame - The name or index of the frame within the Texture.
+ *
+ * @return {this} This Game Object instance.
+ */
+ setFrame: function (frame)
+ {
+ this.frame = this.texture.get(frame);
+
+ if (!this.frame.cutWidth || !this.frame.cutHeight)
+ {
+ this.renderFlags &= ~8;
+ }
+ else
+ {
+ this.renderFlags |= 8;
+ }
+
+ frame = this.frame;
+
+ // TL
+ this.uv[0] = frame.u0;
+ this.uv[1] = frame.v0;
+
+ // BL
+ this.uv[2] = frame.u0;
+ this.uv[3] = frame.v1;
+
+ // BR
+ this.uv[4] = frame.u1;
+ this.uv[5] = frame.v1;
+
+ // TL
+ this.uv[6] = frame.u0;
+ this.uv[7] = frame.v0;
+
+ // BR
+ this.uv[8] = frame.u1;
+ this.uv[9] = frame.v1;
+
+ // TR
+ this.uv[10] = frame.u1;
+ this.uv[11] = frame.v0;
+
+ return this;
+ },
+
+ /**
+ * The top-left x vertex of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#topLeftX
+ * @type {number}
+ * @since 3.0.0
+ */
+ topLeftX: {
+
+ get: function ()
+ {
+ return this.x + this.vertices[0];
+ },
+
+ set: function (value)
+ {
+ this.vertices[0] = value - this.x;
+ this.vertices[6] = value - this.x;
+ }
+
+ },
+
+ /**
+ * The top-left y vertex of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#topLeftY
+ * @type {number}
+ * @since 3.0.0
+ */
+ topLeftY: {
+
+ get: function ()
+ {
+ return this.y + this.vertices[1];
+ },
+
+ set: function (value)
+ {
+ this.vertices[1] = value - this.y;
+ this.vertices[7] = value - this.y;
+ }
+
+ },
+
+ /**
+ * The top-right x vertex of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#topRightX
+ * @type {number}
+ * @since 3.0.0
+ */
+ topRightX: {
+
+ get: function ()
+ {
+ return this.x + this.vertices[10];
+ },
+
+ set: function (value)
+ {
+ this.vertices[10] = value - this.x;
+ }
+
+ },
+
+ /**
+ * The top-right y vertex of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#topRightY
+ * @type {number}
+ * @since 3.0.0
+ */
+ topRightY: {
+
+ get: function ()
+ {
+ return this.y + this.vertices[11];
+ },
+
+ set: function (value)
+ {
+ this.vertices[11] = value - this.y;
+ }
+
+ },
+
+ /**
+ * The bottom-left x vertex of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#bottomLeftX
+ * @type {number}
+ * @since 3.0.0
+ */
+ bottomLeftX: {
+
+ get: function ()
+ {
+ return this.x + this.vertices[2];
+ },
+
+ set: function (value)
+ {
+ this.vertices[2] = value - this.x;
+ }
+
+ },
+
+ /**
+ * The bottom-left y vertex of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#bottomLeftY
+ * @type {number}
+ * @since 3.0.0
+ */
+ bottomLeftY: {
+
+ get: function ()
+ {
+ return this.y + this.vertices[3];
+ },
+
+ set: function (value)
+ {
+ this.vertices[3] = value - this.y;
+ }
+
+ },
+
+ /**
+ * The bottom-right x vertex of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#bottomRightX
+ * @type {number}
+ * @since 3.0.0
+ */
+ bottomRightX: {
+
+ get: function ()
+ {
+ return this.x + this.vertices[4];
+ },
+
+ set: function (value)
+ {
+ this.vertices[4] = value - this.x;
+ this.vertices[8] = value - this.x;
+ }
+
+ },
+
+ /**
+ * The bottom-right y vertex of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#bottomRightY
+ * @type {number}
+ * @since 3.0.0
+ */
+ bottomRightY: {
+
+ get: function ()
+ {
+ return this.y + this.vertices[5];
+ },
+
+ set: function (value)
+ {
+ this.vertices[5] = value - this.y;
+ this.vertices[9] = value - this.y;
+ }
+
+ },
+
+ /**
+ * The top-left alpha value of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#topLeftAlpha
+ * @type {number}
+ * @since 3.0.0
+ */
+ topLeftAlpha: {
+
+ get: function ()
+ {
+ return this.alphas[0];
+ },
+
+ set: function (value)
+ {
+ this.alphas[0] = value;
+ this.alphas[3] = value;
+ }
+
+ },
+
+ /**
+ * The top-right alpha value of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#topRightAlpha
+ * @type {number}
+ * @since 3.0.0
+ */
+ topRightAlpha: {
+
+ get: function ()
+ {
+ return this.alphas[5];
+ },
+
+ set: function (value)
+ {
+ this.alphas[5] = value;
+ }
+
+ },
+
+ /**
+ * The bottom-left alpha value of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#bottomLeftAlpha
+ * @type {number}
+ * @since 3.0.0
+ */
+ bottomLeftAlpha: {
+
+ get: function ()
+ {
+ return this.alphas[1];
+ },
+
+ set: function (value)
+ {
+ this.alphas[1] = value;
+ }
+
+ },
+
+ /**
+ * The bottom-right alpha value of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#bottomRightAlpha
+ * @type {number}
+ * @since 3.0.0
+ */
+ bottomRightAlpha: {
+
+ get: function ()
+ {
+ return this.alphas[2];
+ },
+
+ set: function (value)
+ {
+ this.alphas[2] = value;
+ this.alphas[4] = value;
+ }
+
+ },
+
+ /**
+ * The top-left color value of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#topLeftColor
+ * @type {number}
+ * @since 3.0.0
+ */
+ topLeftColor: {
+
+ get: function ()
+ {
+ return this.colors[0];
+ },
+
+ set: function (value)
+ {
+ this.colors[0] = value;
+ this.colors[3] = value;
+ }
+
+ },
+
+ /**
+ * The top-right color value of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#topRightColor
+ * @type {number}
+ * @since 3.0.0
+ */
+ topRightColor: {
+
+ get: function ()
+ {
+ return this.colors[5];
+ },
+
+ set: function (value)
+ {
+ this.colors[5] = value;
+ }
+
+ },
+
+ /**
+ * The bottom-left color value of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#bottomLeftColor
+ * @type {number}
+ * @since 3.0.0
+ */
+ bottomLeftColor: {
+
+ get: function ()
+ {
+ return this.colors[1];
+ },
+
+ set: function (value)
+ {
+ this.colors[1] = value;
+ }
+
+ },
+
+ /**
+ * The bottom-right color value of this Quad.
+ *
+ * @name Phaser.GameObjects.Quad#bottomRightColor
+ * @type {number}
+ * @since 3.0.0
+ */
+ bottomRightColor: {
+
+ get: function ()
+ {
+ return this.colors[2];
+ },
+
+ set: function (value)
+ {
+ this.colors[2] = value;
+ this.colors[4] = value;
+ }
+
+ },
+
+ /**
+ * Sets the top-left vertex position of this Quad.
+ *
+ * @method Phaser.GameObjects.Quad#setTopLeft
+ * @since 3.0.0
+ *
+ * @param {number} x - The horizontal coordinate of the vertex.
+ * @param {number} y - The vertical coordinate of the vertex.
+ *
+ * @return {Phaser.GameObjects.Quad} This Game Object.
+ */
+ setTopLeft: function (x, y)
+ {
+ this.topLeftX = x;
+ this.topLeftY = y;
+
+ return this;
+ },
+
+ /**
+ * Sets the top-right vertex position of this Quad.
+ *
+ * @method Phaser.GameObjects.Quad#setTopRight
+ * @since 3.0.0
+ *
+ * @param {number} x - The horizontal coordinate of the vertex.
+ * @param {number} y - The vertical coordinate of the vertex.
+ *
+ * @return {Phaser.GameObjects.Quad} This Game Object.
+ */
+ setTopRight: function (x, y)
+ {
+ this.topRightX = x;
+ this.topRightY = y;
+
+ return this;
+ },
+
+ /**
+ * Sets the bottom-left vertex position of this Quad.
+ *
+ * @method Phaser.GameObjects.Quad#setBottomLeft
+ * @since 3.0.0
+ *
+ * @param {number} x - The horizontal coordinate of the vertex.
+ * @param {number} y - The vertical coordinate of the vertex.
+ *
+ * @return {Phaser.GameObjects.Quad} This Game Object.
+ */
+ setBottomLeft: function (x, y)
+ {
+ this.bottomLeftX = x;
+ this.bottomLeftY = y;
+
+ return this;
+ },
+
+ /**
+ * Sets the bottom-right vertex position of this Quad.
+ *
+ * @method Phaser.GameObjects.Quad#setBottomRight
+ * @since 3.0.0
+ *
+ * @param {number} x - The horizontal coordinate of the vertex.
+ * @param {number} y - The vertical coordinate of the vertex.
+ *
+ * @return {Phaser.GameObjects.Quad} This Game Object.
+ */
+ setBottomRight: function (x, y)
+ {
+ this.bottomRightX = x;
+ this.bottomRightY = y;
+
+ return this;
+ },
+
+ /**
+ * Resets the positions of the four corner vertices of this Quad.
+ *
+ * @method Phaser.GameObjects.Quad#resetPosition
+ * @since 3.0.0
+ *
+ * @return {Phaser.GameObjects.Quad} This Game Object.
+ */
+ resetPosition: function ()
+ {
+ var x = this.x;
+ var y = this.y;
+ var halfWidth = Math.floor(this.width / 2);
+ var halfHeight = Math.floor(this.height / 2);
+
+ this.setTopLeft(x - halfWidth, y - halfHeight);
+ this.setTopRight(x + halfWidth, y - halfHeight);
+ this.setBottomLeft(x - halfWidth, y + halfHeight);
+ this.setBottomRight(x + halfWidth, y + halfHeight);
+
+ return this;
+ },
+
+ /**
+ * Resets the alpha values used by this Quad back to 1.
+ *
+ * @method Phaser.GameObjects.Quad#resetAlpha
+ * @since 3.0.0
+ *
+ * @return {Phaser.GameObjects.Quad} This Game Object.
+ */
+ resetAlpha: function ()
+ {
+ var alphas = this.alphas;
+
+ alphas[0] = 1;
+ alphas[1] = 1;
+ alphas[2] = 1;
+ alphas[3] = 1;
+ alphas[4] = 1;
+ alphas[5] = 1;
+
+ return this;
+ },
+
+ /**
+ * Resets the color values used by this Quad back to 0xffffff.
+ *
+ * @method Phaser.GameObjects.Quad#resetColors
+ * @since 3.0.0
+ *
+ * @return {Phaser.GameObjects.Quad} This Game Object.
+ */
+ resetColors: function ()
+ {
+ var colors = this.colors;
+
+ colors[0] = 0xffffff;
+ colors[1] = 0xffffff;
+ colors[2] = 0xffffff;
+ colors[3] = 0xffffff;
+ colors[4] = 0xffffff;
+ colors[5] = 0xffffff;
+
+ return this;
+ },
+
+ /**
+ * Resets the position, alpha and color values used by this Quad.
+ *
+ * @method Phaser.GameObjects.Quad#reset
+ * @since 3.0.0
+ *
+ * @return {Phaser.GameObjects.Quad} This Game Object.
+ */
+ reset: function ()
+ {
+ this.resetPosition();
+
+ this.resetAlpha();
+
+ return this.resetColors();
+ }
+
+});
+
+module.exports = Quad;
+
+
+/***/ }),
+/* 150 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+// Checks whether the x and y coordinates are contained within this polygon.
+// Adapted from http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html by Jonas Raoni Soares Silva
+
+/**
+ * Checks if a point is within the bounds of a Polygon.
+ *
+ * @function Phaser.Geom.Polygon.Contains
+ * @since 3.0.0
+ *
+ * @param {Phaser.Geom.Polygon} polygon - The Polygon to check against.
+ * @param {number} x - The X coordinate of the point to check.
+ * @param {number} y - The Y coordinate of the point to check.
+ *
+ * @return {boolean} `true` if the point is within the bounds of the Polygon, otherwise `false`.
+ */
+var Contains = function (polygon, x, y)
+{
+ var inside = false;
+
+ for (var i = -1, j = polygon.points.length - 1; ++i < polygon.points.length; j = i)
+ {
+ var ix = polygon.points[i].x;
+ var iy = polygon.points[i].y;
+
+ var jx = polygon.points[j].x;
+ var jy = polygon.points[j].y;
+
+ if (((iy <= y && y < jy) || (jy <= y && y < iy)) && (x < (jx - ix) * (y - iy) / (jy - iy) + ix))
+ {
+ inside = !inside;
+ }
+ }
+
+ return inside;
+};
+
+module.exports = Contains;
+
+
+/***/ }),
+/* 151 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var Contains = __webpack_require__(150);
+var GetPoints = __webpack_require__(284);
+
+/**
+ * @classdesc
+ * [description]
+ *
+ * @class Polygon
+ * @memberof Phaser.Geom
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {Phaser.Geom.Point[]} [points] - [description]
+ */
+var Polygon = new Class({
+
+ initialize:
+
+ function Polygon (points)
+ {
+ /**
+ * The area of this Polygon.
+ *
+ * @name Phaser.Geom.Polygon#area
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.area = 0;
+
+ /**
+ * An array of number pair objects that make up this polygon. I.e. [ {x,y}, {x,y}, {x,y} ]
+ *
+ * @name Phaser.Geom.Polygon#points
+ * @type {Phaser.Geom.Point[]}
+ * @since 3.0.0
+ */
+ this.points = [];
+
+ if (points)
+ {
+ this.setTo(points);
+ }
+ },
+
+ /**
+ * Check to see if the Polygon contains the given x / y coordinates.
+ *
+ * @method Phaser.Geom.Polygon#contains
+ * @since 3.0.0
+ *
+ * @param {number} x - The x coordinate to check within the polygon.
+ * @param {number} y - The y coordinate to check within the polygon.
+ *
+ * @return {boolean} `true` if the coordinates are within the polygon, otherwise `false`.
+ */
+ contains: function (x, y)
+ {
+ return Contains(this, x, y);
+ },
+
+ /**
+ * Sets this Polygon to the given points.
+ *
+ * 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 objects: `[new Phaser.Point(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], ...]`
+ *
+ * `setTo` may also be called without any arguments to remove all points.
+ *
+ * @method Phaser.Geom.Polygon#setTo
+ * @since 3.0.0
+ *
+ * @param {array} points - [description]
+ *
+ * @return {Phaser.Geom.Polygon} This Polygon object.
+ */
+ setTo: function (points)
+ {
+ this.area = 0;
+ this.points = [];
+
+ if (typeof points === 'string')
+ {
+ points = points.split(' ');
+ }
+
+ if (!Array.isArray(points))
+ {
+ return this;
+ }
+
+ var p;
+ var y0 = Number.MAX_VALUE;
+
+ // The points argument is an array, so iterate through it
+ for (var i = 0; i < points.length; i++)
+ {
+ p = { x: 0, y: 0 };
+
+ if (typeof points[i] === 'number' || typeof points[i] === 'string')
+ {
+ p.x = parseFloat(points[i]);
+ p.y = parseFloat(points[i + 1]);
+ i++;
+ }
+ else if (Array.isArray(points[i]))
+ {
+ // An array of arrays?
+ p.x = points[i][0];
+ p.y = points[i][1];
+ }
+ else
+ {
+ p.x = points[i].x;
+ p.y = points[i].y;
+ }
+
+ this.points.push(p);
+
+ // Lowest boundary
+ if (p.y < y0)
+ {
+ y0 = p.y;
+ }
+ }
+
+ this.calculateArea(y0);
+
+ return this;
+ },
+
+ /**
+ * Calculates the area of the Polygon. This is available in the property Polygon.area
+ *
+ * @method Phaser.Geom.Polygon#calculateArea
+ * @since 3.0.0
+ *
+ * @return {number} The area of the polygon.
+ */
+ calculateArea: function ()
+ {
+ if (this.points.length < 3)
+ {
+ this.area = 0;
+
+ return this.area;
+ }
+
+ var sum = 0;
+ var p1;
+ var p2;
+
+ for (var i = 0; i < this.points.length - 1; i++)
+ {
+ p1 = this.points[i];
+ p2 = this.points[i + 1];
+
+ sum += (p2.x - p1.x) * (p1.y + p2.y);
+ }
+
+ p1 = this.points[0];
+ p2 = this.points[this.points.length - 1];
+
+ sum += (p1.x - p2.x) * (p2.y + p1.y);
+
+ this.area = -sum * 0.5;
+
+ return this.area;
+ },
+
+ /**
+ * Returns an array of Point objects containing the coordinates of the points around the perimeter of the Polygon,
+ * based on the given quantity or stepRate values.
+ *
+ * @method Phaser.Geom.Polygon#getPoints
+ * @since 3.12.0
+ *
+ * @param {integer} quantity - The amount of points to return. If a falsey value the quantity will be derived from the `stepRate` instead.
+ * @param {number} [stepRate] - Sets the quantity by getting the perimeter of the Polygon and dividing it by the stepRate.
+ * @param {array} [output] - An array to insert the points in to. If not provided a new array will be created.
+ *
+ * @return {Phaser.Geom.Point[]} An array of Point objects pertaining to the points around the perimeter of the Polygon.
+ */
+ getPoints: function (quantity, step, output)
+ {
+ return GetPoints(this, quantity, step, output);
+ }
+
+});
+
+module.exports = Polygon;
+
+
+/***/ }),
+/* 152 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var CanvasPool = __webpack_require__(24);
+var Class = __webpack_require__(0);
+var Components = __webpack_require__(14);
+var CONST = __webpack_require__(26);
+var GameObject = __webpack_require__(19);
+var GetPowerOfTwo = __webpack_require__(294);
+var Smoothing = __webpack_require__(120);
+var TileSpriteRender = __webpack_require__(805);
+var Vector2 = __webpack_require__(3);
+
+// bitmask flag for GameObject.renderMask
+var _FLAG = 8; // 1000
+
+/**
+ * @classdesc
+ * A TileSprite is a Sprite that has a repeating texture.
+ *
+ * The texture can be scrolled and scaled independently of the TileSprite itself. Textures will automatically wrap and
+ * are designed so that you can create game backdrops using seamless textures as a source.
+ *
+ * You shouldn't ever create a TileSprite any larger than your actual screen size. If you want to create a large repeating background
+ * that scrolls across the whole map of your game, then you create a TileSprite that fits the screen size and then use the `tilePosition`
+ * property to scroll the texture as the player moves. If you create a TileSprite that is thousands of pixels in size then it will
+ * consume huge amounts of memory and cause performance issues. Remember: use `tilePosition` to scroll your texture and `tileScale` to
+ * adjust the scale of the texture - don't resize the sprite itself or make it larger than it needs.
+ *
+ * An important note about Tile Sprites and NPOT textures: Internally, TileSprite textures use GL_REPEAT to provide
+ * seamless repeating of the textures. This, combined with the way in which the textures are handled in WebGL, means
+ * they need to be POT (power-of-two) sizes in order to wrap. If you provide a NPOT (non power-of-two) texture to a
+ * TileSprite it will generate a POT sized canvas and draw your texture to it, scaled up to the POT size. It's then
+ * scaled back down again during rendering to the original dimensions. While this works, in that it allows you to use
+ * any size texture for a Tile Sprite, it does mean that NPOT textures are going to appear anti-aliased when rendered,
+ * due to the interpolation that took place when it was resized into a POT texture. This is especially visible in
+ * pixel art graphics. If you notice it and it becomes an issue, the only way to avoid it is to ensure that you
+ * provide POT textures for Tile Sprites.
+ *
+ * @class TileSprite
+ * @extends Phaser.GameObjects.GameObject
+ * @memberof Phaser.GameObjects
+ * @constructor
+ * @since 3.0.0
+ *
+ * @extends Phaser.GameObjects.Components.Alpha
+ * @extends Phaser.GameObjects.Components.BlendMode
+ * @extends Phaser.GameObjects.Components.ComputedSize
+ * @extends Phaser.GameObjects.Components.Crop
+ * @extends Phaser.GameObjects.Components.Depth
+ * @extends Phaser.GameObjects.Components.Flip
+ * @extends Phaser.GameObjects.Components.GetBounds
+ * @extends Phaser.GameObjects.Components.Mask
+ * @extends Phaser.GameObjects.Components.Origin
+ * @extends Phaser.GameObjects.Components.Pipeline
+ * @extends Phaser.GameObjects.Components.ScaleMode
+ * @extends Phaser.GameObjects.Components.ScrollFactor
+ * @extends Phaser.GameObjects.Components.Tint
+ * @extends Phaser.GameObjects.Components.Transform
+ * @extends Phaser.GameObjects.Components.Visible
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time.
+ * @param {number} x - The horizontal position of this Game Object in the world.
+ * @param {number} y - The vertical position of this Game Object in the world.
+ * @param {integer} width - The width of the Game Object. If zero it will use the size of the texture frame.
+ * @param {integer} height - The height of the Game Object. If zero it will use the size of the texture frame.
+ * @param {string} textureKey - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
+ * @param {(string|integer)} [frameKey] - An optional frame from the Texture this Game Object is rendering with.
+ */
+var TileSprite = new Class({
+
+ Extends: GameObject,
+
+ Mixins: [
+ Components.Alpha,
+ Components.BlendMode,
+ Components.ComputedSize,
+ Components.Crop,
+ Components.Depth,
+ Components.Flip,
+ Components.GetBounds,
+ Components.Mask,
+ Components.Origin,
+ Components.Pipeline,
+ Components.ScaleMode,
+ Components.ScrollFactor,
+ Components.Tint,
+ Components.Transform,
+ Components.Visible,
+ TileSpriteRender
+ ],
+
+ initialize:
+
+ function TileSprite (scene, x, y, width, height, textureKey, frameKey)
+ {
+ var renderer = scene.sys.game.renderer;
+
+ GameObject.call(this, scene, 'TileSprite');
+
+ var displayTexture = scene.sys.textures.get(textureKey);
+ var displayFrame = displayTexture.get(frameKey);
+
+ if (!width || !height)
+ {
+ width = displayFrame.width;
+ height = displayFrame.height;
+ }
+ else
+ {
+ width = Math.floor(width);
+ height = Math.floor(height);
+ }
+
+ /**
+ * Internal tile position vector.
+ *
+ * @name Phaser.GameObjects.TileSprite#_tilePosition
+ * @type {Phaser.Math.Vector2}
+ * @private
+ * @since 3.12.0
+ */
+ this._tilePosition = new Vector2();
+
+ /**
+ * Internal tile scale vector.
+ *
+ * @name Phaser.GameObjects.TileSprite#_tileScale
+ * @type {Phaser.Math.Vector2}
+ * @private
+ * @since 3.12.0
+ */
+ this._tileScale = new Vector2(1, 1);
+
+ /**
+ * Whether the Tile Sprite has changed in some way, requiring an re-render of its tile texture.
+ *
+ * Such changes include the texture frame and scroll position of the Tile Sprite.
+ *
+ * @name Phaser.GameObjects.TileSprite#dirty
+ * @type {boolean}
+ * @default false
+ * @since 3.0.0
+ */
+ this.dirty = false;
+
+ /**
+ * The renderer in use by this Tile Sprite.
+ *
+ * @name Phaser.GameObjects.TileSprite#renderer
+ * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)}
+ * @since 3.0.0
+ */
+ this.renderer = renderer;
+
+ /**
+ * The Canvas element that the TileSprite renders its fill pattern in to.
+ * Only used in Canvas mode.
+ *
+ * @name Phaser.GameObjects.TileSprite#canvas
+ * @type {?HTMLCanvasElement}
+ * @since 3.12.0
+ */
+ this.canvas = CanvasPool.create(this, width, height);
+
+ /**
+ * The Context of the Canvas element that the TileSprite renders its fill pattern in to.
+ * Only used in Canvas mode.
+ *
+ * @name Phaser.GameObjects.TileSprite#context
+ * @type {CanvasRenderingContext2D}
+ * @since 3.12.0
+ */
+ this.context = this.canvas.getContext('2d');
+
+ /**
+ * The Texture the TileSprite is using as its fill pattern.
+ *
+ * @name Phaser.GameObjects.TileSprite#displayTexture
+ * @type {Phaser.Textures.Texture|Phaser.Textures.CanvasTexture}
+ * @private
+ * @since 3.12.0
+ */
+ this.displayTexture = displayTexture;
+
+ /**
+ * The Frame the TileSprite is using as its fill pattern.
+ *
+ * @name Phaser.GameObjects.TileSprite#displayFrame
+ * @type {Phaser.Textures.Frame}
+ * @private
+ * @since 3.12.0
+ */
+ this.displayFrame = displayFrame;
+
+ /**
+ * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method.
+ *
+ * @name Phaser.GameObjects.TileSprite#_crop
+ * @type {object}
+ * @private
+ * @since 3.12.0
+ */
+ this._crop = this.resetCropObject();
+
+ /**
+ * The Texture this Game Object is using to render with.
+ *
+ * @name Phaser.GameObjects.TileSprite#texture
+ * @type {Phaser.Textures.Texture|Phaser.Textures.CanvasTexture}
+ * @since 3.0.0
+ */
+ this.texture = scene.sys.textures.addCanvas(null, this.canvas, true);
+
+ /**
+ * The Texture Frame this Game Object is using to render with.
+ *
+ * @name Phaser.GameObjects.TileSprite#frame
+ * @type {Phaser.Textures.Frame}
+ * @since 3.0.0
+ */
+ this.frame = this.texture.get();
+
+ /**
+ * The next power of two value from the width of the Fill Pattern frame.
+ *
+ * @name Phaser.GameObjects.TileSprite#potWidth
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.potWidth = GetPowerOfTwo(displayFrame.width);
+
+ /**
+ * The next power of two value from the height of the Fill Pattern frame.
+ *
+ * @name Phaser.GameObjects.TileSprite#potHeight
+ * @type {integer}
+ * @since 3.0.0
+ */
+ this.potHeight = GetPowerOfTwo(displayFrame.height);
+
+ /**
+ * The Canvas that the TileSprites texture is rendered to.
+ * This is used to create a WebGL texture from.
+ *
+ * @name Phaser.GameObjects.TileSprite#fillCanvas
+ * @type {HTMLCanvasElement}
+ * @since 3.12.0
+ */
+ this.fillCanvas = CanvasPool.create2D(this, this.potWidth, this.potHeight);
+
+ /**
+ * The Canvas Context used to render the TileSprites texture.
+ *
+ * @name Phaser.GameObjects.TileSprite#fillContext
+ * @type {CanvasRenderingContext2D}
+ * @since 3.12.0
+ */
+ this.fillContext = this.fillCanvas.getContext('2d');
+
+ /**
+ * The texture that the Tile Sprite is rendered to, which is then rendered to a Scene.
+ * In WebGL this is a WebGLTexture. In Canvas it's a Canvas Fill Pattern.
+ *
+ * @name Phaser.GameObjects.TileSprite#fillPattern
+ * @type {?(WebGLTexture|CanvasPattern)}
+ * @since 3.12.0
+ */
+ this.fillPattern = null;
+
+ this.setPosition(x, y);
+ this.setSize(width, height);
+ this.setFrame(frameKey);
+ this.setOriginFromFrame();
+ this.initPipeline();
+
+ if (scene.sys.game.config.renderType === CONST.WEBGL)
+ {
+ scene.sys.game.renderer.onContextRestored(function (renderer)
+ {
+ var gl = renderer.gl;
+
+ this.dirty = true;
+ this.fillPattern = null;
+ this.fillPattern = renderer.createTexture2D(0, gl.LINEAR, gl.LINEAR, gl.REPEAT, gl.REPEAT, gl.RGBA, this.fillCanvas, this.potWidth, this.potHeight);
+ }, this);
+ }
+ },
+
+ /**
+ * Sets the texture and frame this Game Object will use to render with.
+ *
+ * Textures are referenced by their string-based keys, as stored in the Texture Manager.
+ *
+ * @method Phaser.GameObjects.TileSprite#setTexture
+ * @since 3.0.0
+ *
+ * @param {string} key - The key of the texture to be used, as stored in the Texture Manager.
+ * @param {(string|integer)} [frame] - The name or index of the frame within the Texture.
+ *
+ * @return {this} This Game Object instance.
+ */
+ setTexture: function (key, frame)
+ {
+ this.displayTexture = this.scene.sys.textures.get(key);
+
+ return this.setFrame(frame);
+ },
+
+ /**
+ * Sets the frame this Game Object will use to render with.
+ *
+ * The Frame has to belong to the current Texture being used.
+ *
+ * It can be either a string or an index.
+ *
+ * @method Phaser.GameObjects.TileSprite#setFrame
+ * @since 3.0.0
+ *
+ * @param {(string|integer)} frame - The name or index of the frame within the Texture.
+ *
+ * @return {this} This Game Object instance.
+ */
+ setFrame: function (frame)
+ {
+ this.displayFrame = this.displayTexture.get(frame);
+
+ if (!this.displayFrame.cutWidth || !this.displayFrame.cutHeight)
+ {
+ this.renderFlags &= ~_FLAG;
+ }
+ else
+ {
+ this.renderFlags |= _FLAG;
+ }
+
+ this.dirty = true;
+
+ this.updateTileTexture();
+
+ return this;
+ },
+
+ /**
+ * Sets {@link Phaser.GameObjects.TileSprite#tilePositionX} and {@link Phaser.GameObjects.TileSprite#tilePositionY}.
+ *
+ * @method Phaser.GameObjects.TileSprite#setTilePosition
+ * @since 3.3.0
+ *
+ * @param {number} [x] - The x position of this sprite's tiling texture.
+ * @param {number} [y] - The y position of this sprite's tiling texture.
+ *
+ * @return {this} This Tile Sprite instance.
+ */
+ setTilePosition: function (x, y)
+ {
+ if (x !== undefined)
+ {
+ this.tilePositionX = x;
+ }
+
+ if (y !== undefined)
+ {
+ this.tilePositionY = y;
+ }
+
+ return this;
+ },
+
+ /**
+ * Sets {@link Phaser.GameObjects.TileSprite#tileScaleX} and {@link Phaser.GameObjects.TileSprite#tileScaleY}.
+ *
+ * @method Phaser.GameObjects.TileSprite#setTileScale
+ * @since 3.12.0
+ *
+ * @param {number} [x] - The horizontal scale of the tiling texture.
+ * @param {number} [y] - The vertical scale of the tiling texture.
+ *
+ * @return {this} This Tile Sprite instance.
+ */
+ setTileScale: function (x, y)
+ {
+ if (x !== undefined)
+ {
+ this.tileScaleX = x;
+ }
+
+ if (y !== undefined)
+ {
+ this.tileScaleY = y;
+ }
+
+ return this;
+ },
+
+ /**
+ * Render the tile texture if it is dirty, or if the frame has changed.
+ *
+ * @method Phaser.GameObjects.TileSprite#updateTileTexture
+ * @private
+ * @since 3.0.0
+ */
+ updateTileTexture: function ()
+ {
+ if (!this.dirty)
+ {
+ return;
+ }
+
+ // Draw the displayTexture to our fillCanvas
+
+ var frame = this.displayFrame;
+
+ var ctx = this.fillContext;
+ var canvas = this.fillCanvas;
+
+ var fw = this.potWidth;
+ var fh = this.potHeight;
+
+ if (!this.renderer.gl)
+ {
+ fw = frame.cutWidth;
+ fh = frame.cutHeight;
+ }
+
+ ctx.clearRect(0, 0, fw, fh);
+
+ canvas.width = fw;
+ canvas.height = fh;
+
+ ctx.drawImage(
+ frame.source.image,
+ frame.cutX, frame.cutY,
+ frame.cutWidth, frame.cutHeight,
+ 0, 0,
+ fw, fh
+ );
+
+ if (this.renderer.gl)
+ {
+ this.fillPattern = this.renderer.canvasToTexture(canvas, this.fillPattern);
+ }
+ else
+ {
+ this.fillPattern = ctx.createPattern(canvas, 'repeat');
+ }
+
+ this.updateCanvas();
+
+ this.dirty = false;
+ },
+
+ /**
+ * Draw the fill pattern to the internal canvas.
+ *
+ * @method Phaser.GameObjects.TileSprite#updateCanvas
+ * @private
+ * @since 3.12.0
+ */
+ updateCanvas: function ()
+ {
+ var canvas = this.canvas;
+
+ if (canvas.width !== this.width || canvas.height !== this.height)
+ {
+ canvas.width = this.width;
+ canvas.height = this.height;
+
+ this.frame.setSize(this.width, this.height);
+ }
+
+ if (!this.dirty || this.renderer && this.renderer.gl)
+ {
+ this.dirty = false;
+ return;
+ }
+
+ var ctx = this.context;
+
+ if (!this.scene.sys.game.config.antialias)
+ {
+ Smoothing.disable(ctx);
+ }
+
+ var scaleX = this._tileScale.x;
+ var scaleY = this._tileScale.y;
+
+ var positionX = this._tilePosition.x;
+ var positionY = this._tilePosition.y;
+
+ ctx.clearRect(0, 0, this.width, this.height);
+
+ ctx.save();
+
+ ctx.scale(scaleX, scaleY);
+
+ ctx.translate(-positionX, -positionY);
+
+ ctx.fillStyle = this.fillPattern;
+
+ ctx.fillRect(positionX, positionY, this.width / scaleX, this.height / scaleY);
+
+ ctx.restore();
+
+ this.dirty = false;
+ },
+
+ /**
+ * Internal destroy handler, called as part of the destroy process.
+ *
+ * @method Phaser.GameObjects.TileSprite#preDestroy
+ * @protected
+ * @since 3.9.0
+ */
+ preDestroy: function ()
+ {
+ if (this.renderer && this.renderer.gl)
+ {
+ this.renderer.deleteTexture(this.fillPattern);
+ }
+
+ CanvasPool.remove(this.canvas);
+ CanvasPool.remove(this.fillCanvas);
+
+ this.fillPattern = null;
+ this.fillContext = null;
+ this.fillCanvas = null;
+
+ this.displayTexture = null;
+ this.displayFrame = null;
+
+ this.texture.destroy();
+
+ this.renderer = null;
+ },
+
+ /**
+ * The horizontal scroll position of the Tile Sprite.
+ *
+ * @name Phaser.GameObjects.TileSprite#tilePositionX
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ tilePositionX: {
+
+ get: function ()
+ {
+ return this._tilePosition.x;
+ },
+
+ set: function (value)
+ {
+ this._tilePosition.x = value;
+ this.dirty = true;
+ }
+
+ },
+
+ /**
+ * The vertical scroll position of the Tile Sprite.
+ *
+ * @name Phaser.GameObjects.TileSprite#tilePositionY
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ tilePositionY: {
+
+ get: function ()
+ {
+ return this._tilePosition.y;
+ },
+
+ set: function (value)
+ {
+ this._tilePosition.y = value;
+ this.dirty = true;
+ }
+
+ },
+
+ /**
+ * The horizontal scale of the Tile Sprite texture.
+ *
+ * @name Phaser.GameObjects.TileSprite#tileScaleX
+ * @type {number}
+ * @default 1
+ * @since 3.11.0
+ */
+ tileScaleX: {
+
+ get: function ()
+ {
+ return this._tileScale.x;
+ },
+
+ set: function (value)
+ {
+ this._tileScale.x = value;
+ this.dirty = true;
+ }
+
+ },
+
+ /**
+ * The vertical scale of the Tile Sprite texture.
+ *
+ * @name Phaser.GameObjects.TileSprite#tileScaleY
+ * @type {number}
+ * @default 1
+ * @since 3.11.0
+ */
+ tileScaleY: {
+
+ get: function ()
+ {
+ return this._tileScale.y;
+ },
+
+ set: function (value)
+ {
+ this._tileScale.y = value;
+ this.dirty = true;
+ }
+
+ }
+
+});
+
+module.exports = TileSprite;
+
+
+/***/ }),
+/* 153 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var AddToDOM = __webpack_require__(169);
+var CanvasPool = __webpack_require__(24);
+var Class = __webpack_require__(0);
+var Components = __webpack_require__(14);
+var CONST = __webpack_require__(26);
+var GameObject = __webpack_require__(19);
+var GetTextSize = __webpack_require__(811);
+var GetValue = __webpack_require__(4);
+var RemoveFromDOM = __webpack_require__(342);
+var TextRender = __webpack_require__(810);
+var TextStyle = __webpack_require__(807);
+
+/**
+ * @classdesc
+ * 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.
+ *
+ * @class Text
+ * @extends Phaser.GameObjects.GameObject
+ * @memberof Phaser.GameObjects
+ * @constructor
+ * @since 3.0.0
+ *
+ * @extends Phaser.GameObjects.Components.Alpha
+ * @extends Phaser.GameObjects.Components.BlendMode
+ * @extends Phaser.GameObjects.Components.ComputedSize
+ * @extends Phaser.GameObjects.Components.Crop
+ * @extends Phaser.GameObjects.Components.Depth
+ * @extends Phaser.GameObjects.Components.Flip
+ * @extends Phaser.GameObjects.Components.GetBounds
+ * @extends Phaser.GameObjects.Components.Mask
+ * @extends Phaser.GameObjects.Components.Origin
+ * @extends Phaser.GameObjects.Components.Pipeline
+ * @extends Phaser.GameObjects.Components.ScaleMode
+ * @extends Phaser.GameObjects.Components.ScrollFactor
+ * @extends Phaser.GameObjects.Components.Tint
+ * @extends Phaser.GameObjects.Components.Transform
+ * @extends Phaser.GameObjects.Components.Visible
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time.
+ * @param {number} x - The horizontal position of this Game Object in the world.
+ * @param {number} y - The vertical position of this Game Object in the world.
+ * @param {(string|string[])} text - The text this Text object will display.
+ * @param {object} style - The text style configuration object.
+ */
+var Text = new Class({
+
+ Extends: GameObject,
+
+ Mixins: [
+ Components.Alpha,
+ Components.BlendMode,
+ Components.ComputedSize,
+ Components.Crop,
+ Components.Depth,
+ Components.Flip,
+ Components.GetBounds,
+ Components.Mask,
+ Components.Origin,
+ Components.Pipeline,
+ Components.ScaleMode,
+ Components.ScrollFactor,
+ Components.Tint,
+ Components.Transform,
+ Components.Visible,
+ TextRender
+ ],
+
+ initialize:
+
+ function Text (scene, x, y, text, style)
+ {
+ if (x === undefined) { x = 0; }
+ if (y === undefined) { y = 0; }
+
+ GameObject.call(this, scene, 'Text');
+
+ /**
+ * The renderer in use by this Text object.
+ *
+ * @name Phaser.GameObjects.Text#renderer
+ * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)}
+ * @since 3.12.0
+ */
+ this.renderer = scene.sys.game.renderer;
+
+ this.setPosition(x, y);
+ this.setOrigin(0, 0);
+ this.initPipeline();
+
+ /**
+ * The canvas element that the text is rendered to.
+ *
+ * @name Phaser.GameObjects.Text#canvas
+ * @type {HTMLCanvasElement}
+ * @since 3.0.0
+ */
+ this.canvas = CanvasPool.create(this);
+
+ /**
+ * The context of the canvas element that the text is rendered to.
+ *
+ * @name Phaser.GameObjects.Text#context
+ * @type {CanvasRenderingContext2D}
+ * @since 3.0.0
+ */
+ this.context = this.canvas.getContext('2d');
+
+ /**
+ * The Text Style object.
+ *
+ * Manages the style of this Text object.
+ *
+ * @name Phaser.GameObjects.Text#style
+ * @type {Phaser.GameObjects.Text.TextStyle}
+ * @since 3.0.0
+ */
+ this.style = new TextStyle(this, style);
+
+ /**
+ * Whether to automatically round line positions.
+ *
+ * @name Phaser.GameObjects.Text#autoRound
+ * @type {boolean}
+ * @default true
+ * @since 3.0.0
+ */
+ this.autoRound = true;
+
+ /**
+ * The Regular Expression that is used to split the text up into lines, in
+ * multi-line text. By default this is `/(?:\r\n|\r|\n)/`.
+ * You can change this RegExp to be anything else that you may need.
+ *
+ * @name Phaser.GameObjects.Text#splitRegExp
+ * @type {object}
+ * @since 3.0.0
+ */
+ this.splitRegExp = /(?:\r\n|\r|\n)/;
+
+ /**
+ * The text to display.
+ *
+ * @name Phaser.GameObjects.Text#_text
+ * @type {string}
+ * @private
+ * @since 3.12.0
+ */
+ this._text = '';
+
+ /**
+ * Specify a padding value which is added to the line width and height when calculating the Text size.
+ * Allows you to add extra spacing if the browser is unable to accurately determine the true font dimensions.
+ *
+ * @name Phaser.GameObjects.Text#padding
+ * @type {{left:number,right:number,top:number,bottom:number}}
+ * @since 3.0.0
+ */
+ this.padding = { left: 0, right: 0, top: 0, bottom: 0 };
+
+ /**
+ * The width of this Text object.
+ *
+ * @name Phaser.GameObjects.Text#width
+ * @type {number}
+ * @default 1
+ * @since 3.0.0
+ */
+ this.width = 1;
+
+ /**
+ * The height of this Text object.
+ *
+ * @name Phaser.GameObjects.Text#height
+ * @type {number}
+ * @default 1
+ * @since 3.0.0
+ */
+ this.height = 1;
+
+ /**
+ * The line spacing value.
+ * This value is added to the font height to calculate the overall line height.
+ * Only has an effect if this Text object contains multiple lines of text.
+ *
+ * If you update this property directly, instead of using the `setLineSpacing` method, then
+ * be sure to call `updateText` after, or you won't see the change reflected in the Text object.
+ *
+ * @name Phaser.GameObjects.Text#lineSpacing
+ * @type {number}
+ * @since 3.13.0
+ */
+ this.lineSpacing = 0;
+
+ /**
+ * Whether the text or its settings have changed and need updating.
+ *
+ * @name Phaser.GameObjects.Text#dirty
+ * @type {boolean}
+ * @default false
+ * @since 3.0.0
+ */
+ this.dirty = false;
+
+ // If resolution wasn't set, then we get it from the game config
+ if (this.style.resolution === 0)
+ {
+ this.style.resolution = scene.sys.game.config.resolution;
+ }
+
+ /**
+ * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method.
+ *
+ * @name Phaser.GameObjects.Text#_crop
+ * @type {object}
+ * @private
+ * @since 3.12.0
+ */
+ this._crop = this.resetCropObject();
+
+ // Create a Texture for this Text object
+ this.texture = scene.sys.textures.addCanvas(null, this.canvas, true);
+
+ // Get the frame
+ this.frame = this.texture.get();
+
+ // Set the resolution
+ this.frame.source.resolution = this.style.resolution;
+
+ if (this.renderer && this.renderer.gl)
+ {
+ // Clear the default 1x1 glTexture, as we override it later
+ this.renderer.deleteTexture(this.frame.source.glTexture);
+
+ this.frame.source.glTexture = null;
+ }
+
+ this.initRTL();
+
+ if (style && style.padding)
+ {
+ this.setPadding(style.padding);
+ }
+
+ if (style && style.lineSpacing)
+ {
+ this.lineSpacing = style.lineSpacing;
+ }
+
+ this.setText(text);
+
+ if (scene.sys.game.config.renderType === CONST.WEBGL)
+ {
+ scene.sys.game.renderer.onContextRestored(function ()
+ {
+ this.dirty = true;
+ }, this);
+ }
+ },
+
+ /**
+ * Initialize right to left text.
+ *
+ * @method Phaser.GameObjects.Text#initRTL
+ * @since 3.0.0
+ */
+ initRTL: function ()
+ {
+ if (!this.style.rtl)
+ {
+ return;
+ }
+
+ // Here is where the crazy starts.
+ //
+ // Due to browser implementation issues, you cannot fillText BiDi text to a canvas
+ // that is not part of the DOM. It just completely ignores the direction property.
+
+ this.canvas.dir = 'rtl';
+
+ // Experimental atm, but one day ...
+ this.context.direction = 'rtl';
+
+ // Add it to the DOM, but hidden within the parent canvas.
+ this.canvas.style.display = 'none';
+
+ AddToDOM(this.canvas, this.scene.sys.canvas);
+
+ // And finally we set the x origin
+ this.originX = 1;
+ },
+
+ /**
+ * Greedy wrapping algorithm that will wrap words as the line grows longer than its horizontal
+ * bounds.
+ *
+ * @method Phaser.GameObjects.Text#runWordWrap
+ * @since 3.0.0
+ *
+ * @param {string} text - The text to perform word wrap detection against.
+ *
+ * @return {string} The text after wrapping has been applied.
+ */
+ runWordWrap: function (text)
+ {
+ var style = this.style;
+
+ if (style.wordWrapCallback)
+ {
+ var wrappedLines = style.wordWrapCallback.call(style.wordWrapCallbackScope, text, this);
+
+ if (Array.isArray(wrappedLines))
+ {
+ wrappedLines = wrappedLines.join('\n');
+ }
+
+ return wrappedLines;
+ }
+ else if (style.wordWrapWidth)
+ {
+ if (style.wordWrapUseAdvanced)
+ {
+ return this.advancedWordWrap(text, this.context, this.style.wordWrapWidth);
+ }
+ else
+ {
+ return this.basicWordWrap(text, this.context, this.style.wordWrapWidth);
+ }
+ }
+ else
+ {
+ return text;
+ }
+ },
+
+ /**
+ * Advanced wrapping algorithm that will wrap words as the line grows longer than its horizontal
+ * bounds. Consecutive spaces will be collapsed and replaced with a single space. Lines will be
+ * trimmed of white space before processing. Throws an error if wordWrapWidth is less than a
+ * single character.
+ *
+ * @method Phaser.GameObjects.Text#advancedWordWrap
+ * @since 3.0.0
+ *
+ * @param {string} text - The text to perform word wrap detection against.
+ * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context.
+ * @param {number} wordWrapWidth - The word wrap width.
+ *
+ * @return {string} The wrapped text.
+ */
+ advancedWordWrap: function (text, context, wordWrapWidth)
+ {
+ var output = '';
+
+ // Condense consecutive spaces and split into lines
+ var lines = text
+ .replace(/ +/gi, ' ')
+ .split(this.splitRegExp);
+
+ var linesCount = lines.length;
+
+ for (var i = 0; i < linesCount; i++)
+ {
+ var line = lines[i];
+ var out = '';
+
+ // Trim whitespace
+ line = line.replace(/^ *|\s*$/gi, '');
+
+ // If entire line is less than wordWrapWidth append the entire line and exit early
+ var lineWidth = context.measureText(line).width;
+
+ if (lineWidth < wordWrapWidth)
+ {
+ output += line + '\n';
+ continue;
+ }
+
+ // Otherwise, calculate new lines
+ var currentLineWidth = wordWrapWidth;
+
+ // Split into words
+ var words = line.split(' ');
+
+ for (var j = 0; j < words.length; j++)
+ {
+ var word = words[j];
+ var wordWithSpace = word + ' ';
+ var wordWidth = context.measureText(wordWithSpace).width;
+
+ if (wordWidth > currentLineWidth)
+ {
+ // Break word
+ if (j === 0)
+ {
+ // Shave off letters from word until it's small enough
+ var newWord = wordWithSpace;
+
+ while (newWord.length)
+ {
+ newWord = newWord.slice(0, -1);
+ wordWidth = context.measureText(newWord).width;
+
+ if (wordWidth <= currentLineWidth)
+ {
+ break;
+ }
+ }
+
+ // If wordWrapWidth is too small for even a single letter, shame user
+ // failure with a fatal error
+ if (!newWord.length)
+ {
+ throw new Error('This text\'s wordWrapWidth setting is less than a single character!');
+ }
+
+ // Replace current word in array with remainder
+ var secondPart = word.substr(newWord.length);
+
+ words[j] = secondPart;
+
+ // Append first piece to output
+ out += newWord;
+ }
+
+ // If existing word length is 0, don't include it
+ var offset = (words[j].length) ? j : j + 1;
+
+ // Collapse rest of sentence and remove any trailing white space
+ var remainder = words.slice(offset).join(' ')
+ .replace(/[ \n]*$/gi, '');
+
+ // Prepend remainder to next line
+ lines[i + 1] = remainder + ' ' + (lines[i + 1] || '');
+ linesCount = lines.length;
+
+ break; // Processing on this line
+
+ // Append word with space to output
+ }
+ else
+ {
+ out += wordWithSpace;
+ currentLineWidth -= wordWidth;
+ }
+ }
+
+ // Append processed line to output
+ output += out.replace(/[ \n]*$/gi, '') + '\n';
+ }
+
+ // Trim the end of the string
+ output = output.replace(/[\s|\n]*$/gi, '');
+
+ return output;
+ },
+
+ /**
+ * Greedy wrapping algorithm that will wrap words as the line grows longer than its horizontal
+ * bounds. Spaces are not collapsed and whitespace is not trimmed.
+ *
+ * @method Phaser.GameObjects.Text#basicWordWrap
+ * @since 3.0.0
+ *
+ * @param {string} text - The text to perform word wrap detection against.
+ * @param {CanvasRenderingContext2D} context - The Canvas Rendering Context.
+ * @param {number} wordWrapWidth - The word wrap width.
+ *
+ * @return {string} The wrapped text.
+ */
+ basicWordWrap: function (text, context, wordWrapWidth)
+ {
+ var result = '';
+ var lines = text.split(this.splitRegExp);
+
+ for (var i = 0; i < lines.length; i++)
+ {
+ var spaceLeft = wordWrapWidth;
+ var words = lines[i].split(' ');
+
+ for (var j = 0; j < words.length; j++)
+ {
+ var wordWidth = context.measureText(words[j]).width;
+ var wordWidthWithSpace = wordWidth + context.measureText(' ').width;
+
+ if (wordWidthWithSpace > spaceLeft)
+ {
+ // Skip printing the newline if it's the first word of the line that is greater
+ // than the word wrap width.
+ if (j > 0)
+ {
+ result += '\n';
+ }
+
+ result += words[j] + ' ';
+ spaceLeft = wordWrapWidth - wordWidth;
+ }
+ else
+ {
+ spaceLeft -= wordWidthWithSpace;
+ result += words[j];
+
+ if (j < (words.length - 1))
+ {
+ result += ' ';
+ }
+ }
+ }
+
+ if (i < lines.length - 1)
+ {
+ result += '\n';
+ }
+ }
+
+ return result;
+ },
+
+ /**
+ * Runs the given text through this Text objects word wrapping and returns the results as an
+ * array, where each element of the array corresponds to a wrapped line of text.
+ *
+ * @method Phaser.GameObjects.Text#getWrappedText
+ * @since 3.0.0
+ *
+ * @param {string} text - The text for which the wrapping will be calculated. If unspecified, the Text objects current text will be used.
+ *
+ * @return {string[]} An array of strings with the pieces of wrapped text.
+ */
+ getWrappedText: function (text)
+ {
+ if (text === undefined) { text = this._text; }
+
+ this.style.syncFont(this.canvas, this.context);
+
+ var wrappedLines = this.runWordWrap(text);
+
+ return wrappedLines.split(this.splitRegExp);
+ },
+
+ /**
+ * Set the text to display.
+ *
+ * An array of strings will be joined with `\n` line breaks.
+ *
+ * @method Phaser.GameObjects.Text#setText
+ * @since 3.0.0
+ *
+ * @param {(string|string[])} value - The string, or array of strings, to be set as the content of this Text object.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setText: function (value)
+ {
+ if (!value && value !== 0)
+ {
+ value = '';
+ }
+
+ if (Array.isArray(value))
+ {
+ value = value.join('\n');
+ }
+
+ if (value !== this._text)
+ {
+ this._text = value.toString();
+
+ this.updateText();
+ }
+
+ return this;
+ },
+
+ /**
+ * Set the text style.
+ *
+ * @example
+ * text.setStyle({
+ * fontSize: '64px',
+ * fontFamily: 'Arial',
+ * color: '#ffffff',
+ * align: 'center',
+ * backgroundColor: '#ff00ff'
+ * });
+ *
+ * @method Phaser.GameObjects.Text#setStyle
+ * @since 3.0.0
+ *
+ * @param {object} style - The style settings to set.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setStyle: function (style)
+ {
+ return this.style.setStyle(style);
+ },
+
+ /**
+ * 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.
+ *
+ * @method Phaser.GameObjects.Text#setFont
+ * @since 3.0.0
+ *
+ * @param {string} font - The font family or font settings to set.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setFont: function (font)
+ {
+ return this.style.setFont(font);
+ },
+
+ /**
+ * Set the font family.
+ *
+ * @method Phaser.GameObjects.Text#setFontFamily
+ * @since 3.0.0
+ *
+ * @param {string} family - The font family.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setFontFamily: function (family)
+ {
+ return this.style.setFontFamily(family);
+ },
+
+ /**
+ * Set the font size.
+ *
+ * @method Phaser.GameObjects.Text#setFontSize
+ * @since 3.0.0
+ *
+ * @param {number} size - The font size.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setFontSize: function (size)
+ {
+ return this.style.setFontSize(size);
+ },
+
+ /**
+ * Set the font style.
+ *
+ * @method Phaser.GameObjects.Text#setFontStyle
+ * @since 3.0.0
+ *
+ * @param {string} style - The font style.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setFontStyle: function (style)
+ {
+ return this.style.setFontStyle(style);
+ },
+
+ /**
+ * Set a fixed width and height for the text.
+ *
+ * Pass in `0` for either of these parameters to disable fixed width or height respectively.
+ *
+ * @method Phaser.GameObjects.Text#setFixedSize
+ * @since 3.0.0
+ *
+ * @param {number} width - The fixed width to set. `0` disables fixed width.
+ * @param {number} height - The fixed height to set. `0` disables fixed height.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setFixedSize: function (width, height)
+ {
+ return this.style.setFixedSize(width, height);
+ },
+
+ /**
+ * Set the background color.
+ *
+ * @method Phaser.GameObjects.Text#setBackgroundColor
+ * @since 3.0.0
+ *
+ * @param {string} color - The background color.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setBackgroundColor: function (color)
+ {
+ return this.style.setBackgroundColor(color);
+ },
+
+ /**
+ * Set the text fill color.
+ *
+ * @method Phaser.GameObjects.Text#setFill
+ * @since 3.0.0
+ *
+ * @param {string} color - The text fill color.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setFill: function (color)
+ {
+ return this.style.setFill(color);
+ },
+
+ /**
+ * Set the text fill color.
+ *
+ * @method Phaser.GameObjects.Text#setColor
+ * @since 3.0.0
+ *
+ * @param {string} color - The text fill color.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setColor: function (color)
+ {
+ return this.style.setColor(color);
+ },
+
+ /**
+ * Set the stroke settings.
+ *
+ * @method Phaser.GameObjects.Text#setStroke
+ * @since 3.0.0
+ *
+ * @param {string} color - The stroke color.
+ * @param {number} thickness - The stroke thickness.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setStroke: function (color, thickness)
+ {
+ return this.style.setStroke(color, thickness);
+ },
+
+ /**
+ * Set the shadow settings.
+ *
+ * @method Phaser.GameObjects.Text#setShadow
+ * @since 3.0.0
+ *
+ * @param {number} [x=0] - The horizontal shadow offset.
+ * @param {number} [y=0] - The vertical shadow offset.
+ * @param {string} [color='#000'] - The shadow color.
+ * @param {number} [blur=0] - The shadow blur radius.
+ * @param {boolean} [shadowStroke=false] - Whether to stroke the shadow.
+ * @param {boolean} [shadowFill=true] - Whether to fill the shadow.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setShadow: function (x, y, color, blur, shadowStroke, shadowFill)
+ {
+ return this.style.setShadow(x, y, color, blur, shadowStroke, shadowFill);
+ },
+
+ /**
+ * Set the shadow offset.
+ *
+ * @method Phaser.GameObjects.Text#setShadowOffset
+ * @since 3.0.0
+ *
+ * @param {number} x - The horizontal shadow offset.
+ * @param {number} y - The vertical shadow offset.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setShadowOffset: function (x, y)
+ {
+ return this.style.setShadowOffset(x, y);
+ },
+
+ /**
+ * Set the shadow color.
+ *
+ * @method Phaser.GameObjects.Text#setShadowColor
+ * @since 3.0.0
+ *
+ * @param {string} color - The shadow color.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setShadowColor: function (color)
+ {
+ return this.style.setShadowColor(color);
+ },
+
+ /**
+ * Set the shadow blur radius.
+ *
+ * @method Phaser.GameObjects.Text#setShadowBlur
+ * @since 3.0.0
+ *
+ * @param {number} blur - The shadow blur radius.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setShadowBlur: function (blur)
+ {
+ return this.style.setShadowBlur(blur);
+ },
+
+ /**
+ * Enable or disable shadow stroke.
+ *
+ * @method Phaser.GameObjects.Text#setShadowStroke
+ * @since 3.0.0
+ *
+ * @param {boolean} enabled - Whether shadow stroke is enabled or not.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setShadowStroke: function (enabled)
+ {
+ return this.style.setShadowStroke(enabled);
+ },
+
+ /**
+ * Enable or disable shadow fill.
+ *
+ * @method Phaser.GameObjects.Text#setShadowFill
+ * @since 3.0.0
+ *
+ * @param {boolean} enabled - Whether shadow fill is enabled or not.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setShadowFill: function (enabled)
+ {
+ return this.style.setShadowFill(enabled);
+ },
+
+ /**
+ * Set the width (in pixels) to use for wrapping lines. Pass in null to remove wrapping by width.
+ *
+ * @method Phaser.GameObjects.Text#setWordWrapWidth
+ * @since 3.0.0
+ *
+ * @param {?number} width - The maximum width of a line in pixels. Set to null to remove wrapping.
+ * @param {boolean} [useAdvancedWrap=false] - 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.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setWordWrapWidth: function (width, useAdvancedWrap)
+ {
+ return this.style.setWordWrapWidth(width, useAdvancedWrap);
+ },
+
+ /**
+ * Set a custom callback for wrapping lines. Pass in null to remove wrapping by callback.
+ *
+ * @method Phaser.GameObjects.Text#setWordWrapCallback
+ * @since 3.0.0
+ *
+ * @param {TextStyleWordWrapCallback} 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 {object} [scope=null] - The scope that will be applied when the callback is invoked.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setWordWrapCallback: function (callback, scope)
+ {
+ return this.style.setWordWrapCallback(callback, scope);
+ },
+
+ /**
+ * Set the text alignment.
+ *
+ * Expects values like `'left'`, `'right'`, `'center'` or `'justified'`.
+ *
+ * @method Phaser.GameObjects.Text#setAlign
+ * @since 3.0.0
+ *
+ * @param {string} align - The text alignment.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setAlign: function (align)
+ {
+ return this.style.setAlign(align);
+ },
+
+ /**
+ * Set the resolution used by this 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, or by specifying it in the Text style configuration object.
+ *
+ * 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.
+ *
+ * Therefore, please use with caution, as the more high res Text you have, the more memory it uses.
+ *
+ * @method Phaser.GameObjects.Text#setResolution
+ * @since 3.12.0
+ *
+ * @param {number} value - The resolution for this Text object to use.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setResolution: function (value)
+ {
+ return this.style.setResolution(value);
+ },
+
+ /**
+ * Sets the line spacing value.
+ *
+ * This value is _added_ to the height of the font when calculating the overall line height.
+ * This only has an effect if this Text object consists of multiple lines of text.
+ *
+ * @method Phaser.GameObjects.Text#setLineSpacing
+ * @since 3.13.0
+ *
+ * @param {number} value - The amount to add to the font height to achieve the overall line height.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setLineSpacing: function (value)
+ {
+ this.lineSpacing = value;
+
+ return this.updateText();
+ },
+
+ /**
+ * Set the text padding.
+ *
+ * 'left' can be an object.
+ *
+ * If only 'left' and 'top' are given they are treated as 'x' and 'y'.
+ *
+ * @method Phaser.GameObjects.Text#setPadding
+ * @since 3.0.0
+ *
+ * @param {(number|object)} left - The left padding value, or a padding config object.
+ * @param {number} top - The top padding value.
+ * @param {number} right - The right padding value.
+ * @param {number} bottom - The bottom padding value.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setPadding: function (left, top, right, bottom)
+ {
+ if (typeof left === 'object')
+ {
+ var config = left;
+
+ // If they specify x and/or y this applies to all
+ var x = GetValue(config, 'x', null);
+
+ if (x !== null)
+ {
+ left = x;
+ right = x;
+ }
+ else
+ {
+ left = GetValue(config, 'left', 0);
+ right = GetValue(config, 'right', left);
+ }
+
+ var y = GetValue(config, 'y', null);
+
+ if (y !== null)
+ {
+ top = y;
+ bottom = y;
+ }
+ else
+ {
+ top = GetValue(config, 'top', 0);
+ bottom = GetValue(config, 'bottom', top);
+ }
+ }
+ else
+ {
+ if (left === undefined) { left = 0; }
+ if (top === undefined) { top = left; }
+ if (right === undefined) { right = left; }
+ if (bottom === undefined) { bottom = top; }
+ }
+
+ this.padding.left = left;
+ this.padding.top = top;
+ this.padding.right = right;
+ this.padding.bottom = bottom;
+
+ return this.updateText();
+ },
+
+ /**
+ * Set the maximum number of lines to draw.
+ *
+ * @method Phaser.GameObjects.Text#setMaxLines
+ * @since 3.0.0
+ *
+ * @param {integer} [max=0] - The maximum number of lines to draw.
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ setMaxLines: function (max)
+ {
+ return this.style.setMaxLines(max);
+ },
+
+ /**
+ * Update the displayed text.
+ *
+ * @method Phaser.GameObjects.Text#updateText
+ * @since 3.0.0
+ *
+ * @return {Phaser.GameObjects.Text} This Text object.
+ */
+ updateText: function ()
+ {
+ var canvas = this.canvas;
+ var context = this.context;
+ var style = this.style;
+ var resolution = style.resolution;
+ var size = style.metrics;
+
+ style.syncFont(canvas, context);
+
+ var outputText = this._text;
+
+ if (style.wordWrapWidth || style.wordWrapCallback)
+ {
+ outputText = this.runWordWrap(this._text);
+ }
+
+ // Split text into lines
+ var lines = outputText.split(this.splitRegExp);
+
+ var textSize = GetTextSize(this, size, lines);
+
+ var padding = this.padding;
+
+ var w = textSize.width + padding.left + padding.right;
+ var h = textSize.height + padding.top + padding.bottom;
+
+ if (style.fixedWidth === 0)
+ {
+ this.width = w;
+ }
+
+ if (style.fixedHeight === 0)
+ {
+ this.height = h;
+ }
+
+ this.updateDisplayOrigin();
+
+ w *= resolution;
+ h *= resolution;
+
+ w = Math.max(w, 1);
+ h = Math.max(h, 1);
+
+ if (canvas.width !== w || canvas.height !== h)
+ {
+ canvas.width = w;
+ canvas.height = h;
+
+ this.frame.setSize(w, h);
+
+ style.syncFont(canvas, context); // Resizing resets the context
+ }
+ else
+ {
+ context.clearRect(0, 0, w, h);
+ }
+
+ context.save();
+
+ context.scale(resolution, resolution);
+
+ if (style.backgroundColor)
+ {
+ context.fillStyle = style.backgroundColor;
+ context.fillRect(0, 0, w, h);
+ }
+
+ style.syncStyle(canvas, context);
+
+ context.textBaseline = 'alphabetic';
+
+ // Apply padding
+ context.translate(padding.left, padding.top);
+
+ var linePositionX;
+ var linePositionY;
+
+ // Draw text line by line
+ for (var i = 0; i < textSize.lines; i++)
+ {
+ linePositionX = style.strokeThickness / 2;
+ linePositionY = (style.strokeThickness / 2 + i * textSize.lineHeight) + size.ascent;
+
+ if (i > 0)
+ {
+ linePositionY += (textSize.lineSpacing * i);
+ }
+
+ if (style.rtl)
+ {
+ linePositionX = w - linePositionX;
+ }
+ else if (style.align === 'right')
+ {
+ linePositionX += textSize.width - textSize.lineWidths[i];
+ }
+ else if (style.align === 'center')
+ {
+ linePositionX += (textSize.width - textSize.lineWidths[i]) / 2;
+ }
+
+ if (this.autoRound)
+ {
+ linePositionX = Math.round(linePositionX);
+ linePositionY = Math.round(linePositionY);
+ }
+
+ if (style.strokeThickness)
+ {
+ this.style.syncShadow(context, style.shadowStroke);
+
+ context.strokeText(lines[i], linePositionX, linePositionY);
+ }
+
+ if (style.color)
+ {
+ this.style.syncShadow(context, style.shadowFill);
+
+ context.fillText(lines[i], linePositionX, linePositionY);
+ }
+ }
+
+ context.restore();
+
+ if (this.renderer.gl)
+ {
+ this.frame.source.glTexture = this.renderer.canvasToTexture(canvas, this.frame.source.glTexture, true);
+
+ this.frame.glTexture = this.frame.source.glTexture;
+ }
+
+ this.dirty = true;
+
+ return this;
+ },
+
+ /**
+ * Get the current text metrics.
+ *
+ * @method Phaser.GameObjects.Text#getTextMetrics
+ * @since 3.0.0
+ *
+ * @return {object} The text metrics.
+ */
+ getTextMetrics: function ()
+ {
+ return this.style.getTextMetrics();
+ },
+
+ /**
+ * The text string being rendered by this Text Game Object.
+ *
+ * @name Phaser.GameObjects.Text#text
+ * @type {string}
+ * @since 3.0.0
+ */
+ text: {
+
+ get: function ()
+ {
+ return this._text;
+ },
+
+ set: function (value)
+ {
+ this.setText(value);
+ }
+
+ },
+
+ /**
+ * Build a JSON representation of the Text object.
+ *
+ * @method Phaser.GameObjects.Text#toJSON
+ * @since 3.0.0
+ *
+ * @return {JSONGameObject} A JSON representation of the Text object.
+ */
+ toJSON: function ()
+ {
+ var out = Components.ToJSON(this);
+
+ // Extra Text data is added here
+
+ var data = {
+ autoRound: this.autoRound,
+ text: this._text,
+ style: this.style.toJSON(),
+ padding: {
+ left: this.padding.left,
+ right: this.padding.right,
+ top: this.padding.top,
+ bottom: this.padding.bottom
+ }
+ };
+
+ out.data = data;
+
+ return out;
+ },
+
+ /**
+ * Internal destroy handler, called as part of the destroy process.
+ *
+ * @method Phaser.GameObjects.Text#preDestroy
+ * @protected
+ * @since 3.0.0
+ */
+ preDestroy: function ()
+ {
+ if (this.style.rtl)
+ {
+ RemoveFromDOM(this.canvas);
+ }
+
+ CanvasPool.remove(this.canvas);
+
+ this.texture.destroy();
+ }
+
+});
+
+module.exports = Text;
+
+
+/***/ }),
+/* 154 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Camera = __webpack_require__(121);
+var CanvasPool = __webpack_require__(24);
+var Class = __webpack_require__(0);
+var Components = __webpack_require__(14);
+var CONST = __webpack_require__(26);
+var Frame = __webpack_require__(113);
+var GameObject = __webpack_require__(19);
+var Render = __webpack_require__(817);
+var UUID = __webpack_require__(295);
+
+/**
+ * @classdesc
+ * A Render Texture.
+ *
+ * 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.
+ *
+ * @class RenderTexture
+ * @extends Phaser.GameObjects.GameObject
+ * @memberof Phaser.GameObjects
+ * @constructor
+ * @since 3.2.0
+ *
+ * @extends Phaser.GameObjects.Components.Alpha
+ * @extends Phaser.GameObjects.Components.BlendMode
+ * @extends Phaser.GameObjects.Components.ComputedSize
+ * @extends Phaser.GameObjects.Components.Depth
+ * @extends Phaser.GameObjects.Components.Flip
+ * @extends Phaser.GameObjects.Components.GetBounds
+ * @extends Phaser.GameObjects.Components.Mask
+ * @extends Phaser.GameObjects.Components.Origin
+ * @extends Phaser.GameObjects.Components.Pipeline
+ * @extends Phaser.GameObjects.Components.ScaleMode
+ * @extends Phaser.GameObjects.Components.ScrollFactor
+ * @extends Phaser.GameObjects.Components.Tint
+ * @extends Phaser.GameObjects.Components.Transform
+ * @extends Phaser.GameObjects.Components.Visible
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time.
+ * @param {number} [x=0] - The horizontal position of this Game Object in the world.
+ * @param {number} [y=0] - The vertical position of this Game Object in the world.
+ * @param {integer} [width=32] - The width of the Render Texture.
+ * @param {integer} [height=32] - The height of the Render Texture.
+ */
+var RenderTexture = new Class({
+
+ Extends: GameObject,
+
+ Mixins: [
+ Components.Alpha,
+ Components.BlendMode,
+ Components.ComputedSize,
+ Components.Crop,
+ Components.Depth,
+ Components.Flip,
+ Components.GetBounds,
+ Components.Mask,
+ Components.Origin,
+ Components.Pipeline,
+ Components.ScaleMode,
+ Components.ScrollFactor,
+ Components.Tint,
+ Components.Transform,
+ Components.Visible,
+ Render
+ ],
+
+ initialize:
+
+ function RenderTexture (scene, x, y, width, height)
+ {
+ if (x === undefined) { x = 0; }
+ if (y === undefined) { y = 0; }
+ if (width === undefined) { width = 32; }
+ if (height === undefined) { height = 32; }
+
+ GameObject.call(this, scene, 'RenderTexture');
+
+ /**
+ * A reference to either the Canvas or WebGL Renderer that the Game instance is using.
+ *
+ * @name Phaser.GameObjects.RenderTexture#renderer
+ * @type {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)}
+ * @since 3.2.0
+ */
+ this.renderer = scene.sys.game.renderer;
+
+ /**
+ * A reference to the Texture Manager.
+ *
+ * @name Phaser.GameObjects.RenderTexture#textureManager
+ * @type {Phaser.Textures.TextureManager}
+ * @since 3.12.0
+ */
+ this.textureManager = scene.sys.textures;
+
+ /**
+ * The tint of the Render Texture when rendered.
+ *
+ * @name Phaser.GameObjects.RenderTexture#globalTint
+ * @type {number}
+ * @default 0xffffff
+ * @since 3.2.0
+ */
+ this.globalTint = 0xffffff;
+
+ /**
+ * The alpha of the Render Texture when rendered.
+ *
+ * @name Phaser.GameObjects.RenderTexture#globalAlpha
+ * @type {number}
+ * @default 1
+ * @since 3.2.0
+ */
+ this.globalAlpha = 1;
+
+ /**
+ * The HTML Canvas Element that the Render Texture is drawing to.
+ * This is only populated if Phaser is running with the Canvas Renderer.
+ *
+ * @name Phaser.GameObjects.RenderTexture#canvas
+ * @type {HTMLCanvasElement}
+ * @since 3.2.0
+ */
+ this.canvas = CanvasPool.create2D(this, width, height);
+
+ /**
+ * A reference to the Rendering Context belonging to the Canvas Element this Render Texture is drawing to.
+ *
+ * @name Phaser.GameObjects.RenderTexture#context
+ * @type {CanvasRenderingContext2D}
+ * @since 3.2.0
+ */
+ this.context = this.canvas.getContext('2d');
+
+ /**
+ * A reference to the GL Frame Buffer this Render Texture is drawing to.
+ * This is only set if Phaser is running with the WebGL Renderer.
+ *
+ * @name Phaser.GameObjects.RenderTexture#framebuffer
+ * @type {?WebGLFramebuffer}
+ * @since 3.2.0
+ */
+ this.framebuffer = null;
+
+ /**
+ * The internal crop data object, as used by `setCrop` and passed to the `Frame.setCropUVs` method.
+ *
+ * @name Phaser.GameObjects.RenderTexture#_crop
+ * @type {object}
+ * @private
+ * @since 3.12.0
+ */
+ this._crop = this.resetCropObject();
+
+ /**
+ * The Texture corresponding to this Render Texture.
+ *
+ * @name Phaser.GameObjects.RenderTexture#texture
+ * @type {Phaser.Textures.Texture}
+ * @since 3.12.0
+ */
+ this.texture = scene.sys.textures.addCanvas(UUID(), this.canvas);
+
+ /**
+ * The Frame corresponding to this Render Texture.
+ *
+ * @name Phaser.GameObjects.RenderTexture#frame
+ * @type {Phaser.Textures.Frame}
+ * @since 3.12.0
+ */
+ this.frame = this.texture.get();
+
+ /**
+ * Internal saved texture flag.
+ *
+ * @name Phaser.GameObjects.RenderTexture#_saved
+ * @type {boolean}
+ * @private
+ * @since 3.12.0
+ */
+ this._saved = false;
+
+ /**
+ * An internal Camera that can be used to move around the Render Texture.
+ * Control it just like you would any Scene Camera. The difference is that it only impacts the placement of what
+ * is drawn to the Render Texture. You can scroll, zoom and rotate this Camera.
+ *
+ * @name Phaser.GameObjects.RenderTexture#camera
+ * @type {Phaser.Cameras.Scene2D.BaseCamera}
+ * @since 3.12.0
+ */
+ this.camera = new Camera(0, 0, width, height);
+
+ /**
+ * Is this Render Texture dirty or not? If not it won't spend time clearing or filling itself.
+ *
+ * @name Phaser.GameObjects.RenderTexture#dirty
+ * @type {boolean}
+ * @since 3.12.0
+ */
+ this.dirty = false;
+
+ /**
+ * A reference to the WebGL Rendering Context.
+ *
+ * @name Phaser.GameObjects.RenderTexture#gl
+ * @type {WebGLRenderingContext}
+ * @default null
+ * @since 3.0.0
+ */
+ this.gl = null;
+
+ var renderer = this.renderer;
+
+ if (renderer.type === CONST.WEBGL)
+ {
+ var gl = renderer.gl;
+
+ this.gl = gl;
+ this.drawGameObject = this.batchGameObjectWebGL;
+ this.framebuffer = renderer.createFramebuffer(width, height, this.frame.source.glTexture, false);
+ }
+ else if (renderer.type === CONST.CANVAS)
+ {
+ this.drawGameObject = this.batchGameObjectCanvas;
+ }
+
+ this.camera.setScene(scene);
+
+ this.setPosition(x, y);
+ this.setSize(width, height);
+ this.setOrigin(0, 0);
+ this.initPipeline();
+ },
+
+ /**
+ * Sets the size of this Game Object.
+ *
+ * @method Phaser.GameObjects.Components.Size#setSize
+ * @since 3.0.0
+ *
+ * @param {number} width - The width of this Game Object.
+ * @param {number} height - The height of this Game Object.
+ *
+ * @return {this} This Game Object instance.
+ */
+ setSize: function (width, height)
+ {
+ return this.resize(width, height);
+ },
+
+ /**
+ * Resizes the Render Texture to the new dimensions given.
+ *
+ * In WebGL it will destroy and then re-create the frame buffer being used by the Render Texture.
+ * In Canvas it will resize the underlying canvas element.
+ * Both approaches will erase everything currently drawn to the Render Texture.
+ *
+ * If the dimensions given are the same as those already being used, calling this method will do nothing.
+ *
+ * @method Phaser.GameObjects.RenderTexture#resize
+ * @since 3.10.0
+ *
+ * @param {number} width - The new width of the Render Texture.
+ * @param {number} [height] - The new height of the Render Texture. If not specified, will be set the same as the `width`.
+ *
+ * @return {this} This Render Texture.
+ */
+ resize: function (width, height)
+ {
+ if (height === undefined) { height = width; }
+
+ if (width !== this.width || height !== this.height)
+ {
+ this.canvas.width = width;
+ this.canvas.height = height;
+
+ if (this.gl)
+ {
+ var gl = this.gl;
+
+ this.renderer.deleteTexture(this.frame.source.glTexture);
+ this.renderer.deleteFramebuffer(this.framebuffer);
+
+ this.frame.source.glTexture = this.renderer.createTexture2D(0, gl.NEAREST, gl.NEAREST, gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE, gl.RGBA, null, width, height, false);
+ this.framebuffer = this.renderer.createFramebuffer(width, height, this.frame.source.glTexture, false);
+
+ this.frame.glTexture = this.frame.source.glTexture;
+ }
+
+ this.frame.source.width = width;
+ this.frame.source.height = height;
+
+ this.camera.setSize(width, height);
+
+ this.frame.setSize(width, height);
+
+ this.width = width;
+ this.height = height;
+ }
+
+ return this;
+ },
+
+ /**
+ * Set the tint to use when rendering this Render Texture.
+ *
+ * @method Phaser.GameObjects.RenderTexture#setGlobalTint
+ * @since 3.2.0
+ *
+ * @param {integer} tint - The tint value.
+ *
+ * @return {this} This Render Texture.
+ */
+ setGlobalTint: function (tint)
+ {
+ this.globalTint = tint;
+
+ return this;
+ },
+
+ /**
+ * Set the alpha to use when rendering this Render Texture.
+ *
+ * @method Phaser.GameObjects.RenderTexture#setGlobalAlpha
+ * @since 3.2.0
+ *
+ * @param {number} alpha - The alpha value.
+ *
+ * @return {this} This Render Texture.
+ */
+ setGlobalAlpha: function (alpha)
+ {
+ this.globalAlpha = alpha;
+
+ return this;
+ },
+
+ /**
+ * Stores a copy of this Render Texture in the Texture Manager using the given key.
+ *
+ * After doing this, any texture based Game Object, such as a Sprite, can use the contents of this
+ * Render Texture by using the texture key:
+ *
+ * ```javascript
+ * var rt = this.add.renderTexture(0, 0, 128, 128);
+ *
+ * // Draw something to the Render Texture
+ *
+ * rt.saveTexture('doodle');
+ *
+ * this.add.image(400, 300, 'doodle');
+ * ```
+ *
+ * Updating the contents of this Render Texture will automatically update _any_ Game Object
+ * that is using it as a texture. Calling `saveTexture` again will not save another copy
+ * of the same texture, it will just rename the key of the existing copy.
+ *
+ * By default it will create a single base texture. You can add frames to the texture
+ * by using the `Texture.add` method. After doing this, you can then allow Game Objects
+ * to use a specific frame from a Render Texture.
+ *
+ * @method Phaser.GameObjects.RenderTexture#saveTexture
+ * @since 3.12.0
+ *
+ * @param {string} key - The unique key to store the texture as within the global Texture Manager.
+ *
+ * @return {Phaser.Textures.Texture} The Texture that was saved.
+ */
+ saveTexture: function (key)
+ {
+ this.textureManager.renameTexture(this.texture.key, key);
+
+ this._saved = true;
+
+ return this.texture;
+ },
+
+ /**
+ * Fills the Render Texture with the given color.
+ *
+ * @method Phaser.GameObjects.RenderTexture#fill
+ * @since 3.2.0
+ *
+ * @param {number} rgb - The color to fill the Render Texture with.
+ * @param {number} [alpha=1] - The alpha value used by the fill.
+ *
+ * @return {this} This Render Texture instance.
+ */
+ fill: function (rgb, alpha)
+ {
+ if (alpha === undefined) { alpha = 1; }
+
+ var ur = ((rgb >> 16)|0) & 0xff;
+ var ug = ((rgb >> 8)|0) & 0xff;
+ var ub = (rgb|0) & 0xff;
+
+ if (this.gl)
+ {
+ this.renderer.setFramebuffer(this.framebuffer);
+
+ var gl = this.gl;
+
+ gl.clearColor(ur / 255.0, ug / 255.0, ub / 255.0, alpha);
+
+ gl.clear(gl.COLOR_BUFFER_BIT);
+
+ this.renderer.setFramebuffer(null);
+ }
+ else
+ {
+ this.context.fillStyle = 'rgb(' + ur + ',' + ug + ',' + ub + ')';
+ this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
+ }
+
+ return this;
+ },
+
+ /**
+ * Clears the Render Texture.
+ *
+ * @method Phaser.GameObjects.RenderTexture#clear
+ * @since 3.2.0
+ *
+ * @return {this} This Render Texture instance.
+ */
+ clear: function ()
+ {
+ if (this.dirty)
+ {
+ if (this.gl)
+ {
+ this.renderer.setFramebuffer(this.framebuffer);
+
+ var gl = this.gl;
+
+ gl.clearColor(0, 0, 0, 0);
+
+ gl.clear(gl.COLOR_BUFFER_BIT);
+
+ this.renderer.setFramebuffer(null);
+ }
+ else
+ {
+ var ctx = this.context;
+
+ ctx.save();
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
+ ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
+ ctx.restore();
+ }
+
+ this.dirty = false;
+ }
+
+ return this;
+ },
+
+ /**
+ * Draws the given object, or an array of objects, to this Render Texture.
+ *
+ * It can accept any of the following:
+ *
+ * * Any renderable Game Object, such as a Sprite, Text, Graphics or TileSprite.
+ * * Dynamic and Static Tilemap Layers.
+ * * A Group. The contents of which will be iterated and drawn in turn.
+ * * A Container. The contents of which will be iterated fully, and drawn in turn.
+ * * A Scene's Display List. Pass in `Scene.children` to draw the whole list.
+ * * Another Render Texture.
+ * * A Texture Frame instance.
+ * * A string. This is used to look-up a texture from the Texture Manager.
+ *
+ * Note: You cannot draw a Render Texture to itself.
+ *
+ * If passing in a Group or Container it will only draw children that return `true`
+ * when their `willRender()` method is called. I.e. a Container with 10 children,
+ * 5 of which have `visible=false` will only draw the 5 visible ones.
+ *
+ * If passing in an array of Game Objects it will draw them all, regardless if
+ * they pass a `willRender` check or not.
+ *
+ * You can pass in a string in which case it will look for a texture in the Texture
+ * Manager matching that string, and draw the base frame. If you need to specify
+ * exactly which frame to draw then use the method `drawFrame` instead.
+ *
+ * You can pass in the `x` and `y` coordinates to draw the objects at. The use of
+ * the coordinates differ based on what objects are being drawn. If the object is
+ * a Group, Container or Display List, the coordinates are _added_ to the positions
+ * of the children. For all other types of object, the coordinates are exact.
+ *
+ * The `alpha` and `tint` values are only used by Texture Frames.
+ * Game Objects use their own alpha and tint values when being drawn.
+ *
+ * Calling this method causes the WebGL batch to flush, so it can write the texture
+ * data to the framebuffer being used internally. The batch is flushed at the end,
+ * after the entries have been iterated. So if you've a bunch of objects to draw,
+ * try and pass them in an array in one single call, rather than making lots of
+ * separate calls.
+ *
+ * @method Phaser.GameObjects.RenderTexture#draw
+ * @since 3.2.0
+ *
+ * @param {any} entries - Any renderable Game Object, or Group, Container, Display List, other Render Texture, Texture Frame or an array of any of these.
+ * @param {number} [x] - The x position to draw the Frame at, or the offset applied to the object.
+ * @param {number} [y] - The y position to draw the Frame at, or the offset applied to the object.
+ * @param {number} [alpha] - The alpha value. Only used for Texture Frames and if not specified defaults to the `globalAlpha` property. Game Objects use their own current alpha value.
+ * @param {number} [tint] - WebGL only. The tint color value. Only used for Texture Frames and if not specified defaults to the `globalTint` property. Game Objects use their own current tint value.
+ *
+ * @return {this} This Render Texture instance.
+ */
+ draw: function (entries, x, y, alpha, tint)
+ {
+ if (alpha === undefined) { alpha = this.globalAlpha; }
+
+ if (tint === undefined)
+ {
+ tint = (this.globalTint >> 16) + (this.globalTint & 0xff00) + ((this.globalTint & 0xff) << 16);
+ }
+ else
+ {
+ tint = (tint >> 16) + (tint & 0xff00) + ((tint & 0xff) << 16);
+ }
+
+ if (!Array.isArray(entries))
+ {
+ entries = [ entries ];
+ }
+
+ var gl = this.gl;
+
+ this.camera.preRender(1, 1, 1);
+
+ if (gl)
+ {
+ this.renderer.setFramebuffer(this.framebuffer);
+
+ var pipeline = this.pipeline;
+
+ pipeline.projOrtho(0, this.width, 0, this.height, -1000.0, 1000.0);
+
+ this.batchList(entries, x, y, alpha, tint);
+
+ pipeline.flush();
+
+ this.renderer.setFramebuffer(null);
+
+ pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0);
+ }
+ else
+ {
+ this.renderer.setContext(this.context);
+
+ this.batchList(entries, x, y, alpha, tint);
+
+ this.renderer.setContext();
+ }
+
+ this.dirty = true;
+
+ return this;
+ },
+
+ /**
+ * Draws the Texture Frame to the Render Texture at the given position.
+ *
+ * Textures are referenced by their string-based keys, as stored in the Texture Manager.
+ *
+ * ```javascript
+ * var rt = this.add.renderTexture(0, 0, 800, 600);
+ * rt.drawFrame(key, frame);
+ * ```
+ *
+ * You can optionally provide a position, alpha and tint value to apply to the frame
+ * before it is drawn.
+ *
+ * Calling this method will cause a batch flush, so if you've got a stack of things to draw
+ * in a tight loop, try using the `draw` method instead.
+ *
+ * If you need to draw a Sprite to this Render Texture, use the `draw` method instead.
+ *
+ * @method Phaser.GameObjects.RenderTexture#drawFrame
+ * @since 3.12.0
+ *
+ * @param {string} key - The key of the texture to be used, as stored in the Texture Manager.
+ * @param {(string|integer)} [frame] - The name or index of the frame within the Texture.
+ * @param {number} [x=0] - The x position to draw the frame at.
+ * @param {number} [y=0] - The y position to draw the frame at.
+ * @param {number} [alpha] - The alpha to use. If not specified it uses the `globalAlpha` property.
+ * @param {number} [tint] - WebGL only. The tint color to use. If not specified it uses the `globalTint` property.
+ *
+ * @return {this} This Render Texture instance.
+ */
+ drawFrame: function (key, frame, x, y, alpha, tint)
+ {
+ if (x === undefined) { x = 0; }
+ if (y === undefined) { y = 0; }
+ if (alpha === undefined) { alpha = this.globalAlpha; }
+
+ if (tint === undefined)
+ {
+ tint = (this.globalTint >> 16) + (this.globalTint & 0xff00) + ((this.globalTint & 0xff) << 16);
+ }
+ else
+ {
+ tint = (tint >> 16) + (tint & 0xff00) + ((tint & 0xff) << 16);
+ }
+
+ var gl = this.gl;
+ var textureFrame = this.textureManager.getFrame(key, frame);
+
+ if (textureFrame)
+ {
+ this.camera.preRender(1, 1, 1);
+
+ if (gl)
+ {
+ this.renderer.setFramebuffer(this.framebuffer);
+
+ var pipeline = this.pipeline;
+
+ pipeline.projOrtho(0, this.width, 0, this.height, -1000.0, 1000.0);
+
+ pipeline.batchTextureFrame(textureFrame, x, y, tint, alpha, this.camera.matrix, null);
+
+ pipeline.flush();
+
+ this.renderer.setFramebuffer(null);
+
+ pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0);
+ }
+ else
+ {
+ this.batchTextureFrame(textureFrame, x, y, alpha, tint);
+ }
+
+ this.dirty = true;
+ }
+
+ return this;
+ },
+
+ /**
+ * Internal method that handles the drawing of an array of children.
+ *
+ * @method Phaser.GameObjects.RenderTexture#batchList
+ * @private
+ * @since 3.12.0
+ *
+ * @param {array} children - The array of Game Objects to draw.
+ * @param {number} x - The x position to offset the Game Object by.
+ * @param {number} y - The y position to offset the Game Object by.
+ * @param {number} [alpha] - The alpha to use. If not specified it uses the `globalAlpha` property.
+ * @param {number} [tint] - The tint color to use. If not specified it uses the `globalTint` property.
+ */
+ batchList: function (children, x, y, alpha, tint)
+ {
+ for (var i = 0; i < children.length; i++)
+ {
+ var entry = children[i];
+
+ if (!entry || entry === this)
+ {
+ continue;
+ }
+
+ if (entry.renderWebGL || entry.renderCanvas)
+ {
+ // Game Objects
+ this.drawGameObject(entry, x, y);
+ }
+ else if (entry.isParent || entry.list)
+ {
+ // Groups / Display Lists
+ this.batchGroup(entry.getChildren(), x, y);
+ }
+ else if (typeof entry === 'string')
+ {
+ // Texture key
+ this.batchTextureFrameKey(entry, null, x, y, alpha, tint);
+ }
+ else if (entry instanceof Frame)
+ {
+ // Texture Frame instance
+ this.batchTextureFrame(entry, x, y, alpha, tint);
+ }
+ else if (Array.isArray(entry))
+ {
+ // Another Array
+ this.batchList(entry, x, y, alpha, tint);
+ }
+ }
+ },
+
+ /**
+ * Internal method that handles the drawing a Phaser Group contents.
+ *
+ * @method Phaser.GameObjects.RenderTexture#batchGroup
+ * @private
+ * @since 3.12.0
+ *
+ * @param {array} children - The array of Game Objects to draw.
+ * @param {number} x - The x position to offset the Game Object by.
+ * @param {number} y - The y position to offset the Game Object by.
+ */
+ batchGroup: function (children, x, y)
+ {
+ if (x === undefined) { x = 0; }
+ if (y === undefined) { y = 0; }
+
+ for (var i = 0; i < children.length; i++)
+ {
+ var entry = children[i];
+
+ if (entry.willRender())
+ {
+ var tx = entry.x + x;
+ var ty = entry.y + y;
+
+ this.drawGameObject(entry, tx, ty);
+ }
+ }
+ },
+
+ /**
+ * Internal method that handles drawing a single Phaser Game Object to this Render Texture using WebGL.
+ *
+ * @method Phaser.GameObjects.RenderTexture#batchGameObjectWebGL
+ * @private
+ * @since 3.12.0
+ *
+ * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to draw.
+ * @param {number} x - The x position to draw the Game Object at.
+ * @param {number} y - The y position to draw the Game Object at.
+ */
+ batchGameObjectWebGL: function (gameObject, x, y)
+ {
+ if (x === undefined) { x = gameObject.x; }
+ if (y === undefined) { y = gameObject.y; }
+
+ var prevX = gameObject.x;
+ var prevY = gameObject.y;
+
+ this.renderer.setBlendMode(gameObject.blendMode);
+
+ gameObject.setPosition(x, y);
+
+ gameObject.renderWebGL(this.renderer, gameObject, 0, this.camera, null);
+
+ gameObject.setPosition(prevX, prevY);
+ },
+
+ /**
+ * Internal method that handles drawing a single Phaser Game Object to this Render Texture using Canvas.
+ *
+ * @method Phaser.GameObjects.RenderTexture#batchGameObjectCanvas
+ * @private
+ * @since 3.12.0
+ *
+ * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object to draw.
+ * @param {number} x - The x position to draw the Game Object at.
+ * @param {number} y - The y position to draw the Game Object at.
+ */
+ batchGameObjectCanvas: function (gameObject, x, y)
+ {
+ if (x === undefined) { x = gameObject.x; }
+ if (y === undefined) { y = gameObject.y; }
+
+ var prevX = gameObject.x;
+ var prevY = gameObject.y;
+
+ gameObject.setPosition(x, y);
+
+ gameObject.renderCanvas(this.renderer, gameObject, 0, this.camera, null);
+
+ gameObject.setPosition(prevX, prevY);
+ },
+
+ /**
+ * Internal method that handles the drawing of an array of children.
+ *
+ * @method Phaser.GameObjects.RenderTexture#batchTextureFrameKey
+ * @private
+ * @since 3.12.0
+ *
+ * @param {string} key - The key of the texture to be used, as stored in the Texture Manager.
+ * @param {(string|integer)} [frame] - The name or index of the frame within the Texture.
+ * @param {number} x - The x position to offset the Game Object by.
+ * @param {number} y - The y position to offset the Game Object by.
+ * @param {number} [alpha] - The alpha to use. If not specified it uses the `globalAlpha` property.
+ * @param {number} [tint] - The tint color to use. If not specified it uses the `globalTint` property.
+ *
+ * @return {boolean} `true` if the frame was found and drawn, otherwise `false`.
+ */
+ batchTextureFrameKey: function (key, frame, x, y, alpha, tint)
+ {
+ var textureFrame = this.textureManager.getFrame(key, frame);
+
+ if (textureFrame)
+ {
+ this.batchTextureFrame(textureFrame, x, y, alpha, tint);
+ }
+ },
+
+ /**
+ * Internal method that handles the drawing of a Texture Frame to this Render Texture.
+ *
+ * @method Phaser.GameObjects.RenderTexture#batchTextureFrame
+ * @private
+ * @since 3.12.0
+ *
+ * @param {Phaser.Textures.Frame} textureFrame - The Texture Frame to draw.
+ * @param {number} x - The x position to draw the Frame at.
+ * @param {number} y - The y position to draw the Frame at.
+ * @param {number} [tint] - A tint color to be applied to the frame drawn to the Render Texture.
+ */
+ batchTextureFrame: function (textureFrame, x, y, alpha, tint)
+ {
+ if (x === undefined) { x = 0; }
+ if (y === undefined) { y = 0; }
+
+ if (this.gl)
+ {
+ this.pipeline.batchTextureFrame(textureFrame, x, y, tint, alpha, this.camera.matrix, null);
+ }
+ else
+ {
+ var ctx = this.context;
+ var cd = textureFrame.canvasData;
+ var source = textureFrame.source.image;
+
+ var matrix = this.camera.matrix;
+
+ ctx.globalAlpha = this.globalAlpha;
+
+ ctx.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
+
+ ctx.drawImage(source, cd.x, cd.y, cd.width, cd.height, x, y, cd.width, cd.height);
+ }
+ },
+
+ /**
+ * Internal destroy handler, called as part of the destroy process.
+ *
+ * @method Phaser.GameObjects.RenderTexture#preDestroy
+ * @protected
+ * @since 3.9.0
+ */
+ preDestroy: function ()
+ {
+ if (!this._saved)
+ {
+ CanvasPool.remove(this.canvas);
+
+ if (this.gl)
+ {
+ this.renderer.deleteFramebuffer(this.framebuffer);
+ }
+
+ this.texture.destroy();
+ }
+ }
+
+});
+
+module.exports = RenderTexture;
+
+
+/***/ }),
+/* 155 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var Components = __webpack_require__(14);
+var GameObject = __webpack_require__(19);
+var GravityWell = __webpack_require__(304);
+var List = __webpack_require__(112);
+var ParticleEmitter = __webpack_require__(302);
+var Render = __webpack_require__(821);
+
+/**
+ * @classdesc
+ * A Particle Emitter Manager creates and controls {@link Phaser.GameObjects.Particles.ParticleEmitter Particle Emitters} and {@link Phaser.GameObjects.Particles.GravityWell Gravity Wells}.
+ *
+ * @class ParticleEmitterManager
+ * @extends Phaser.GameObjects.GameObject
+ * @memberof Phaser.GameObjects.Particles
+ * @constructor
+ * @since 3.0.0
+ *
+ * @extends Phaser.GameObjects.Components.Depth
+ * @extends Phaser.GameObjects.Components.Pipeline
+ * @extends Phaser.GameObjects.Components.Transform
+ * @extends Phaser.GameObjects.Components.Visible
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Emitter Manager belongs.
+ * @param {string} texture - The key of the Texture this Emitter Manager will use to render particles, as stored in the Texture Manager.
+ * @param {(string|integer)} [frame] - An optional frame from the Texture this Emitter Manager will use to render particles.
+ * @param {ParticleEmitterConfig|ParticleEmitterConfig[]} [emitters] - Configuration settings for one or more emitters to create.
+ */
+var ParticleEmitterManager = new Class({
+
+ Extends: GameObject,
+
+ Mixins: [
+ Components.Depth,
+ Components.Pipeline,
+ Components.Transform,
+ Components.Visible,
+ Render
+ ],
+
+ initialize:
+
+ // frame is optional and can contain the emitters array or object if skipped
+ function ParticleEmitterManager (scene, texture, frame, emitters)
+ {
+ GameObject.call(this, scene, 'ParticleEmitterManager');
+
+ /**
+ * The blend mode applied to all emitters and particles.
+ *
+ * @name Phaser.GameObjects.Particles.ParticleEmitterManager#blendMode
+ * @type {integer}
+ * @default -1
+ * @private
+ * @since 3.0.0
+ */
+ this.blendMode = -1;
+
+ /**
+ * The time scale applied to all emitters and particles, affecting flow rate, lifespan, and movement.
+ * Values larger than 1 are faster than normal.
+ * This is multiplied with any timeScale set on each individual emitter.
+ *
+ * @name Phaser.GameObjects.Particles.ParticleEmitterManager#timeScale
+ * @type {number}
+ * @default 1
+ * @since 3.0.0
+ */
+ this.timeScale = 1;
+
+ /**
+ * The texture used to render this Emitter Manager's particles.
+ *
+ * @name Phaser.GameObjects.Particles.ParticleEmitterManager#texture
+ * @type {Phaser.Textures.Texture}
+ * @default null
+ * @since 3.0.0
+ */
+ this.texture = null;
+
+ /**
+ * The texture frame used to render this Emitter Manager's particles.
+ *
+ * @name Phaser.GameObjects.Particles.ParticleEmitterManager#frame
+ * @type {Phaser.Textures.Frame}
+ * @default null
+ * @since 3.0.0
+ */
+ this.frame = null;
+
+ /**
+ * Names of this Emitter Manager's texture frames.
+ *
+ * @name Phaser.GameObjects.Particles.ParticleEmitterManager#frameNames
+ * @type {string[]}
+ * @since 3.0.0
+ */
+ this.frameNames = [];
+
+ // frame is optional and can contain the emitters array or object if skipped
+ if (frame !== null && (typeof frame === 'object' || Array.isArray(frame)))
+ {
+ emitters = frame;
+ frame = null;
+ }
+
+ this.setTexture(texture, frame);
+
+ this.initPipeline();
+
+ /**
+ * A list of Emitters being managed by this Emitter Manager.
+ *
+ * @name Phaser.GameObjects.Particles.ParticleEmitterManager#emitters
+ * @type {Phaser.Structs.List.}
+ * @since 3.0.0
+ */
+ this.emitters = new List(this);
+
+ /**
+ * A list of Gravity Wells being managed by this Emitter Manager.
+ *
+ * @name Phaser.GameObjects.Particles.ParticleEmitterManager#wells
+ * @type {Phaser.Structs.List.}
+ * @since 3.0.0
+ */
+ this.wells = new List(this);
+
+ if (emitters)
+ {
+ // An array of emitter configs?
+ if (!Array.isArray(emitters))
+ {
+ emitters = [ emitters ];
+ }
+
+ for (var i = 0; i < emitters.length; i++)
+ {
+ this.createEmitter(emitters[i]);
+ }
+ }
+ },
+
+ /**
+ * Sets the texture and frame this Emitter Manager will use to render with.
+ *
+ * Textures are referenced by their string-based keys, as stored in the Texture Manager.
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#setTexture
+ * @since 3.0.0
+ *
+ * @param {string} key - The key of the texture to be used, as stored in the Texture Manager.
+ * @param {(string|integer)} [frame] - The name or index of the frame within the Texture.
+ *
+ * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Emitter Manager.
+ */
+ setTexture: function (key, frame)
+ {
+ this.texture = this.scene.sys.textures.get(key);
+
+ return this.setFrame(frame);
+ },
+
+ /**
+ * Sets the frame this Emitter Manager will use to render with.
+ *
+ * The Frame has to belong to the current Texture being used.
+ *
+ * It can be either a string or an index.
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#setFrame
+ * @since 3.0.0
+ *
+ * @param {(string|integer)} [frame] - The name or index of the frame within the Texture.
+ *
+ * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Emitter Manager.
+ */
+ setFrame: function (frame)
+ {
+ this.frame = this.texture.get(frame);
+
+ var frames = this.texture.getFramesFromTextureSource(this.frame.sourceIndex);
+
+ var names = [];
+
+ frames.forEach(function (sourceFrame)
+ {
+ names.push(sourceFrame.name);
+ });
+
+ this.frameNames = names;
+
+ this.defaultFrame = this.frame;
+
+ return this;
+ },
+
+ /**
+ * Assigns texture frames to an emitter.
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#setEmitterFrames
+ * @since 3.0.0
+ *
+ * @param {(Phaser.Textures.Frame|Phaser.Textures.Frame[])} frames - The texture frames.
+ * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - The particle emitter to modify.
+ *
+ * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Emitter Manager.
+ */
+ setEmitterFrames: function (frames, emitter)
+ {
+ if (!Array.isArray(frames))
+ {
+ frames = [ frames ];
+ }
+
+ var out = emitter.frames;
+
+ out.length = 0;
+
+ for (var i = 0; i < frames.length; i++)
+ {
+ var frame = frames[i];
+
+ if (this.frameNames.indexOf(frame) !== -1)
+ {
+ out.push(this.texture.get(frame));
+ }
+ }
+
+ if (out.length > 0)
+ {
+ emitter.defaultFrame = out[0];
+ }
+ else
+ {
+ emitter.defaultFrame = this.defaultFrame;
+ }
+
+ return this;
+ },
+
+ /**
+ * Adds an existing Particle Emitter to this Emitter Manager.
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#addEmitter
+ * @since 3.0.0
+ *
+ * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - The Particle Emitter to add to this Emitter Manager.
+ *
+ * @return {Phaser.GameObjects.Particles.ParticleEmitter} The Particle Emitter that was added to this Emitter Manager.
+ */
+ addEmitter: function (emitter)
+ {
+ return this.emitters.add(emitter);
+ },
+
+ /**
+ * Creates a new Particle Emitter object, adds it to this Emitter Manager and returns a reference to it.
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#createEmitter
+ * @since 3.0.0
+ *
+ * @param {ParticleEmitterConfig} config - Configuration settings for the Particle Emitter to create.
+ *
+ * @return {Phaser.GameObjects.Particles.ParticleEmitter} The Particle Emitter that was created.
+ */
+ createEmitter: function (config)
+ {
+ return this.addEmitter(new ParticleEmitter(this, config));
+ },
+
+ /**
+ * Adds an existing Gravity Well object to this Emitter Manager.
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#addGravityWell
+ * @since 3.0.0
+ *
+ * @param {Phaser.GameObjects.Particles.GravityWell} well - The Gravity Well to add to this Emitter Manager.
+ *
+ * @return {Phaser.GameObjects.Particles.GravityWell} The Gravity Well that was added to this Emitter Manager.
+ */
+ addGravityWell: function (well)
+ {
+ return this.wells.add(well);
+ },
+
+ /**
+ * Creates a new Gravity Well, adds it to this Emitter Manager and returns a reference to it.
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#createGravityWell
+ * @since 3.0.0
+ *
+ * @param {GravityWellConfig} config - Configuration settings for the Gravity Well to create.
+ *
+ * @return {Phaser.GameObjects.Particles.GravityWell} The Gravity Well that was created.
+ */
+ createGravityWell: function (config)
+ {
+ return this.addGravityWell(new GravityWell(config));
+ },
+
+ /**
+ * Emits particles from each active emitter.
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#emitParticle
+ * @since 3.0.0
+ *
+ * @param {integer} [count] - The number of particles to release from each emitter. The default is the emitter's own {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}.
+ * @param {number} [x] - The x-coordinate to to emit particles from. The default is the x-coordinate of the emitter's current location.
+ * @param {number} [y] - The y-coordinate to to emit particles from. The default is the y-coordinate of the emitter's current location.
+ *
+ * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Emitter Manager.
+ */
+ emitParticle: function (count, x, y)
+ {
+ var emitters = this.emitters.list;
+
+ for (var i = 0; i < emitters.length; i++)
+ {
+ var emitter = emitters[i];
+
+ if (emitter.active)
+ {
+ emitter.emitParticle(count, x, y);
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Emits particles from each active emitter.
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#emitParticleAt
+ * @since 3.0.0
+ *
+ * @param {number} [x] - The x-coordinate to to emit particles from. The default is the x-coordinate of the emitter's current location.
+ * @param {number} [y] - The y-coordinate to to emit particles from. The default is the y-coordinate of the emitter's current location.
+ * @param {integer} [count] - The number of particles to release from each emitter. The default is the emitter's own {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}.
+ *
+ * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Emitter Manager.
+ */
+ emitParticleAt: function (x, y, count)
+ {
+ return this.emitParticle(count, x, y);
+ },
+
+ /**
+ * Pauses this Emitter Manager.
+ *
+ * This has the effect of pausing all emitters, and all particles of those emitters, currently under its control.
+ *
+ * The particles will still render, but they will not have any of their logic updated.
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#pause
+ * @since 3.0.0
+ *
+ * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Emitter Manager.
+ */
+ pause: function ()
+ {
+ this.active = false;
+
+ return this;
+ },
+
+ /**
+ * Resumes this Emitter Manager, should it have been previously paused.
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#resume
+ * @since 3.0.0
+ *
+ * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Emitter Manager.
+ */
+ resume: function ()
+ {
+ this.active = true;
+
+ return this;
+ },
+
+ /**
+ * Gets all active particle processors (gravity wells).
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#getProcessors
+ * @since 3.0.0
+ *
+ * @return {Phaser.GameObjects.Particles.GravityWell[]} - The active gravity wells.
+ */
+ getProcessors: function ()
+ {
+ return this.wells.getAll('active', true);
+ },
+
+ /**
+ * Updates all active emitters.
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#preUpdate
+ * @since 3.0.0
+ *
+ * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout.
+ * @param {number} delta - The delta time, in ms, elapsed since the last frame.
+ */
+ preUpdate: function (time, delta)
+ {
+ // Scale the delta
+ delta *= this.timeScale;
+
+ var emitters = this.emitters.list;
+
+ for (var i = 0; i < emitters.length; i++)
+ {
+ var emitter = emitters[i];
+
+ if (emitter.active)
+ {
+ emitter.preUpdate(time, delta);
+ }
+ }
+ },
+
+ /**
+ * A NOOP method so you can pass an EmitterManager to a Container.
+ * Calling this method will do nothing. It is intentionally empty.
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#setAlpha
+ * @private
+ * @since 3.10.0
+ */
+ setAlpha: function ()
+ {
+ },
+
+ /**
+ * A NOOP method so you can pass an EmitterManager to a Container.
+ * Calling this method will do nothing. It is intentionally empty.
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#setScrollFactor
+ * @private
+ * @since 3.10.0
+ */
+ setScrollFactor: function ()
+ {
+ },
+
+ /**
+ * A NOOP method so you can pass an EmitterManager to a Container.
+ * Calling this method will do nothing. It is intentionally empty.
+ *
+ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#setBlendMode
+ * @private
+ * @since 3.15.0
+ */
+ setBlendMode: function ()
+ {
+ }
+
+});
+
+module.exports = ParticleEmitterManager;
+
+
+/***/ }),
+/* 156 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Point = __webpack_require__(6);
+
+/**
+ * Returns a Point object containing the coordinates of a point on the circumference of the Ellipse based on the given angle.
+ *
+ * @function Phaser.Geom.Ellipse.CircumferencePoint
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Geom.Point} O - [out,$return]
+ *
+ * @param {Phaser.Geom.Ellipse} ellipse - The Ellipse to get the circumference point on.
+ * @param {number} angle - The angle from the center of the Ellipse to the circumference to return the point from. Given in radians.
+ * @param {(Phaser.Geom.Point|object)} [out] - A Point, or point-like object, to store the results in. If not given a Point will be created.
+ *
+ * @return {(Phaser.Geom.Point|object)} A Point object where the `x` and `y` properties are the point on the circumference.
+ */
+var CircumferencePoint = function (ellipse, angle, out)
+{
+ if (out === undefined) { out = new Point(); }
+
+ var halfWidth = ellipse.width / 2;
+ var halfHeight = ellipse.height / 2;
+
+ out.x = ellipse.x + halfWidth * Math.cos(angle);
+ out.y = ellipse.y + halfHeight * Math.sin(angle);
+
+ return out;
+};
+
+module.exports = CircumferencePoint;
+
+
+/***/ }),
+/* 157 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @namespace Phaser.GameObjects.Graphics.Commands
+ */
+
+module.exports = {
+
+ ARC: 0,
+ BEGIN_PATH: 1,
+ CLOSE_PATH: 2,
+ FILL_RECT: 3,
+ LINE_TO: 4,
+ MOVE_TO: 5,
+ LINE_STYLE: 6,
+ FILL_STYLE: 7,
+ FILL_PATH: 8,
+ STROKE_PATH: 9,
+ FILL_TRIANGLE: 10,
+ STROKE_TRIANGLE: 11,
+ LINE_FX_TO: 12,
+ MOVE_FX_TO: 13,
+ SAVE: 14,
+ RESTORE: 15,
+ TRANSLATE: 16,
+ SCALE: 17,
+ ROTATE: 18,
+ SET_TEXTURE: 19,
+ CLEAR_TEXTURE: 20,
+ GRADIENT_FILL_STYLE: 21,
+ GRADIENT_LINE_STYLE: 22
+
+};
+
+
+/***/ }),
+/* 158 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var BaseCamera = __webpack_require__(121);
+var Class = __webpack_require__(0);
+var Commands = __webpack_require__(157);
+var ComponentsAlpha = __webpack_require__(401);
+var ComponentsBlendMode = __webpack_require__(400);
+var ComponentsDepth = __webpack_require__(399);
+var ComponentsMask = __webpack_require__(395);
+var ComponentsPipeline = __webpack_require__(186);
+var ComponentsTransform = __webpack_require__(390);
+var ComponentsVisible = __webpack_require__(389);
+var ComponentsScrollFactor = __webpack_require__(392);
+
+var Ellipse = __webpack_require__(90);
+var GameObject = __webpack_require__(19);
+var GetFastValue = __webpack_require__(2);
var GetValue = __webpack_require__(4);
var MATH_CONST = __webpack_require__(16);
-var Render = __webpack_require__(463);
+var Render = __webpack_require__(831);
/**
* Graphics line style (or stroke style) settings.
*
* @typedef {object} GraphicsLineStyle
*
- * @property {number} width - The stroke width.
- * @property {number} color - The stroke color.
- * @property {number} alpha - The stroke alpha.
+ * @property {number} [width] - The stroke width.
+ * @property {number} [color] - The stroke color.
+ * @property {number} [alpha] - The stroke alpha.
*/
/**
@@ -22731,8 +32859,8 @@ var Render = __webpack_require__(463);
*
* @typedef {object} GraphicsFillStyle
*
- * @property {number} color - The fill color.
- * @property {number} alpha - The fill alpha.
+ * @property {number} [color] - The fill color.
+ * @property {number} [alpha] - The fill alpha.
*/
/**
@@ -22740,8 +32868,8 @@ var Render = __webpack_require__(463);
*
* @typedef {object} GraphicsStyles
*
- * @property {GraphicsLineStyle} lineStyle - The style applied to shape outlines.
- * @property {GraphicsFillStyle} fillStyle - The style applied to shape areas.
+ * @property {GraphicsLineStyle} [lineStyle] - The style applied to shape outlines.
+ * @property {GraphicsFillStyle} [fillStyle] - The style applied to shape areas.
*/
/**
@@ -22750,13 +32878,13 @@ var Render = __webpack_require__(463);
* @typedef {object} GraphicsOptions
* @extends GraphicsStyles
*
- * @property {number} x - The x coordinate of the Graphics.
- * @property {number} y - The y coordinate of the Graphics.
+ * @property {number} [x] - The x coordinate of the Graphics.
+ * @property {number} [y] - The y coordinate of the Graphics.
*/
/**
* @classdesc
- * A Graphics object is a way to draw primitive shapes to you game. Primitives include forms of geometry, such as
+ * A Graphics object is a way to draw primitive shapes to your game. Primitives include forms of geometry, such as
* Rectangles, Circles, and Polygons. They also include lines, arcs and curves. When you initially create a Graphics
* object it will be empty.
*
@@ -22797,7 +32925,7 @@ var Render = __webpack_require__(463);
*
* @class Graphics
* @extends Phaser.GameObjects.GameObject
- * @memberOf Phaser.GameObjects
+ * @memberof Phaser.GameObjects
* @constructor
* @since 3.0.0
*
@@ -22811,21 +32939,21 @@ var Render = __webpack_require__(463);
* @extends Phaser.GameObjects.Components.ScrollFactor
*
* @param {Phaser.Scene} scene - The Scene to which this Graphics object belongs.
- * @param {GraphicsOptions} options - Options that set the position and default style of this Graphics object.
+ * @param {GraphicsOptions} [options] - Options that set the position and default style of this Graphics object.
*/
var Graphics = new Class({
Extends: GameObject,
Mixins: [
- Components.Alpha,
- Components.BlendMode,
- Components.Depth,
- Components.Mask,
- Components.Pipeline,
- Components.Transform,
- Components.Visible,
- Components.ScrollFactor,
+ ComponentsAlpha,
+ ComponentsBlendMode,
+ ComponentsDepth,
+ ComponentsMask,
+ ComponentsPipeline,
+ ComponentsTransform,
+ ComponentsVisible,
+ ComponentsScrollFactor,
Render
],
@@ -22839,7 +32967,7 @@ var Graphics = new Class({
GameObject.call(this, scene, 'Graphics');
this.setPosition(x, y);
- this.initPipeline('FlatTintPipeline');
+ this.initPipeline();
/**
* The horizontal display origin of the Graphics.
@@ -23015,6 +33143,139 @@ var Graphics = new Class({
return this;
},
+ /**
+ * Sets a gradient fill style. This is a WebGL only feature.
+ *
+ * The gradient color values represent the 4 corners of an untransformed rectangle.
+ * The gradient is used to color all filled shapes and paths drawn after calling this method.
+ * If you wish to turn a gradient off, call `fillStyle` and provide a new single fill color.
+ *
+ * When filling a triangle only the first 3 color values provided are used for the 3 points of a triangle.
+ *
+ * This feature is best used only on rectangles and triangles. All other shapes will give strange results.
+ *
+ * Note that for objects such as arcs or ellipses, or anything which is made out of triangles, each triangle used
+ * will be filled with a gradient on its own. There is no ability to gradient fill a shape or path as a single
+ * entity at this time.
+ *
+ * @method Phaser.GameObjects.Graphics#fillGradientStyle
+ * @webglOnly
+ * @since 3.12.0
+ *
+ * @param {integer} topLeft - The tint being applied to the top-left of the Game Object.
+ * @param {integer} topRight - The tint being applied to the top-right of the Game Object.
+ * @param {integer} bottomLeft - The tint being applied to the bottom-left of the Game Object.
+ * @param {integer} bottomRight - The tint being applied to the bottom-right of the Game Object.
+ * @param {number} [alpha=1] - The fill alpha.
+ *
+ * @return {Phaser.GameObjects.Graphics} This Game Object.
+ */
+ fillGradientStyle: function (topLeft, topRight, bottomLeft, bottomRight, alpha)
+ {
+ if (alpha === undefined) { alpha = 1; }
+
+ this.commandBuffer.push(
+ Commands.GRADIENT_FILL_STYLE,
+ alpha, topLeft, topRight, bottomLeft, bottomRight
+ );
+
+ return this;
+ },
+
+ /**
+ * Sets a gradient line style. This is a WebGL only feature.
+ *
+ * The gradient color values represent the 4 corners of an untransformed rectangle.
+ * The gradient is used to color all stroked shapes and paths drawn after calling this method.
+ * If you wish to turn a gradient off, call `lineStyle` and provide a new single line color.
+ *
+ * This feature is best used only on single lines. All other shapes will give strange results.
+ *
+ * Note that for objects such as arcs or ellipses, or anything which is made out of triangles, each triangle used
+ * will be filled with a gradient on its own. There is no ability to gradient stroke a shape or path as a single
+ * entity at this time.
+ *
+ * @method Phaser.GameObjects.Graphics#lineGradientStyle
+ * @webglOnly
+ * @since 3.12.0
+ *
+ * @param {number} lineWidth - The stroke width.
+ * @param {integer} topLeft - The tint being applied to the top-left of the Game Object.
+ * @param {integer} topRight - The tint being applied to the top-right of the Game Object.
+ * @param {integer} bottomLeft - The tint being applied to the bottom-left of the Game Object.
+ * @param {integer} bottomRight - The tint being applied to the bottom-right of the Game Object.
+ * @param {number} [alpha=1] - The fill alpha.
+ *
+ * @return {Phaser.GameObjects.Graphics} This Game Object.
+ */
+ lineGradientStyle: function (lineWidth, topLeft, topRight, bottomLeft, bottomRight, alpha)
+ {
+ if (alpha === undefined) { alpha = 1; }
+
+ this.commandBuffer.push(
+ Commands.GRADIENT_LINE_STYLE,
+ lineWidth, alpha, topLeft, topRight, bottomLeft, bottomRight
+ );
+
+ return this;
+ },
+
+ /**
+ * Sets the texture frame this Graphics Object will use when drawing all shapes defined after calling this.
+ *
+ * Textures are referenced by their string-based keys, as stored in the Texture Manager.
+ *
+ * Once set, all shapes will use this texture. Call this method with no arguments to clear it.
+ *
+ * The textures are not tiled. They are stretched to the dimensions of the shapes being rendered. For this reason,
+ * it works best with seamless / tileable textures.
+ *
+ * The mode argument controls how the textures are combined with the fill colors. The default value (0) will
+ * multiply the texture by the fill color. A value of 1 will use just the fill color, but the alpha data from the texture,
+ * and a value of 2 will use just the texture and no fill color at all.
+ *
+ * @method Phaser.GameObjects.Graphics#setTexture
+ * @since 3.12.0
+ * @webglOnly
+ *
+ * @param {string} [key] - The key of the texture to be used, as stored in the Texture Manager. Leave blank to clear a previously set texture.
+ * @param {(string|integer)} [frame] - The name or index of the frame within the Texture.
+ * @param {number} [mode=0] - The texture tint mode. 0 is multiply, 1 is alpha only and 2 is texture only.
+ *
+ * @return {this} This Game Object.
+ */
+ setTexture: function (key, frame, mode)
+ {
+ if (mode === undefined) { mode = 0; }
+
+ if (key === undefined)
+ {
+ this.commandBuffer.push(
+ Commands.CLEAR_TEXTURE
+ );
+ }
+ else
+ {
+ var textureFrame = this.scene.sys.textures.getFrame(key, frame);
+
+ if (textureFrame)
+ {
+ if (mode === 2)
+ {
+ mode = 3;
+ }
+
+ this.commandBuffer.push(
+ Commands.SET_TEXTURE,
+ textureFrame,
+ mode
+ );
+ }
+ }
+
+ return this;
+ },
+
/**
* Start a new shape path.
*
@@ -23250,6 +33511,106 @@ var Graphics = new Class({
return this;
},
+ /**
+ * Fill a rounded rectangle with the given position, size and radius.
+ *
+ * @method Phaser.GameObjects.Graphics#fillRoundedRect
+ * @since 3.11.0
+ *
+ * @param {number} x - The x coordinate of the top-left of the rectangle.
+ * @param {number} y - The y coordinate of the top-left of the rectangle.
+ * @param {number} width - The width of the rectangle.
+ * @param {number} height - The height of the rectangle.
+ * @param {number} [radius = 20] - The corner radius; It can also be an object to specify different radii for corners
+ * @param {number} [radius.tl = 20] Top left
+ * @param {number} [radius.tr = 20] Top right
+ * @param {number} [radius.br = 20] Bottom right
+ * @param {number} [radius.bl = 20] Bottom left
+ *
+ * @return {Phaser.GameObjects.Graphics} This Game Object.
+ */
+ fillRoundedRect: function (x, y, width, height, radius)
+ {
+ if (radius === undefined) { radius = 20; }
+
+ var tl = radius;
+ var tr = radius;
+ var bl = radius;
+ var br = radius;
+
+ if (typeof radius !== 'number')
+ {
+ tl = GetFastValue(radius, 'tl', 20);
+ tr = GetFastValue(radius, 'tr', 20);
+ bl = GetFastValue(radius, 'bl', 20);
+ br = GetFastValue(radius, 'br', 20);
+ }
+
+ this.beginPath();
+ this.moveTo(x + tl, y);
+ this.lineTo(x + width - tr, y);
+ this.arc(x + width - tr, y + tr, tr, -MATH_CONST.TAU, 0);
+ this.lineTo(x + width, y + height - br);
+ this.arc(x + width - br, y + height - br, br, 0, MATH_CONST.TAU);
+ this.lineTo(x + bl, y + height);
+ this.arc(x + bl, y + height - bl, bl, MATH_CONST.TAU, Math.PI);
+ this.lineTo(x, y + tl);
+ this.arc(x + tl, y + tl, tl, -Math.PI, -MATH_CONST.TAU);
+ this.fillPath();
+
+ return this;
+ },
+
+ /**
+ * Stroke a rounded rectangle with the given position, size and radius.
+ *
+ * @method Phaser.GameObjects.Graphics#strokeRoundedRect
+ * @since 3.11.0
+ *
+ * @param {number} x - The x coordinate of the top-left of the rectangle.
+ * @param {number} y - The y coordinate of the top-left of the rectangle.
+ * @param {number} width - The width of the rectangle.
+ * @param {number} height - The height of the rectangle.
+ * @param {number} [radius = 20] - The corner radius; It can also be an object to specify different radii for corners
+ * @param {number} [radius.tl = 20] Top left
+ * @param {number} [radius.tr = 20] Top right
+ * @param {number} [radius.br = 20] Bottom right
+ * @param {number} [radius.bl = 20] Bottom left
+ *
+ * @return {Phaser.GameObjects.Graphics} This Game Object.
+ */
+ strokeRoundedRect: function (x, y, width, height, radius)
+ {
+ if (radius === undefined) { radius = 20; }
+
+ var tl = radius;
+ var tr = radius;
+ var bl = radius;
+ var br = radius;
+
+ if (typeof radius !== 'number')
+ {
+ tl = GetFastValue(radius, 'tl', 20);
+ tr = GetFastValue(radius, 'tr', 20);
+ bl = GetFastValue(radius, 'bl', 20);
+ br = GetFastValue(radius, 'br', 20);
+ }
+
+ this.beginPath();
+ this.moveTo(x + tl, y);
+ this.lineTo(x + width - tr, y);
+ this.arc(x + width - tr, y + tr, tr, -MATH_CONST.TAU, 0);
+ this.lineTo(x + width, y + height - br);
+ this.arc(x + width - br, y + height - br, br, 0, MATH_CONST.TAU);
+ this.lineTo(x + bl, y + height);
+ this.arc(x + bl, y + height - bl, bl, MATH_CONST.TAU, Math.PI);
+ this.lineTo(x, y + tl);
+ this.arc(x + tl, y + tl, tl, -Math.PI, -MATH_CONST.TAU);
+ this.strokePath();
+
+ return this;
+ },
+
/**
* Fill the given point.
*
@@ -23680,6 +34041,13 @@ var Graphics = new Class({
* Draw an arc.
*
* This method can be used to create circles, or parts of circles.
+ *
+ * Make sure you call `beginPath` before starting the arc unless you wish for the arc to automatically
+ * close when filled or stroked.
+ *
+ * Use the optional `overshoot` argument increase the number of iterations that take place when
+ * the arc is rendered in WebGL. This is useful if you're drawing an arc with an especially thick line,
+ * as it will allow the arc to fully join-up. Try small values at first, i.e. 0.01.
*
* Call {@link Phaser.GameObjects.Graphics#fillPath} or {@link Phaser.GameObjects.Graphics#strokePath} after calling
* this method to draw the arc.
@@ -23693,14 +34061,18 @@ var Graphics = new Class({
* @param {number} startAngle - The starting angle, in radians.
* @param {number} endAngle - The ending angle, in radians.
* @param {boolean} [anticlockwise=false] - Whether the drawing should be anticlockwise or clockwise.
+ * @param {number} [overshoot=0] - This value allows you to increase the segment iterations in WebGL rendering. Useful if the arc has a thick stroke and needs to overshoot to join-up cleanly. Use small numbers such as 0.01 to start with and increase as needed.
*
* @return {Phaser.GameObjects.Graphics} This Game Object.
*/
- arc: function (x, y, radius, startAngle, endAngle, anticlockwise)
+ arc: function (x, y, radius, startAngle, endAngle, anticlockwise, overshoot)
{
+ if (anticlockwise === undefined) { anticlockwise = false; }
+ if (overshoot === undefined) { overshoot = 0; }
+
this.commandBuffer.push(
Commands.ARC,
- x, y, radius, startAngle, endAngle, anticlockwise
+ x, y, radius, startAngle, endAngle, anticlockwise, overshoot
);
return this;
@@ -23724,19 +34096,21 @@ var Graphics = new Class({
* @param {number} radius - The radius of the slice.
* @param {number} startAngle - The start angle of the slice, given in radians.
* @param {number} endAngle - The end angle of the slice, given in radians.
- * @param {boolean} [anticlockwise=false] - Draw the slice piece anticlockwise or clockwise?
+ * @param {boolean} [anticlockwise=false] - Whether the drawing should be anticlockwise or clockwise.
+ * @param {number} [overshoot=0] - This value allows you to overshoot the endAngle by this amount. Useful if the arc has a thick stroke and needs to overshoot to join-up cleanly.
*
* @return {Phaser.GameObjects.Graphics} This Game Object.
*/
- slice: function (x, y, radius, startAngle, endAngle, anticlockwise)
+ slice: function (x, y, radius, startAngle, endAngle, anticlockwise, overshoot)
{
if (anticlockwise === undefined) { anticlockwise = false; }
+ if (overshoot === undefined) { overshoot = 0; }
this.commandBuffer.push(Commands.BEGIN_PATH);
this.commandBuffer.push(Commands.MOVE_TO, x, y);
- this.commandBuffer.push(Commands.ARC, x, y, radius, startAngle, endAngle, anticlockwise);
+ this.commandBuffer.push(Commands.ARC, x, y, radius, startAngle, endAngle, anticlockwise, overshoot);
this.commandBuffer.push(Commands.CLOSE_PATH);
@@ -23744,7 +34118,9 @@ var Graphics = new Class({
},
/**
- * [description]
+ * Saves the state of the Graphics by pushing the current state onto a stack.
+ *
+ * The most recently saved state can then be restored with {@link Phaser.GameObjects.Graphics#restore}.
*
* @method Phaser.GameObjects.Graphics#save
* @since 3.0.0
@@ -23761,7 +34137,11 @@ var Graphics = new Class({
},
/**
- * [description]
+ * Restores the most recently saved state of the Graphics by popping from the state stack.
+ *
+ * Use {@link Phaser.GameObjects.Graphics#save} to save the current state, and call this afterwards to restore that state.
+ *
+ * If there is no saved state, this command does nothing.
*
* @method Phaser.GameObjects.Graphics#restore
* @since 3.0.0
@@ -23885,10 +34265,12 @@ var Graphics = new Class({
generateTexture: function (key, width, height)
{
var sys = this.scene.sys;
+ var renderer = sys.game.renderer;
if (width === undefined) { width = sys.game.config.width; }
if (height === undefined) { height = sys.game.config.height; }
+ Graphics.TargetCamera.setScene(this.scene);
Graphics.TargetCamera.setViewport(0, 0, width, height);
Graphics.TargetCamera.scrollX = this.x;
Graphics.TargetCamera.scrollY = this.y;
@@ -23929,11 +34311,12 @@ var Graphics = new Class({
if (ctx)
{
- this.renderCanvas(sys.game.renderer, this, 0.0, Graphics.TargetCamera, null, ctx);
+ // var GraphicsCanvasRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix, renderTargetCtx, allowClip)
+ this.renderCanvas(renderer, this, 0, Graphics.TargetCamera, null, ctx, false);
- if (sys.game.renderer.gl && texture)
+ if (texture)
{
- texture.source[0].glTexture = sys.game.renderer.canvasToTexture(ctx.canvas, texture.source[0].glTexture);
+ texture.refresh();
}
}
@@ -23961,13 +34344,1839 @@ var Graphics = new Class({
* @type {Phaser.Cameras.Scene2D.Camera}
* @since 3.1.0
*/
-Graphics.TargetCamera = new Camera(0, 0, 0, 0);
+Graphics.TargetCamera = new BaseCamera();
module.exports = Graphics;
/***/ }),
-/* 116 */
+/* 159 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var BitmapText = __webpack_require__(109);
+var Class = __webpack_require__(0);
+var Render = __webpack_require__(834);
+
+/**
+ * @typedef {object} DisplayCallbackConfig
+ *
+ * @property {{topLeft:number, topRight:number, bottomLeft:number, bottomRight:number}} tint - The tint of the character being rendered.
+ * @property {number} index - The index of the character being rendered.
+ * @property {number} charCode - The character code of the character being rendered.
+ * @property {number} x - The x position of the character being rendered.
+ * @property {number} y - The y position of the character being rendered.
+ * @property {number} scale - The scale of the character being rendered.
+ * @property {number} rotation - The rotation of the character being rendered.
+ * @property {any} data - Custom data stored with the character being rendered.
+ */
+
+/**
+ * @callback DisplayCallback
+ *
+ * @param {DisplayCallbackConfig} display - Settings of the character that is about to be rendered.
+ *
+ * @return {{x:number, y:number, scale:number, rotation:number}} Altered position, scale and rotation values for the character that is about to be rendered.
+ */
+
+/**
+ * @classdesc
+ * 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
+ *
+ * @class DynamicBitmapText
+ * @extends Phaser.GameObjects.BitmapText
+ * @memberof Phaser.GameObjects
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time.
+ * @param {number} x - The x coordinate of this Game Object in world space.
+ * @param {number} y - The y coordinate of this Game Object in world space.
+ * @param {string} font - The key of the font to use from the Bitmap Font cache.
+ * @param {(string|string[])} [text] - The string, or array of strings, to be set as the content of this Bitmap Text.
+ * @param {number} [size] - The font size of this Bitmap Text.
+ * @param {integer} [align=0] - The alignment of the text in a multi-line BitmapText object.
+ */
+var DynamicBitmapText = new Class({
+
+ Extends: BitmapText,
+
+ Mixins: [
+ Render
+ ],
+
+ initialize:
+
+ function DynamicBitmapText (scene, x, y, font, text, size, align)
+ {
+ BitmapText.call(this, scene, x, y, font, text, size, align);
+
+ this.type = 'DynamicBitmapText';
+
+ /**
+ * The horizontal scroll position of the Bitmap Text.
+ *
+ * @name Phaser.GameObjects.DynamicBitmapText#scrollX
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.scrollX = 0;
+
+ /**
+ * The vertical scroll position of the Bitmap Text.
+ *
+ * @name Phaser.GameObjects.DynamicBitmapText#scrollY
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.scrollY = 0;
+
+ /**
+ * The crop width of the Bitmap Text.
+ *
+ * @name Phaser.GameObjects.DynamicBitmapText#cropWidth
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.cropWidth = 0;
+
+ /**
+ * The crop height of the Bitmap Text.
+ *
+ * @name Phaser.GameObjects.DynamicBitmapText#cropHeight
+ * @type {number}
+ * @default 0
+ * @since 3.0.0
+ */
+ this.cropHeight = 0;
+
+ /**
+ * A callback that alters how each character of the Bitmap Text is rendered.
+ *
+ * @name Phaser.GameObjects.DynamicBitmapText#displayCallback
+ * @type {DisplayCallback}
+ * @since 3.0.0
+ */
+ this.displayCallback;
+
+ /**
+ * The data object that is populated during rendering, then passed to the displayCallback.
+ * You should modify this object then return it back from the callback. It's updated values
+ * will be used to render the specific glyph.
+ *
+ * Please note that if you need a reference to this object locally in your game code then you
+ * should shallow copy it, as it's updated and re-used for every glyph in the text.
+ *
+ * @name Phaser.GameObjects.DynamicBitmapText#callbackData
+ * @type {DisplayCallbackConfig}
+ * @since 3.11.0
+ */
+ this.callbackData = {
+ color: 0,
+ tint: {
+ topLeft: 0,
+ topRight: 0,
+ bottomLeft: 0,
+ bottomRight: 0
+ },
+ index: 0,
+ charCode: 0,
+ x: 0,
+ y: 0,
+ scale: 0,
+ rotation: 0,
+ data: 0
+ };
+ },
+
+ /**
+ * Set the crop size of this Bitmap Text.
+ *
+ * @method Phaser.GameObjects.DynamicBitmapText#setSize
+ * @since 3.0.0
+ *
+ * @param {number} width - The width of the crop.
+ * @param {number} height - The height of the crop.
+ *
+ * @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
+ */
+ setSize: function (width, height)
+ {
+ this.cropWidth = width;
+ this.cropHeight = height;
+
+ return this;
+ },
+
+ /**
+ * Set a callback that alters how each character of the Bitmap Text is rendered.
+ *
+ * The callback receives a {@link DisplayCallbackConfig} object that contains information about the character that's
+ * about to be rendered.
+ *
+ * It should return an object with `x`, `y`, `scale` and `rotation` properties that will be used instead of the
+ * usual values when rendering.
+ *
+ * @method Phaser.GameObjects.DynamicBitmapText#setDisplayCallback
+ * @since 3.0.0
+ *
+ * @param {DisplayCallback} callback - The display callback to set.
+ *
+ * @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
+ */
+ setDisplayCallback: function (callback)
+ {
+ this.displayCallback = callback;
+
+ return this;
+ },
+
+ /**
+ * Set the horizontal scroll position of this Bitmap Text.
+ *
+ * @method Phaser.GameObjects.DynamicBitmapText#setScrollX
+ * @since 3.0.0
+ *
+ * @param {number} value - The horizontal scroll position to set.
+ *
+ * @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
+ */
+ setScrollX: function (value)
+ {
+ this.scrollX = value;
+
+ return this;
+ },
+
+ /**
+ * Set the vertical scroll position of this Bitmap Text.
+ *
+ * @method Phaser.GameObjects.DynamicBitmapText#setScrollY
+ * @since 3.0.0
+ *
+ * @param {number} value - The vertical scroll position to set.
+ *
+ * @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
+ */
+ setScrollY: function (value)
+ {
+ this.scrollY = value;
+
+ return this;
+ }
+
+});
+
+module.exports = DynamicBitmapText;
+
+
+/***/ }),
+/* 160 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @author Felipe Alfonso <@bitnenfer>
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var ArrayUtils = __webpack_require__(164);
+var BlendModes = __webpack_require__(66);
+var Class = __webpack_require__(0);
+var Components = __webpack_require__(14);
+var GameObject = __webpack_require__(19);
+var Rectangle = __webpack_require__(9);
+var Render = __webpack_require__(837);
+var Union = __webpack_require__(309);
+var Vector2 = __webpack_require__(3);
+
+/**
+ * @classdesc
+ * A Container Game Object.
+ *
+ * A Container, as the name implies, can 'contain' other types of Game Object.
+ * When a Game Object is added to a Container, the Container becomes responsible for the rendering of it.
+ * By default it will be removed from the Display List and instead added to the Containers own internal list.
+ *
+ * The position of the Game Object automatically becomes relative to the position of the Container.
+ *
+ * When the Container is rendered, all of its children are rendered as well, in the order in which they exist
+ * within the Container. Container children can be repositioned using methods such as `MoveUp`, `MoveDown` and `SendToBack`.
+ *
+ * If you modify a transform property of the Container, such as `Container.x` or `Container.rotation` then it will
+ * automatically influence all children as well.
+ *
+ * Containers can include other Containers for deeply nested transforms.
+ *
+ * Containers can have masks set on them and can be used as a mask too. However, Container children cannot be masked.
+ * The masks do not 'stack up'. Only a Container on the root of the display list will use its mask.
+ *
+ * Containers can be enabled for input. Because they do not have a texture you need to provide a shape for them
+ * to use as their hit area. Container children can also be enabled for input, independent of the Container.
+ *
+ * Containers can be given a physics body for either Arcade Physics, Impact Physics or Matter Physics. However,
+ * if Container _children_ are enabled for physics you may get unexpected results, such as offset bodies,
+ * if the Container itself, or any of its ancestors, is positioned anywhere other than at 0 x 0. Container children
+ * with physics do not factor in the Container due to the excessive extra calculations needed. Please structure
+ * your game to work around this.
+ *
+ * It's important to understand the impact of using Containers. They add additional processing overhead into
+ * every one of their children. The deeper you nest them, the more the cost escalates. This is especially true
+ * for input events. You also loose the ability to set the display depth of Container children in the same
+ * 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
+ * @memberof Phaser.GameObjects
+ * @constructor
+ * @since 3.4.0
+ *
+ * @extends Phaser.GameObjects.Components.Alpha
+ * @extends Phaser.GameObjects.Components.BlendMode
+ * @extends Phaser.GameObjects.Components.ComputedSize
+ * @extends Phaser.GameObjects.Components.Depth
+ * @extends Phaser.GameObjects.Components.Mask
+ * @extends Phaser.GameObjects.Components.ScrollFactor
+ * @extends Phaser.GameObjects.Components.Transform
+ * @extends Phaser.GameObjects.Components.Visible
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. A Game Object can only belong to one Scene at a time.
+ * @param {number} [x=0] - The horizontal position of this Game Object in the world.
+ * @param {number} [y=0] - The vertical position of this Game Object in the world.
+ * @param {Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to this Container.
+ */
+var Container = new Class({
+
+ Extends: GameObject,
+
+ Mixins: [
+ Components.Alpha,
+ Components.BlendMode,
+ Components.ComputedSize,
+ Components.Depth,
+ Components.Mask,
+ Components.ScrollFactor,
+ Components.Transform,
+ Components.Visible,
+ Render
+ ],
+
+ initialize:
+
+ function Container (scene, x, y, children)
+ {
+ GameObject.call(this, scene, 'Container');
+
+ /**
+ * An array holding the children of this Container.
+ *
+ * @name Phaser.GameObjects.Container#list
+ * @type {Phaser.GameObjects.GameObject[]}
+ * @since 3.4.0
+ */
+ this.list = [];
+
+ /**
+ * Does this Container exclusively manage its children?
+ *
+ * The default is `true` which means a child added to this Container cannot
+ * belong in another Container, which includes the Scene display list.
+ *
+ * If you disable this then this Container will no longer exclusively manage its children.
+ * This allows you to create all kinds of interesting graphical effects, such as replicating
+ * Game Objects without reparenting them all over the Scene.
+ * However, doing so will prevent children from receiving any kind of input event or have
+ * their physics bodies work by default, as they're no longer a single entity on the
+ * display list, but are being replicated where-ever this Container is.
+ *
+ * @name Phaser.GameObjects.Container#exclusive
+ * @type {boolean}
+ * @default true
+ * @since 3.4.0
+ */
+ this.exclusive = true;
+
+ /**
+ * Containers can have an optional maximum size. If set to anything above 0 it
+ * will constrict the addition of new Game Objects into the Container, capping off
+ * the maximum limit the Container can grow in size to.
+ *
+ * @name Phaser.GameObjects.Container#maxSize
+ * @type {integer}
+ * @default -1
+ * @since 3.4.0
+ */
+ this.maxSize = -1;
+
+ /**
+ * The cursor position.
+ *
+ * @name Phaser.GameObjects.Container#position
+ * @type {integer}
+ * @since 3.4.0
+ */
+ this.position = 0;
+
+ /**
+ * Internal Transform Matrix used for local space conversion.
+ *
+ * @name Phaser.GameObjects.Container#localTransform
+ * @type {Phaser.GameObjects.Components.TransformMatrix}
+ * @since 3.4.0
+ */
+ this.localTransform = new Components.TransformMatrix();
+
+ /**
+ * Internal temporary Transform Matrix used to avoid object creation.
+ *
+ * @name Phaser.GameObjects.Container#tempTransformMatrix
+ * @type {Phaser.GameObjects.Components.TransformMatrix}
+ * @private
+ * @since 3.4.0
+ */
+ this.tempTransformMatrix = new Components.TransformMatrix();
+
+ /**
+ * A reference to the Scene Display List.
+ *
+ * @name Phaser.GameObjects.Container#_displayList
+ * @type {Phaser.GameObjects.DisplayList}
+ * @private
+ * @since 3.4.0
+ */
+ this._displayList = scene.sys.displayList;
+
+ /**
+ * The property key to sort by.
+ *
+ * @name Phaser.GameObjects.Container#_sortKey
+ * @type {string}
+ * @private
+ * @since 3.4.0
+ */
+ this._sortKey = '';
+
+ /**
+ * A reference to the Scene Systems Event Emitter.
+ *
+ * @name Phaser.GameObjects.Container#_sysEvents
+ * @type {Phaser.Events.EventEmitter}
+ * @private
+ * @since 3.9.0
+ */
+ this._sysEvents = scene.sys.events;
+
+ this.setPosition(x, y);
+
+ this.clearAlpha();
+
+ this.setBlendMode(BlendModes.SKIP_CHECK);
+
+ if (children)
+ {
+ this.add(children);
+ }
+ },
+
+ /**
+ * Internal value to allow Containers to be used for input and physics.
+ * Do not change this value. It has no effect other than to break things.
+ *
+ * @name Phaser.GameObjects.Container#originX
+ * @type {number}
+ * @readonly
+ * @since 3.4.0
+ */
+ originX: {
+
+ get: function ()
+ {
+ return 0.5;
+ }
+
+ },
+
+ /**
+ * Internal value to allow Containers to be used for input and physics.
+ * Do not change this value. It has no effect other than to break things.
+ *
+ * @name Phaser.GameObjects.Container#originY
+ * @type {number}
+ * @readonly
+ * @since 3.4.0
+ */
+ originY: {
+
+ get: function ()
+ {
+ return 0.5;
+ }
+
+ },
+
+ /**
+ * Internal value to allow Containers to be used for input and physics.
+ * Do not change this value. It has no effect other than to break things.
+ *
+ * @name Phaser.GameObjects.Container#displayOriginX
+ * @type {number}
+ * @readonly
+ * @since 3.4.0
+ */
+ displayOriginX: {
+
+ get: function ()
+ {
+ return this.width * 0.5;
+ }
+
+ },
+
+ /**
+ * Internal value to allow Containers to be used for input and physics.
+ * Do not change this value. It has no effect other than to break things.
+ *
+ * @name Phaser.GameObjects.Container#displayOriginY
+ * @type {number}
+ * @readonly
+ * @since 3.4.0
+ */
+ displayOriginY: {
+
+ get: function ()
+ {
+ return this.height * 0.5;
+ }
+
+ },
+
+ /**
+ * Does this Container exclusively manage its children?
+ *
+ * The default is `true` which means a child added to this Container cannot
+ * belong in another Container, which includes the Scene display list.
+ *
+ * If you disable this then this Container will no longer exclusively manage its children.
+ * This allows you to create all kinds of interesting graphical effects, such as replicating
+ * Game Objects without reparenting them all over the Scene.
+ * However, doing so will prevent children from receiving any kind of input event or have
+ * their physics bodies work by default, as they're no longer a single entity on the
+ * display list, but are being replicated where-ever this Container is.
+ *
+ * @method Phaser.GameObjects.Container#setExclusive
+ * @since 3.4.0
+ *
+ * @param {boolean} [value=true] - The exclusive state of this Container.
+ *
+ * @return {Phaser.GameObjects.Container} This Container.
+ */
+ setExclusive: function (value)
+ {
+ if (value === undefined) { value = true; }
+
+ this.exclusive = value;
+
+ return this;
+ },
+
+ /**
+ * Gets the bounds of this Container. It works by iterating all children of the Container,
+ * getting their respective bounds, and then working out a min-max rectangle from that.
+ * It does not factor in if the children render or not, all are included.
+ *
+ * Some children are unable to return their bounds, such as Graphics objects, in which case
+ * they are skipped.
+ *
+ * Depending on the quantity of children in this Container it could be a really expensive call,
+ * so cache it and only poll it as needed.
+ *
+ * The values are stored and returned in a Rectangle object.
+ *
+ * @method Phaser.GameObjects.Container#getBounds
+ * @since 3.4.0
+ *
+ * @param {Phaser.Geom.Rectangle} [output] - A Geom.Rectangle object to store the values in. If not provided a new Rectangle will be created.
+ *
+ * @return {Phaser.Geom.Rectangle} The values stored in the output object.
+ */
+ getBounds: function (output)
+ {
+ if (output === undefined) { output = new Rectangle(); }
+
+ output.setTo(this.x, this.y, 0, 0);
+
+ if (this.list.length > 0)
+ {
+ var children = this.list;
+ var tempRect = new Rectangle();
+
+ for (var i = 0; i < children.length; i++)
+ {
+ var entry = children[i];
+
+ if (entry.getBounds)
+ {
+ entry.getBounds(tempRect);
+
+ Union(tempRect, output, output);
+ }
+ }
+ }
+
+ return output;
+ },
+
+ /**
+ * Internal add handler.
+ *
+ * @method Phaser.GameObjects.Container#addHandler
+ * @private
+ * @since 3.4.0
+ *
+ * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was just added to this Container.
+ */
+ addHandler: function (gameObject)
+ {
+ gameObject.once('destroy', this.remove, this);
+
+ if (this.exclusive)
+ {
+ this._displayList.remove(gameObject);
+
+ if (gameObject.parentContainer)
+ {
+ gameObject.parentContainer.remove(gameObject);
+ }
+
+ gameObject.parentContainer = this;
+ }
+ },
+
+ /**
+ * Internal remove handler.
+ *
+ * @method Phaser.GameObjects.Container#removeHandler
+ * @private
+ * @since 3.4.0
+ *
+ * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was just removed from this Container.
+ */
+ removeHandler: function (gameObject)
+ {
+ gameObject.off('destroy', this.remove);
+
+ if (this.exclusive)
+ {
+ gameObject.parentContainer = null;
+ }
+ },
+
+ /**
+ * Takes a Point-like object, such as a Vector2, Geom.Point or object with public x and y properties,
+ * and transforms it into the space of this Container, then returns it in the output object.
+ *
+ * @method Phaser.GameObjects.Container#pointToContainer
+ * @since 3.4.0
+ *
+ * @param {(object|Phaser.Geom.Point|Phaser.Math.Vector2)} source - The Source Point to be transformed.
+ * @param {(object|Phaser.Geom.Point|Phaser.Math.Vector2)} [output] - A destination object to store the transformed point in. If none given a Vector2 will be created and returned.
+ *
+ * @return {(object|Phaser.Geom.Point|Phaser.Math.Vector2)} The transformed point.
+ */
+ pointToContainer: function (source, output)
+ {
+ if (output === undefined) { output = new Vector2(); }
+
+ if (this.parentContainer)
+ {
+ return this.parentContainer.pointToContainer(source, output);
+ }
+
+ var tempMatrix = this.tempTransformMatrix;
+
+ // No need to loadIdentity because applyITRS overwrites every value anyway
+ tempMatrix.applyITRS(this.x, this.y, this.rotation, this.scaleX, this.scaleY);
+
+ tempMatrix.invert();
+
+ tempMatrix.transformPoint(source.x, source.y, output);
+
+ return output;
+ },
+
+ /**
+ * Returns the world transform matrix as used for Bounds checks.
+ *
+ * The returned matrix is temporal and shouldn't be stored.
+ *
+ * @method Phaser.GameObjects.Container#getBoundsTransformMatrix
+ * @since 3.4.0
+ *
+ * @return {Phaser.GameObjects.Components.TransformMatrix} The world transform matrix.
+ */
+ getBoundsTransformMatrix: function ()
+ {
+ return this.getWorldTransformMatrix(this.tempTransformMatrix, this.localTransform);
+ },
+
+ /**
+ * Adds the given Game Object, or array of Game Objects, to this Container.
+ *
+ * Each Game Object must be unique within the Container.
+ *
+ * @method Phaser.GameObjects.Container#add
+ * @since 3.4.0
+ *
+ * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} child - The Game Object, or array of Game Objects, to add to the Container.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ add: function (child)
+ {
+ ArrayUtils.Add(this.list, child, this.maxSize, this.addHandler, this);
+
+ return this;
+ },
+
+ /**
+ * Adds the given Game Object, or array of Game Objects, to this Container at the specified position.
+ *
+ * Existing Game Objects in the Container are shifted up.
+ *
+ * Each Game Object must be unique within the Container.
+ *
+ * @method Phaser.GameObjects.Container#addAt
+ * @since 3.4.0
+ *
+ * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} child - The Game Object, or array of Game Objects, to add to the Container.
+ * @param {integer} [index=0] - The position to insert the Game Object/s at.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ addAt: function (child, index)
+ {
+ ArrayUtils.AddAt(this.list, child, index, this.maxSize, this.addHandler, this);
+
+ return this;
+ },
+
+ /**
+ * Returns the Game Object at the given position in this Container.
+ *
+ * @method Phaser.GameObjects.Container#getAt
+ * @since 3.4.0
+ *
+ * @param {integer} index - The position to get the Game Object from.
+ *
+ * @return {?Phaser.GameObjects.GameObject} The Game Object at the specified index, or `null` if none found.
+ */
+ getAt: function (index)
+ {
+ return this.list[index];
+ },
+
+ /**
+ * Returns the index of the given Game Object in this Container.
+ *
+ * @method Phaser.GameObjects.Container#getIndex
+ * @since 3.4.0
+ *
+ * @param {Phaser.GameObjects.GameObject} child - The Game Object to search for in this Container.
+ *
+ * @return {integer} The index of the Game Object in this Container, or -1 if not found.
+ */
+ getIndex: function (child)
+ {
+ return this.list.indexOf(child);
+ },
+
+ /**
+ * Sort the contents of this Container so the items are in order based on the given property.
+ * For example: `sort('alpha')` would sort the elements based on the value of their `alpha` property.
+ *
+ * @method Phaser.GameObjects.Container#sort
+ * @since 3.4.0
+ *
+ * @param {string} property - The property to lexically sort by.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ sort: function (property)
+ {
+ if (property)
+ {
+ this._sortKey = property;
+
+ ArrayUtils.StableSort.inplace(this.list, this.sortHandler);
+ }
+
+ return this;
+ },
+
+ /**
+ * Internal sort handler method.
+ *
+ * @method Phaser.GameObjects.Container#sortHandler
+ * @private
+ * @since 3.4.0
+ *
+ * @param {Phaser.GameObjects.GameObject} childA - The first child to sort.
+ * @param {Phaser.GameObjects.GameObject} childB - The second child to sort.
+ *
+ * @return {integer} The sort results.
+ */
+ sortHandler: function (childA, childB)
+ {
+ return childA[this._sortKey] - childB[this._sortKey];
+ },
+
+ /**
+ * Searches for the first instance of a child with its `name` property matching the given argument.
+ * Should more than one child have the same name only the first is returned.
+ *
+ * @method Phaser.GameObjects.Container#getByName
+ * @since 3.4.0
+ *
+ * @param {string} name - The name to search for.
+ *
+ * @return {?Phaser.GameObjects.GameObject} The first child with a matching name, or `null` if none were found.
+ */
+ getByName: function (name)
+ {
+ return ArrayUtils.GetFirst(this.list, 'name', name);
+ },
+
+ /**
+ * Returns a random Game Object from this Container.
+ *
+ * @method Phaser.GameObjects.Container#getRandom
+ * @since 3.4.0
+ *
+ * @param {integer} [startIndex=0] - An optional start index.
+ * @param {integer} [length] - An optional length, the total number of elements (from the startIndex) to choose from.
+ *
+ * @return {?Phaser.GameObjects.GameObject} A random child from the Container, or `null` if the Container is empty.
+ */
+ getRandom: function (startIndex, length)
+ {
+ return ArrayUtils.GetRandom(this.list, startIndex, length);
+ },
+
+ /**
+ * Gets the first Game Object in this Container.
+ *
+ * You can also specify a property and value to search for, in which case it will return the first
+ * Game Object in this Container with a matching property and / or value.
+ *
+ * For example: `getFirst('visible', true)` would return the first Game Object that had its `visible` property set.
+ *
+ * You can limit the search to the `startIndex` - `endIndex` range.
+ *
+ * @method Phaser.GameObjects.Container#getFirst
+ * @since 3.4.0
+ *
+ * @param {string} [property] - The property to test on each Game Object in the Container.
+ * @param {*} [value] - The value to test the property against. Must pass a strict (`===`) comparison check.
+ * @param {integer} [startIndex=0] - An optional start index to search from.
+ * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included)
+ *
+ * @return {?Phaser.GameObjects.GameObject} The first matching Game Object, or `null` if none was found.
+ */
+ getFirst: function (property, value, startIndex, endIndex)
+ {
+ return ArrayUtils.GetFirstElement(this.list, property, value, startIndex, endIndex);
+ },
+
+ /**
+ * Returns all Game Objects in this Container.
+ *
+ * You can optionally specify a matching criteria using the `property` and `value` arguments.
+ *
+ * For example: `getAll('body')` would return only Game Objects that have a body property.
+ *
+ * You can also specify a value to compare the property to:
+ *
+ * `getAll('visible', true)` would return only Game Objects that have their visible property set to `true`.
+ *
+ * Optionally you can specify a start and end index. For example if this Container had 100 Game Objects,
+ * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only
+ * the first 50 Game Objects.
+ *
+ * @method Phaser.GameObjects.Container#getAll
+ * @since 3.4.0
+ *
+ * @param {string} [property] - The property to test on each Game Object in the Container.
+ * @param {any} [value] - If property is set then the `property` must strictly equal this value to be included in the results.
+ * @param {integer} [startIndex=0] - An optional start index to search from.
+ * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included)
+ *
+ * @return {Phaser.GameObjects.GameObject[]} An array of matching Game Objects from this Container.
+ */
+ getAll: function (property, value, startIndex, endIndex)
+ {
+ return ArrayUtils.GetAll(this.list, property, value, startIndex, endIndex);
+ },
+
+ /**
+ * Returns the total number of Game Objects in this Container that have a property
+ * matching the given value.
+ *
+ * For example: `count('visible', true)` would count all the elements that have their visible property set.
+ *
+ * You can optionally limit the operation to the `startIndex` - `endIndex` range.
+ *
+ * @method Phaser.GameObjects.Container#count
+ * @since 3.4.0
+ *
+ * @param {string} property - The property to check.
+ * @param {any} value - The value to check.
+ * @param {integer} [startIndex=0] - An optional start index to search from.
+ * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included)
+ *
+ * @return {integer} The total number of Game Objects in this Container with a property matching the given value.
+ */
+ count: function (property, value, startIndex, endIndex)
+ {
+ return ArrayUtils.CountAllMatching(this.list, property, value, startIndex, endIndex);
+ },
+
+ /**
+ * Swaps the position of two Game Objects in this Container.
+ * Both Game Objects must belong to this Container.
+ *
+ * @method Phaser.GameObjects.Container#swap
+ * @since 3.4.0
+ *
+ * @param {Phaser.GameObjects.GameObject} child1 - The first Game Object to swap.
+ * @param {Phaser.GameObjects.GameObject} child2 - The second Game Object to swap.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ swap: function (child1, child2)
+ {
+ ArrayUtils.Swap(this.list, child1, child2);
+
+ return this;
+ },
+
+ /**
+ * Moves a Game Object to a new position within this Container.
+ *
+ * The Game Object must already be a child of this Container.
+ *
+ * The Game Object is removed from its old position and inserted into the new one.
+ * Therefore the Container size does not change. Other children will change position accordingly.
+ *
+ * @method Phaser.GameObjects.Container#moveTo
+ * @since 3.4.0
+ *
+ * @param {Phaser.GameObjects.GameObject} child - The Game Object to move.
+ * @param {integer} index - The new position of the Game Object in this Container.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ moveTo: function (child, index)
+ {
+ ArrayUtils.MoveTo(this.list, child, index);
+
+ return this;
+ },
+
+ /**
+ * Removes the given Game Object, or array of Game Objects, from this Container.
+ *
+ * The Game Objects must already be children of this Container.
+ *
+ * You can also optionally call `destroy` on each Game Object that is removed from the Container.
+ *
+ * @method Phaser.GameObjects.Container#remove
+ * @since 3.4.0
+ *
+ * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} child - The Game Object, or array of Game Objects, to be removed from the Container.
+ * @param {boolean} [destroyChild=false] - Optionally call `destroy` on each child successfully removed from this Container.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ remove: function (child, destroyChild)
+ {
+ var removed = ArrayUtils.Remove(this.list, child, this.removeHandler, this);
+
+ if (destroyChild && removed)
+ {
+ if (!Array.isArray(removed))
+ {
+ removed = [ removed ];
+ }
+
+ for (var i = 0; i < removed.length; i++)
+ {
+ removed[i].destroy();
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Removes the Game Object at the given position in this Container.
+ *
+ * You can also optionally call `destroy` on the Game Object, if one is found.
+ *
+ * @method Phaser.GameObjects.Container#removeAt
+ * @since 3.4.0
+ *
+ * @param {integer} index - The index of the Game Object to be removed.
+ * @param {boolean} [destroyChild=false] - Optionally call `destroy` on the Game Object if successfully removed from this Container.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ removeAt: function (index, destroyChild)
+ {
+ var removed = ArrayUtils.RemoveAt(this.list, index, this.removeHandler, this);
+
+ if (destroyChild && removed)
+ {
+ removed.destroy();
+ }
+
+ return this;
+ },
+
+ /**
+ * Removes the Game Objects between the given positions in this Container.
+ *
+ * You can also optionally call `destroy` on each Game Object that is removed from the Container.
+ *
+ * @method Phaser.GameObjects.Container#removeBetween
+ * @since 3.4.0
+ *
+ * @param {integer} [startIndex=0] - An optional start index to search from.
+ * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included)
+ * @param {boolean} [destroyChild=false] - Optionally call `destroy` on each Game Object successfully removed from this Container.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ removeBetween: function (startIndex, endIndex, destroyChild)
+ {
+ var removed = ArrayUtils.RemoveBetween(this.list, startIndex, endIndex, this.removeHandler, this);
+
+ if (destroyChild)
+ {
+ for (var i = 0; i < removed.length; i++)
+ {
+ removed[i].destroy();
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Removes all Game Objects from this Container.
+ *
+ * You can also optionally call `destroy` on each Game Object that is removed from the Container.
+ *
+ * @method Phaser.GameObjects.Container#removeAll
+ * @since 3.4.0
+ *
+ * @param {boolean} [destroyChild=false] - Optionally call `destroy` on each Game Object successfully removed from this Container.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ removeAll: function (destroyChild)
+ {
+ var removed = ArrayUtils.RemoveBetween(this.list, 0, this.list.length, this.removeHandler, this);
+
+ if (destroyChild)
+ {
+ for (var i = 0; i < removed.length; i++)
+ {
+ removed[i].destroy();
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Brings the given Game Object to the top of this Container.
+ * This will cause it to render on-top of any other objects in the Container.
+ *
+ * @method Phaser.GameObjects.Container#bringToTop
+ * @since 3.4.0
+ *
+ * @param {Phaser.GameObjects.GameObject} child - The Game Object to bring to the top of the Container.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ bringToTop: function (child)
+ {
+ ArrayUtils.BringToTop(this.list, child);
+
+ return this;
+ },
+
+ /**
+ * Sends the given Game Object to the bottom of this Container.
+ * This will cause it to render below any other objects in the Container.
+ *
+ * @method Phaser.GameObjects.Container#sendToBack
+ * @since 3.4.0
+ *
+ * @param {Phaser.GameObjects.GameObject} child - The Game Object to send to the bottom of the Container.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ sendToBack: function (child)
+ {
+ ArrayUtils.SendToBack(this.list, child);
+
+ return this;
+ },
+
+ /**
+ * Moves the given Game Object up one place in this Container, unless it's already at the top.
+ *
+ * @method Phaser.GameObjects.Container#moveUp
+ * @since 3.4.0
+ *
+ * @param {Phaser.GameObjects.GameObject} child - The Game Object to be moved in the Container.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ moveUp: function (child)
+ {
+ ArrayUtils.MoveUp(this.list, child);
+
+ return this;
+ },
+
+ /**
+ * Moves the given Game Object down one place in this Container, unless it's already at the bottom.
+ *
+ * @method Phaser.GameObjects.Container#moveDown
+ * @since 3.4.0
+ *
+ * @param {Phaser.GameObjects.GameObject} child - The Game Object to be moved in the Container.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ moveDown: function (child)
+ {
+ ArrayUtils.MoveDown(this.list, child);
+
+ return this;
+ },
+
+ /**
+ * Reverses the order of all Game Objects in this Container.
+ *
+ * @method Phaser.GameObjects.Container#reverse
+ * @since 3.4.0
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ reverse: function ()
+ {
+ this.list.reverse();
+
+ return this;
+ },
+
+ /**
+ * Shuffles the all Game Objects in this Container using the Fisher-Yates implementation.
+ *
+ * @method Phaser.GameObjects.Container#shuffle
+ * @since 3.4.0
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ shuffle: function ()
+ {
+ ArrayUtils.Shuffle(this.list);
+
+ return this;
+ },
+
+ /**
+ * Replaces a Game Object in this Container with the new Game Object.
+ * The new Game Object cannot already be a child of this Container.
+ *
+ * @method Phaser.GameObjects.Container#replace
+ * @since 3.4.0
+ *
+ * @param {Phaser.GameObjects.GameObject} oldChild - The Game Object in this Container that will be replaced.
+ * @param {Phaser.GameObjects.GameObject} newChild - The Game Object to be added to this Container.
+ * @param {boolean} [destroyChild=false] - Optionally call `destroy` on the Game Object if successfully removed from this Container.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ replace: function (oldChild, newChild, destroyChild)
+ {
+ var moved = ArrayUtils.Replace(this.list, oldChild, newChild);
+
+ if (moved)
+ {
+ this.addHandler(newChild);
+ this.removeHandler(oldChild);
+
+ if (destroyChild)
+ {
+ oldChild.destroy();
+ }
+ }
+
+ return this;
+ },
+
+ /**
+ * Returns `true` if the given Game Object is a direct child of this Container.
+ *
+ * This check does not scan nested Containers.
+ *
+ * @method Phaser.GameObjects.Container#exists
+ * @since 3.4.0
+ *
+ * @param {Phaser.GameObjects.GameObject} child - The Game Object to check for within this Container.
+ *
+ * @return {boolean} True if the Game Object is an immediate child of this Container, otherwise false.
+ */
+ exists: function (child)
+ {
+ return (this.list.indexOf(child) > -1);
+ },
+
+ /**
+ * Sets the property to the given value on all Game Objects in this Container.
+ *
+ * Optionally you can specify a start and end index. For example if this Container had 100 Game Objects,
+ * and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only
+ * the first 50 Game Objects.
+ *
+ * @method Phaser.GameObjects.Container#setAll
+ * @since 3.4.0
+ *
+ * @param {string} property - The property that must exist on the Game Object.
+ * @param {any} value - The value to get the property to.
+ * @param {integer} [startIndex=0] - An optional start index to search from.
+ * @param {integer} [endIndex=Container.length] - An optional end index to search up to (but not included)
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ setAll: function (property, value, startIndex, endIndex)
+ {
+ ArrayUtils.SetAll(this.list, property, value, startIndex, endIndex);
+
+ return this;
+ },
+
+ /**
+ * @callback EachContainerCallback
+ * @generic I - [item]
+ *
+ * @param {*} item - The child Game Object of the Container.
+ * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
+ */
+
+ /**
+ * Passes all Game Objects in this Container to the given callback.
+ *
+ * A copy of the Container is made before passing each entry to your callback.
+ * This protects against the callback itself modifying the Container.
+ *
+ * If you know for sure that the callback will not change the size of this Container
+ * then you can use the more performant `Container.iterate` method instead.
+ *
+ * @method Phaser.GameObjects.Container#each
+ * @since 3.4.0
+ *
+ * @param {function} callback - The function to call.
+ * @param {object} [context] - Value to use as `this` when executing callback.
+ * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ each: function (callback, context)
+ {
+ var args = [ null ];
+ var i;
+ var temp = this.list.slice();
+ var len = temp.length;
+
+ for (i = 2; i < arguments.length; i++)
+ {
+ args.push(arguments[i]);
+ }
+
+ for (i = 0; i < len; i++)
+ {
+ args[0] = temp[i];
+
+ callback.apply(context, args);
+ }
+
+ return this;
+ },
+
+ /**
+ * Passes all Game Objects in this Container to the given callback.
+ *
+ * Only use this method when you absolutely know that the Container will not be modified during
+ * the iteration, i.e. by removing or adding to its contents.
+ *
+ * @method Phaser.GameObjects.Container#iterate
+ * @since 3.4.0
+ *
+ * @param {function} callback - The function to call.
+ * @param {object} [context] - Value to use as `this` when executing callback.
+ * @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
+ *
+ * @return {Phaser.GameObjects.Container} This Container instance.
+ */
+ iterate: function (callback, context)
+ {
+ var args = [ null ];
+ var i;
+
+ for (i = 2; i < arguments.length; i++)
+ {
+ args.push(arguments[i]);
+ }
+
+ for (i = 0; i < this.list.length; i++)
+ {
+ args[0] = this.list[i];
+
+ callback.apply(context, args);
+ }
+
+ return this;
+ },
+
+ /**
+ * The number of Game Objects inside this Container.
+ *
+ * @name Phaser.GameObjects.Container#length
+ * @type {integer}
+ * @readonly
+ * @since 3.4.0
+ */
+ length: {
+
+ get: function ()
+ {
+ return this.list.length;
+ }
+
+ },
+
+ /**
+ * Returns the first Game Object within the Container, or `null` if it is empty.
+ *
+ * You can move the cursor by calling `Container.next` and `Container.previous`.
+ *
+ * @name Phaser.GameObjects.Container#first
+ * @type {?Phaser.GameObjects.GameObject}
+ * @readonly
+ * @since 3.4.0
+ */
+ first: {
+
+ get: function ()
+ {
+ this.position = 0;
+
+ if (this.list.length > 0)
+ {
+ return this.list[0];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ },
+
+ /**
+ * Returns the last Game Object within the Container, or `null` if it is empty.
+ *
+ * You can move the cursor by calling `Container.next` and `Container.previous`.
+ *
+ * @name Phaser.GameObjects.Container#last
+ * @type {?Phaser.GameObjects.GameObject}
+ * @readonly
+ * @since 3.4.0
+ */
+ last: {
+
+ get: function ()
+ {
+ if (this.list.length > 0)
+ {
+ this.position = this.list.length - 1;
+
+ return this.list[this.position];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ },
+
+ /**
+ * Returns the next Game Object within the Container, or `null` if it is empty.
+ *
+ * You can move the cursor by calling `Container.next` and `Container.previous`.
+ *
+ * @name Phaser.GameObjects.Container#next
+ * @type {?Phaser.GameObjects.GameObject}
+ * @readonly
+ * @since 3.4.0
+ */
+ next: {
+
+ get: function ()
+ {
+ if (this.position < this.list.length)
+ {
+ this.position++;
+
+ return this.list[this.position];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ },
+
+ /**
+ * Returns the previous Game Object within the Container, or `null` if it is empty.
+ *
+ * You can move the cursor by calling `Container.next` and `Container.previous`.
+ *
+ * @name Phaser.GameObjects.Container#previous
+ * @type {?Phaser.GameObjects.GameObject}
+ * @readonly
+ * @since 3.4.0
+ */
+ previous: {
+
+ get: function ()
+ {
+ if (this.position > 0)
+ {
+ this.position--;
+
+ return this.list[this.position];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ },
+
+ /**
+ * Internal destroy handler, called as part of the destroy process.
+ *
+ * @method Phaser.GameObjects.Container#preDestroy
+ * @protected
+ * @since 3.9.0
+ */
+ preDestroy: function ()
+ {
+ this.removeAll(!!this.exclusive);
+
+ this.localTransform.destroy();
+ this.tempTransformMatrix.destroy();
+
+ this.list = [];
+ this._displayList = null;
+ }
+
+});
+
+module.exports = Container;
+
+
+/***/ }),
+/* 161 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var BlitterRender = __webpack_require__(841);
+var Bob = __webpack_require__(838);
+var Class = __webpack_require__(0);
+var Components = __webpack_require__(14);
+var Frame = __webpack_require__(113);
+var GameObject = __webpack_require__(19);
+var List = __webpack_require__(112);
+
+/**
+ * @callback Phaser.GameObjects.Blitter.CreateCallback
+ *
+ * @param {Phaser.GameObjects.Blitter.Bob} bob - The Bob that was created by the Blitter.
+ * @param {integer} index - The position of the Bob within the Blitter display list.
+ */
+
+/**
+ * @classdesc
+ * A Blitter Game Object.
+ *
+ * The Blitter Game Object is a special kind of container that creates, updates and manages Bob objects.
+ * Bobs are designed for rendering speed rather than flexibility. They consist of a texture, or frame from a texture,
+ * a position and an alpha value. You cannot scale or rotate them. They use a batched drawing method for speed
+ * during rendering.
+ *
+ * A Blitter Game Object has one texture bound to it. Bobs created by the Blitter can use any Frame from this
+ * Texture to render with, but they cannot use any other Texture. It is this single texture-bind that allows
+ * them their speed.
+ *
+ * If you have a need to blast a large volume of frames around the screen then Blitter objects are well worth
+ * investigating. They are especially useful for using as a base for your own special effects systems.
+ *
+ * @class Blitter
+ * @extends Phaser.GameObjects.GameObject
+ * @memberof Phaser.GameObjects
+ * @constructor
+ * @since 3.0.0
+ *
+ * @extends Phaser.GameObjects.Components.Alpha
+ * @extends Phaser.GameObjects.Components.BlendMode
+ * @extends Phaser.GameObjects.Components.Depth
+ * @extends Phaser.GameObjects.Components.Mask
+ * @extends Phaser.GameObjects.Components.Pipeline
+ * @extends Phaser.GameObjects.Components.ScaleMode
+ * @extends Phaser.GameObjects.Components.ScrollFactor
+ * @extends Phaser.GameObjects.Components.Size
+ * @extends Phaser.GameObjects.Components.Texture
+ * @extends Phaser.GameObjects.Components.Transform
+ * @extends Phaser.GameObjects.Components.Visible
+ *
+ * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time.
+ * @param {number} [x=0] - The x coordinate of this Game Object in world space.
+ * @param {number} [y=0] - The y coordinate of this Game Object in world space.
+ * @param {string} [texture='__DEFAULT'] - The key of the texture this Game Object will use for rendering. The Texture must already exist in the Texture Manager.
+ * @param {(string|integer)} [frame=0] - The Frame of the Texture that this Game Object will use. Only set if the Texture has multiple frames, such as a Texture Atlas or Sprite Sheet.
+ */
+var Blitter = new Class({
+
+ Extends: GameObject,
+
+ Mixins: [
+ Components.Alpha,
+ Components.BlendMode,
+ Components.Depth,
+ Components.Mask,
+ Components.Pipeline,
+ Components.ScaleMode,
+ Components.ScrollFactor,
+ Components.Size,
+ Components.Texture,
+ Components.Transform,
+ Components.Visible,
+ BlitterRender
+ ],
+
+ initialize:
+
+ function Blitter (scene, x, y, texture, frame)
+ {
+ GameObject.call(this, scene, 'Blitter');
+
+ this.setTexture(texture, frame);
+ this.setPosition(x, y);
+ this.initPipeline();
+
+ /**
+ * The children of this Blitter.
+ * This List contains all of the Bob objects created by the Blitter.
+ *
+ * @name Phaser.GameObjects.Blitter#children
+ * @type {Phaser.Structs.List.}
+ * @since 3.0.0
+ */
+ this.children = new List();
+
+ /**
+ * A transient array that holds all of the Bobs that will be rendered this frame.
+ * The array is re-populated whenever the dirty flag is set.
+ *
+ * @name Phaser.GameObjects.Blitter#renderList
+ * @type {Phaser.GameObjects.Blitter.Bob[]}
+ * @default []
+ * @private
+ * @since 3.0.0
+ */
+ this.renderList = [];
+
+ /**
+ * Is the Blitter considered dirty?
+ * A 'dirty' Blitter has had its child count changed since the last frame.
+ *
+ * @name Phaser.GameObjects.Blitter#dirty
+ * @type {boolean}
+ * @since 3.0.0
+ */
+ this.dirty = false;
+ },
+
+ /**
+ * Creates a new Bob in this Blitter.
+ *
+ * The Bob is created at the given coordinates, relative to the Blitter and uses the given frame.
+ * A Bob can use any frame belonging to the texture bound to the Blitter.
+ *
+ * @method Phaser.GameObjects.Blitter#create
+ * @since 3.0.0
+ *
+ * @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object.
+ * @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object.
+ * @param {(string|integer|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using.
+ * @param {boolean} [visible=true] - Should the created Bob render or not?
+ * @param {integer} [index] - The position in the Blitters Display List to add the new Bob at. Defaults to the top of the list.
+ *
+ * @return {Phaser.GameObjects.Blitter.Bob} The newly created Bob object.
+ */
+ create: function (x, y, frame, visible, index)
+ {
+ if (visible === undefined) { visible = true; }
+ if (index === undefined) { index = this.children.length; }
+
+ if (frame === undefined)
+ {
+ frame = this.frame;
+ }
+ else if (!(frame instanceof Frame))
+ {
+ frame = this.texture.get(frame);
+ }
+
+ var bob = new Bob(this, x, y, frame, visible);
+
+ this.children.addAt(bob, index, false);
+
+ this.dirty = true;
+
+ return bob;
+ },
+
+ /**
+ * Creates multiple Bob objects within this Blitter and then passes each of them to the specified callback.
+ *
+ * @method Phaser.GameObjects.Blitter#createFromCallback
+ * @since 3.0.0
+ *
+ * @param {Phaser.GameObjects.Blitter.CreateCallback} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob.
+ * @param {integer} quantity - The quantity of Bob objects to create.
+ * @param {(string|integer|Phaser.Textures.Frame|string[]|integer[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture.
+ * @param {boolean} [visible=true] - Should the created Bob render or not?
+ *
+ * @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that were created.
+ */
+ createFromCallback: function (callback, quantity, frame, visible)
+ {
+ var bobs = this.createMultiple(quantity, frame, visible);
+
+ for (var i = 0; i < bobs.length; i++)
+ {
+ var bob = bobs[i];
+
+ callback.call(this, bob, i);
+ }
+
+ return bobs;
+ },
+
+ /**
+ * Creates multiple Bobs in one call.
+ *
+ * The amount created is controlled by a combination of the `quantity` argument and the number of frames provided.
+ *
+ * If the quantity is set to 10 and you provide 2 frames, then 20 Bobs will be created. 10 with the first
+ * frame and 10 with the second.
+ *
+ * @method Phaser.GameObjects.Blitter#createMultiple
+ * @since 3.0.0
+ *
+ * @param {integer} quantity - The quantity of Bob objects to create.
+ * @param {(string|integer|Phaser.Textures.Frame|string[]|integer[]|Phaser.Textures.Frame[])} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture.
+ * @param {boolean} [visible=true] - Should the created Bob render or not?
+ *
+ * @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that were created.
+ */
+ createMultiple: function (quantity, frame, visible)
+ {
+ if (frame === undefined) { frame = this.frame.name; }
+ if (visible === undefined) { visible = true; }
+
+ if (!Array.isArray(frame))
+ {
+ frame = [ frame ];
+ }
+
+ var bobs = [];
+ var _this = this;
+
+ frame.forEach(function (singleFrame)
+ {
+ for (var i = 0; i < quantity; i++)
+ {
+ bobs.push(_this.create(0, 0, singleFrame, visible));
+ }
+ });
+
+ return bobs;
+ },
+
+ /**
+ * Checks if the given child can render or not, by checking its `visible` and `alpha` values.
+ *
+ * @method Phaser.GameObjects.Blitter#childCanRender
+ * @since 3.0.0
+ *
+ * @param {Phaser.GameObjects.Blitter.Bob} child - The Bob to check for rendering.
+ *
+ * @return {boolean} Returns `true` if the given child can render, otherwise `false`.
+ */
+ childCanRender: function (child)
+ {
+ return (child.visible && child.alpha > 0);
+ },
+
+ /**
+ * Returns an array of Bobs to be rendered.
+ * If the Blitter is dirty then a new list is generated and stored in `renderList`.
+ *
+ * @method Phaser.GameObjects.Blitter#getRenderList
+ * @since 3.0.0
+ *
+ * @return {Phaser.GameObjects.Blitter.Bob[]} An array of Bob objects that will be rendered this frame.
+ */
+ getRenderList: function ()
+ {
+ if (this.dirty)
+ {
+ this.renderList = this.children.list.filter(this.childCanRender, this);
+ this.dirty = false;
+ }
+
+ return this.renderList;
+ },
+
+ /**
+ * Removes all Bobs from the children List and clears the dirty flag.
+ *
+ * @method Phaser.GameObjects.Blitter#clear
+ * @since 3.0.0
+ */
+ clear: function ()
+ {
+ this.children.removeAll();
+ this.dirty = true;
+ },
+
+ /**
+ * Internal destroy handler, called as part of the destroy process.
+ *
+ * @method Phaser.GameObjects.Blitter#preDestroy
+ * @protected
+ * @since 3.9.0
+ */
+ preDestroy: function ()
+ {
+ this.children.destroy();
+
+ this.renderList = [];
+ }
+
+});
+
+module.exports = Blitter;
+
+
+/***/ }),
+/* 162 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Returns a Random element from the array.
+ *
+ * @function Phaser.Utils.Array.GetRandom
+ * @since 3.0.0
+ *
+ * @param {array} array - The array to select the random entry from.
+ * @param {integer} [startIndex=0] - An optional start index.
+ * @param {integer} [length=array.length] - An optional length, the total number of elements (from the startIndex) to choose from.
+ *
+ * @return {*} A random element from the array, or `null` if no element could be found in the range given.
+ */
+var GetRandom = function (array, startIndex, length)
+{
+ if (startIndex === undefined) { startIndex = 0; }
+ if (length === undefined) { length = array.length; }
+
+ var randomIndex = startIndex + Math.floor(Math.random() * length);
+
+ return (array[randomIndex] === undefined) ? null : array[randomIndex];
+};
+
+module.exports = GetRandom;
+
+
+/***/ }),
+/* 163 */
/***/ (function(module, exports) {
/**
@@ -24025,7 +36234,60 @@ module.exports = CheckMatrix;
/***/ }),
-/* 117 */
+/* 164 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @namespace Phaser.Utils.Array
+ */
+
+module.exports = {
+
+ Matrix: __webpack_require__(874),
+
+ Add: __webpack_require__(867),
+ AddAt: __webpack_require__(866),
+ BringToTop: __webpack_require__(865),
+ CountAllMatching: __webpack_require__(864),
+ Each: __webpack_require__(863),
+ EachInRange: __webpack_require__(862),
+ FindClosestInSorted: __webpack_require__(383),
+ GetAll: __webpack_require__(861),
+ GetFirst: __webpack_require__(860),
+ GetRandom: __webpack_require__(162),
+ MoveDown: __webpack_require__(859),
+ MoveTo: __webpack_require__(858),
+ MoveUp: __webpack_require__(857),
+ NumberArray: __webpack_require__(856),
+ NumberArrayStep: __webpack_require__(855),
+ QuickSelect: __webpack_require__(313),
+ Range: __webpack_require__(312),
+ Remove: __webpack_require__(330),
+ RemoveAt: __webpack_require__(854),
+ RemoveBetween: __webpack_require__(853),
+ RemoveRandomElement: __webpack_require__(852),
+ Replace: __webpack_require__(851),
+ RotateLeft: __webpack_require__(387),
+ RotateRight: __webpack_require__(386),
+ SafeRange: __webpack_require__(62),
+ SendToBack: __webpack_require__(850),
+ SetAll: __webpack_require__(849),
+ Shuffle: __webpack_require__(122),
+ SpliceOne: __webpack_require__(91),
+ StableSort: __webpack_require__(110),
+ Swap: __webpack_require__(848)
+
+};
+
+
+/***/ }),
+/* 165 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -24035,8 +36297,10 @@ module.exports = CheckMatrix;
*/
var Class = __webpack_require__(0);
-var Frame = __webpack_require__(128);
-var TextureSource = __webpack_require__(183);
+var Frame = __webpack_require__(113);
+var TextureSource = __webpack_require__(317);
+
+var TEXTURE_MISSING_ERROR = 'Texture.frame missing: ';
/**
* @classdesc
@@ -24051,7 +36315,7 @@ var TextureSource = __webpack_require__(183);
* Sprites and other Game Objects get the texture data they need from the TextureManager.
*
* @class Texture
- * @memberOf Phaser.Textures
+ * @memberof Phaser.Textures
* @constructor
* @since 3.0.0
*
@@ -24233,7 +36497,7 @@ var Texture = new Class({
if (!frame)
{
- console.warn('No Texture.frame found with name ' + name);
+ console.warn(TEXTURE_MISSING_ERROR + name);
frame = this.frames[this.firstFrame];
}
@@ -24274,16 +36538,19 @@ var Texture = new Class({
* @since 3.0.0
*
* @param {integer} sourceIndex - The index of the TextureSource to get the Frames from.
+ * @param {boolean} [includeBase=false] - Include the `__BASE` Frame in the output array?
*
* @return {Phaser.Textures.Frame[]} An array of Texture Frames.
*/
- getFramesFromTextureSource: function (sourceIndex)
+ getFramesFromTextureSource: function (sourceIndex, includeBase)
{
+ if (includeBase === undefined) { includeBase = false; }
+
var out = [];
for (var frameName in this.frames)
{
- if (frameName === '__BASE')
+ if (frameName === '__BASE' && !includeBase)
{
continue;
}
@@ -24292,7 +36559,7 @@ var Texture = new Class({
if (frame.sourceIndex === sourceIndex)
{
- out.push(frame.name);
+ out.push(frame);
}
}
@@ -24341,7 +36608,7 @@ var Texture = new Class({
*
* @param {(string|integer)} [name] - The string-based name, or integer based index, of the Frame to get from this Texture.
*
- * @return {(HTMLImageElement|HTMLCanvasElement)} The DOM Image or Canvas Element.
+ * @return {(HTMLImageElement|HTMLCanvasElement|Phaser.GameObjects.RenderTexture)} The DOM Image, Canvas Element or Render Texture.
*/
getSourceImage: function (name)
{
@@ -24352,15 +36619,15 @@ var Texture = new Class({
var frame = this.frames[name];
- if (!frame)
+ if (frame)
{
- console.warn('No Texture.frame found with name ' + name);
-
- return this.frames['__BASE'].source.image;
+ return frame.source.image;
}
else
{
- return frame.source.image;
+ console.warn(TEXTURE_MISSING_ERROR + name);
+
+ return this.frames['__BASE'].source.image;
}
},
@@ -24389,7 +36656,7 @@ var Texture = new Class({
if (!frame)
{
- console.warn('No Texture.frame found with name ' + name);
+ console.warn(TEXTURE_MISSING_ERROR + name);
idx = this.frames['__BASE'].sourceIndex;
}
@@ -24418,7 +36685,7 @@ var Texture = new Class({
{
data = [ data ];
}
-
+
for (var i = 0; i < data.length; i++)
{
var source = this.source[i];
@@ -24495,7 +36762,7 @@ module.exports = Texture;
/***/ }),
-/* 118 */
+/* 166 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -24505,12 +36772,12 @@ module.exports = Texture;
*/
var Class = __webpack_require__(0);
-var CONST = __webpack_require__(55);
-var DefaultPlugins = __webpack_require__(121);
-var GetPhysicsPlugins = __webpack_require__(518);
-var GetScenePlugins = __webpack_require__(517);
-var NOOP = __webpack_require__(3);
-var Settings = __webpack_require__(192);
+var CONST = __webpack_require__(116);
+var DefaultPlugins = __webpack_require__(167);
+var GetPhysicsPlugins = __webpack_require__(890);
+var GetScenePlugins = __webpack_require__(889);
+var NOOP = __webpack_require__(1);
+var Settings = __webpack_require__(326);
/**
* @classdesc
@@ -24521,7 +36788,7 @@ var Settings = __webpack_require__(192);
* handling the update step and renderer. It also contains references to global systems belonging to Game.
*
* @class Systems
- * @memberOf Phaser.Scenes
+ * @memberof Phaser.Scenes
* @constructor
* @since 3.0.0
*
@@ -24535,7 +36802,7 @@ var Systems = new Class({
function Systems (scene, config)
{
/**
- * [description]
+ * A reference to the Scene that these Systems belong to.
*
* @name Phaser.Scenes.Systems#scene
* @type {Phaser.Scene}
@@ -24544,7 +36811,7 @@ var Systems = new Class({
this.scene = scene;
/**
- * [description]
+ * A reference to the Phaser Game instance.
*
* @name Phaser.Scenes.Systems#game
* @type {Phaser.Game}
@@ -24552,8 +36819,11 @@ var Systems = new Class({
*/
this.game;
+ if (false)
+ {}
+
/**
- * [description]
+ * The Scene Configuration object, as passed in when creating the Scene.
*
* @name Phaser.Scenes.Systems#config
* @type {(string|Phaser.Scenes.Settings.Config)}
@@ -24562,7 +36832,7 @@ var Systems = new Class({
this.config = config;
/**
- * [description]
+ * The Scene Settings. This is the parsed output based on the Scene configuration.
*
* @name Phaser.Scenes.Systems#settings
* @type {Phaser.Scenes.Settings.Object}
@@ -24580,7 +36850,7 @@ var Systems = new Class({
this.canvas;
/**
- * [description]
+ * A reference to the Canvas Rendering Context being used by the renderer.
*
* @name Phaser.Scenes.Systems#context
* @type {CanvasRenderingContext2D}
@@ -24591,7 +36861,9 @@ var Systems = new Class({
// Global Systems - these are single-instance global managers that belong to Game
/**
- * [description]
+ * A reference to the global Animations Manager.
+ *
+ * In the default set-up you can access this from within a Scene via the `this.anims` property.
*
* @name Phaser.Scenes.Systems#anims
* @type {Phaser.Animations.AnimationManager}
@@ -24600,7 +36872,10 @@ var Systems = new Class({
this.anims;
/**
- * [description]
+ * A reference to the global Cache. The Cache stores all files bought in to Phaser via
+ * the Loader, with the exception of images. Images are stored in the Texture Manager.
+ *
+ * In the default set-up you can access this from within a Scene via the `this.cache` property.
*
* @name Phaser.Scenes.Systems#cache
* @type {Phaser.Cache.CacheManager}
@@ -24609,7 +36884,9 @@ var Systems = new Class({
this.cache;
/**
- * [description]
+ * A reference to the global Plugins Manager.
+ *
+ * In the default set-up you can access this from within a Scene via the `this.plugins` property.
*
* @name Phaser.Scenes.Systems#plugins
* @type {Phaser.Plugins.PluginManager}
@@ -24618,7 +36895,10 @@ var Systems = new Class({
this.plugins;
/**
- * [description]
+ * A reference to the global registry. This is a game-wide instance of the Data Manager, allowing
+ * you to exchange data between Scenes via a universal and shared point.
+ *
+ * In the default set-up you can access this from within a Scene via the `this.registry` property.
*
* @name Phaser.Scenes.Systems#registry
* @type {Phaser.Data.DataManager}
@@ -24627,7 +36907,9 @@ var Systems = new Class({
this.registry;
/**
- * [description]
+ * A reference to the global Sound Manager.
+ *
+ * In the default set-up you can access this from within a Scene via the `this.sound` property.
*
* @name Phaser.Scenes.Systems#sound
* @type {Phaser.Sound.BaseSoundManager}
@@ -24636,7 +36918,9 @@ var Systems = new Class({
this.sound;
/**
- * [description]
+ * A reference to the global Texture Manager.
+ *
+ * In the default set-up you can access this from within a Scene via the `this.textures` property.
*
* @name Phaser.Scenes.Systems#textures
* @type {Phaser.Textures.TextureManager}
@@ -24647,7 +36931,11 @@ var Systems = new Class({
// Core Plugins - these are non-optional Scene plugins, needed by lots of the other systems
/**
- * [description]
+ * A reference to the Scene's Game Object Factory.
+ *
+ * Use this to quickly and easily create new Game Object's.
+ *
+ * In the default set-up you can access this from within a Scene via the `this.add` property.
*
* @name Phaser.Scenes.Systems#add
* @type {Phaser.GameObjects.GameObjectFactory}
@@ -24656,7 +36944,11 @@ var Systems = new Class({
this.add;
/**
- * [description]
+ * A reference to the Scene's Camera Manager.
+ *
+ * Use this to manipulate and create Cameras for this specific Scene.
+ *
+ * In the default set-up you can access this from within a Scene via the `this.cameras` property.
*
* @name Phaser.Scenes.Systems#cameras
* @type {Phaser.Cameras.Scene2D.CameraManager}
@@ -24665,7 +36957,11 @@ var Systems = new Class({
this.cameras;
/**
- * [description]
+ * A reference to the Scene's Display List.
+ *
+ * Use this to organize the children contained in the display list.
+ *
+ * In the default set-up you can access this from within a Scene via the `this.children` property.
*
* @name Phaser.Scenes.Systems#displayList
* @type {Phaser.GameObjects.DisplayList}
@@ -24674,7 +36970,11 @@ var Systems = new Class({
this.displayList;
/**
- * [description]
+ * A reference to the Scene's Event Manager.
+ *
+ * Use this to listen for Scene specific events, such as `pause` and `shutdown`.
+ *
+ * In the default set-up you can access this from within a Scene via the `this.events` property.
*
* @name Phaser.Scenes.Systems#events
* @type {Phaser.Events.EventEmitter}
@@ -24683,7 +36983,13 @@ var Systems = new Class({
this.events;
/**
- * [description]
+ * A reference to the Scene's Game Object Creator.
+ *
+ * Use this to quickly and easily create new Game Object's. The difference between this and the
+ * Game Object Factory, is that the Creator just creates and returns Game Object instances, it
+ * doesn't then add them to the Display List or Update List.
+ *
+ * In the default set-up you can access this from within a Scene via the `this.make` property.
*
* @name Phaser.Scenes.Systems#make
* @type {Phaser.GameObjects.GameObjectCreator}
@@ -24692,7 +36998,12 @@ var Systems = new Class({
this.make;
/**
- * [description]
+ * A reference to the Scene Manager Plugin.
+ *
+ * Use this to manipulate both this and other Scene's in your game, for example to launch a parallel Scene,
+ * or pause or resume a Scene, or switch from this Scene to another.
+ *
+ * In the default set-up you can access this from within a Scene via the `this.scene` property.
*
* @name Phaser.Scenes.Systems#scenePlugin
* @type {Phaser.Scenes.ScenePlugin}
@@ -24701,7 +37012,14 @@ var Systems = new Class({
this.scenePlugin;
/**
- * [description]
+ * A reference to the Scene's Update List.
+ *
+ * Use this to organize the children contained in the update list.
+ *
+ * The Update List is responsible for managing children that need their `preUpdate` methods called,
+ * in order to process so internal components, such as Sprites with Animations.
+ *
+ * In the default set-up there is no reference to this from within the Scene itself.
*
* @name Phaser.Scenes.Systems#updateList
* @type {Phaser.GameObjects.UpdateList}
@@ -24711,7 +37029,7 @@ var Systems = new Class({
/**
* The Scene Update function.
- *
+ *
* This starts out as NOOP during init, preload and create, and at the end of create
* it swaps to be whatever the Scene.update function is.
*
@@ -24798,13 +37116,13 @@ var Systems = new Class({
},
/**
- * Called automatically by the Scene Manager. Instructs the Scene to render itself via
- * its Camera Manager to the renderer given.
+ * Called automatically by the Scene Manager.
+ * Instructs the Scene to render itself via its Camera Manager to the renderer given.
*
* @method Phaser.Scenes.Systems#render
* @since 3.0.0
*
- * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - [description]
+ * @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that invoked the render call.
*/
render: function (renderer)
{
@@ -24845,10 +37163,12 @@ var Systems = new Class({
*
* @method Phaser.Scenes.Systems#pause
* @since 3.0.0
+ *
+ * @param {object} [data] - A data object that will be passed in the 'pause' event.
*
* @return {Phaser.Scenes.Systems} This Systems object.
*/
- pause: function ()
+ pause: function (data)
{
if (this.settings.active)
{
@@ -24856,7 +37176,7 @@ var Systems = new Class({
this.settings.active = false;
- this.events.emit('pause', this);
+ this.events.emit('pause', this, data);
}
return this;
@@ -24868,9 +37188,11 @@ var Systems = new Class({
* @method Phaser.Scenes.Systems#resume
* @since 3.0.0
*
+ * @param {object} [data] - A data object that will be passed in the 'resume' event.
+ *
* @return {Phaser.Scenes.Systems} This Systems object.
*/
- resume: function ()
+ resume: function (data)
{
if (!this.settings.active)
{
@@ -24878,7 +37200,7 @@ var Systems = new Class({
this.settings.active = true;
- this.events.emit('resume', this);
+ this.events.emit('resume', this, data);
}
return this;
@@ -24894,17 +37216,19 @@ var Systems = new Class({
*
* @method Phaser.Scenes.Systems#sleep
* @since 3.0.0
+ *
+ * @param {object} [data] - A data object that will be passed in the 'sleep' event.
*
* @return {Phaser.Scenes.Systems} This Systems object.
*/
- sleep: function ()
+ sleep: function (data)
{
this.settings.status = CONST.SLEEPING;
this.settings.active = false;
this.settings.visible = false;
- this.events.emit('sleep', this);
+ this.events.emit('sleep', this, data);
return this;
},
@@ -24915,9 +37239,11 @@ var Systems = new Class({
* @method Phaser.Scenes.Systems#wake
* @since 3.0.0
*
+ * @param {object} [data] - A data object that will be passed in the 'wake' event.
+ *
* @return {Phaser.Scenes.Systems} This Systems object.
*/
- wake: function ()
+ wake: function (data)
{
var settings = this.settings;
@@ -24926,7 +37252,7 @@ var Systems = new Class({
settings.active = true;
settings.visible = true;
- this.events.emit('wake', this);
+ this.events.emit('wake', this, data);
if (settings.isTransition)
{
@@ -24942,7 +37268,7 @@ var Systems = new Class({
* @method Phaser.Scenes.Systems#isSleeping
* @since 3.0.0
*
- * @return {boolean} [description]
+ * @return {boolean} `true` if this Scene is asleep, otherwise `false`.
*/
isSleeping: function ()
{
@@ -24955,13 +37281,26 @@ var Systems = new Class({
* @method Phaser.Scenes.Systems#isActive
* @since 3.0.0
*
- * @return {boolean} [description]
+ * @return {boolean} `true` if this Scene is active, otherwise `false`.
*/
isActive: function ()
{
return (this.settings.status === CONST.RUNNING);
},
+ /**
+ * Is this Scene paused?
+ *
+ * @method Phaser.Scenes.Systems#isPaused
+ * @since 3.13.0
+ *
+ * @return {boolean} `true` if this Scene is paused, otherwise `false`.
+ */
+ isPaused: function ()
+ {
+ return (this.settings.status === CONST.PAUSED);
+ },
+
/**
* Is this Scene currently transitioning out to, or in from another Scene?
*
@@ -25007,7 +37346,7 @@ var Systems = new Class({
* @method Phaser.Scenes.Systems#isVisible
* @since 3.0.0
*
- * @return {boolean} [description]
+ * @return {boolean} `true` if this Scene is visible, otherwise `false`.
*/
isVisible: function ()
{
@@ -25021,7 +37360,7 @@ var Systems = new Class({
* @method Phaser.Scenes.Systems#setVisible
* @since 3.0.0
*
- * @param {boolean} value - [description]
+ * @param {boolean} value - `true` to render this Scene, otherwise `false`.
*
* @return {Phaser.Scenes.Systems} This Systems object.
*/
@@ -25034,24 +37373,26 @@ var Systems = new Class({
/**
* Set the active state of this Scene.
+ *
* An active Scene will run its core update loop.
*
* @method Phaser.Scenes.Systems#setActive
* @since 3.0.0
*
* @param {boolean} value - If `true` the Scene will be resumed, if previously paused. If `false` it will be paused.
+ * @param {object} [data] - A data object that will be passed in the 'resume' or 'pause' events.
*
* @return {Phaser.Scenes.Systems} This Systems object.
*/
- setActive: function (value)
+ setActive: function (value, data)
{
if (value)
{
- return this.resume();
+ return this.resume(data);
}
else
{
- return this.pause();
+ return this.pause(data);
}
},
@@ -25080,7 +37421,7 @@ var Systems = new Class({
this.events.emit('start', this);
// For user-land code to listen out for
- this.events.emit('ready', this);
+ this.events.emit('ready', this, data);
},
/**
@@ -25107,8 +37448,10 @@ var Systems = new Class({
*
* @method Phaser.Scenes.Systems#shutdown
* @since 3.0.0
+ *
+ * @param {object} [data] - A data object that will be passed in the 'shutdown' event.
*/
- shutdown: function ()
+ shutdown: function (data)
{
this.events.off('transitioninit');
this.events.off('transitionstart');
@@ -25120,7 +37463,7 @@ var Systems = new Class({
this.settings.active = false;
this.settings.visible = false;
- this.events.emit('shutdown', this);
+ this.events.emit('shutdown', this, data);
},
/**
@@ -25157,46 +37500,7 @@ module.exports = Systems;
/***/ }),
-/* 119 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * @namespace Phaser.GameObjects.Graphics.Commands
- */
-
-module.exports = {
-
- ARC: 0,
- BEGIN_PATH: 1,
- CLOSE_PATH: 2,
- FILL_RECT: 3,
- LINE_TO: 4,
- MOVE_TO: 5,
- LINE_STYLE: 6,
- FILL_STYLE: 7,
- FILL_PATH: 8,
- STROKE_PATH: 9,
- FILL_TRIANGLE: 10,
- STROKE_TRIANGLE: 11,
- LINE_FX_TO: 12,
- MOVE_FX_TO: 13,
- SAVE: 14,
- RESTORE: 15,
- TRANSLATE: 16,
- SCALE: 17,
- ROTATE: 18
-
-};
-
-
-/***/ }),
-/* 120 */
+/* 167 */
/***/ (function(module, exports, __webpack_require__) {
/**
@@ -25205,9 +37509,110 @@ module.exports = {
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var OS = __webpack_require__(57);
-var Browser = __webpack_require__(80);
-var CanvasPool = __webpack_require__(22);
+/**
+ * @typedef {object} Phaser.Plugins.DefaultPlugins
+ *
+ * @property {array} Global - These are the Global Managers that are created by the Phaser.Game instance.
+ * @property {array} CoreScene - These are the core plugins that are installed into every Scene.Systems instance, no matter what.
+ * @property {array} DefaultScene - These plugins are created in Scene.Systems in addition to the CoreScenePlugins.
+ */
+
+var DefaultPlugins = {
+
+ /**
+ * These are the Global Managers that are created by the Phaser.Game instance.
+ * They are referenced from Scene.Systems so that plugins can use them.
+ *
+ * @name Phaser.Plugins.Global
+ * @type {array}
+ * @since 3.0.0
+ */
+ Global: [
+
+ 'game',
+ 'anims',
+ 'cache',
+ 'plugins',
+ 'registry',
+ 'scale',
+ 'sound',
+ 'textures'
+
+ ],
+
+ /**
+ * These are the core plugins that are installed into every Scene.Systems instance, no matter what.
+ * They are optionally exposed in the Scene as well (see the InjectionMap for details)
+ *
+ * They are created in the order in which they appear in this array and EventEmitter is always first.
+ *
+ * @name Phaser.Plugins.CoreScene
+ * @type {array}
+ * @since 3.0.0
+ */
+ CoreScene: [
+
+ 'EventEmitter',
+
+ 'CameraManager',
+ 'GameObjectCreator',
+ 'GameObjectFactory',
+ 'ScenePlugin',
+ 'DisplayList',
+ 'UpdateList'
+
+ ],
+
+ /**
+ * These plugins are created in Scene.Systems in addition to the CoreScenePlugins.
+ *
+ * You can elect not to have these plugins by either creating a DefaultPlugins object as part
+ * of the Game Config, by creating a Plugins object as part of a Scene Config, or by modifying this array
+ * and building your own bundle.
+ *
+ * They are optionally exposed in the Scene as well (see the InjectionMap for details)
+ *
+ * They are always created in the order in which they appear in the array.
+ *
+ * @name Phaser.Plugins.DefaultScene
+ * @type {array}
+ * @since 3.0.0
+ */
+ DefaultScene: [
+
+ 'Clock',
+ 'DataManagerPlugin',
+ 'InputPlugin',
+ 'Loader',
+ 'TweenManager',
+ 'LightsPlugin'
+
+ ]
+
+};
+
+if (false)
+{}
+
+if (false)
+{}
+
+module.exports = DefaultPlugins;
+
+
+/***/ }),
+/* 168 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2018 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var OS = __webpack_require__(92);
+var Browser = __webpack_require__(118);
+var CanvasPool = __webpack_require__(24);
/**
* Determines the features of the browser running this Phaser Game instance.
@@ -25393,4811 +37798,7 @@ module.exports = init();
/***/ }),
-/* 121 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * @typedef {object} Phaser.Plugins.DefaultPlugins
- *
- * @property {array} Global - These are the Global Managers that are created by the Phaser.Game instance.
- * @property {array} CoreScene - These are the core plugins that are installed into every Scene.Systems instance, no matter what.
- * @property {array} DefaultScene - These plugins are created in Scene.Systems in addition to the CoreScenePlugins.
- */
-
-var DefaultPlugins = {
-
- /**
- * These are the Global Managers that are created by the Phaser.Game instance.
- * They are referenced from Scene.Systems so that plugins can use them.
- *
- * @name Phaser.Plugins.Global
- * @type {array}
- * @since 3.0.0
- */
- Global: [
-
- 'anims',
- 'cache',
- 'plugins',
- 'registry',
- 'sound',
- 'textures'
-
- ],
-
- /**
- * These are the core plugins that are installed into every Scene.Systems instance, no matter what.
- * They are optionally exposed in the Scene as well (see the InjectionMap for details)
- *
- * They are created in the order in which they appear in this array and EventEmitter is always first.
- *
- * @name Phaser.Plugins.CoreScene
- * @type {array}
- * @since 3.0.0
- */
- CoreScene: [
-
- 'EventEmitter',
-
- 'CameraManager',
- 'GameObjectCreator',
- 'GameObjectFactory',
- 'ScenePlugin',
- 'DisplayList',
- 'UpdateList'
-
- ],
-
- /**
- * These plugins are created in Scene.Systems in addition to the CoreScenePlugins.
- *
- * You can elect not to have these plugins by either creating a DefaultPlugins object as part
- * of the Game Config, by creating a Plugins object as part of a Scene Config, or by modifying this array
- * and building your own bundle.
- *
- * They are optionally exposed in the Scene as well (see the InjectionMap for details)
- *
- * They are always created in the order in which they appear in the array.
- *
- * @name Phaser.Plugins.DefaultScene
- * @type {array}
- * @since 3.0.0
- */
- DefaultScene: [
-
- 'CameraManager3D',
- 'Clock',
- 'DataManagerPlugin',
- 'InputPlugin',
- 'Loader',
- 'TweenManager',
- 'LightsPlugin'
-
- ]
-
-};
-
-module.exports = DefaultPlugins;
-
-
-/***/ }),
-/* 122 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Calculates a linear (interpolation) value over t.
- *
- * @function Phaser.Math.Linear
- * @since 3.0.0
- *
- * @param {number} p0 - The first point.
- * @param {number} p1 - The second point.
- * @param {float} t - The percentage between p0 and p1 to return, represented as a number between 0 and 1.
- *
- * @return {number} The step t% of the way between p0 and p1.
- */
-var Linear = function (p0, p1, t)
-{
- return (p1 - p0) * t + p0;
-};
-
-module.exports = Linear;
-
-
-/***/ }),
-/* 123 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Clamp = __webpack_require__(23);
-var Class = __webpack_require__(0);
-var DegToRad = __webpack_require__(38);
-var Effects = __webpack_require__(204);
-var EventEmitter = __webpack_require__(9);
-var Linear = __webpack_require__(122);
-var Rectangle = __webpack_require__(14);
-var TransformMatrix = __webpack_require__(64);
-var ValueToColor = __webpack_require__(132);
-var Vector2 = __webpack_require__(6);
-
-/**
- * @typedef {object} JSONCameraBounds
- * @property {number} x - The horizontal position of camera
- * @property {number} y - The vertical position of camera
- * @property {number} width - The width size of camera
- * @property {number} height - The height size of camera
- */
-
-/**
- * @typedef {object} JSONCamera
- *
- * @property {string} name - The name of the camera
- * @property {number} x - The horizontal position of camera
- * @property {number} y - The vertical position of camera
- * @property {number} width - The width size of camera
- * @property {number} height - The height size of camera
- * @property {number} zoom - The zoom of camera
- * @property {number} rotation - The rotation of camera
- * @property {boolean} roundPixels - The round pixels st status of camera
- * @property {number} scrollX - The horizontal scroll of camera
- * @property {number} scrollY - The vertical scroll of camera
- * @property {string} backgroundColor - The background color of camera
- * @property {(JSONCameraBounds|undefined)} [bounds] - The bounds of camera
- */
-
-/**
- * @classdesc
- * A Camera.
- *
- * The Camera is the way in which all games are rendered in Phaser. They provide a view into your game world,
- * and can be positioned, rotated, zoomed and scrolled accordingly.
- *
- * A Camera consists of two elements: The viewport and the scroll values.
- *
- * The viewport is the physical position and size of the Camera within your game. Cameras, by default, are
- * created the same size as your game, but their position and size can be set to anything. This means if you
- * wanted to create a camera that was 320x200 in size, positioned in the bottom-right corner of your game,
- * you'd adjust the viewport to do that (using methods like `setViewport` and `setSize`).
- *
- * If you wish to change where the Camera is looking in your game, then you scroll it. You can do this
- * via the properties `scrollX` and `scrollY` or the method `setScroll`. Scrolling has no impact on the
- * viewport, and changing the viewport has no impact on the scrolling.
- *
- * By default a Camera will render all Game Objects it can see. You can change this using the `ignore` method,
- * allowing you to filter Game Objects out on a per-Camera basis.
- *
- * A Camera also has built-in special effects including Fade, Flash and Camera Shake.
- *
- * @class Camera
- * @extends Phaser.Events.EventEmitter
- * @memberOf Phaser.Cameras.Scene2D
- * @constructor
- * @since 3.0.0
- *
- * @param {number} x - The x position of the Camera, relative to the top-left of the game canvas.
- * @param {number} y - The y position of the Camera, relative to the top-left of the game canvas.
- * @param {number} width - The width of the Camera, in pixels.
- * @param {number} height - The height of the Camera, in pixels.
- */
-var Camera = new Class({
-
- Extends: EventEmitter,
-
- initialize:
-
- function Camera (x, y, width, height)
- {
- EventEmitter.call(this);
-
- /**
- * A reference to the Scene this camera belongs to.
- *
- * @name Phaser.Cameras.Scene2D.Camera#scene
- * @type {Phaser.Scene}
- * @since 3.0.0
- */
- this.scene;
-
- /**
- * The name of the Camera. This is left empty for your own use.
- *
- * @name Phaser.Cameras.Scene2D.Camera#name
- * @type {string}
- * @default ''
- * @since 3.0.0
- */
- this.name = '';
-
- /**
- * The x position of the Camera, relative to the top-left of the game canvas.
- *
- * @name Phaser.Cameras.Scene2D.Camera#x
- * @type {number}
- * @since 3.0.0
- */
- this.x = x;
-
- /**
- * The y position of the Camera, relative to the top-left of the game canvas.
- *
- * @name Phaser.Cameras.Scene2D.Camera#y
- * @type {number}
- * @since 3.0.0
- */
- this.y = y;
-
- /**
- * The width of the Camera, in pixels.
- *
- * @name Phaser.Cameras.Scene2D.Camera#width
- * @type {number}
- * @since 3.0.0
- */
- this.width = width;
-
- /**
- * The height of the Camera, in pixels.
- *
- * @name Phaser.Cameras.Scene2D.Camera#height
- * @type {number}
- * @since 3.0.0
- */
- this.height = height;
-
- /**
- * Should this camera round its pixel values to integers?
- *
- * @name Phaser.Cameras.Scene2D.Camera#roundPixels
- * @type {boolean}
- * @default false
- * @since 3.0.0
- */
- this.roundPixels = false;
-
- /**
- * Is this Camera visible or not?
- *
- * A visible camera will render and perform input tests.
- * An invisible camera will not render anything and will skip input tests.
- *
- * @name Phaser.Cameras.Scene2D.Camera#visible
- * @type {boolean}
- * @default true
- * @since 3.10.0
- */
- this.visible = true;
-
- /**
- * Is this Camera using a bounds to restrict scrolling movement?
- * Set this property along with the bounds via `Camera.setBounds`.
- *
- * @name Phaser.Cameras.Scene2D.Camera#useBounds
- * @type {boolean}
- * @default false
- * @since 3.0.0
- */
- this.useBounds = false;
-
- /**
- * The bounds the camera is restrained to during scrolling.
- *
- * @name Phaser.Cameras.Scene2D.Camera#_bounds
- * @type {Phaser.Geom.Rectangle}
- * @private
- * @since 3.0.0
- */
- this._bounds = new Rectangle();
-
- /**
- * Does this Camera allow the Game Objects it renders to receive input events?
- *
- * @name Phaser.Cameras.Scene2D.Camera#inputEnabled
- * @type {boolean}
- * @default true
- * @since 3.0.0
- */
- this.inputEnabled = true;
-
- /**
- * The horizontal scroll position of this camera.
- * Optionally restricted via the Camera bounds.
- *
- * @name Phaser.Cameras.Scene2D.Camera#scrollX
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.scrollX = 0;
-
- /**
- * The vertical scroll position of this camera.
- * Optionally restricted via the Camera bounds.
- *
- * @name Phaser.Cameras.Scene2D.Camera#scrollY
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.scrollY = 0;
-
- /**
- * The Camera zoom value. Change this value to zoom in, or out of, a Scene.
- * Set to 1 to return to the default zoom level.
- *
- * @name Phaser.Cameras.Scene2D.Camera#zoom
- * @type {float}
- * @default 1
- * @since 3.0.0
- */
- this.zoom = 1;
-
- /**
- * The rotation of the Camera. This influences the rendering of all Game Objects visible by this camera.
- *
- * @name Phaser.Cameras.Scene2D.Camera#rotation
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.rotation = 0;
-
- /**
- * A local transform matrix used for internal calculations.
- *
- * @name Phaser.Cameras.Scene2D.Camera#matrix
- * @type {Phaser.GameObjects.Components.TransformMatrix}
- * @since 3.0.0
- */
- this.matrix = new TransformMatrix(1, 0, 0, 1, 0, 0);
-
- /**
- * Does this Camera have a transparent background?
- *
- * @name Phaser.Cameras.Scene2D.Camera#transparent
- * @type {boolean}
- * @default true
- * @since 3.0.0
- */
- this.transparent = true;
-
- /**
- * The background color of this Camera. Only used if `transparent` is `false`.
- *
- * @name Phaser.Cameras.Scene2D.Camera#backgroundColor
- * @type {Phaser.Display.Color}
- * @since 3.0.0
- */
- this.backgroundColor = ValueToColor('rgba(0,0,0,0)');
-
- /**
- * The Camera Fade effect handler.
- * To fade this camera see the `Camera.fade` methods.
- *
- * @name Phaser.Cameras.Scene2D.Camera#fadeEffect
- * @type {Phaser.Cameras.Scene2D.Effects.Fade}
- * @since 3.5.0
- */
- this.fadeEffect = new Effects.Fade(this);
-
- /**
- * The Camera Flash effect handler.
- * To flash this camera see the `Camera.flash` method.
- *
- * @name Phaser.Cameras.Scene2D.Camera#flashEffect
- * @type {Phaser.Cameras.Scene2D.Effects.Flash}
- * @since 3.5.0
- */
- this.flashEffect = new Effects.Flash(this);
-
- /**
- * The Camera Shake effect handler.
- * To shake this camera see the `Camera.shake` method.
- *
- * @name Phaser.Cameras.Scene2D.Camera#shakeEffect
- * @type {Phaser.Cameras.Scene2D.Effects.Shake}
- * @since 3.5.0
- */
- this.shakeEffect = new Effects.Shake(this);
-
- /**
- * Should the camera cull Game Objects before checking them for input hit tests?
- * In some special cases it may be beneficial to disable this.
- *
- * @name Phaser.Cameras.Scene2D.Camera#disableCull
- * @type {boolean}
- * @default false
- * @since 3.0.0
- */
- this.disableCull = false;
-
- /**
- * A temporary array of culled objects.
- *
- * @name Phaser.Cameras.Scene2D.Camera#culledObjects
- * @type {Phaser.GameObjects.GameObject[]}
- * @default []
- * @since 3.0.0
- */
- this.culledObjects = [];
-
- /**
- * The linear interpolation value to use when following a target.
- *
- * Can also be set via `setLerp` or as part of the `startFollow` call.
- *
- * The default values of 1 means the camera will instantly snap to the target coordinates.
- * A lower value, such as 0.1 means the camera will more slowly track the target, giving
- * a smooth transition. You can set the horizontal and vertical values independently, and also
- * adjust this value in real-time during your game.
- *
- * Be sure to keep the value between 0 and 1. A value of zero will disable tracking on that axis.
- *
- * @name Phaser.Cameras.Scene2D.Camera#lerp
- * @type {Phaser.Math.Vector2}
- * @since 3.9.0
- */
- this.lerp = new Vector2(1, 1);
-
- /**
- * The values stored in this property are subtracted from the Camera targets position, allowing you to
- * offset the camera from the actual target x/y coordinates by this amount.
- * Can also be set via `setFollowOffset` or as part of the `startFollow` call.
- *
- * @name Phaser.Cameras.Scene2D.Camera#followOffset
- * @type {Phaser.Math.Vector2}
- * @since 3.9.0
- */
- this.followOffset = new Vector2();
-
- /**
- * Internal follow target reference.
- *
- * @name Phaser.Cameras.Scene2D.Camera#_follow
- * @type {?any}
- * @private
- * @default null
- * @since 3.0.0
- */
- this._follow = null;
-
- /**
- * Internal camera ID. Assigned by the Camera Manager and used in the camera pool.
- *
- * @name Phaser.Cameras.Scene2D.Camera#_id
- * @type {integer}
- * @private
- * @default 0
- * @since 3.0.0
- */
- this._id = 0;
- },
-
- /**
- * Scrolls the Camera so that it is looking at the center of the Camera Bounds (if previously enabled)
- *
- * @method Phaser.Cameras.Scene2D.Camera#centerToBounds
- * @since 3.0.0
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- centerToBounds: function ()
- {
- if (this.useBounds)
- {
- this.scrollX = (this._bounds.width * 0.5) - (this.width * 0.5);
- this.scrollY = (this._bounds.height * 0.5) - (this.height * 0.5);
- }
-
- return this;
- },
-
- /**
- * Scrolls the Camera so that it is re-centered based on its viewport size.
- *
- * @method Phaser.Cameras.Scene2D.Camera#centerToSize
- * @since 3.0.0
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- centerToSize: function ()
- {
- this.scrollX = this.width * 0.5;
- this.scrollY = this.height * 0.5;
-
- return this;
- },
-
- /**
- * Takes an array of Game Objects and returns a new array featuring only those objects
- * visible by this camera.
- *
- * @method Phaser.Cameras.Scene2D.Camera#cull
- * @since 3.0.0
- *
- * @generic {Phaser.GameObjects.GameObject[]} G - [renderableObjects,$return]
- *
- * @param {Phaser.GameObjects.GameObject[]} renderableObjects - An array of Game Objects to cull.
- *
- * @return {Phaser.GameObjects.GameObject[]} An array of Game Objects visible to this Camera.
- */
- cull: function (renderableObjects)
- {
- if (this.disableCull)
- {
- return renderableObjects;
- }
-
- var cameraMatrix = this.matrix.matrix;
-
- var mva = cameraMatrix[0];
- var mvb = cameraMatrix[1];
- var mvc = cameraMatrix[2];
- var mvd = cameraMatrix[3];
-
- /* First Invert Matrix */
- var determinant = (mva * mvd) - (mvb * mvc);
-
- if (!determinant)
- {
- return renderableObjects;
- }
-
- var mve = cameraMatrix[4];
- var mvf = cameraMatrix[5];
-
- var scrollX = this.scrollX;
- var scrollY = this.scrollY;
- var cameraW = this.width;
- var cameraH = this.height;
- var culledObjects = this.culledObjects;
- var length = renderableObjects.length;
-
- determinant = 1 / determinant;
-
- culledObjects.length = 0;
-
- for (var index = 0; index < length; ++index)
- {
- var object = renderableObjects[index];
-
- if (!object.hasOwnProperty('width') || object.parentContainer)
- {
- culledObjects.push(object);
- continue;
- }
-
- var objectW = object.width;
- var objectH = object.height;
- var objectX = (object.x - (scrollX * object.scrollFactorX)) - (objectW * object.originX);
- var objectY = (object.y - (scrollY * object.scrollFactorY)) - (objectH * object.originY);
- var tx = (objectX * mva + objectY * mvc + mve);
- var ty = (objectX * mvb + objectY * mvd + mvf);
- var tw = ((objectX + objectW) * mva + (objectY + objectH) * mvc + mve);
- var th = ((objectX + objectW) * mvb + (objectY + objectH) * mvd + mvf);
- var cullW = cameraW + objectW;
- var cullH = cameraH + objectH;
-
- if (tx > -objectW && ty > -objectH && tx < cullW && ty < cullH &&
- tw > -objectW && th > -objectH && tw < cullW && th < cullH)
- {
- culledObjects.push(object);
- }
- }
-
- return culledObjects;
- },
-
- /**
- * Fades the Camera in from the given color over the duration specified.
- *
- * @method Phaser.Cameras.Scene2D.Camera#fadeIn
- * @since 3.3.0
- *
- * @param {integer} [duration=1000] - The duration of the effect in milliseconds.
- * @param {integer} [red=0] - The amount to fade the red channel towards. A value between 0 and 255.
- * @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255.
- * @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255.
- * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect.
- * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is.
- * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- fadeIn: function (duration, red, green, blue, callback, context)
- {
- return this.fadeEffect.start(false, duration, red, green, blue, true, callback, context);
- },
-
- /**
- * Fades the Camera out to the given color over the duration specified.
- * This is an alias for Camera.fade that forces the fade to start, regardless of existing fades.
- *
- * @method Phaser.Cameras.Scene2D.Camera#fadeOut
- * @since 3.3.0
- *
- * @param {integer} [duration=1000] - The duration of the effect in milliseconds.
- * @param {integer} [red=0] - The amount to fade the red channel towards. A value between 0 and 255.
- * @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255.
- * @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255.
- * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect.
- * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is.
- * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- fadeOut: function (duration, red, green, blue, callback, context)
- {
- return this.fadeEffect.start(true, duration, red, green, blue, true, callback, context);
- },
-
- /**
- * Fades the Camera from the given color to transparent over the duration specified.
- *
- * @method Phaser.Cameras.Scene2D.Camera#fadeFrom
- * @since 3.5.0
- *
- * @param {integer} [duration=1000] - The duration of the effect in milliseconds.
- * @param {integer} [red=0] - The amount to fade the red channel towards. A value between 0 and 255.
- * @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255.
- * @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255.
- * @param {boolean} [force=false] - Force the effect to start immediately, even if already running.
- * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect.
- * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is.
- * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- fadeFrom: function (duration, red, green, blue, force, callback, context)
- {
- return this.fadeEffect.start(false, duration, red, green, blue, force, callback, context);
- },
-
- /**
- * Fades the Camera from transparent to the given color over the duration specified.
- *
- * @method Phaser.Cameras.Scene2D.Camera#fade
- * @since 3.0.0
- *
- * @param {integer} [duration=1000] - The duration of the effect in milliseconds.
- * @param {integer} [red=0] - The amount to fade the red channel towards. A value between 0 and 255.
- * @param {integer} [green=0] - The amount to fade the green channel towards. A value between 0 and 255.
- * @param {integer} [blue=0] - The amount to fade the blue channel towards. A value between 0 and 255.
- * @param {boolean} [force=false] - Force the effect to start immediately, even if already running.
- * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect.
- * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is.
- * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- fade: function (duration, red, green, blue, force, callback, context)
- {
- return this.fadeEffect.start(true, duration, red, green, blue, force, callback, context);
- },
-
- /**
- * Flashes the Camera by setting it to the given color immediately and then fading it away again quickly over the duration specified.
- *
- * @method Phaser.Cameras.Scene2D.Camera#flash
- * @since 3.0.0
- *
- * @param {integer} [duration=250] - The duration of the effect in milliseconds.
- * @param {integer} [red=255] - The amount to fade the red channel towards. A value between 0 and 255.
- * @param {integer} [green=255] - The amount to fade the green channel towards. A value between 0 and 255.
- * @param {integer} [blue=255] - The amount to fade the blue channel towards. A value between 0 and 255.
- * @param {boolean} [force=false] - Force the effect to start immediately, even if already running.
- * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect.
- * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is.
- * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- flash: function (duration, red, green, blue, force, callback, context)
- {
- return this.flashEffect.start(duration, red, green, blue, force, callback, context);
- },
-
- /**
- * Shakes the Camera by the given intensity over the duration specified.
- *
- * @method Phaser.Cameras.Scene2D.Camera#shake
- * @since 3.0.0
- *
- * @param {integer} [duration=100] - The duration of the effect in milliseconds.
- * @param {number} [intensity=0.05] - The intensity of the shake.
- * @param {boolean} [force=false] - Force the shake effect to start immediately, even if already running.
- * @param {function} [callback] - This callback will be invoked every frame for the duration of the effect.
- * It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is.
- * @param {any} [context] - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- shake: function (duration, intensity, force, callback, context)
- {
- return this.shakeEffect.start(duration, intensity, force, callback, context);
- },
-
- /**
- * Converts the given `x` and `y` coordinates into World space, based on this Cameras transform.
- * You can optionally provide a Vector2, or similar object, to store the results in.
- *
- * @method Phaser.Cameras.Scene2D.Camera#getWorldPoint
- * @since 3.0.0
- *
- * @generic {Phaser.Math.Vector2} O - [output,$return]
- *
- * @param {number} x - The x position to convert to world space.
- * @param {number} y - The y position to convert to world space.
- * @param {(object|Phaser.Math.Vector2)} [output] - An optional object to store the results in. If not provided a new Vector2 will be created.
- *
- * @return {Phaser.Math.Vector2} An object holding the converted values in its `x` and `y` properties.
- */
- getWorldPoint: function (x, y, output)
- {
- if (output === undefined) { output = new Vector2(); }
-
- var cameraMatrix = this.matrix.matrix;
-
- var mva = cameraMatrix[0];
- var mvb = cameraMatrix[1];
- var mvc = cameraMatrix[2];
- var mvd = cameraMatrix[3];
- var mve = cameraMatrix[4];
- var mvf = cameraMatrix[5];
-
- /* First Invert Matrix */
- var determinant = (mva * mvd) - (mvb * mvc);
-
- if (!determinant)
- {
- output.x = x;
- output.y = y;
-
- return output;
- }
-
- determinant = 1 / determinant;
-
- var ima = mvd * determinant;
- var imb = -mvb * determinant;
- var imc = -mvc * determinant;
- var imd = mva * determinant;
- var ime = (mvc * mvf - mvd * mve) * determinant;
- var imf = (mvb * mve - mva * mvf) * determinant;
-
- var c = Math.cos(this.rotation);
- var s = Math.sin(this.rotation);
-
- var zoom = this.zoom;
-
- var scrollX = this.scrollX;
- var scrollY = this.scrollY;
-
- var sx = x + ((scrollX * c - scrollY * s) * zoom);
- var sy = y + ((scrollX * s + scrollY * c) * zoom);
-
- /* Apply transform to point */
- output.x = (sx * ima + sy * imc + ime);
- output.y = (sx * imb + sy * imd + imf);
-
- return output;
- },
-
- /**
- * Given a Game Object, or an array of Game Objects, it will update all of their camera filter settings
- * so that they are ignored by this Camera. This means they will not be rendered by this Camera.
- *
- * @method Phaser.Cameras.Scene2D.Camera#ignore
- * @since 3.0.0
- *
- * @param {(Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[])} gameObject - The Game Object, or array of Game Objects, to be ignored by this Camera.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- ignore: function (gameObject)
- {
- var id = this._id;
-
- if (Array.isArray(gameObject))
- {
- for (var i = 0; i < gameObject.length; i++)
- {
- gameObject[i].cameraFilter |= id;
- }
- }
- else
- {
- gameObject.cameraFilter |= id;
- }
-
- return this;
- },
-
- /**
- * Internal preRender step.
- *
- * @method Phaser.Cameras.Scene2D.Camera#preRender
- * @protected
- * @since 3.0.0
- *
- * @param {number} baseScale - The base scale, as set in the Camera Manager.
- * @param {number} resolution - The game resolution.
- */
- preRender: function (baseScale, resolution)
- {
- var width = this.width;
- var height = this.height;
- var zoom = this.zoom * baseScale;
- var matrix = this.matrix;
- var originX = width / 2;
- var originY = height / 2;
- var follow = this._follow;
-
- if (follow)
- {
- this.scrollX = Linear(this.scrollX, (follow.x - this.followOffset.x) - originX, this.lerp.x) / zoom;
- this.scrollY = Linear(this.scrollY, (follow.y - this.followOffset.y) - originY, this.lerp.y) / zoom;
- }
-
- if (this.useBounds)
- {
- var bounds = this._bounds;
-
- var bw = Math.max(0, bounds.right - width);
- var bh = Math.max(0, bounds.bottom - height);
-
- if (this.scrollX < bounds.x)
- {
- this.scrollX = bounds.x;
- }
- else if (this.scrollX > bw)
- {
- this.scrollX = bw;
- }
-
- if (this.scrollY < bounds.y)
- {
- this.scrollY = bounds.y;
- }
- else if (this.scrollY > bh)
- {
- this.scrollY = bh;
- }
- }
-
- if (this.roundPixels)
- {
- this.scrollX = Math.round(this.scrollX);
- this.scrollY = Math.round(this.scrollY);
- }
-
- matrix.loadIdentity();
- matrix.scale(resolution, resolution);
- matrix.translate(this.x + originX, this.y + originY);
- matrix.rotate(this.rotation);
- matrix.scale(zoom, zoom);
- matrix.translate(-originX, -originY);
-
- this.shakeEffect.preRender();
- },
-
- /**
- * If this Camera has previously had movement bounds set on it, this will remove them.
- *
- * @method Phaser.Cameras.Scene2D.Camera#removeBounds
- * @since 3.0.0
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- removeBounds: function ()
- {
- this.useBounds = false;
-
- this._bounds.setEmpty();
-
- return this;
- },
-
- /**
- * Set the rotation of this Camera. This causes everything it renders to appear rotated.
- *
- * Rotating a camera does not rotate the viewport itself, it is applied during rendering.
- *
- * @method Phaser.Cameras.Scene2D.Camera#setAngle
- * @since 3.0.0
- *
- * @param {number} [value=0] - The cameras angle of rotation, given in degrees.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- setAngle: function (value)
- {
- if (value === undefined) { value = 0; }
-
- this.rotation = DegToRad(value);
-
- return this;
- },
-
- /**
- * Sets the linear interpolation value to use when following a target.
- *
- * The default values of 1 means the camera will instantly snap to the target coordinates.
- * A lower value, such as 0.1 means the camera will more slowly track the target, giving
- * a smooth transition. You can set the horizontal and vertical values independently, and also
- * adjust this value in real-time during your game.
- *
- * Be sure to keep the value between 0 and 1. A value of zero will disable tracking on that axis.
- *
- * @method Phaser.Cameras.Scene2D.Camera#setLerp
- * @since 3.9.0
- *
- * @param {number} [x=1] - The amount added to the horizontal linear interpolation of the follow target.
- * @param {number} [y=1] - The amount added to the vertical linear interpolation of the follow target.
- *
- * @return {this} This Camera instance.
- */
- setLerp: function (x, y)
- {
- if (x === undefined) { x = 1; }
- if (y === undefined) { y = x; }
-
- this.lerp.set(x, y);
-
- return this;
- },
-
- /**
- * Sets the horizontal and vertical offset of the camera from its follow target.
- * The values are subtracted from the targets position during the Cameras update step.
- *
- * @method Phaser.Cameras.Scene2D.Camera#setFollowOffset
- * @since 3.9.0
- *
- * @param {number} [x=0] - The horizontal offset from the camera follow target.x position.
- * @param {number} [y=0] - The vertical offset from the camera follow target.y position.
- *
- * @return {this} This Camera instance.
- */
- setFollowOffset: function (x, y)
- {
- if (x === undefined) { x = 0; }
- if (y === undefined) { y = 0; }
-
- this.followOffset.set(x, y);
-
- return this;
- },
-
- /**
- * Sets the background color for this Camera.
- *
- * By default a Camera has a transparent background but it can be given a solid color, with any level
- * of transparency, via this method.
- *
- * The color value can be specified using CSS color notation, hex or numbers.
- *
- * @method Phaser.Cameras.Scene2D.Camera#setBackgroundColor
- * @since 3.0.0
- *
- * @param {(string|number|InputColorObject)} [color='rgba(0,0,0,0)'] - The color value. In CSS, hex or numeric color notation.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- setBackgroundColor: function (color)
- {
- if (color === undefined) { color = 'rgba(0,0,0,0)'; }
-
- this.backgroundColor = ValueToColor(color);
-
- this.transparent = (this.backgroundColor.alpha === 0);
-
- return this;
- },
-
- /**
- * Set the world bounds for this Camera.
- *
- * A Camera bounds controls where the camera can scroll to within the world. It does not limit
- * rendering of the camera, or placement of the viewport within your game.
- *
- * @method Phaser.Cameras.Scene2D.Camera#setBounds
- * @since 3.0.0
- *
- * @param {integer} x - The top-left x coordinate of the bounds.
- * @param {integer} y - The top-left y coordinate of the bounds.
- * @param {integer} width - The width of the bounds, in pixels.
- * @param {integer} height - The height of the bounds, in pixels.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- setBounds: function (x, y, width, height)
- {
- this._bounds.setTo(x, y, width, height);
-
- this.useBounds = true;
-
- return this;
- },
-
- /**
- * Sets the name of this Camera.
- * This value is for your own use and isn't used internally.
- *
- * @method Phaser.Cameras.Scene2D.Camera#setName
- * @since 3.0.0
- *
- * @param {string} [value=''] - The name of the Camera.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- setName: function (value)
- {
- if (value === undefined) { value = ''; }
-
- this.name = value;
-
- return this;
- },
-
- /**
- * Set the position of the Camera viewport within the game.
- *
- * This does not change where the camera is 'looking'. See `setScroll` to control that.
- *
- * @method Phaser.Cameras.Scene2D.Camera#setPosition
- * @since 3.0.0
- *
- * @param {number} x - The top-left x coordinate of the Camera viewport.
- * @param {number} [y=x] - The top-left y coordinate of the Camera viewport.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- setPosition: function (x, y)
- {
- if (y === undefined) { y = x; }
-
- this.x = x;
- this.y = y;
-
- return this;
- },
-
- /**
- * Set the rotation of this Camera. This causes everything it renders to appear rotated.
- *
- * Rotating a camera does not rotate the viewport itself, it is applied during rendering.
- *
- * @method Phaser.Cameras.Scene2D.Camera#setRotation
- * @since 3.0.0
- *
- * @param {number} [value=0] - The rotation of the Camera, in radians.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- setRotation: function (value)
- {
- if (value === undefined) { value = 0; }
-
- this.rotation = value;
-
- return this;
- },
-
- /**
- * Should the Camera round pixel values to whole integers when scrolling?
- * In some types of game this is required to prevent sub-pixel aliasing.
- *
- * @method Phaser.Cameras.Scene2D.Camera#setRoundPixels
- * @since 3.0.0
- *
- * @param {boolean} value - `true` to round Camera pixels, `false` to not.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- setRoundPixels: function (value)
- {
- this.roundPixels = value;
-
- return this;
- },
-
- /**
- * Sets the Scene the Camera is bound to.
- *
- * @method Phaser.Cameras.Scene2D.Camera#setScene
- * @since 3.0.0
- *
- * @param {Phaser.Scene} scene - The Scene the camera is bound to.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- setScene: function (scene)
- {
- this.scene = scene;
-
- return this;
- },
-
- /**
- * Set the position of where the Camera is looking within the game.
- * You can also modify the properties `Camera.scrollX` and `Camera.scrollY` directly.
- * Use this method, or the scroll properties, to move your camera around the game world.
- *
- * This does not change where the camera viewport is placed. See `setPosition` to control that.
- *
- * @method Phaser.Cameras.Scene2D.Camera#setScroll
- * @since 3.0.0
- *
- * @param {number} x - The x coordinate of the Camera in the game world.
- * @param {number} [y=x] - The y coordinate of the Camera in the game world.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- setScroll: function (x, y)
- {
- if (y === undefined) { y = x; }
-
- this.scrollX = x;
- this.scrollY = y;
-
- return this;
- },
-
- /**
- * Set the size of the Camera viewport.
- *
- * By default a Camera is the same size as the game, but can be made smaller via this method,
- * allowing you to create mini-cam style effects by creating and positioning a smaller Camera
- * viewport within your game.
- *
- * @method Phaser.Cameras.Scene2D.Camera#setSize
- * @since 3.0.0
- *
- * @param {integer} width - The width of the Camera viewport.
- * @param {integer} [height=width] - The height of the Camera viewport.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- setSize: function (width, height)
- {
- if (height === undefined) { height = width; }
-
- this.width = width;
- this.height = height;
-
- return this;
- },
-
- /**
- * This method sets the position and size of the Camera viewport in a single call.
- *
- * If you're trying to change where the Camera is looking at in your game, then see
- * the method `Camera.setScroll` instead. This method is for changing the viewport
- * itself, not what the camera can see.
- *
- * By default a Camera is the same size as the game, but can be made smaller via this method,
- * allowing you to create mini-cam style effects by creating and positioning a smaller Camera
- * viewport within your game.
- *
- * @method Phaser.Cameras.Scene2D.Camera#setViewport
- * @since 3.0.0
- *
- * @param {number} x - The top-left x coordinate of the Camera viewport.
- * @param {number} y - The top-left y coordinate of the Camera viewport.
- * @param {integer} width - The width of the Camera viewport.
- * @param {integer} [height=width] - The height of the Camera viewport.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- setViewport: function (x, y, width, height)
- {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
-
- return this;
- },
-
- /**
- * Set the zoom value of the Camera.
- *
- * Changing to a smaller value, such as 0.5, will cause the camera to 'zoom out'.
- * Changing to a larger value, such as 2, will cause the camera to 'zoom in'.
- *
- * A value of 1 means 'no zoom' and is the default.
- *
- * Changing the zoom does not impact the Camera viewport in any way, it is only applied during rendering.
- *
- * @method Phaser.Cameras.Scene2D.Camera#setZoom
- * @since 3.0.0
- *
- * @param {float} [value=1] - The zoom value of the Camera.
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- setZoom: function (value)
- {
- if (value === undefined) { value = 1; }
-
- this.zoom = value;
-
- return this;
- },
-
- /**
- * Sets the visibility of this Camera.
- *
- * An invisible Camera will skip rendering and input tests of everything it can see.
- *
- * @method Phaser.Cameras.Scene2D.Camera#setVisible
- * @since 3.10.0
- *
- * @param {boolean} value - The visible state of the Camera.
- *
- * @return {this} This Camera instance.
- */
- setVisible: function (value)
- {
- this.visible = value;
-
- return this;
- },
-
- /**
- * Sets the Camera to follow a Game Object.
- *
- * When enabled the Camera will automatically adjust its scroll position to keep the target Game Object
- * in its center.
- *
- * You can set the linear interpolation value used in the follow code.
- * Use low lerp values (such as 0.1) to automatically smooth the camera motion.
- *
- * If you find you're getting a slight "jitter" effect when following an object it's probably to do with sub-pixel
- * rendering of the targets position. This can be rounded by setting the `roundPixels` argument to `true` to
- * force full pixel rounding rendering. Note that this can still be broken if you have specified a non-integer zoom
- * value on the camera. So be sure to keep the camera zoom to integers.
- *
- * @method Phaser.Cameras.Scene2D.Camera#startFollow
- * @since 3.0.0
- *
- * @param {(Phaser.GameObjects.GameObject|object)} target - The target for the Camera to follow.
- * @param {boolean} [roundPixels=false] - Round the camera position to whole integers to avoid sub-pixel rendering?
- * @param {float} [lerpX=1] - A value between 0 and 1. This value specifies the amount of linear interpolation to use when horizontally tracking the target. The closer the value to 1, the faster the camera will track.
- * @param {float} [lerpY=1] - A value between 0 and 1. This value specifies the amount of linear interpolation to use when vertically tracking the target. The closer the value to 1, the faster the camera will track.
- * @param {number} [offsetX=0] - The horizontal offset from the camera follow target.x position.
- * @param {number} [offsetY=0] - The vertical offset from the camera follow target.y position.
- *
- * @return {this} This Camera instance.
- */
- startFollow: function (target, roundPixels, lerpX, lerpY, offsetX, offsetY)
- {
- if (roundPixels === undefined) { roundPixels = false; }
- if (lerpX === undefined) { lerpX = 1; }
- if (lerpY === undefined) { lerpY = lerpX; }
- if (offsetX === undefined) { offsetX = 0; }
- if (offsetY === undefined) { offsetY = offsetX; }
-
- this._follow = target;
-
- this.roundPixels = roundPixels;
-
- lerpX = Clamp(lerpX, 0, 1);
- lerpY = Clamp(lerpY, 0, 1);
-
- this.lerp.set(lerpX, lerpY);
-
- this.followOffset.set(offsetX, offsetY);
-
- // Move the camera there immediately, to avoid a large lerp during preUpdate
- var zoom = this.zoom;
- var originX = this.width / 2;
- var originY = this.height / 2;
-
- this.scrollX = (target.x - offsetX - originX) / zoom;
- this.scrollY = (target.y - offsetY - originY) / zoom;
-
- return this;
- },
-
- /**
- * Stops a Camera from following a Game Object, if previously set via `Camera.startFollow`.
- *
- * @method Phaser.Cameras.Scene2D.Camera#stopFollow
- * @since 3.0.0
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- stopFollow: function ()
- {
- this._follow = null;
-
- return this;
- },
-
- /**
- * Returns an Object suitable for JSON storage containing all of the Camera viewport and rendering properties.
- *
- * @method Phaser.Cameras.Scene2D.Camera#toJSON
- * @since 3.0.0
- *
- * @return {JSONCamera} A well-formed object suitable for conversion to JSON.
- */
- toJSON: function ()
- {
- var output = {
- name: this.name,
- x: this.x,
- y: this.y,
- width: this.width,
- height: this.height,
- zoom: this.zoom,
- rotation: this.rotation,
- roundPixels: this.roundPixels,
- scrollX: this.scrollX,
- scrollY: this.scrollY,
- backgroundColor: this.backgroundColor.rgba
- };
-
- if (this.useBounds)
- {
- output['bounds'] = {
- x: this._bounds.x,
- y: this._bounds.y,
- width: this._bounds.width,
- height: this._bounds.height
- };
- }
-
- return output;
- },
-
- /**
- * Resets any active FX, such as a fade, flash or shake. Useful to call after a fade in order to
- * remove the fade.
- *
- * @method Phaser.Cameras.Scene2D.Camera#resetFX
- * @since 3.0.0
- *
- * @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
- */
- resetFX: function ()
- {
- this.shakeEffect.reset();
- this.flashEffect.reset();
- this.fadeEffect.reset();
-
- return this;
- },
-
- /**
- * Internal method called automatically by the Camera Manager.
- *
- * @method Phaser.Cameras.Scene2D.Camera#update
- * @protected
- * @since 3.0.0
- *
- * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout.
- * @param {number} delta - The delta time, in ms, elapsed since the last frame.
- */
- update: function (time, delta)
- {
- if (this.visible)
- {
- this.shakeEffect.update(time, delta);
- this.flashEffect.update(time, delta);
- this.fadeEffect.update(time, delta);
- }
- },
-
- /**
- * This event is fired when a camera is destroyed by the Camera Manager.
- *
- * @event CameraDestroyEvent
- * @param {Phaser.Cameras.Scene2D.Camera} camera - The camera that was destroyed.
- */
-
- /**
- * Destroys this Camera instance. You rarely need to call this directly.
- *
- * Called by the Camera Manager. If you wish to destroy a Camera please use `CameraManager.remove` as
- * cameras are stored in a pool, ready for recycling later, and calling this directly will prevent that.
- *
- * @method Phaser.Cameras.Scene2D.Camera#destroy
- * @fires CameraDestroyEvent
- * @since 3.0.0
- */
- destroy: function ()
- {
- this.emit('cameradestroy', this);
-
- this.removeAllListeners();
-
- this.resetFX();
-
- this.matrix.destroy();
-
- this.culledObjects = [];
-
- this._follow = null;
-
- this._bounds = null;
-
- this.scene = null;
- },
-
- /**
- * The x position of the center of the Camera's viewport, relative to the top-left of the game canvas.
- *
- * @name Phaser.Cameras.Scene2D.Camera#centerX
- * @type {number}
- * @readOnly
- * @since 3.10.0
- */
- centerX: {
-
- get: function ()
- {
- return this.x + (0.5 * this.width);
- }
-
- },
-
- /**
- * The y position of the center of the Camera's viewport, relative to the top-left of the game canvas.
- *
- * @name Phaser.Cameras.Scene2D.Camera#centerY
- * @type {number}
- * @readOnly
- * @since 3.10.0
- */
- centerY: {
-
- get: function ()
- {
- return this.y + (0.5 * this.height);
- }
-
- }
-
-});
-
-module.exports = Camera;
-
-
-/***/ }),
-/* 124 */
-/***/ (function(module, exports, __webpack_require__) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-var Class = __webpack_require__(0);
-
-/**
- * @callback EachMapCallback
- * @generic E - [entry]
- *
- * @param {string} key - [description]
- * @param {*} entry - [description]
- *
- * @return {?boolean} [description]
- */
-
-/**
- * @classdesc
- * The keys of a Map can be arbitrary values.
- * var map = new Map([
- * [ 1, 'one' ],
- * [ 2, 'two' ],
- * [ 3, 'three' ]
- * ]);
- *
- * @class Map
- * @memberOf Phaser.Structs
- * @constructor
- * @since 3.0.0
- *
- * @generic K
- * @generic V
- * @genericUse {V[]} - [elements]
- *
- * @param {Array.<*>} elements - [description]
- */
-var Map = new Class({
-
- initialize:
-
- function Map (elements)
- {
- /**
- * [description]
- *
- * @genericUse {Object.} - [$type]
- *
- * @name Phaser.Structs.Map#entries
- * @type {Object.}
- * @default {}
- * @since 3.0.0
- */
- this.entries = {};
-
- /**
- * [description]
- *
- * @name Phaser.Structs.Map#size
- * @type {number}
- * @default 0
- * @since 3.0.0
- */
- this.size = 0;
-
- if (Array.isArray(elements))
- {
- for (var i = 0; i < elements.length; i++)
- {
- this.set(elements[i][0], elements[i][1]);
- }
- }
- },
-
- /**
- * [description]
- *
- * @method Phaser.Structs.Map#set
- * @since 3.0.0
- *
- * @genericUse {K} - [key]
- * @genericUse {V} - [value]
- * @genericUse {Phaser.Structs.Map.