diff --git a/.eslintignore b/.eslintignore
index 1b84fb0bf..2d978e10c 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -8,8 +8,6 @@ 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.*
diff --git a/.eslintrc.json b/.eslintrc.json
index f0680fd43..5cf14c39a 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -85,7 +85,7 @@
"no-trailing-spaces": [ "error", { "skipBlankLines": true, "ignoreComments": true } ],
"no-underscore-dangle": "off",
"no-whitespace-before-property": "error",
- "object-curly-newline": [ "error", { "multiline": true, "minProperties": 0 } ],
+ "object-curly-newline": [ "error", { "multiline": true, "minProperties": 0, "consistent": true } ],
"one-var-declaration-per-line": [ "error", "initializations" ],
"quote-props": [ "error", "as-needed" ],
"quotes": [ "error", "single" ],
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 844990001..b58bade0a 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -76,5 +76,5 @@ Thanks to Chad for creating the original Pixi.js Contributing file which we adap
[1]: http://jsfiddle.net
[2]: http://jsbin.com/
[3]: http://nodejs.org
-[4]: http://www.html5gamedevs.com/forum/33-phaser-3/
+[4]: https://phaser.discourse.group/
[5]: https://codepen.io/pen?template=YeEWom "Phaser 3 game template"
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index c49b33b07..73b1e5203 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -9,7 +9,7 @@ Thank you for taking the time to contribute towards Phaser. Before submitting yo
1. This repo is for Phaser 3 only. Phaser 2.x issues should be raised in the [Phaser CE](https://github.com/photonstorm/phaser-ce) repo.
-2. This repo should not be used for technical support. If you're struggling 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.
+2. This repo should not be used for technical support. If you're struggling to use Phaser then post your question to the [forum](https://phaser.discourse.group/), [Slack](https://phaser.io/community/slack) or [Discord](https://phaser.io/community/discord) channels. GitHub Issues are for bugs and feature requests only.
3. Make sure your issue isn't a duplicate, or has already been fixed.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 796de0510..11197f78e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,33 +1,185 @@
# Change Log
-## Version 3.16.0 - Ishikawa - in development
+## Version 3.17.0 - Ishikawa - in dev
-### Facebook Instant Games Updates and Fixes
+Notes:
-* 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)
+1) Vertex for any GO
+2) Body Blocked
+3) GO auto-add to Scene
+4) GO move to another Scene
+
+### Arcade Physics
+
+#### New Features
+
+* `overlapTiles` is a new method that allows you to check for overlaps between a physics enabled Game Object and an array of Tiles. The Tiles don't have to have been enable for collision, or even be on the same layer, for the overlap check to work. You can provide your own process callback and/or overlap callback. This is handy for testing for overlap for a specific Tile in your map, not just based on a tile index. This is available via `this.physics.overlapTiles` and the World instance.
+* `collideTiles` is a new method that allows you to check for collision between a physics enabled Game Object and an array of Tiles. The Tiles don't have to have been enable for collision, or even be on the same layer, for the collision to work. You can provide your own process callback and/or overlap callback. There are some limitations in using this method, please consult the API Docs for details, but on the whole, it allows for dynamic collision on small sets of Tile instances. This is available via `this.physics.collideTiles` and the World instance.
+* `overlapRect` is a new method that allows you to return an array of all physics bodies within the given rectangular region of the World. It can return dynamic or static bodies and will use the RTree for super-fast searching, if enabled (which it is by default)
+
+#### Updates
+
+* `Body.preUpdate` is a new method that is called only once per game step. It resets all collision status properties and syncs the Body with the parent Game Object.
+* `Body.update` has been rewritten to just perform one single physics step and no longer re-syncs with the Game Object. It can be called multiple times per game step, depending on the World FPS rate.
+* `Body.postUpdate` has been rewritten to make it more compact. It syncs the body data back to the parent Game Object and is only called once per game step now (previously it was called whenever the Body updated)
+* The `World.late` Set has been removed and is no longer populated, as it's no longer required.
+* `World.update` now calls `Body.preUpdate` just once per game step, then calls `Body.update` as many times as is required as per the FPS setting, and no longer calls `Body.postUpdate` at all.
+* `World.collideSpriteVsTilemapLayer` now returns a boolean if a collision or overlap happens, where-as before it didn't.
+* `World.collideSpriteVsTilemapLayerHandler` is a new private method that handles all tilemap collision checks.
+* The internal method `SeparateTile` now has a new argument `isLayer` which controls if the set comes from a layer or an array.
+* The internal method `TileCheckX` now has a new argument `isLayer` which controls if the set comes from a layer or an array.
+* The internal method `TileCheckY` now has a new argument `isLayer` which controls if the set comes from a layer or an array.
+
+#### Bug Fixes
+
+* The `Body.delta` values are now able to be read and acted upon during a Scene update, due to the new game step flow. This means you can now call `this.physics.collide` during a Scene `update` and it will work properly again. Fix #4370 (thanks @NokFrt)
+* `ArcadePhysics.furthest` now iterates the bodies Set, rather than the RTree, which keeps it working even if the RTree has been disabled.
+* `ArcadePhysics.closest` now iterates the bodies Set, rather than the RTree, which keeps it working even if the RTree has been disabled.
+
+### New Features
+
+* There is a new Game Config property `input.windowEvents` which is true by default. It controls if Phaser will listen for any input events on the Window. If you disable this, Phaser will stop being able to emit events like `POINTER_UP_OUTSIDE`, or be aware of anything that happens outside of the Canvas re: input.
+* A Scene will now emit the new `CREATE` event after it has been created by the Scene Manager. If the Scene has a `create` method this event comes after that, so is useful to knowing when a Scene may have finished creating Game Objects, etc. (thanks @jackfreak)
+* `Tilemap.removeTile` is a new method that allows you to remove a tile, or an array of tiles, by passing in references to the tiles themselves, rather than coordinates. The tiles can be replaced with new tiles of the given index, or removed entirely, and the method can optionally recalculate interesting faces on the layer.
+
+### Updates
+
+* Removed all references to CocoonJS from the API, including in the Device.OS object and elsewhere, as Cocoon is no longer.
+* The MouseManager and TouchManager now use separate handlers for the Window level input events, which check to see if the canvas is the target or not, and redirect processing accordingly.
+* `AnimationManager.generateFrameNumbers` can now accept a start number greater than the end number, and will generate them in reverse (thanks @cruzdanilo)
+* The return from the `ScenePlugin.add` method has changed. Previously, it would return the ScenePlugin, but now it returns a reference to the Scene that was added to the Scene Manager, keeping it in-line with all other `add` methods in the API. Fix #4359 (thanks @BigZaphod)
+* The `PluginManager.installScenePlugin` method has a new optional boolean parameter `fromLoader` which controls if the plugin is coming in from the result of a Loader operation or not. If it is, it no longer throws a console warning if the plugin already exists. This fixes an issue where if you return to a Scene that loads a Scene Plugin it would throw a warning and then not install the plugin to the Scene.
+* The Scale Manager has a new event `FULLSCREEN_FAILED` which is fired if you try to enter fullscreen mode, but the browser rejects it for some reason.
+
+### Bug Fixes
+
+* The parent bounds are reset when exiting fullscreen mode in the Scale Manager. This fixes an issue when leaving fullscreen mode by pressing ESC (instead of programmatically) would leave the canvas in the full screen size. Fix #4357 (thanks @khutchins and @HeyStevenXu)
+* `GetAdvancedValue` now uses the correct Math RND reference, which means anything that used the `randInt` or `randFloat` features of this function, such as creating a Sprite from a Config object, or Bitmap Text sizing, will no longer throw an error about a null object reference. Fix #4369 (thanks @sanadov)
+* Trying to enter Fullscreen mode on Android / Chrome, or iOS / Safari, would throw an error regarding an unhandled Promise and a failure to invoke the event from a user gesture. This has been tightened up, using a proper Promise handler internally and the documentation clarified to explicitly say that you must call the function from a `pointerup` handler, and not `pointerdown`. Fix #4355 (thanks @matrizet)
+
+### 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:
+
+@sky-coding @G-Rath @S4n60w3n @rootasjey @englercj @josephmbustamante
+
+
+## Version 3.16.2 - Ishikawa - 11th February 2019
+
+This is point release primarily fixes a few important issues that surfaced in 3.16.0.
+
+### Matter Pointer Constraint Changes
+
+The following changes all effect the Matter JS Pointer Constraint class:
+
+* Pointer handling has been changed to make more sense. In the previous version, pressing down and then moving the Pointer _over_ a body would start it being dragged, even if the pointer was pressed down well outside of the body bounds. Now, a body can only be dragged by actually pressing down on it, or any of its parts, which is more in-line with how input events should work.
+* Previously, releasing ANY pointer would stop an object being dragged, even if it wasn't the one actually dragging a body, as in a multi-touch game. Bodies are now bound to the pointer which started their drag and only the release of that pointer will stop them.
+* There is a new Matter Physics Event `DRAG_START` which is emitted by a Pointer Constraint when it starts dragging a body. Listen for this event from the Matter World instance.
+* There is a new Matter Physics Event `DRAG` which is emitted by a Pointer Constraint as it drags a body. Listen for this event from the Matter World instance.
+* There is a new Matter Physics Event `DRAG_END` which is emitted by a Pointer Constraint when it stops dragging a body. Listen for this event from the Matter World instance.
+* The `camera` property can no longer be set in the config object. Instead it is set every time the Pointer is pressed down on a Body, this resolves issues where you have a multi-camera Scene and want to drag a body in the non-main camera.
+* `body` is a new property that holds a reference to the Body being dragged, if any.
+* `part` is a new property that holds a reference to the Body part that was clicked on which started the drag.
+* The internal `getBodyPart` method has been renamed to `hitTestBody` to more accurately reflect what it does.
+* The class no longer listens for the pointer `up` event, instead of tracks the active pointer and waits for that to be released. This has reduced the complexity and size of the `update` method considerably.
+* `stopDrag` is a new method that allows you to manually stop an object being dragged, even if the pointer isn't released.
+* This class now has 100% JSDocs.
+
+### Updates
+
+* `TileSprite.setTileScale` has been updated so that the `y` argument is optional and set to match the `x` argument, like `setScale` elsewhere in the API.
+* `InputManager.time` is a new property that holds the most recent time it was updated from the Game step, which plugins can access.
+* `InputManager.preStep` is a new method that populates some internal properties every step.
+* `KeyboardPlugin.time` has moved from being a property to being a getter, which returns the time from the InputManager.
+* The `scale` property has been added to the `Scene` class (thanks @strangeweekend)
+* `Matter.World.remove` now uses the `Composite.remove` method internally. Previously, it used `Composite.removeBody` which only allowed it to remove bodies from the simulation. Now, it can remove any type of Matter object.
+* When the Matter World creates its wall bounds, the left and right walls now extend further up and down than before, so that in a 4-wall setting there are no gaps in the corners, which previously allowed for fast moving objects that hit a corner intersection point to sometimes travel through it.
+* Touch inputs will now trigger a `POINTER_OUT` event if they leave the game (i.e. are released), where-as before they would only trigger the `POINTER_UP` event. Now, both happen (thanks @rgk)
+
+### Bug Fixes
+
+* The `Mesh.setAlpha` method has been restored, even though it's empty and does nothing, to prevent runtime errors when adding a Mesh or Quad object to a Container. Fix #4338 #4343 (thanks @pfdtravalmatic @charmingny)
+* `KeyboardPlugin.checkDown` would always fail if using the new event system, because the time value it was checking wasn't updated.
+* Entering `Fullscreen` mode in the Scale Manager and then pressing ESC would leave the injected fullsceen div in the DOM, causing it to throw a node insertion failure the second time you wanted to enter fullscreen mode. Fix #4352 (thanks @ngdevr)
+* Due to the changes in the Input event system, the `GAME_OUT` event would never fire unless the input system was in legacy mode. The OUT and OVER handlers have been refactored and will now fire as soon as the DOM event happens. As a result the `InputManager._emitIsOverEvent` property has been removed, as the native event is sent directly to the handler and doesn't need storing locally any more. Fix #4344 (thanks @RademCZ)
+* Added `Zone.setBlendMode` method as a NOOP function, fixing a bug where if you added a Zone to a Container when running under Canvas it would fail. Fix #4295 (thanks @emanuel15)
+
+### 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:
+
+@maretana @CipSoft-Components @brian-lui
+
+## Version 3.16.0 / 3.16.1 - Ishikawa - 5th February 2019
+
+Phaser 3.16 is a massive update. The single largest in the history of Phaser 3 and it contains _breaking changes_. If you're upgrading from an earlier version please do check the log entries below.
+
+Please note: there is no difference between 3.16.0 and 3.16.1. The version bump was just to get around a stupid npm semver policy.
+
+### Important Namespace Changes
+
+* The `Phaser.Boot` namespace has been renamed to `Phaser.Core`. As a result, the `boot` folder has been renamed to `core`. This impacts the `TimeStep` class and `VisibilityHandler` function, which have been moved to be under the new namespace.
+* The `Phaser.Animations` namespace was incorrectly exposed in the Phaser entrypoints as `Animation` (note the lack of plural). This means that if you are creating any custom classes that extend Animation objects using the Phaser namespace, then please update them from `Phaser.Animation` to `Phaser.Animations`, i.e. `Phaser.Animation.AnimationFrame` to `Phaser.Animations.AnimationFrame`. This doesn't impact you if you created animations directly via the Animation Manager.
+* The keyed Data Manager change data event string has changed from `changedata_` to `changedata-` to keep it consistent with other keyed events. Note the change from `_` to `-`.
+* The Keyboard Plugin `keydown` dynamic event string has changed from `keydown_` to `keydown-` to keep it consistent with other keyed events. Note the change from `_` to `-`.
+* The Keyboard Plugin `keyup` dynamic event string has changed from `keyup_` to `keyup-` to keep it consistent with other keyed events. Note the change from `_` to `-`.
+* The `texturesready` event emitted by the Texture Manager has been renamed to `ready`.
+* The `loadcomplete` event emitted by the Loader Plugin has been renamed to `postprocess` to be reflect what it's used for.
+* Game Objects used to emit a `collide` event if they had an Arcade Physics Body with `onCollide` set, that collided with a Tile. This has changed. The event has been renamed to `tilecollide` and you should now listen for this event from the Arcade Physics World itself: `this.physics.world.on('tilecollide')`. Game Objects no longer emit this event.
+* Game Objects used to emit an `overlap` event if they had an Arcade Physics Body with `onOverlap` set, that overlapped with a Tile. This has changed. The event has been renamed to `tileoverlap` and you should now listen for this event from the Arcade Physics World itself: `this.physics.world.on('tileoverlap')`. Game Objects no longer emit this event.
+* The function `Phaser.Physics.Impact.SeperateX` has been renamed to `SeparateX` to correct the spelling mistake.
+* The function `Phaser.Physics.Impact.SeperateY` has been renamed to `SeparateY` to correct the spelling mistake.
+* The `ended` event in `WebAudioSound` has been renamed to `complete` to make it more consistent with the rest of the API.
+* The `ended` event in `HTML5AudioSound` has been renamed to `complete` to make it more consistent with the rest of the API.
+* The `Phaser.Utils.Objects` namespace was incorrectly exposed in the Phaser entrypoints as `Object` (note the lack of plural), this has now been fixed so all associated functions are properly namespaced.
+* `Phaser.GameObjects.Blitter.Bob` has been renamed to `Phaser.GameObjects.Bob` to avoid namespace conflicts in TypeScript.
+* `Phaser.GameObjects.Text.TextStyle` has been renamed to `Phaser.GameObjects.TextStyle` to avoid namespace conflicts in TypeScript.
+
+### Important Changes to the Input System
+
+In Phaser 3.15 and earlier the Input system worked using an event queue. All native DOM input events, such as from the Mouse, Touch or Keyboard, were picked up by event handlers and stored in a queue within the Input Manager. This queue was then processed during the next game step, all the events were dealt with and then it was cleared, ready to receive more events. As they were processed, the internal Phaser events such as `pointerdown` or `keyup` were dispatched to your game code.
+
+This worked fine in that you were able to guarantee _exactly_ when the events would arrive, because it was always at the same time in the game step. However, it had the side effect of you not being able to do things like open external browser windows, or go into Full Screen mode, during your event handlers - because they weren't "real" events, so didn't pass the browser security checks. To this end, methods like `addUpCallback` were added to try and provide this support (although it was never possible for keyboard events).
+
+In 3.16 this has changed. The DOM Events now trigger the respective internal events immediately, in the same invocation. So if you click on the canvas, the `pointerdown` event you receive in your game is still part of the 'native' event handler, so you're now free to do things like go into full screen mode, or open external windows, without any browser warnings or work-arounds.
+
+It does, however, mean that the point at which these handlers are called is no longer always consistent, and is no longer bound to the speed of the Request Animation Frame update. We've tested as much as possible, and so far, things carry on working as before. We've noticed a slight increase in responsiveness, due to the removal of the fractional delay in processing the events, which feels good. However, if for whatever reason this change has broken your game then you're able to easily switch back to the previous version. In your Game Config, create an `input` object and give it the property `queue: true`. This will tell Phaser to use the legacy event queue system.
+
+Please note that we _will_ remove this legacy system in the near future. So, please try and adapt your games to use the new system. If you've found an edge-case where something breaks because of it, please report it so we can look into it.
+
+As a result of this change, the following are now deprecated:
+
+* `InputPlugin.addUpCallback` method.
+* `InputPlugin.addDownCallback` method.
+* `InputPlugin.addMoveCallback` method.
+* `InputManager.queue` property.
+* `InputManager.domCallbacks` property.
+* `InputManager._hasUpCallback` property.
+* `InputManager._hasDownCallback` property.
+* `InputManager._hasMoveCallback` property.
+* `InputManager.processDomCallbacks` method.
+* `InputManager.addUpCallback` method.
+* `InputManager.addDownCallback` method.
+* `InputManager.addMoveCallback` method.
+
+### keydown and keyup changes
+
+Due to unification across the event system, the `keydown_` and `keyup_` dynamic event strings have changed.
+
+* In all cases the `keydown_KEY` event name has changed to `keydown-KEY`. Note the change from an underscore to a hyphen.
+* In all cases the `keyup_KEY` event name has changed to `keyup-KEY`. Note the change from an underscore to a hyphen.
+
+You should update your game code accordingly.
### 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 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.
+You also now have the ability to cancel this at any stage either on a local or global level. All event 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.
@@ -58,10 +210,11 @@ Default captures can be defined in the Game Config in the `input.keyboard.captur
#### 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
+* 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 now 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.
+* If the browser Window loses focus, either from switching to another app, or another tab, all active Keys will be reset. This prevents issues with keys still reporting as being held down after leaving the game and returning to it again. Fix #4134 (thanks @Simplonium)
* `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`.
@@ -83,60 +236,121 @@ one set of bindings ever created, which makes things a lot cleaner.
* `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.
+* `KeyboardPlugin.startListeners` has been removed as it's no longer used by the class.
+* `KeyboardPlugin.stopListeners` 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 }`.
+* `Config.inputSmoothFactor` is a new property that allows you to set the smoothing factor for all Pointers the game creates. 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.
+* `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 and 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 and 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 and 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.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 button was pressed down. If no button is held down, it will return the last recorded duration, based on the time the Pointer button was released.
* `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.
+* 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 moved 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 moved 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 moved 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.
+* 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 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, if 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.
+* 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.
+* The `Pointer.dragState` property has been removed. This is no longer used internally as it has to be tracked per Scene, not on a global level.
+* `InputPlugin.setDragState` is a new internal method that sets the drag state for the given Pointer.
+* `InputPlugin.getDragState` is a new internal method that gets the drag state for the given Pointer.
+* Draggable Game Objects would not work if you had multiple Scenes running in parallel, with draggable objects in both of them. Only the top-most Scene would work fully. Items in the bottom Scene would never finish their drag cycle, causing them to get stuck. Fix #4249 #4278 (thanks @probt @iArePJ)
+* `Pointer.leftButtonDown` will now return an actual boolean, rather than the result of the bitwise op (which still evaluated as a boolean, but this is cleaner).
+* `Pointer.rightButtonDown` will now return an actual boolean, rather than the result of the bitwise op (which still evaluated as a boolean, but this is cleaner).
+* `Pointer.middleButtonDown` will now return an actual boolean, rather than the result of the bitwise op (which still evaluated as a boolean, but this is cleaner).
+* `Pointer.backButtonDown` will now return an actual boolean, rather than the result of the bitwise op (which still evaluated as a boolean, but this is cleaner).
+* `Pointer.forwardButtonDown` will now return an actual boolean, rather than the result of the bitwise op (which still evaluated as a boolean, but this is cleaner).
+* `Pointer.up`, `Pointer.move` and `Pointer.down` now use `in` to check for the existance of the `buttons` property on the event, causing it to be set even if equal to zero, which it is when there are no buttons down. This also fixes an issue where the buttons didn't update during a move event (thanks @SonnyCampbell @rexrainbow)
+
+### Changes as a result of the new Scale Manager
+
+3.16 introduces the completed Scale Manager. This is fully documented, but the class, all methods and all properties. It also includes a folder full of examples in the Phaser Labs, so you're strongly recommended to start there.
+
+* If you set the Game Config property `zoom` to be > 1 then it will automatically enable `pixelArt` mode, unless you set `pixelArt: false` in the config.
+* There is a new property in the Game Config called `autoRound`, which controls if the canvas size and style sizes are passed through Math.floor or not. On some devices this can help with performance and anti-aliasing. The default is `false` (turned off).
+* The Game Config property `autoResize` has been removed as it's now redundant.
+* The WebGL and Canvas Renderers no longer change the Canvas size in their `resize` methods. They just update internal properties.
+* The WebGL and Canvas Renderers now read the `width`, `height` and `resolution` values from the Scale Manager, not the Game Config.
+* `CameraManager.baseScale` property has been removed as it's no longer used anywhere.
+* The BaseCamera and Camera `preRender` methods now only take a resolution argument and use it internally for their transforms.
+* `InputManager.scaleManager` is a new property that is a reference to the Scale Manager. This is populated in the `boot` method.
+* The `InputManager.transformX` method has been removed. This is now available in the ScaleManager.
+* The `InputManager.transformY` method has been removed. This is now available in the ScaleManager.
+* The `InputManager.scale` property has been removed. This is now available in the ScaleManager under `displayScale`.
+* The `InputManager.resize` method has been removed as this process is now handled by the ScaleManager.
+* The `InputManager.bounds` property has been removed as this process is now handled by the ScaleManager.
+* The `InputManager.updateBounds` method has been removed as this process is now handled by the ScaleManager.
+* The `InputManager.getOffsetX` method has been removed as it's no longer required.
+* The `InputManager.getOffsetY` method has been removed as it's no longer required.
+* The `InputManager.getScaleX` method has been removed as it's no longer required.
+* The `InputManager.getScaleY` method has been removed as it's no longer required.
+* The `SceneManager.resize` method has been removed as it's no longer required.
+* The `Scene.Systems.resize` method has been removed as it's no longer required.
+* Scenes will no longer dispatch the `resize` event. You should now listen for this event from the Scale Manager instead.
+* `BaseCamera.config` has been removed as it's no longer required.
+* `BaseCamera.scaleManager` is a new property that references the Scale Manager and is used internally for size checks.
+* The `Game.resize` method has been removed as it's no longer required. You should now call `ScaleManager.resize` instead.
+* The Game will no longer dispatch the `resize` event. You should now listen for this event from the Scale Manager instead.
+
+### 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)
+* Fixed the `Leaderboard.getScores` method to now take the arguments into account. Fix #4271 (thanks @Oramy)
+* Fixed an API validation error in the `chooseContext` method. Fix #4248 (thanks @yadurajiv)
### 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.
+* The WebGL Renderer has a new method `rebindPipeline`, which will rebind the given pipeline instance, reset the blank texture and reset the blend mode. This 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.
+* `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 require you to 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)
@@ -145,8 +359,8 @@ one set of bindings ever created, which makes things a lot cleaner.
* `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.
+* `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`.
@@ -163,6 +377,29 @@ one set of bindings ever created, which makes things a lot cleaner.
* `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.
+* `Line.Extend` is a new static function that allows you extend the start and/or end points of a Line by the given amounts.
+* `Vector2.LEFT` is a new constant that can be used in Vector comparison operations (thanks @Aedalus)
+* `Vector2.RIGHT` is a new constant that can be used in Vector comparison operations (thanks @Aedalus)
+* `Vector2.UP` is a new constant that can be used in Vector comparison operations (thanks @Aedalus)
+* `Vector2.DOWN` is a new constant that can be used in Vector comparison operations (thanks @Aedalus)
+* `Vector2.ONE` is a new constant that can be used in Vector comparison operations (thanks @Aedalus)
+* `Vector3.ZERO` is a new constant that can be used in Vector comparison operations (thanks @Aedalus)
+* `Vector3.LEFT` is a new constant that can be used in Vector comparison operations (thanks @Aedalus)
+* `Vector3.RIGHT` is a new constant that can be used in Vector comparison operations (thanks @Aedalus)
+* `Vector3.UP` is a new constant that can be used in Vector comparison operations (thanks @Aedalus)
+* `Vector3.DOWN` is a new constant that can be used in Vector comparison operations (thanks @Aedalus)
+* `Vector3.FORWARD` is a new constant that can be used in Vector comparison operations (thanks @Aedalus)
+* `Vector3.BACK` is a new constant that can be used in Vector comparison operations (thanks @Aedalus)
+* `Vector3.ONE` is a new constant that can be used in Vector comparison operations (thanks @Aedalus)
+* Geometery Mask has a new property called `invertAlpha` in WebGL, which works in the same way as the flag on the Bitmap Mask and allows you to invert the function of the stencil buffer, i.e. non-drawn shapes become invisible, and drawn shapes visible (thanks @tfelix)
+* The Arcade Physics Body has a new property `maxSpeed` which limits the vector length of the Body velocity. You can set it via the method `setMaxSpeed` and it is applied in the `World.computeVelocity` method (thanks @Edwin222 @rexrainbow)
+* `WebGLRenderer.snapshotArea` is a new method that allows you to grab an image of the given region of the canvas during the post-render step and have it sent to your defined callback. This is the same as `snapshot` except you control the area being grabbed, so is more efficient if you only need a smaller area.
+* `WebGLRenderer.snapshotPixel` is a new method that allows you to grab a single pixel from the game canvas, post-render. It returns the result as a `Color` object to your specified callback.
+* `CanvasRenderer.snapshotArea` is a new method that allows you to grab an image of the given region of the canvas during the post-render step and have it sent to your defined callback. This is the same as `snapshot` except you control the area being grabbed, so is more efficient if you only need a smaller area.
+* `CanvasRenderer.snapshotPixel` is a new method that allows you to grab a single pixel from the game canvas, post-render. It returns the result as a `Color` object to your specified callback.
+* `SceneManager.getScenes` is a new method that will return all current Scenes being managed by the Scene Manager. You can optionally return only active scenes and reverse the order in which they are returned in the array.
+* `DOM.GetTarget` is a new helper function that will return a reference to a DOM Element based on the given string or node.
+* `GameObjects.Extern` is a new special type of Game Object that allows you to pass rendering off to a 3rd party. When you create an Extern and place it in the display list of a Scene, the renderer will process the list as usual. When it finds an Extern it will flush the current batch, clear down the pipeline and prepare a transform matrix which your render function can take advantage of, if required. The Extern Game Object is used heavily by the Spine Plugin, but can also be used by other libraries such as three.js, allowing them to render directly into a Phaser game.
### Updates
@@ -176,8 +413,8 @@ one set of bindings ever created, which makes things a lot cleaner.
* 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)
+* The method `DisplayList.sortGameObjects` has been removed. It has thrown a runtime error since v3.3.0(!) which no-one even spotted which is a good indication of how little the method was 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 which is a good indication of how little the method was 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.
@@ -203,6 +440,24 @@ one set of bindings ever created, which makes things a lot cleaner.
* `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.
* `Map.set` will now update an existing value if you provide it with a key that already exists within the Map. Previously, if you tried to set the value of a key that existed it would be skipped.
+* `MatterSprite` would set its `type` property to be `Image`. It now sets it to be `Sprite` as it should do.
+* `Matter.TileBody.setFromTileCollision` no longer checks if the shape is concave or convex before modifying the vertices, as the update to the Matter.js lib in 3.12 stopped this from working with Tiled collision shapes.
+* The Scene `transitionstart` event is now dispatched by the Target Scene of a transition, regardless if the Scene has a `create` method or not. Previously, it was only dispatched if the Scene had a create method.
+* The Loader will now allow an XHR status of 0 as success too. Normally only status 200 would be accepted as success, but 0 is returned when a file is loaded from the local filesystem (file://). This happens, for example, when opening the index.html of a game in a browser directly, or when using Cordova on iOS. Fix #3464 (thanks @Ithamar)
+* `Tween.restart` now returns the Tween instance (thanks @rexrainbow)
+* `Tween.play` now returns the Tween instance (thanks @rexrainbow)
+* `Tween.seek` now returns the Tween instance (thanks @rexrainbow)
+* `Tween.complete` now returns the Tween instance (thanks @rexrainbow)
+* `Tween.stop` now returns the Tween instance (thanks @rexrainbow)
+* `List.sort` now has an optional parameter `handler` which allows you to provide your own sort handling function (thanks @jcyuan)
+* `Container.sort` now has an optional parameter `handler` which allows you to provide your own sort handling function (thanks @jcyuan)
+* The WebGLRenderer method `canvasToTexture` will now only set the filter to be `NEAREST` if `antialias` is disabled in the game config (i.e. when running in pixelArt mode). This means that Text objects, and other Canvas backed textures, now render with anti-aliasing if everything else does. You can disable this on a per-object basis by calling `texture.setFilter(1)` on them.
+* `CanvasRenderer.snapshotCallback`, `snapshotType` and `snapshotEncoder` have all been removed as they are no longer required.
+* `CanvasRenderer.snapshotState` is a new object that contains the snapshot configuration data, the same as the WebGL Renderer.
+* The signature of the `WebGLSnapshot` function has changed. It now takes a Snapshot Configuration object as the second parameter.
+* The signature of the `CanvasSnapshot` function has changed. It now takes a Snapshot Configuration object as the second parameter.
+* A Tween Timeline will now set it's internal destroy state _before_ calling either the `onComplete` callback or sending the `COMPLETE` event. This means you can now call methods that will change the state of the Timeline, such as `play`, during the callback handlers, where-as before doing this would have had the internal state changed immediately, preventing it (thanks Lucas Knight)
+* The `AddToDOM` method has had the `overflowHidden` argument removed. The DOM element the canvas is inserted into no longer has `overflow: hidden` applied to its style. If you wish to have this, please add it directly via CSS.
### Bug Fixes
@@ -212,7 +467,7 @@ one set of bindings ever created, which makes things a lot cleaner.
* 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 `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.
@@ -221,52 +476,62 @@ one set of bindings ever created, which makes things a lot cleaner.
* 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)
+* 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.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)
+* `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.
+* `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.
+* `Particle.resetPosition` is a new method that is called when a particle dies preparing it 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)
+* 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.
+* 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)
+* 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)
+* `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 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)
+* The `processDomCallbacks` method in the Input Manager wasn't correctly clearing the `once` arrays. Responsibility for this has now been passed to the queue methods `queueTouchStart`, `queueTouchMove`, `queueTouchEnd`, `queueMouseDown`, `queueMouseMove` and `queueMouseUp`. Fix #4257 (thanks @iArePJ)
+* Arcade Physics now manages when `postUpdate` should be applied better, stopping it from gaining a zero delta during a further check in the same frame. This fixes various issues, including the mass collision test demo. Fix #4154 (thanks @samme)
+* Arcade Physics could trigger a `collide` event on a Body even if it performing an overlap check, if the `onCollide` property was true (thanks @samme)
+* TileSprites no longer cause a crash when using the Headless mode renderer. Fix #4297 (thanks @clesquir)
+* The WebGLRenderer will now apply a transparent background if `transparent = true` in the game config (thanks @gomachan7)
+* `List.sort` was missing the scope required for the sort handler, this is now correctly provided internally. Fix #4241 (thanks @jcyuan)
+* `Container.sort` was missing the scope required for the sort handler, this is now correctly provided internally. Fix #4241 (thanks @jcyuan)
+* `DataManager.pop` would emit the DataManager instance, instead of the parent, as the first event argument. It now emits the parent as it should do. Fix #4186 (thanks @gadelan)
+* The `GetValue` function wasn't checking for the existance of '.' in the config property name correctly, causing the branch to always be taken (thanks @kyranet)
+* Safari had permission problems playing HTML5 Audio files on Mac OS. Due to the changes in the input event system audio now plays properly based on user interactions. You still can't play it automatically, though, it will always require a user gesture to begin. Fix #4217 (thanks @increpare)
### 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 @jestarray
+@guilhermehto @samvieten @darkwebdev @RoryO @snowbillr @slothyrulez @jcyuan @jestarray @CzBiX
### 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
+@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
+@bryanwood @jestarray @matosummer @tfelix @imilo @BigZaphod @OmarShehata @16patsle @jcyuan @iam13islucky @FractalBobz Endre
## Version 3.15.1 - Batou - 16th October 2018
@@ -280,7 +545,7 @@ Note: We are releasing this version ahead of schedule in order to make some very
* 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)
+* 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.
diff --git a/README.md b/README.md
index ae2391003..261ffe03e 100644
--- a/README.md
+++ b/README.md
@@ -24,25 +24,19 @@ Grab the source and join the fun!
-> 16th October 2018
+> 11th February 2019
-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.
+With a new version as large as 3.16.0 was, there were bound to be some bugs that got overlooked. With 3.16.2 we address some of the more important ones. Please see the Change Log below for full details. If you're using 3.16, then please upgrade to 3.16.2.
-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.
+5th February 2019:
-> 1st October 2018
+I'm pleased to announce that Phaser 3.16 is now available. This version represents a significant milestone in the project as Phaser 3 is now 100% feature complete with all of the initially planned systems now in place. The most significant additions in 3.16 is the overhaul of the Input event handling, the long-awaited introduction of the Scale Manager, and the Extern Game Object, which allows for 3rd party rendering support, as required by Spine. Spine animation support is being handled exclusively through a Phaser Plugin. The current build of the Spine plugin can be found in this repo in the `plugins` folder, along with examples in the Phaser Labs. The Spine plugin will be developed independently of Phaser in the coming weeks.
-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.
+This is the single largest update of Phaser 3 yet, and as such, there _are_ breaking changes. I have painstakingly listed all of them in the Change Log, so please do read it if you're upgrading from an earlier version. I know there is a lot to take in, so I'll be covering the new features in the Phaser World newsletter in the coming weeks.
-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.
+3.16 also brings together all of the hard work from the community that went in to the documentation. They're in a much better state than ever before, and very nearly 100% complete. I also completely reworked the internal event system, so event names, callback arguments and more are easy to find in one central place in the docs and can be reference in your code with either strings or properly name-spaced constants.
-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.
+A massive thank-you to everyone who supports Phaser on Patreon and PayPal. It's your backing that allows me to work on this full-time. If you've ever considered becoming a backer, now is the perfect time!
As always, please check out the [Change Log](#changelog) for comprehensive details about what recent versions contain.
@@ -62,15 +56,17 @@ Rich - [@photonstorm](https://twitter.com/photonstorm)
![Support Phaser](https://phaser.io/images/github/div-support-phaser.png "Support Phaser")
-Developing Phaser takes a lot of time, effort and money. There are monthly running costs as well as countless hours of development time, community support, and assistance resolving issues.
+Because Phaser is an open source project, we cannot charge for it in the same way as traditional retail software. What's more, we don't ever want to. After all, it's built on, and was born from, open web standards. It's part of our manifesto that the core framework will always be free, even if you use it commercially, as many of you do.
-If you have found Phaser useful in your development life or have made income as a result of it please support our work via:
+**You may not realize it, but because of this, we rely 100% on community backing to fund development.**
-* A monthly contribution on [Patreon](https://www.patreon.com/photonstorm).
-* A [one-off donation](https://phaser.io/community/donate) with PayPal.
-* Purchase any of our [plugins or books](https://phaser.io/shop).
+Those funds allow Phaser to improve, and when it improves, everyone involved benefits. Your support helps secure a constant cycle of updates, fixes, new features and planning for the future.
-It all helps and genuinely contributes towards future development.
+There are other benefits to [backing Phaser](https://www.patreon.com/join/photonstorm), too:
+
+![Backers Perks](https://phaser.io/images/github/patreon-perk-chart.png)
+
+I use [Patreon](https://www.patreon.com/photonstorm) to manage the backing and you can [support Phaser](https://www.patreon.com/join/photonstorm?) from $1 per month. The amount you pledge is entirely up to you and can be changed as often as you like. Patreon renews monthly, just like Netflix. You can, of course, cancel at any point. Tears will be shed on this end, but that's not your concern.
Extra special thanks to our top-tier sponsors: [Orange Games](http://orangegames.com) and [CrossInstall](https://crossinstall.com).
@@ -82,7 +78,7 @@ Extra special thanks to our top-tier sponsors: [Orange Games](http://orangegames
We publish the [Phaser World](https://phaser.io/community/newsletter) newsletter. It's packed full of the latest Phaser games, tutorials, videos, meet-ups, talks, and more. The newsletter also contains our weekly Development Progress updates which let you know about the new features we're working on.
-Over 120 previous editions can be found on our [Back Issues](https://phaser.io/community/backissues) page.
+Over 130 previous editions can be found on our [Back Issues](https://phaser.io/community/backissues) page.
![Download Phaser](https://phaser.io/images/github/div-download.png "Download Phaser")
@@ -108,13 +104,13 @@ 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
@@ -186,13 +182,13 @@ We've 3 tutorials related to Facebook Instant Games and Phaser:
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.
@@ -209,7 +205,7 @@ Create an `index.html` page locally and paste the following code into it:
-
+
@@ -320,42 +316,51 @@ You can then run `webpack` to create a development build in the `build` folder w
# Change Log
-## Version 3.15.1 - Batou - 16th October 2018
+## Version 3.16.2 - Ishikawa - 11th February 2019
-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.
+This is point release primarily fixes a few important issues that surfaced in 3.16.0. Please be sure to read the [Change Log](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md) if you are coming from a version < 3.16.0 as it contains lots of important updates.
-### New Features
+### Matter Pointer Constraint Changes
-* 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`.
+The following changes all effect the Matter JS Pointer Constraint class:
+
+* Pointer handling has been changed to make more sense. In the previous version, pressing down and then moving the Pointer _over_ a body would start it being dragged, even if the pointer was pressed down well outside of the body bounds. Now, a body can only be dragged by actually pressing down on it, or any of its parts, which is more in-line with how input events should work.
+* Previously, releasing ANY pointer would stop an object being dragged, even if it wasn't the one actually dragging a body, as in a multi-touch game. Bodies are now bound to the pointer which started their drag and only the release of that pointer will stop them.
+* There is a new Matter Physics Event `DRAG_START` which is emitted by a Pointer Constraint when it starts dragging a body. Listen for this event from the Matter World instance.
+* There is a new Matter Physics Event `DRAG` which is emitted by a Pointer Constraint as it drags a body. Listen for this event from the Matter World instance.
+* There is a new Matter Physics Event `DRAG_END` which is emitted by a Pointer Constraint when it stops dragging a body. Listen for this event from the Matter World instance.
+* The `camera` property can no longer be set in the config object. Instead it is set every time the Pointer is pressed down on a Body, this resolves issues where you have a multi-camera Scene and want to drag a body in the non-main camera.
+* `body` is a new property that holds a reference to the Body being dragged, if any.
+* `part` is a new property that holds a reference to the Body part that was clicked on which started the drag.
+* The internal `getBodyPart` method has been renamed to `hitTestBody` to more accurately reflect what it does.
+* The class no longer listens for the pointer `up` event, instead of tracks the active pointer and waits for that to be released. This has reduced the complexity and size of the `update` method considerably.
+* `stopDrag` is a new method that allows you to manually stop an object being dragged, even if the pointer isn't released.
+* This class now has 100% JSDocs.
### 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.
+* `TileSprite.setTileScale` has been updated so that the `y` argument is optional and set to match the `x` argument, like `setScale` elsewhere in the API.
+* `InputManager.time` is a new property that holds the most recent time it was updated from the Game step, which plugins can access.
+* `InputManager.preStep` is a new method that populates some internal properties every step.
+* `KeyboardPlugin.time` has moved from being a property to being a getter, which returns the time from the InputManager.
+* The `scale` property has been added to the `Scene` class (thanks @strangeweekend)
+* `Matter.World.remove` now uses the `Composite.remove` method internally. Previously, it used `Composite.removeBody` which only allowed it to remove bodies from the simulation. Now, it can remove any type of Matter object.
+* When the Matter World creates its wall bounds, the left and right walls now extend further up and down than before, so that in a 4-wall setting there are no gaps in the corners, which previously allowed for fast moving objects that hit a corner intersection point to sometimes travel through it.
+* Touch inputs will now trigger a `POINTER_OUT` event if they leave the game (i.e. are released), where-as before they would only trigger the `POINTER_UP` event. Now, both happen (thanks @rgk)
### 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)
+* The `Mesh.setAlpha` method has been restored, even though it's empty and does nothing, to prevent runtime errors when adding a Mesh or Quad object to a Container. Fix #4338 #4343 (thanks @pfdtravalmatic @charmingny)
+* `KeyboardPlugin.checkDown` would always fail if using the new event system, because the time value it was checking wasn't updated.
+* Entering `Fullscreen` mode in the Scale Manager and then pressing ESC would leave the injected fullsceen div in the DOM, causing it to throw a node insertion failure the second time you wanted to enter fullscreen mode. Fix #4352 (thanks @ngdevr)
+* Due to the changes in the Input event system, the `GAME_OUT` event would never fire unless the input system was in legacy mode. The OUT and OVER handlers have been refactored and will now fire as soon as the DOM event happens. As a result the `InputManager._emitIsOverEvent` property has been removed, as the native event is sent directly to the handler and doesn't need storing locally any more. Fix #4344 (thanks @RademCZ)
+* Added `Zone.setBlendMode` method as a NOOP function, fixing a bug where if you added a Zone to a Container when running under Canvas it would fail. Fix #4295 (thanks @emanuel15)
+
+### 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:
+
+@maretana @CipSoft-Components @brian-lui
Please see the complete [Change Log](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md) for previous releases.
@@ -382,14 +387,14 @@ Phaser is a [Photon Storm](http://www.photonstorm.com) production.
Created by [Richard Davey](mailto:rich@photonstorm.com). Powered by coffee, anime, pixels and love.
-The Phaser logo and characters are © 2018 Photon Storm Limited.
+The Phaser logo and characters are © 2019 Photon Storm Limited.
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.15.1/phaser.js
-[get-minjs]: https://github.com/photonstorm/phaser/releases/download/v3.15.1/phaser.min.js
+[get-js]: https://github.com/photonstorm/phaser/releases/download/v3.16.2/phaser.js
+[get-minjs]: https://github.com/photonstorm/phaser/releases/download/v3.16.2/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
diff --git a/dist/phaser-arcade-physics.js b/dist/phaser-arcade-physics.js
index 40e97dc8e..0d99f593c 100644
--- a/dist/phaser-arcade-physics.js
+++ b/dist/phaser-arcade-physics.js
@@ -46,19 +46,34 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
-/******/ Object.defineProperty(exports, name, {
-/******/ configurable: false,
-/******/ enumerable: true,
-/******/ get: getter
-/******/ });
+/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
+/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
+/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
+/******/ // create a fake namespace object
+/******/ // mode & 1: value is a module id, require it
+/******/ // mode & 2: merge all properties of value into the ns
+/******/ // mode & 4: return value when already ns object
+/******/ // mode & 8|1: behave like require
+/******/ __webpack_require__.t = function(value, mode) {
+/******/ if(mode & 1) value = __webpack_require__(value);
+/******/ if(mode & 8) return value;
+/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
+/******/ var ns = Object.create(null);
+/******/ __webpack_require__.r(ns);
+/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
+/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
+/******/ return ns;
+/******/ };
+/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
@@ -76,7 +91,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/
/******/
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 1078);
+/******/ return __webpack_require__(__webpack_require__.s = 1299);
/******/ })
/************************************************************************/
/******/ ([
@@ -85,7 +100,7 @@ return /******/ (function(modules) { // webpackBootstrap
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -323,7 +338,7 @@ module.exports = Class;
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -350,7 +365,7 @@ module.exports = NOOP;
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -393,7 +408,7 @@ module.exports = GetFastValue;
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -856,14 +871,14 @@ var Vector2 = new Class({
},
/**
- * [description]
+ * Calculate the cross product of this Vector and the given Vector.
*
* @method Phaser.Math.Vector2#cross
* @since 3.0.0
*
- * @param {Phaser.Math.Vector2} src - [description]
+ * @param {Phaser.Math.Vector2} src - The Vector2 to cross with this Vector2.
*
- * @return {number} [description]
+ * @return {number} The cross product of this Vector and the given Vector.
*/
cross: function (src)
{
@@ -960,14 +975,76 @@ var Vector2 = new Class({
/**
* A static zero Vector2 for use by reference.
+ *
+ * This constant is meant for comparison operations and should not be modified directly.
*
* @constant
* @name Phaser.Math.Vector2.ZERO
- * @type {Vector2}
+ * @type {Phaser.Math.Vector2}
* @since 3.1.0
*/
Vector2.ZERO = new Vector2();
+/**
+ * A static right Vector2 for use by reference.
+ *
+ * This constant is meant for comparison operations and should not be modified directly.
+ *
+ * @constant
+ * @name Phaser.Math.Vector2.RIGHT
+ * @type {Phaser.Math.Vector2}
+ * @since 3.16.0
+ */
+Vector2.RIGHT = new Vector2(1, 0);
+
+/**
+ * A static left Vector2 for use by reference.
+ *
+ * This constant is meant for comparison operations and should not be modified directly.
+ *
+ * @constant
+ * @name Phaser.Math.Vector2.LEFT
+ * @type {Phaser.Math.Vector2}
+ * @since 3.16.0
+ */
+Vector2.LEFT = new Vector2(-1, 0);
+
+/**
+ * A static up Vector2 for use by reference.
+ *
+ * This constant is meant for comparison operations and should not be modified directly.
+ *
+ * @constant
+ * @name Phaser.Math.Vector2.UP
+ * @type {Phaser.Math.Vector2}
+ * @since 3.16.0
+ */
+Vector2.UP = new Vector2(0, -1);
+
+/**
+ * A static down Vector2 for use by reference.
+ *
+ * This constant is meant for comparison operations and should not be modified directly.
+ *
+ * @constant
+ * @name Phaser.Math.Vector2.DOWN
+ * @type {Phaser.Math.Vector2}
+ * @since 3.16.0
+ */
+Vector2.DOWN = new Vector2(0, 1);
+
+/**
+ * A static one Vector2 for use by reference.
+ *
+ * This constant is meant for comparison operations and should not be modified directly.
+ *
+ * @constant
+ * @name Phaser.Math.Vector2.ONE
+ * @type {Phaser.Math.Vector2}
+ * @since 3.16.0
+ */
+Vector2.ONE = new Vector2(1, 1);
+
module.exports = Vector2;
@@ -977,7 +1054,7 @@ module.exports = Vector2;
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -1007,7 +1084,7 @@ var GetValue = function (source, key, defaultValue)
{
return source[key];
}
- else if (key.indexOf('.'))
+ else if (key.indexOf('.') !== -1)
{
var keys = key.split('.');
var parent = source;
@@ -1048,12 +1125,13 @@ module.exports = GetValue;
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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);
+var PluginCache = __webpack_require__(17);
+var SceneEvents = __webpack_require__(16);
/**
* @classdesc
@@ -1116,8 +1194,8 @@ var GameObjectFactory = new Class({
*/
this.updateList;
- scene.sys.events.once('boot', this.boot, this);
- scene.sys.events.on('start', this.start, this);
+ scene.sys.events.once(SceneEvents.BOOT, this.boot, this);
+ scene.sys.events.on(SceneEvents.START, this.start, this);
},
/**
@@ -1133,7 +1211,7 @@ var GameObjectFactory = new Class({
this.displayList = this.systems.displayList;
this.updateList = this.systems.updateList;
- this.systems.events.once('destroy', this.destroy, this);
+ this.systems.events.once(SceneEvents.DESTROY, this.destroy, this);
},
/**
@@ -1147,7 +1225,7 @@ var GameObjectFactory = new Class({
*/
start: function ()
{
- this.systems.events.once('shutdown', this.shutdown, this);
+ this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this);
},
/**
@@ -1188,7 +1266,7 @@ var GameObjectFactory = new Class({
*/
shutdown: function ()
{
- this.systems.events.off('shutdown', this.shutdown, this);
+ this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this);
},
/**
@@ -1203,7 +1281,7 @@ var GameObjectFactory = new Class({
{
this.shutdown();
- this.scene.sys.events.off('start', this.start, this);
+ this.scene.sys.events.off(SceneEvents.START, this.start, this);
this.scene = null;
this.systems = null;
@@ -1235,7 +1313,7 @@ module.exports = GameObjectFactory;
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -1316,12 +1394,16 @@ module.exports = Point;
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
var types = {};
+/**
+ * @namespace Phaser.Loader.FileTypesManager
+ */
+
var FileTypesManager = {
/**
@@ -1330,7 +1412,7 @@ var FileTypesManager = {
* Loops through the local types object and injects all of them as
* properties into the LoaderPlugin instance.
*
- * @method Phaser.Loader.FileTypesManager.register
+ * @method Phaser.Loader.FileTypesManager.install
* @since 3.0.0
*
* @param {Phaser.Loader.LoaderPlugin} loader - The LoaderPlugin to install the types into.
@@ -1381,7 +1463,7 @@ module.exports = FileTypesManager;
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -1433,20 +1515,155 @@ module.exports = IsPlainObject;
/***/ }),
/* 9 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @author Felipe Alfonso <@bitnenfer>
+ * @copyright 2019 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 - Green component in a range from 0.0 to 1.0
+ * @param {number} b - Blue component in a range from 0.0 to 1.0
+ * @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;
+ }
+
+};
+
+
+/***/ }),
+/* 10 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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);
+var Contains = __webpack_require__(42);
+var GetPoint = __webpack_require__(204);
+var GetPoints = __webpack_require__(430);
+var Line = __webpack_require__(59);
+var Random = __webpack_require__(201);
/**
* @classdesc
@@ -1930,141 +2147,6 @@ var Rectangle = new Class({
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__) {
@@ -2414,51 +2496,52 @@ if (true) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var MATH = __webpack_require__(16);
+var MATH = __webpack_require__(20);
var GetValue = __webpack_require__(4);
-// Allowed types:
-
-// Implicit
-// {
-// x: 4
-// }
-//
-// From function
-// {
-// x: function ()
-// }
-//
-// Randomly pick one element from the array
-// {
-// x: [a, b, c, d, e, f]
-// }
-//
-// Random integer between min and max:
-// {
-// x: { randInt: [min, max] }
-// }
-//
-// Random float between min and max:
-// {
-// x: { randFloat: [min, max] }
-// }
-
/**
- * [description]
+ * Retrieves a value from an object. Allows for more advanced selection options, including:
+ *
+ * Allowed types:
+ *
+ * Implicit
+ * {
+ * x: 4
+ * }
+ *
+ * From function
+ * {
+ * x: function ()
+ * }
+ *
+ * Randomly pick one element from the array
+ * {
+ * x: [a, b, c, d, e, f]
+ * }
+ *
+ * Random integer between min and max:
+ * {
+ * x: { randInt: [min, max] }
+ * }
+ *
+ * Random float between min and max:
+ * {
+ * x: { randFloat: [min, max] }
+ * }
+ *
*
* @function Phaser.Utils.Objects.GetAdvancedValue
* @since 3.0.0
*
- * @param {object} source - [description]
- * @param {string} key - [description]
- * @param {*} defaultValue - [description]
+ * @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 {*} [description]
+ * @return {*} The value of the requested key.
*/
var GetAdvancedValue = function (source, key, defaultValue)
{
@@ -2500,12 +2583,54 @@ module.exports = GetAdvancedValue;
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @namespace Phaser.GameObjects.Components
+ */
+
+module.exports = {
+
+ Alpha: __webpack_require__(435),
+ Animation: __webpack_require__(460),
+ BlendMode: __webpack_require__(432),
+ ComputedSize: __webpack_require__(1248),
+ Crop: __webpack_require__(1247),
+ Depth: __webpack_require__(431),
+ Flip: __webpack_require__(1246),
+ GetBounds: __webpack_require__(1245),
+ Mask: __webpack_require__(427),
+ Origin: __webpack_require__(1244),
+ Pipeline: __webpack_require__(200),
+ ScaleMode: __webpack_require__(1243),
+ ScrollFactor: __webpack_require__(424),
+ Size: __webpack_require__(1242),
+ Texture: __webpack_require__(1241),
+ TextureCrop: __webpack_require__(1240),
+ Tint: __webpack_require__(1239),
+ ToJSON: __webpack_require__(423),
+ Transform: __webpack_require__(422),
+ TransformMatrix: __webpack_require__(41),
+ Visible: __webpack_require__(421)
+
+};
+
+
+/***/ }),
+/* 14 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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);
+var PluginCache = __webpack_require__(17);
+var SceneEvents = __webpack_require__(16);
/**
* @classdesc
@@ -2569,8 +2694,8 @@ var GameObjectCreator = new Class({
*/
this.updateList;
- scene.sys.events.once('boot', this.boot, this);
- scene.sys.events.on('start', this.start, this);
+ scene.sys.events.once(SceneEvents.BOOT, this.boot, this);
+ scene.sys.events.on(SceneEvents.START, this.start, this);
},
/**
@@ -2586,7 +2711,7 @@ var GameObjectCreator = new Class({
this.displayList = this.systems.displayList;
this.updateList = this.systems.updateList;
- this.systems.events.once('destroy', this.destroy, this);
+ this.systems.events.once(SceneEvents.DESTROY, this.destroy, this);
},
/**
@@ -2600,7 +2725,7 @@ var GameObjectCreator = new Class({
*/
start: function ()
{
- this.systems.events.once('shutdown', this.shutdown, this);
+ this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this);
},
/**
@@ -2613,7 +2738,7 @@ var GameObjectCreator = new Class({
*/
shutdown: function ()
{
- this.systems.events.off('shutdown', this.shutdown, this);
+ this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this);
},
/**
@@ -2628,7 +2753,7 @@ var GameObjectCreator = new Class({
{
this.shutdown();
- this.scene.sys.events.off('start', this.start, this);
+ this.scene.sys.events.off(SceneEvents.START, this.start, this);
this.scene = null;
this.systems = null;
@@ -2653,54 +2778,203 @@ PluginCache.register('GameObjectCreator', GameObjectCreator, 'make');
module.exports = GameObjectCreator;
-/***/ }),
-/* 14 */
-/***/ (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.GameObjects.Components
- */
-
-module.exports = {
-
- 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)
-
-};
-
-
/***/ }),
/* 15 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var FILE_CONST = {
+
+ /**
+ * The Loader is idle.
+ *
+ * @name Phaser.Loader.LOADER_IDLE
+ * @type {integer}
+ * @since 3.0.0
+ */
+ LOADER_IDLE: 0,
+
+ /**
+ * The Loader is actively loading.
+ *
+ * @name Phaser.Loader.LOADER_LOADING
+ * @type {integer}
+ * @since 3.0.0
+ */
+ LOADER_LOADING: 1,
+
+ /**
+ * The Loader is processing files is has loaded.
+ *
+ * @name Phaser.Loader.LOADER_PROCESSING
+ * @type {integer}
+ * @since 3.0.0
+ */
+ LOADER_PROCESSING: 2,
+
+ /**
+ * The Loader has completed loading and processing.
+ *
+ * @name Phaser.Loader.LOADER_COMPLETE
+ * @type {integer}
+ * @since 3.0.0
+ */
+ LOADER_COMPLETE: 3,
+
+ /**
+ * The Loader is shutting down.
+ *
+ * @name Phaser.Loader.LOADER_SHUTDOWN
+ * @type {integer}
+ * @since 3.0.0
+ */
+ LOADER_SHUTDOWN: 4,
+
+ /**
+ * The Loader has been destroyed.
+ *
+ * @name Phaser.Loader.LOADER_DESTROYED
+ * @type {integer}
+ * @since 3.0.0
+ */
+ LOADER_DESTROYED: 5,
+
+ /**
+ * File is in the load queue but not yet started
+ *
+ * @name Phaser.Loader.FILE_PENDING
+ * @type {integer}
+ * @since 3.0.0
+ */
+ FILE_PENDING: 10,
+
+ /**
+ * File has been started to load by the loader (onLoad called)
+ *
+ * @name Phaser.Loader.FILE_LOADING
+ * @type {integer}
+ * @since 3.0.0
+ */
+ FILE_LOADING: 11,
+
+ /**
+ * File has loaded successfully, awaiting processing
+ *
+ * @name Phaser.Loader.FILE_LOADED
+ * @type {integer}
+ * @since 3.0.0
+ */
+ FILE_LOADED: 12,
+
+ /**
+ * File failed to load
+ *
+ * @name Phaser.Loader.FILE_FAILED
+ * @type {integer}
+ * @since 3.0.0
+ */
+ FILE_FAILED: 13,
+
+ /**
+ * File is being processed (onProcess callback)
+ *
+ * @name Phaser.Loader.FILE_PROCESSING
+ * @type {integer}
+ * @since 3.0.0
+ */
+ FILE_PROCESSING: 14,
+
+ /**
+ * The File has errored somehow during processing.
+ *
+ * @name Phaser.Loader.FILE_ERRORED
+ * @type {integer}
+ * @since 3.0.0
+ */
+ FILE_ERRORED: 16,
+
+ /**
+ * File has finished processing.
+ *
+ * @name Phaser.Loader.FILE_COMPLETE
+ * @type {integer}
+ * @since 3.0.0
+ */
+ FILE_COMPLETE: 17,
+
+ /**
+ * File has been destroyed
+ *
+ * @name Phaser.Loader.FILE_DESTROYED
+ * @type {integer}
+ * @since 3.0.0
+ */
+ FILE_DESTROYED: 18,
+
+ /**
+ * File was populated from local data and doesn't need an HTTP request
+ *
+ * @name Phaser.Loader.FILE_POPULATED
+ * @type {integer}
+ * @since 3.0.0
+ */
+ FILE_POPULATED: 19
+
+};
+
+module.exports = FILE_CONST;
+
+
+/***/ }),
+/* 16 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @namespace Phaser.Scenes.Events
+ */
+
+module.exports = {
+
+ BOOT: __webpack_require__(1115),
+ DESTROY: __webpack_require__(1114),
+ PAUSE: __webpack_require__(1113),
+ POST_UPDATE: __webpack_require__(1112),
+ PRE_UPDATE: __webpack_require__(1111),
+ READY: __webpack_require__(1110),
+ RENDER: __webpack_require__(1109),
+ RESUME: __webpack_require__(1108),
+ SHUTDOWN: __webpack_require__(1107),
+ SLEEP: __webpack_require__(1106),
+ START: __webpack_require__(1105),
+ TRANSITION_COMPLETE: __webpack_require__(1104),
+ TRANSITION_INIT: __webpack_require__(1103),
+ TRANSITION_OUT: __webpack_require__(1102),
+ TRANSITION_START: __webpack_require__(1101),
+ TRANSITION_WAKE: __webpack_require__(1100),
+ UPDATE: __webpack_require__(1099),
+ WAKE: __webpack_require__(1098)
+
+};
+
+
+/***/ }),
+/* 17 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -2730,6 +3004,10 @@ var customPlugins = {};
var PluginCache = {};
+/**
+ * @namespace Phaser.Plugins.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)
@@ -2915,337 +3193,21 @@ PluginCache.destroyCustomPlugins = function ()
module.exports = PluginCache;
-/***/ }),
-/* 16 */
-/***/ (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 RND = __webpack_require__(404);
-
-var MATH_CONST = {
-
- /**
- * The value of PI * 2.
- *
- * @name Phaser.Math.PI2
- * @type {number}
- * @since 3.0.0
- */
- PI2: Math.PI * 2,
-
- /**
- * The value of PI * 0.5.
- *
- * @name Phaser.Math.TAU
- * @type {number}
- * @since 3.0.0
- */
- TAU: Math.PI * 0.5,
-
- /**
- * An epsilon value (1.0e-6)
- *
- * @name Phaser.Math.EPSILON
- * @type {number}
- * @since 3.0.0
- */
- EPSILON: 1.0e-6,
-
- /**
- * For converting degrees to radians (PI / 180)
- *
- * @name Phaser.Math.DEG_TO_RAD
- * @type {number}
- * @since 3.0.0
- */
- DEG_TO_RAD: Math.PI / 180,
-
- /**
- * For converting radians to degrees (180 / PI)
- *
- * @name Phaser.Math.RAD_TO_DEG
- * @type {number}
- * @since 3.0.0
- */
- RAD_TO_DEG: 180 / Math.PI,
-
- /**
- * An instance of the Random Number Generator.
- *
- * @name Phaser.Math.RND
- * @type {Phaser.Math.RandomDataGenerator}
- * @since 3.0.0
- */
- RND: new RND()
-
-};
-
-module.exports = MATH_CONST;
-
-
-/***/ }),
-/* 17 */
-/***/ (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 GetFastValue = __webpack_require__(2);
-
-/**
- * @typedef {object} GetTilesWithinFilteringOptions
- *
- * @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
- *
- * @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 GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer)
-{
- 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;
-};
-
-module.exports = GetTilesWithin;
-
-
/***/ }),
/* 18 */
-/***/ (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 FILE_CONST = {
-
- /**
- * The Loader is idle.
- *
- * @name Phaser.Loader.LOADER_IDLE
- * @type {integer}
- * @since 3.0.0
- */
- LOADER_IDLE: 0,
-
- /**
- * The Loader is actively loading.
- *
- * @name Phaser.Loader.LOADER_LOADING
- * @type {integer}
- * @since 3.0.0
- */
- LOADER_LOADING: 1,
-
- /**
- * The Loader is processing files is has loaded.
- *
- * @name Phaser.Loader.LOADER_PROCESSING
- * @type {integer}
- * @since 3.0.0
- */
- LOADER_PROCESSING: 2,
-
- /**
- * The Loader has completed loading and processing.
- *
- * @name Phaser.Loader.LOADER_COMPLETE
- * @type {integer}
- * @since 3.0.0
- */
- LOADER_COMPLETE: 3,
-
- /**
- * The Loader is shutting down.
- *
- * @name Phaser.Loader.LOADER_SHUTDOWN
- * @type {integer}
- * @since 3.0.0
- */
- LOADER_SHUTDOWN: 4,
-
- /**
- * The Loader has been destroyed.
- *
- * @name Phaser.Loader.LOADER_DESTROYED
- * @type {integer}
- * @since 3.0.0
- */
- LOADER_DESTROYED: 5,
-
- /**
- * File is in the load queue but not yet started
- *
- * @name Phaser.Loader.FILE_PENDING
- * @type {integer}
- * @since 3.0.0
- */
- FILE_PENDING: 10,
-
- /**
- * File has been started to load by the loader (onLoad called)
- *
- * @name Phaser.Loader.FILE_LOADING
- * @type {integer}
- * @since 3.0.0
- */
- FILE_LOADING: 11,
-
- /**
- * File has loaded successfully, awaiting processing
- *
- * @name Phaser.Loader.FILE_LOADED
- * @type {integer}
- * @since 3.0.0
- */
- FILE_LOADED: 12,
-
- /**
- * File failed to load
- *
- * @name Phaser.Loader.FILE_FAILED
- * @type {integer}
- * @since 3.0.0
- */
- FILE_FAILED: 13,
-
- /**
- * File is being processed (onProcess callback)
- *
- * @name Phaser.Loader.FILE_PROCESSING
- * @type {integer}
- * @since 3.0.0
- */
- FILE_PROCESSING: 14,
-
- /**
- * The File has errored somehow during processing.
- *
- * @name Phaser.Loader.FILE_ERRORED
- * @type {integer}
- * @since 3.0.0
- */
- FILE_ERRORED: 16,
-
- /**
- * File has finished processing.
- *
- * @name Phaser.Loader.FILE_COMPLETE
- * @type {integer}
- * @since 3.0.0
- */
- FILE_COMPLETE: 17,
-
- /**
- * File has been destroyed
- *
- * @name Phaser.Loader.FILE_DESTROYED
- * @type {integer}
- * @since 3.0.0
- */
- FILE_DESTROYED: 18,
-
- /**
- * File was populated from local data and doesn't need an HTTP request
- *
- * @name Phaser.Loader.FILE_POPULATED
- * @type {integer}
- * @since 3.0.0
- */
- FILE_POPULATED: 19
-
-};
-
-module.exports = FILE_CONST;
-
-
-/***/ }),
-/* 19 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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 ComponentsToJSON = __webpack_require__(423);
+var DataManager = __webpack_require__(134);
var EventEmitter = __webpack_require__(11);
+var Events = __webpack_require__(133);
/**
* @classdesc
@@ -3293,6 +3255,22 @@ var GameObject = new Class({
*/
this.type = type;
+ /**
+ * The current state of this Game Object.
+ *
+ * Phaser itself will never modify this value, although plugins may do so.
+ *
+ * Use this property to track the state of a Game Object during its lifetime. For example, it could move from
+ * a state of 'moving', to 'attacking', to 'dead'. The state value should be an integer (ideally mapped to a constant
+ * in your game code), or a string. These are recommended to keep it light and simple, with fast comparisons.
+ * If you need to store complex data about your Game Object, look at using the Data Component instead.
+ *
+ * @name Phaser.GameObjects.GameObject#state
+ * @type {(integer|string)}
+ * @since 3.16.0
+ */
+ this.state = 0;
+
/**
* The parent Container of this Game Object, if it has one.
*
@@ -3449,6 +3427,30 @@ var GameObject = new Class({
return this;
},
+ /**
+ * Sets the current state of this Game Object.
+ *
+ * Phaser itself will never modify the State of a Game Object, although plugins may do so.
+ *
+ * For example, a Game Object could change from a state of 'moving', to 'attacking', to 'dead'.
+ * The state value should typically be an integer (ideally mapped to a constant
+ * in your game code), but could also be a string. It is recommended to keep it light and simple.
+ * If you need to store complex data about your Game Object, look at using the Data Component instead.
+ *
+ * @method Phaser.GameObjects.GameObject#setState
+ * @since 3.16.0
+ *
+ * @param {(integer|string)} value - The state of the Game Object.
+ *
+ * @return {this} This GameObject.
+ */
+ setState: function (value)
+ {
+ this.state = value;
+
+ return this;
+ },
+
/**
* Adds a Data Manager component to this Game Object.
*
@@ -3501,7 +3503,7 @@ var GameObject = new Class({
* 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`.
+ * 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.
@@ -3692,7 +3694,7 @@ var GameObject = new Class({
*/
willRender: function (camera)
{
- return !(GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter > 0 && (this.cameraFilter & camera.id)));
+ return !(GameObject.RENDER_MASK !== this.renderFlags || (this.cameraFilter !== 0 && (this.cameraFilter & camera.id)));
},
/**
@@ -3753,8 +3755,9 @@ var GameObject = new Class({
* Game Object Pool instead of destroying it, as destroyed objects cannot be resurrected.
*
* @method Phaser.GameObjects.GameObject#destroy
+ * @fires Phaser.GameObjects.Events#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)
@@ -3772,7 +3775,7 @@ var GameObject = new Class({
this.preDestroy.call(this);
}
- this.emit('destroy', this);
+ this.emit(Events.DESTROY, this);
var sys = this.scene.sys;
@@ -3832,12 +3835,12 @@ module.exports = GameObject;
/***/ }),
-/* 20 */
+/* 19 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -3853,7 +3856,7 @@ var IsPlainObject = __webpack_require__(8);
* @function Phaser.Utils.Objects.Extend
* @since 3.0.0
*
- * @return {object} [description]
+ * @return {object} The extended object.
*/
var Extend = function ()
{
@@ -3930,23 +3933,188 @@ var Extend = function ()
module.exports = Extend;
+/***/ }),
+/* 20 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var MATH_CONST = {
+
+ /**
+ * The value of PI * 2.
+ *
+ * @name Phaser.Math.PI2
+ * @type {number}
+ * @since 3.0.0
+ */
+ PI2: Math.PI * 2,
+
+ /**
+ * The value of PI * 0.5.
+ *
+ * @name Phaser.Math.TAU
+ * @type {number}
+ * @since 3.0.0
+ */
+ TAU: Math.PI * 0.5,
+
+ /**
+ * An epsilon value (1.0e-6)
+ *
+ * @name Phaser.Math.EPSILON
+ * @type {number}
+ * @since 3.0.0
+ */
+ EPSILON: 1.0e-6,
+
+ /**
+ * For converting degrees to radians (PI / 180)
+ *
+ * @name Phaser.Math.DEG_TO_RAD
+ * @type {number}
+ * @since 3.0.0
+ */
+ DEG_TO_RAD: Math.PI / 180,
+
+ /**
+ * For converting radians to degrees (180 / PI)
+ *
+ * @name Phaser.Math.RAD_TO_DEG
+ * @type {number}
+ * @since 3.0.0
+ */
+ RAD_TO_DEG: 180 / Math.PI,
+
+ /**
+ * An instance of the Random Number Generator.
+ * This is not set until the Game boots.
+ *
+ * @name Phaser.Math.RND
+ * @type {Phaser.Math.RandomDataGenerator}
+ * @since 3.0.0
+ */
+ RND: null
+
+};
+
+module.exports = MATH_CONST;
+
+
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var GetFastValue = __webpack_require__(2);
+
+/**
+ * @typedef {object} GetTilesWithinFilteringOptions
+ *
+ * @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
+ *
+ * @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 GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer)
+{
+ 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;
+};
+
+module.exports = GetTilesWithin;
+
+
+/***/ }),
+/* 22 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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 CONST = __webpack_require__(15);
+var Events = __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);
+var GetURL = __webpack_require__(152);
+var MergeXHRSettings = __webpack_require__(151);
+var XHRLoader = __webpack_require__(259);
+var XHRSettings = __webpack_require__(112);
/**
* @typedef {object} FileConfig
@@ -4251,7 +4419,9 @@ var File = new Class({
*/
onLoad: function (xhr, event)
{
- var success = !(event.target && event.target.status !== 200);
+ var localFileOk = ((xhr.responseURL && xhr.responseURL.indexOf('file://') === 0 && event.target.status === 0));
+
+ var success = !(event.target && event.target.status !== 200) || localFileOk;
// Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called.
if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599)
@@ -4270,6 +4440,7 @@ var File = new Class({
* @method Phaser.Loader.File#onError
* @since 3.0.0
*
+ * @param {XMLHttpRequest} xhr - The XMLHttpRequest that caused this onload event.
* @param {ProgressEvent} event - The DOM ProgressEvent that resulted from this error.
*/
onError: function ()
@@ -4283,6 +4454,7 @@ var File = new Class({
* Called during the file load progress. Is sent a DOM ProgressEvent.
*
* @method Phaser.Loader.File#onProgress
+ * @fires Phaser.Loader.Events#FILE_PROGRESS
* @since 3.0.0
*
* @param {ProgressEvent} event - The DOM ProgressEvent.
@@ -4296,7 +4468,7 @@ var File = new Class({
this.percentComplete = Math.min((this.bytesLoaded / this.bytesTotal), 1);
- this.loader.emit('fileprogress', this, this.percentComplete);
+ this.loader.emit(Events.FILE_PROGRESS, this, this.percentComplete);
}
},
@@ -4384,65 +4556,13 @@ var File = new Class({
this.pendingDestroy();
},
- /**
- * You can listen for this event from the LoaderPlugin. It is dispatched _every time_
- * a file loads and is sent 3 arguments, which allow you to identify the file:
- *
- * ```javascript
- * this.load.on('filecomplete', function (key, type, data) {
- * // Your handler code
- * });
- * ```
- *
- * @event Phaser.Loader.File#fileCompleteEvent
- * @param {string} key - The key of the file that just loaded and finished processing.
- * @param {string} type - The type of the file that just loaded and finished processing.
- * @param {any} data - The data of the file.
- */
-
- /**
- * You can listen for this event from the LoaderPlugin. It is dispatched only once per
- * file and you have to use a special listener handle to pick it up.
- *
- * The string of the event is based on the file type and the key you gave it, split up
- * using hyphens.
- *
- * For example, if you have loaded an image with a key of `monster`, you can listen for it
- * using the following:
- *
- * ```javascript
- * this.load.on('filecomplete-image-monster', function (key, type, data) {
- * // Your handler code
- * });
- * ```
- *
- * Or, if you have loaded a texture atlas with a key of `Level1`:
- *
- * ```javascript
- * this.load.on('filecomplete-atlas-Level1', function (key, type, data) {
- * // Your handler code
- * });
- * ```
- *
- * Or, if you have loaded a sprite sheet with a key of `Explosion` and a prefix of `GAMEOVER`:
- *
- * ```javascript
- * this.load.on('filecomplete-spritesheet-GAMEOVERExplosion', function (key, type, data) {
- * // Your handler code
- * });
- * ```
- *
- * @event Phaser.Loader.File#singleFileCompleteEvent
- * @param {any} data - The data of the file.
- */
-
/**
* Called once the file has been added to its cache and is now ready for deletion from the Loader.
* It will emit a `filecomplete` event from the LoaderPlugin.
*
* @method Phaser.Loader.File#pendingDestroy
- * @fires Phaser.Loader.File#fileCompleteEvent
- * @fires Phaser.Loader.File#singleFileCompleteEvent
+ * @fires Phaser.Loader.Events#FILE_COMPLETE
+ * @fires Phaser.Loader.Events#FILE_KEY_COMPLETE
* @since 3.7.0
*/
pendingDestroy: function (data)
@@ -4452,8 +4572,8 @@ var File = new Class({
var key = this.key;
var type = this.type;
- this.loader.emit('filecomplete', key, type, data);
- this.loader.emit('filecomplete-' + type + '-' + key, key, type, data);
+ this.loader.emit(Events.FILE_COMPLETE, key, type, data);
+ this.loader.emit(Events.FILE_KEY_COMPLETE + type + '-' + key, key, type, data);
this.loader.flagForRemoval(this);
},
@@ -4528,12 +4648,303 @@ module.exports = File;
/***/ }),
-/* 22 */
+/* 23 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Force a value within the boundaries by clamping it to the range `min`, `max`.
+ *
+ * @function Phaser.Math.Clamp
+ * @since 3.0.0
+ *
+ * @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 Clamp = function (value, min, max)
+{
+ return Math.max(min, Math.min(max, value));
+};
+
+module.exports = Clamp;
+
+
+/***/ }),
+/* 24 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var CONST = __webpack_require__(28);
+var Smoothing = __webpack_require__(130);
+
+// The pool into which the canvas elements are placed.
+var pool = [];
+
+// Automatically apply smoothing(false) to created Canvas elements
+var _disableContextSmoothing = false;
+
+/**
+ * The CanvasPool is a global static object, that allows Phaser to recycle and pool 2D Context Canvas DOM elements.
+ * It does not pool WebGL Contexts, because once the context options are set they cannot be modified again,
+ * which is useless for some of the Phaser pipelines / renderer.
+ *
+ * This singleton is instantiated as soon as Phaser loads, before a Phaser.Game instance has even been created.
+ * Which means all instances of Phaser Games on the same page can share the one single pool.
+ *
+ * @namespace Phaser.Display.Canvas.CanvasPool
+ * @since 3.0.0
+ */
+var CanvasPool = function ()
+{
+ /**
+ * Creates a new Canvas DOM element, or pulls one from the pool if free.
+ *
+ * @function Phaser.Display.Canvas.CanvasPool.create
+ * @since 3.0.0
+ *
+ * @param {*} parent - The parent of the Canvas object.
+ * @param {integer} [width=1] - The width of the Canvas.
+ * @param {integer} [height=1] - The height of the Canvas.
+ * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`.
+ * @param {boolean} [selfParent=false] - Use the generated Canvas element as the parent?
+ *
+ * @return {HTMLCanvasElement} The canvas element that was created or pulled from the pool
+ */
+ var create = function (parent, width, height, canvasType, selfParent)
+ {
+ if (width === undefined) { width = 1; }
+ if (height === undefined) { height = 1; }
+ if (canvasType === undefined) { canvasType = CONST.CANVAS; }
+ if (selfParent === undefined) { selfParent = false; }
+
+ var canvas;
+ var container = first(canvasType);
+
+ if (container === null)
+ {
+ container = {
+ parent: parent,
+ canvas: document.createElement('canvas'),
+ type: canvasType
+ };
+
+ if (canvasType === CONST.CANVAS)
+ {
+ pool.push(container);
+ }
+
+ canvas = container.canvas;
+ }
+ else
+ {
+ container.parent = parent;
+
+ canvas = container.canvas;
+ }
+
+ if (selfParent)
+ {
+ container.parent = canvas;
+ }
+
+ canvas.width = width;
+ canvas.height = height;
+
+ if (_disableContextSmoothing && canvasType === CONST.CANVAS)
+ {
+ Smoothing.disable(canvas.getContext('2d'));
+ }
+
+ return canvas;
+ };
+
+ /**
+ * Creates a new Canvas DOM element, or pulls one from the pool if free.
+ *
+ * @function Phaser.Display.Canvas.CanvasPool.create2D
+ * @since 3.0.0
+ *
+ * @param {*} parent - The parent of the Canvas object.
+ * @param {integer} [width=1] - The width of the Canvas.
+ * @param {integer} [height=1] - The height of the Canvas.
+ *
+ * @return {HTMLCanvasElement} The created canvas.
+ */
+ var create2D = function (parent, width, height)
+ {
+ return create(parent, width, height, CONST.CANVAS);
+ };
+
+ /**
+ * Creates a new Canvas DOM element, or pulls one from the pool if free.
+ *
+ * @function Phaser.Display.Canvas.CanvasPool.createWebGL
+ * @since 3.0.0
+ *
+ * @param {*} parent - The parent of the Canvas object.
+ * @param {integer} [width=1] - The width of the Canvas.
+ * @param {integer} [height=1] - The height of the Canvas.
+ *
+ * @return {HTMLCanvasElement} The created WebGL canvas.
+ */
+ var createWebGL = function (parent, width, height)
+ {
+ return create(parent, width, height, CONST.WEBGL);
+ };
+
+ /**
+ * Gets the first free canvas index from the pool.
+ *
+ * @function Phaser.Display.Canvas.CanvasPool.first
+ * @since 3.0.0
+ *
+ * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`.
+ *
+ * @return {HTMLCanvasElement} The first free canvas, or `null` if a WebGL canvas was requested or if the pool doesn't have free canvases.
+ */
+ var first = function (canvasType)
+ {
+ if (canvasType === undefined) { canvasType = CONST.CANVAS; }
+
+ if (canvasType === CONST.WEBGL)
+ {
+ return null;
+ }
+
+ for (var i = 0; i < pool.length; i++)
+ {
+ var container = pool[i];
+
+ if (!container.parent && container.type === canvasType)
+ {
+ return container;
+ }
+ }
+
+ return null;
+ };
+
+ /**
+ * Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use.
+ * The canvas has its width and height set to 1, and its parent attribute nulled.
+ *
+ * @function Phaser.Display.Canvas.CanvasPool.remove
+ * @since 3.0.0
+ *
+ * @param {*} parent - The canvas or the parent of the canvas to free.
+ */
+ var remove = function (parent)
+ {
+ // Check to see if the parent is a canvas object
+ var isCanvas = parent instanceof HTMLCanvasElement;
+
+ pool.forEach(function (container)
+ {
+ if ((isCanvas && container.canvas === parent) || (!isCanvas && container.parent === parent))
+ {
+ container.parent = null;
+ container.canvas.width = 1;
+ container.canvas.height = 1;
+ }
+ });
+ };
+
+ /**
+ * Gets the total number of used canvas elements in the pool.
+ *
+ * @function Phaser.Display.Canvas.CanvasPool.total
+ * @since 3.0.0
+ *
+ * @return {integer} The number of used canvases.
+ */
+ var total = function ()
+ {
+ var c = 0;
+
+ pool.forEach(function (container)
+ {
+ if (container.parent)
+ {
+ c++;
+ }
+ });
+
+ return c;
+ };
+
+ /**
+ * Gets the total number of free canvas elements in the pool.
+ *
+ * @function Phaser.Display.Canvas.CanvasPool.free
+ * @since 3.0.0
+ *
+ * @return {integer} The number of free canvases.
+ */
+ var free = function ()
+ {
+ return pool.length - total();
+ };
+
+ /**
+ * Disable context smoothing on any new Canvas element created.
+ *
+ * @function Phaser.Display.Canvas.CanvasPool.disableSmoothing
+ * @since 3.0.0
+ */
+ var disableSmoothing = function ()
+ {
+ _disableContextSmoothing = true;
+ };
+
+ /**
+ * Enable context smoothing on any new Canvas element created.
+ *
+ * @function Phaser.Display.Canvas.CanvasPool.enableSmoothing
+ * @since 3.0.0
+ */
+ var enableSmoothing = function ()
+ {
+ _disableContextSmoothing = false;
+ };
+
+ return {
+ create2D: create2D,
+ create: create,
+ createWebGL: createWebGL,
+ disableSmoothing: disableSmoothing,
+ enableSmoothing: enableSmoothing,
+ first: first,
+ free: free,
+ pool: pool,
+ remove: remove,
+ total: total
+ };
+};
+
+// If we export the called function here, it'll only be invoked once (not every time it's required).
+module.exports = CanvasPool();
+
+
+/***/ }),
+/* 25 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -4541,12 +4952,12 @@ module.exports = File;
* 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:
*
- * 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.
+ * 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.
*
@@ -4613,303 +5024,46 @@ module.exports = SetTransform;
/***/ }),
-/* 23 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Force a value within the boundaries by clamping it to the range `min`, `max`.
- *
- * @function Phaser.Math.Clamp
- * @since 3.0.0
- *
- * @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 Clamp = function (value, min, max)
-{
- return Math.max(min, Math.min(max, value));
-};
-
-module.exports = Clamp;
-
-
-/***/ }),
-/* 24 */
+/* 26 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var CONST = __webpack_require__(26);
-var Smoothing = __webpack_require__(120);
-
-// The pool into which the canvas elements are placed.
-var pool = [];
-
-// Automatically apply smoothing(false) to created Canvas elements
-var _disableContextSmoothing = false;
-
/**
- * The CanvasPool is a global static object, that allows Phaser to recycle and pool 2D Context Canvas DOM elements.
- * It does not pool WebGL Contexts, because once the context options are set they cannot be modified again,
- * which is useless for some of the Phaser pipelines / renderer.
- *
- * This singleton is instantiated as soon as Phaser loads, before a Phaser.Game instance has even been created.
- * Which means all instances of Phaser Games on the same page can share the one single pool.
- *
- * @namespace Phaser.Display.Canvas.CanvasPool
- * @since 3.0.0
+ * @namespace Phaser.Core.Events
*/
-var CanvasPool = function ()
-{
- /**
- * Creates a new Canvas DOM element, or pulls one from the pool if free.
- *
- * @function Phaser.Display.Canvas.CanvasPool.create
- * @since 3.0.0
- *
- * @param {*} parent - The parent of the Canvas object.
- * @param {integer} [width=1] - The width of the Canvas.
- * @param {integer} [height=1] - The height of the Canvas.
- * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`.
- * @param {boolean} [selfParent=false] - Use the generated Canvas element as the parent?
- *
- * @return {HTMLCanvasElement} [description]
- */
- var create = function (parent, width, height, canvasType, selfParent)
- {
- if (width === undefined) { width = 1; }
- if (height === undefined) { height = 1; }
- if (canvasType === undefined) { canvasType = CONST.CANVAS; }
- if (selfParent === undefined) { selfParent = false; }
- var canvas;
- var container = first(canvasType);
+module.exports = {
- if (container === null)
- {
- container = {
- parent: parent,
- canvas: document.createElement('canvas'),
- type: canvasType
- };
+ BLUR: __webpack_require__(1190),
+ BOOT: __webpack_require__(1189),
+ DESTROY: __webpack_require__(1188),
+ FOCUS: __webpack_require__(1187),
+ HIDDEN: __webpack_require__(1186),
+ PAUSE: __webpack_require__(1185),
+ POST_RENDER: __webpack_require__(1184),
+ POST_STEP: __webpack_require__(1183),
+ PRE_RENDER: __webpack_require__(1182),
+ PRE_STEP: __webpack_require__(1181),
+ READY: __webpack_require__(1180),
+ RESUME: __webpack_require__(1179),
+ STEP: __webpack_require__(1178),
+ VISIBLE: __webpack_require__(1177)
- if (canvasType === CONST.CANVAS)
- {
- pool.push(container);
- }
-
- canvas = container.canvas;
- }
- else
- {
- container.parent = parent;
-
- canvas = container.canvas;
- }
-
- if (selfParent)
- {
- container.parent = canvas;
- }
-
- canvas.width = width;
- canvas.height = height;
-
- if (_disableContextSmoothing && canvasType === CONST.CANVAS)
- {
- Smoothing.disable(canvas.getContext('2d'));
- }
-
- return canvas;
- };
-
- /**
- * Creates a new Canvas DOM element, or pulls one from the pool if free.
- *
- * @function Phaser.Display.Canvas.CanvasPool.create2D
- * @since 3.0.0
- *
- * @param {*} parent - The parent of the Canvas object.
- * @param {integer} [width=1] - The width of the Canvas.
- * @param {integer} [height=1] - The height of the Canvas.
- *
- * @return {HTMLCanvasElement} [description]
- */
- var create2D = function (parent, width, height)
- {
- return create(parent, width, height, CONST.CANVAS);
- };
-
- /**
- * Creates a new Canvas DOM element, or pulls one from the pool if free.
- *
- * @function Phaser.Display.Canvas.CanvasPool.createWebGL
- * @since 3.0.0
- *
- * @param {*} parent - The parent of the Canvas object.
- * @param {integer} [width=1] - The width of the Canvas.
- * @param {integer} [height=1] - The height of the Canvas.
- *
- * @return {HTMLCanvasElement} [description]
- */
- var createWebGL = function (parent, width, height)
- {
- return create(parent, width, height, CONST.WEBGL);
- };
-
- /**
- * Gets the first free canvas index from the pool.
- *
- * @function Phaser.Display.Canvas.CanvasPool.first
- * @since 3.0.0
- *
- * @param {integer} [canvasType=Phaser.CANVAS] - The type of the Canvas. Either `Phaser.CANVAS` or `Phaser.WEBGL`.
- *
- * @return {HTMLCanvasElement} [description]
- */
- var first = function (canvasType)
- {
- if (canvasType === undefined) { canvasType = CONST.CANVAS; }
-
- if (canvasType === CONST.WEBGL)
- {
- return null;
- }
-
- for (var i = 0; i < pool.length; i++)
- {
- var container = pool[i];
-
- if (!container.parent && container.type === canvasType)
- {
- return container;
- }
- }
-
- return null;
- };
-
- /**
- * Looks up a canvas based on its parent, and if found puts it back in the pool, freeing it up for re-use.
- * The canvas has its width and height set to 1, and its parent attribute nulled.
- *
- * @function Phaser.Display.Canvas.CanvasPool.remove
- * @since 3.0.0
- *
- * @param {*} parent - [description]
- */
- var remove = function (parent)
- {
- // Check to see if the parent is a canvas object
- var isCanvas = parent instanceof HTMLCanvasElement;
-
- pool.forEach(function (container)
- {
- if ((isCanvas && container.canvas === parent) || (!isCanvas && container.parent === parent))
- {
- container.parent = null;
- container.canvas.width = 1;
- container.canvas.height = 1;
- }
- });
- };
-
- /**
- * Gets the total number of used canvas elements in the pool.
- *
- * @function Phaser.Display.Canvas.CanvasPool.total
- * @since 3.0.0
- *
- * @return {integer} [description]
- */
- var total = function ()
- {
- var c = 0;
-
- pool.forEach(function (container)
- {
- if (container.parent)
- {
- c++;
- }
- });
-
- return c;
- };
-
- /**
- * Gets the total number of free canvas elements in the pool.
- *
- * @function Phaser.Display.Canvas.CanvasPool.free
- * @since 3.0.0
- *
- * @return {integer} [description]
- */
- var free = function ()
- {
- return pool.length - total();
- };
-
- /**
- * Disable context smoothing on any new Canvas element created.
- *
- * @function Phaser.Display.Canvas.CanvasPool.disableSmoothing
- * @since 3.0.0
- */
- var disableSmoothing = function ()
- {
- _disableContextSmoothing = true;
- };
-
- /**
- * Enable context smoothing on any new Canvas element created.
- *
- * @function Phaser.Display.Canvas.CanvasPool.enableSmoothing
- * @since 3.0.0
- */
- var enableSmoothing = function ()
- {
- _disableContextSmoothing = false;
- };
-
- return {
- create2D: create2D,
- create: create,
- createWebGL: createWebGL,
- disableSmoothing: disableSmoothing,
- enableSmoothing: enableSmoothing,
- first: first,
- free: free,
- pool: pool,
- remove: remove,
- total: total
- };
};
-// If we export the called function here, it'll only be invoked once (not every time it's required).
-module.exports = CanvasPool();
-
/***/ }),
-/* 25 */
+/* 27 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -4971,12 +5125,12 @@ module.exports = PropertyValueSet;
/***/ }),
-/* 26 */
+/* 28 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -4996,11 +5150,11 @@ var CONST = {
* @type {string}
* @since 3.0.0
*/
- VERSION: '3.15.1',
+ VERSION: '3.16.2',
- BlendModes: __webpack_require__(66),
+ BlendModes: __webpack_require__(60),
- ScaleModes: __webpack_require__(94),
+ ScaleModes: __webpack_require__(101),
/**
* AUTO Detect Renderer.
@@ -5109,19 +5263,19 @@ module.exports = CONST;
/***/ }),
-/* 27 */
+/* 29 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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);
+var Components = __webpack_require__(13);
+var GameObject = __webpack_require__(18);
+var Line = __webpack_require__(59);
/**
* @classdesc
@@ -5345,6 +5499,7 @@ var Shape = new Class({
* @method Phaser.GameObjects.Shape#setStrokeStyle
* @since 3.13.0
*
+ * @param {number} [lineWidth] - The width of line to stroke with. If not provided or undefined the Shape will not be stroked.
* @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.
*
@@ -5410,18 +5565,18 @@ module.exports = Shape;
/***/ }),
-/* 28 */
+/* 30 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var BlendModes = __webpack_require__(66);
+var BlendModes = __webpack_require__(60);
var GetAdvancedValue = __webpack_require__(12);
-var ScaleModes = __webpack_require__(94);
+var ScaleModes = __webpack_require__(101);
/**
* @typedef {object} GameObjectConfig
@@ -5563,12 +5718,12 @@ module.exports = BuildGameObject;
/***/ }),
-/* 29 */
+/* 31 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -5617,385 +5772,25 @@ module.exports = {
};
-/***/ }),
-/* 30 */
-/***/ (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 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.
- */
-var FillStyleCanvas = function (ctx, src, altColor)
-{
- var fillColor = (altColor) ? altColor : src.fillColor;
- var fillAlpha = src.fillAlpha;
-
- var red = ((fillColor & 0xFF0000) >>> 16);
- var green = ((fillColor & 0xFF00) >>> 8);
- var blue = (fillColor & 0xFF);
-
- ctx.fillStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + fillAlpha + ')';
-};
-
-module.exports = FillStyleCanvas;
-
-
-/***/ }),
-/* 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.
+ * @copyright 2019 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);
+var GetColor = __webpack_require__(191);
+var GetColor32 = __webpack_require__(409);
+var HSVToRGB = __webpack_require__(190);
+var RGBToHSV = __webpack_require__(408);
+
+/**
+ * @namespace Phaser.Display.Color
+ */
/**
* @classdesc
@@ -6841,12 +6636,411 @@ module.exports = Color;
/***/ }),
-/* 38 */
+/* 33 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * 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.
+ */
+var FillStyleCanvas = function (ctx, src, altColor)
+{
+ var fillColor = (altColor) ? altColor : src.fillColor;
+ var fillAlpha = src.fillAlpha;
+
+ var red = ((fillColor & 0xFF0000) >>> 16);
+ var green = ((fillColor & 0xFF00) >>> 8);
+ var blue = (fillColor & 0xFF);
+
+ ctx.fillStyle = 'rgba(' + red + ',' + green + ',' + blue + ',' + fillAlpha + ')';
+};
+
+module.exports = FillStyleCanvas;
+
+
+/***/ }),
+/* 34 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var CONST = __webpack_require__(20);
+
+/**
+ * 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;
+
+
+/***/ }),
+/* 35 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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 */,
+/* 37 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var GetTileAt = __webpack_require__(109);
+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 - 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;
+
+
+/***/ }),
+/* 38 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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,
+
+ /**
+ * Arcade Physics Group containing Dynamic Bodies.
+ *
+ * @name Phaser.Physics.Arcade.GROUP
+ * @readonly
+ * @type {number}
+ * @since 3.0.0
+ */
+ GROUP: 2,
+
+ /**
+ * A Tilemap Layer.
+ *
+ * @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;
+
+
+/***/ }),
+/* 39 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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;
+
+
+/***/ }),
+/* 40 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @namespace Phaser.Cameras.Scene2D.Events
+ */
+
+module.exports = {
+
+ DESTROY: __webpack_require__(1168),
+ FADE_IN_COMPLETE: __webpack_require__(1167),
+ FADE_IN_START: __webpack_require__(1166),
+ FADE_OUT_COMPLETE: __webpack_require__(1165),
+ FADE_OUT_START: __webpack_require__(1164),
+ FLASH_COMPLETE: __webpack_require__(1163),
+ FLASH_START: __webpack_require__(1162),
+ PAN_COMPLETE: __webpack_require__(1161),
+ PAN_START: __webpack_require__(1160),
+ POST_RENDER: __webpack_require__(1159),
+ PRE_RENDER: __webpack_require__(1158),
+ SHAKE_COMPLETE: __webpack_require__(1157),
+ SHAKE_START: __webpack_require__(1156),
+ ZOOM_COMPLETE: __webpack_require__(1155),
+ ZOOM_START: __webpack_require__(1154)
+
+};
+
+
+/***/ }),
+/* 41 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -7573,7 +7767,11 @@ var TransformMatrix = new Class({
},
/**
- * Decompose this Matrix into its translation, scale and rotation values.
+ * Decompose this Matrix into its translation, scale and rotation values using QR decomposition.
+ *
+ * The result must be applied in the following order to reproduce the current matrix:
+ *
+ * translate -> rotate -> scale
*
* @method Phaser.GameObjects.Components.TransformMatrix#decomposeMatrix
* @since 3.0.0
@@ -7596,21 +7794,33 @@ var TransformMatrix = new Class({
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);
+ var determ = a * d - b * c;
decomposedMatrix.translateX = matrix[4];
decomposedMatrix.translateY = matrix[5];
- decomposedMatrix.scaleX = sx;
- decomposedMatrix.scaleY = sy;
+ if (a || b)
+ {
+ var r = Math.sqrt(a * a + b * b);
- decomposedMatrix.rotation = Math.acos(a / sx) * (Math.atan(-c / a) < 0 ? -1 : 1);
+ decomposedMatrix.rotation = (b > 0) ? Math.acos(a / r) : -Math.acos(a / r);
+ decomposedMatrix.scaleX = r;
+ decomposedMatrix.scaleY = determ / r;
+ }
+ else if (c || d)
+ {
+ var s = Math.sqrt(c * c + d * d);
+
+ decomposedMatrix.rotation = Math.PI * 0.5 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s));
+ decomposedMatrix.scaleX = determ / s;
+ decomposedMatrix.scaleY = s;
+ }
+ else
+ {
+ decomposedMatrix.rotation = 0;
+ decomposedMatrix.scaleX = 0;
+ decomposedMatrix.scaleY = 0;
+ }
return decomposedMatrix;
},
@@ -7752,26 +7962,26 @@ module.exports = TransformMatrix;
/***/ }),
-/* 39 */
+/* 42 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
- * [description]
+ * Checks if a given point is inside a Rectangle's bounds.
*
* @function Phaser.Geom.Rectangle.Contains
* @since 3.0.0
*
- * @param {Phaser.Geom.Rectangle} rect - [description]
- * @param {number} x - [description]
- * @param {number} y - [description]
+ * @param {Phaser.Geom.Rectangle} rect - The Rectangle to check.
+ * @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 point is within the Rectangle's bounds, otherwise `false`.
*/
var Contains = function (rect, x, y)
{
@@ -7787,12 +7997,12 @@ module.exports = Contains;
/***/ }),
-/* 40 */
+/* 43 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -7828,12 +8038,12 @@ module.exports = Contains;
/***/ }),
-/* 41 */
+/* 44 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -7861,12 +8071,12 @@ module.exports = SetTop;
/***/ }),
-/* 42 */
+/* 45 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -7889,12 +8099,12 @@ module.exports = GetTop;
/***/ }),
-/* 43 */
+/* 46 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -7922,12 +8132,12 @@ module.exports = SetRight;
/***/ }),
-/* 44 */
+/* 47 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -7950,12 +8160,12 @@ module.exports = GetRight;
/***/ }),
-/* 45 */
+/* 48 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -7983,12 +8193,12 @@ module.exports = SetLeft;
/***/ }),
-/* 46 */
+/* 49 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -8011,12 +8221,12 @@ module.exports = GetLeft;
/***/ }),
-/* 47 */
+/* 50 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -8044,12 +8254,12 @@ module.exports = SetBottom;
/***/ }),
-/* 48 */
+/* 51 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -8072,12 +8282,75 @@ module.exports = GetBottom;
/***/ }),
-/* 49 */
+/* 52 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @namespace Phaser.Input.Events
+ */
+
+module.exports = {
+
+ BOOT: __webpack_require__(994),
+ DESTROY: __webpack_require__(993),
+ DRAG_END: __webpack_require__(992),
+ DRAG_ENTER: __webpack_require__(991),
+ DRAG: __webpack_require__(990),
+ DRAG_LEAVE: __webpack_require__(989),
+ DRAG_OVER: __webpack_require__(988),
+ DRAG_START: __webpack_require__(987),
+ DROP: __webpack_require__(986),
+ GAME_OUT: __webpack_require__(985),
+ GAME_OVER: __webpack_require__(984),
+ GAMEOBJECT_DOWN: __webpack_require__(983),
+ GAMEOBJECT_DRAG_END: __webpack_require__(982),
+ GAMEOBJECT_DRAG_ENTER: __webpack_require__(981),
+ GAMEOBJECT_DRAG: __webpack_require__(980),
+ GAMEOBJECT_DRAG_LEAVE: __webpack_require__(979),
+ GAMEOBJECT_DRAG_OVER: __webpack_require__(978),
+ GAMEOBJECT_DRAG_START: __webpack_require__(977),
+ GAMEOBJECT_DROP: __webpack_require__(976),
+ GAMEOBJECT_MOVE: __webpack_require__(975),
+ GAMEOBJECT_OUT: __webpack_require__(974),
+ GAMEOBJECT_OVER: __webpack_require__(973),
+ GAMEOBJECT_POINTER_DOWN: __webpack_require__(972),
+ GAMEOBJECT_POINTER_MOVE: __webpack_require__(971),
+ GAMEOBJECT_POINTER_OUT: __webpack_require__(970),
+ GAMEOBJECT_POINTER_OVER: __webpack_require__(969),
+ GAMEOBJECT_POINTER_UP: __webpack_require__(968),
+ GAMEOBJECT_UP: __webpack_require__(967),
+ MANAGER_BOOT: __webpack_require__(966),
+ MANAGER_PROCESS: __webpack_require__(965),
+ MANAGER_UPDATE: __webpack_require__(964),
+ POINTER_DOWN: __webpack_require__(963),
+ POINTER_DOWN_OUTSIDE: __webpack_require__(962),
+ POINTER_MOVE: __webpack_require__(961),
+ POINTER_OUT: __webpack_require__(960),
+ POINTER_OVER: __webpack_require__(959),
+ POINTER_UP: __webpack_require__(958),
+ POINTER_UP_OUTSIDE: __webpack_require__(957),
+ POINTERLOCK_CHANGE: __webpack_require__(956),
+ PRE_UPDATE: __webpack_require__(955),
+ SHUTDOWN: __webpack_require__(954),
+ START: __webpack_require__(953),
+ UPDATE: __webpack_require__(952)
+
+};
+
+
+/***/ }),
+/* 53 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -8123,12 +8396,12 @@ module.exports = WorldToTileY;
/***/ }),
-/* 50 */
+/* 54 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -8174,18 +8447,18 @@ module.exports = WorldToTileX;
/***/ }),
-/* 51 */
+/* 55 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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 CONST = __webpack_require__(15);
+var File = __webpack_require__(22);
var FileTypesManager = __webpack_require__(7);
var GetFastValue = __webpack_require__(2);
var GetValue = __webpack_require__(4);
@@ -8414,12 +8687,12 @@ module.exports = JSONFile;
/***/ }),
-/* 52 */
+/* 56 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -8448,12 +8721,12 @@ module.exports = DistanceBetween;
/***/ }),
-/* 53 */
+/* 57 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -8480,19 +8753,47 @@ module.exports = Wrap;
/***/ }),
-/* 54 */
+/* 58 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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;
+
+
+/***/ }),
+/* 59 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
var Class = __webpack_require__(0);
-var GetPoint = __webpack_require__(397);
-var GetPoints = __webpack_require__(189);
-var Random = __webpack_require__(188);
+var GetPoint = __webpack_require__(429);
+var GetPoints = __webpack_require__(203);
+var Random = __webpack_require__(202);
var Vector2 = __webpack_require__(3);
/**
@@ -8805,18 +9106,273 @@ module.exports = Line;
/***/ }),
-/* 55 */
+/* 60 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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. For Canvas and WebGL.
+ * This is the default setting and draws new shapes on top of the existing canvas content.
+ *
+ * @name Phaser.BlendModes.NORMAL
+ */
+ NORMAL: 0,
+
+ /**
+ * Add blend mode. For Canvas and WebGL.
+ * Where both shapes overlap the color is determined by adding color values.
+ *
+ * @name Phaser.BlendModes.ADD
+ */
+ ADD: 1,
+
+ /**
+ * Multiply blend mode. For Canvas and WebGL.
+ * The pixels are of the top layer are multiplied with the corresponding pixel of the bottom layer. A darker picture is the result.
+ *
+ * @name Phaser.BlendModes.MULTIPLY
+ */
+ MULTIPLY: 2,
+
+ /**
+ * Screen blend mode. For Canvas and WebGL.
+ * The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply)
+ *
+ * @name Phaser.BlendModes.SCREEN
+ */
+ SCREEN: 3,
+
+ /**
+ * Overlay blend mode. For Canvas only.
+ * A combination of multiply and screen. Dark parts on the base layer become darker, and light parts become lighter.
+ *
+ * @name Phaser.BlendModes.OVERLAY
+ */
+ OVERLAY: 4,
+
+ /**
+ * Darken blend mode. For Canvas only.
+ * Retains the darkest pixels of both layers.
+ *
+ * @name Phaser.BlendModes.DARKEN
+ */
+ DARKEN: 5,
+
+ /**
+ * Lighten blend mode. For Canvas only.
+ * Retains the lightest pixels of both layers.
+ *
+ * @name Phaser.BlendModes.LIGHTEN
+ */
+ LIGHTEN: 6,
+
+ /**
+ * Color Dodge blend mode. For Canvas only.
+ * Divides the bottom layer by the inverted top layer.
+ *
+ * @name Phaser.BlendModes.COLOR_DODGE
+ */
+ COLOR_DODGE: 7,
+
+ /**
+ * Color Burn blend mode. For Canvas only.
+ * Divides the inverted bottom layer by the top layer, and then inverts the result.
+ *
+ * @name Phaser.BlendModes.COLOR_BURN
+ */
+ COLOR_BURN: 8,
+
+ /**
+ * Hard Light blend mode. For Canvas only.
+ * A combination of multiply and screen like overlay, but with top and bottom layer swapped.
+ *
+ * @name Phaser.BlendModes.HARD_LIGHT
+ */
+ HARD_LIGHT: 9,
+
+ /**
+ * Soft Light blend mode. For Canvas only.
+ * A softer version of hard-light. Pure black or white does not result in pure black or white.
+ *
+ * @name Phaser.BlendModes.SOFT_LIGHT
+ */
+ SOFT_LIGHT: 10,
+
+ /**
+ * Difference blend mode. For Canvas only.
+ * Subtracts the bottom layer from the top layer or the other way round to always get a positive value.
+ *
+ * @name Phaser.BlendModes.DIFFERENCE
+ */
+ DIFFERENCE: 11,
+
+ /**
+ * Exclusion blend mode. For Canvas only.
+ * Like difference, but with lower contrast.
+ *
+ * @name Phaser.BlendModes.EXCLUSION
+ */
+ EXCLUSION: 12,
+
+ /**
+ * Hue blend mode. For Canvas only.
+ * Preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer.
+ *
+ * @name Phaser.BlendModes.HUE
+ */
+ HUE: 13,
+
+ /**
+ * Saturation blend mode. For Canvas only.
+ * Preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer.
+ *
+ * @name Phaser.BlendModes.SATURATION
+ */
+ SATURATION: 14,
+
+ /**
+ * Color blend mode. For Canvas only.
+ * Preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer.
+ *
+ * @name Phaser.BlendModes.COLOR
+ */
+ COLOR: 15,
+
+ /**
+ * Luminosity blend mode. For Canvas only.
+ * Preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer.
+ *
+ * @name Phaser.BlendModes.LUMINOSITY
+ */
+ LUMINOSITY: 16,
+
+ /**
+ * Alpha erase blend mode. For Canvas and WebGL.
+ *
+ * @name Phaser.BlendModes.ERASE
+ */
+ ERASE: 17,
+
+ /**
+ * Source-in blend mode. For Canvas only.
+ * The new shape is drawn only where both the new shape and the destination canvas overlap. Everything else is made transparent.
+ *
+ * @name Phaser.BlendModes.SOURCE_IN
+ */
+ SOURCE_IN: 18,
+
+ /**
+ * Source-out blend mode. For Canvas only.
+ * The new shape is drawn where it doesn't overlap the existing canvas content.
+ *
+ * @name Phaser.BlendModes.SOURCE_OUT
+ */
+ SOURCE_OUT: 19,
+
+ /**
+ * Source-out blend mode. For Canvas only.
+ * The new shape is only drawn where it overlaps the existing canvas content.
+ *
+ * @name Phaser.BlendModes.SOURCE_ATOP
+ */
+ SOURCE_ATOP: 20,
+
+ /**
+ * Destination-over blend mode. For Canvas only.
+ * New shapes are drawn behind the existing canvas content.
+ *
+ * @name Phaser.BlendModes.DESTINATION_OVER
+ */
+ DESTINATION_OVER: 21,
+
+ /**
+ * Destination-in blend mode. For Canvas only.
+ * The existing canvas content is kept where both the new shape and existing canvas content overlap. Everything else is made transparent.
+ *
+ * @name Phaser.BlendModes.DESTINATION_IN
+ */
+ DESTINATION_IN: 22,
+
+ /**
+ * Destination-out blend mode. For Canvas only.
+ * The existing content is kept where it doesn't overlap the new shape.
+ *
+ * @name Phaser.BlendModes.DESTINATION_OUT
+ */
+ DESTINATION_OUT: 23,
+
+ /**
+ * Destination-out blend mode. For Canvas only.
+ * The existing canvas is only kept where it overlaps the new shape. The new shape is drawn behind the canvas content.
+ *
+ * @name Phaser.BlendModes.DESTINATION_ATOP
+ */
+ DESTINATION_ATOP: 24,
+
+ /**
+ * Lighten blend mode. For Canvas only.
+ * Where both shapes overlap the color is determined by adding color values.
+ *
+ * @name Phaser.BlendModes.LIGHTER
+ */
+ LIGHTER: 25,
+
+ /**
+ * Copy blend mode. For Canvas only.
+ * Only the new shape is shown.
+ *
+ * @name Phaser.BlendModes.COPY
+ */
+ COPY: 26,
+
+ /**
+ * xor blend mode. For Canvas only.
+ * Shapes are made transparent where both overlap and drawn normal everywhere else.
+ *
+ * @name Phaser.BlendModes.XOR
+ */
+ XOR: 27
+
+};
+
+
+/***/ }),
+/* 61 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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 Rectangle = __webpack_require__(265);
+var Components = __webpack_require__(13);
+var Rectangle = __webpack_require__(270);
/**
* @classdesc
@@ -9520,7 +10076,9 @@ var Tile = new Class({
// bottom left, while the Phaser renderer assumes the origin is the top left. The y
// coordinate needs to be adjusted by the difference.
this.pixelX = this.x * this.baseWidth;
- this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight);
+ this.pixelY = this.y * this.baseHeight;
+
+ // this.pixelY = this.y * this.baseHeight - (this.height - this.baseHeight);
return this;
},
@@ -9571,8 +10129,9 @@ var Tile = new Class({
},
/**
- * The tileset that contains this Tile. This will only return null if accessed from a LayerData
- * instance before the tile is placed within a StaticTilemapLayer or DynamicTilemapLayer.
+ * The tileset that contains this Tile. This is null if accessed from a LayerData instance
+ * before the tile is placed in a StaticTilemapLayer or DynamicTilemapLayer, or if the tile has
+ * an index that doesn't correspond to any of the map's tilesets.
*
* @name Phaser.Tilemaps.Tile#tileset
* @type {?Phaser.Tilemaps.Tileset}
@@ -9580,11 +10139,24 @@ var Tile = new Class({
* @since 3.0.0
*/
tileset: {
+
get: function ()
{
- var tilemapLayer = this.tilemapLayer;
- return tilemapLayer ? tilemapLayer.tileset : null;
+ var tilemapLayer = this.layer.tilemapLayer;
+
+ if (tilemapLayer)
+ {
+ var tileset = tilemapLayer.gidMap[this.index];
+
+ if (tileset)
+ {
+ return tileset;
+ }
+ }
+
+ return null;
}
+
},
/**
@@ -9627,12 +10199,12 @@ module.exports = Tile;
/***/ }),
-/* 56 */
+/* 62 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -9663,12 +10235,12 @@ module.exports = SetTileCollision;
/***/ }),
-/* 57 */
+/* 63 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -9857,18 +10429,18 @@ module.exports = MultiFile;
/***/ }),
-/* 58 */
+/* 64 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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 CONST = __webpack_require__(15);
+var File = __webpack_require__(22);
var FileTypesManager = __webpack_require__(7);
var GetFastValue = __webpack_require__(2);
var IsPlainObject = __webpack_require__(8);
@@ -10153,21 +10725,21 @@ module.exports = ImageFile;
/***/ }),
-/* 59 */
+/* 65 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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);
+var Contains = __webpack_require__(74);
+var GetPoint = __webpack_require__(283);
+var GetPoints = __webpack_require__(282);
+var Line = __webpack_require__(59);
+var Random = __webpack_require__(198);
/**
* @classdesc
@@ -10588,16 +11160,16 @@ module.exports = Triangle;
/***/ }),
-/* 60 */
+/* 66 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var Utils = __webpack_require__(10);
+var Utils = __webpack_require__(9);
/**
* Renders a stroke outline around the given Shape.
@@ -10663,19 +11235,19 @@ module.exports = StrokePathWebGL;
/***/ }),
-/* 61 */
+/* 67 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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 SpriteRender = __webpack_require__(829);
+var Components = __webpack_require__(13);
+var GameObject = __webpack_require__(18);
+var SpriteRender = __webpack_require__(852);
/**
* @classdesc
@@ -10843,12 +11415,12 @@ module.exports = Sprite;
/***/ }),
-/* 62 */
+/* 68 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -10892,12 +11464,53 @@ module.exports = SafeRange;
/***/ }),
-/* 63 */
+/* 69 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @namespace Phaser.Sound.Events
+ */
+
+module.exports = {
+
+ COMPLETE: __webpack_require__(932),
+ DESTROY: __webpack_require__(931),
+ DETUNE: __webpack_require__(930),
+ GLOBAL_DETUNE: __webpack_require__(929),
+ GLOBAL_MUTE: __webpack_require__(928),
+ GLOBAL_RATE: __webpack_require__(927),
+ GLOBAL_VOLUME: __webpack_require__(926),
+ LOOP: __webpack_require__(925),
+ LOOPED: __webpack_require__(924),
+ MUTE: __webpack_require__(923),
+ PAUSE_ALL: __webpack_require__(922),
+ PAUSE: __webpack_require__(921),
+ PLAY: __webpack_require__(920),
+ RATE: __webpack_require__(919),
+ RESUME_ALL: __webpack_require__(918),
+ RESUME: __webpack_require__(917),
+ SEEK: __webpack_require__(916),
+ STOP_ALL: __webpack_require__(915),
+ STOP: __webpack_require__(914),
+ UNLOCKED: __webpack_require__(913),
+ VOLUME: __webpack_require__(912)
+
+};
+
+
+/***/ }),
+/* 70 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -10934,47 +11547,40 @@ module.exports = Clone;
/***/ }),
-/* 64 */
+/* 71 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-// 2.1.1 (Mar 17, 2016)
+// Earcut 2.1.4 (December 4th 2018)
/*
-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.
+ * 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;
@@ -10984,9 +11590,9 @@ function earcut(data, holeIndices, dim) {
outerNode = linkedList(data, 0, outerLen, dim, true),
triangles = [];
- if (!outerNode) return triangles;
+ if (!outerNode || outerNode.next === outerNode.prev) return triangles;
- var minX, minY, maxX, maxY, x, y, size;
+ var minX, minY, maxX, maxY, x, y, invSize;
if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
@@ -11004,11 +11610,12 @@ function earcut(data, holeIndices, dim) {
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);
+ // minX, minY and invSize are later used to transform coords into integers for z-order calculation
+ invSize = Math.max(maxX - minX, maxY - minY);
+ invSize = invSize !== 0 ? 1 / invSize : 0;
}
- earcutLinked(outerNode, triangles, dim, minX, minY, size);
+ earcutLinked(outerNode, triangles, dim, minX, minY, invSize);
return triangles;
}
@@ -11044,7 +11651,7 @@ function filterPoints(start, end) {
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;
+ if (p === p.next) break;
again = true;
} else {
@@ -11056,11 +11663,11 @@ function filterPoints(start, end) {
}
// main ear slicing loop which triangulates a polygon (given as a linked list)
-function earcutLinked(ear, triangles, dim, minX, minY, size, pass) {
+function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
if (!ear) return;
// interlink polygon nodes in z-order
- if (!pass && size) indexCurve(ear, minX, minY, size);
+ if (!pass && invSize) indexCurve(ear, minX, minY, invSize);
var stop = ear,
prev, next;
@@ -11070,7 +11677,7 @@ function earcutLinked(ear, triangles, dim, minX, minY, size, pass) {
prev = ear.prev;
next = ear.next;
- if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) {
+ if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
// cut off the triangle
triangles.push(prev.i / dim);
triangles.push(ear.i / dim);
@@ -11078,7 +11685,7 @@ function earcutLinked(ear, triangles, dim, minX, minY, size, pass) {
removeNode(ear);
- // skipping the next vertice leads to less sliver triangles
+ // skipping the next vertex leads to less sliver triangles
ear = next.next;
stop = next.next;
@@ -11091,16 +11698,16 @@ function earcutLinked(ear, triangles, dim, minX, minY, size, pass) {
if (ear === stop) {
// try filtering points and slicing again
if (!pass) {
- earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1);
+ earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 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);
+ earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
// as a last resort, try splitting the remaining polygon into two
} else if (pass === 2) {
- splitEarcut(ear, triangles, dim, minX, minY, size);
+ splitEarcut(ear, triangles, dim, minX, minY, invSize);
}
break;
@@ -11128,7 +11735,7 @@ function isEar(ear) {
return true;
}
-function isEarHashed(ear, minX, minY, size) {
+function isEarHashed(ear, minX, minY, invSize) {
var a = ear.prev,
b = ear,
c = ear.next;
@@ -11142,22 +11749,26 @@ function isEarHashed(ear, minX, minY, size) {
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);
+ var minZ = zOrder(minTX, minTY, minX, minY, invSize),
+ maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);
- // first look for points inside the triangle in increasing z-order
- var p = ear.nextZ;
+ var p = ear.prevZ,
+ n = ear.nextZ;
- while (p && p.z <= maxZ) {
+ // look for points inside the triangle in both directions
+ while (p && p.z >= minZ && n && n.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;
+ p = p.prevZ;
+
+ if (n !== ear.prev && n !== ear.next &&
+ pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&
+ area(n.prev, n, n.next) >= 0) return false;
+ n = n.nextZ;
}
- // then look for points in decreasing z-order
- p = ear.prevZ;
-
+ // look for remaining points in decreasing z-order
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) &&
@@ -11165,6 +11776,14 @@ function isEarHashed(ear, minX, minY, size) {
p = p.prevZ;
}
+ // look for remaining points in increasing z-order
+ while (n && n.z <= maxZ) {
+ if (n !== ear.prev && n !== ear.next &&
+ pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&
+ area(n.prev, n, n.next) >= 0) return false;
+ n = n.nextZ;
+ }
+
return true;
}
@@ -11194,7 +11813,7 @@ function cureLocalIntersections(start, triangles, dim) {
}
// try splitting polygon into two and triangulate them independently
-function splitEarcut(start, triangles, dim, minX, minY, size) {
+function splitEarcut(start, triangles, dim, minX, minY, invSize) {
// look for a valid diagonal that divides the polygon into two
var a = start;
do {
@@ -11209,8 +11828,8 @@ function splitEarcut(start, triangles, dim, minX, minY, size) {
c = filterPoints(c, c.next);
// run earcut on each half
- earcutLinked(a, triangles, dim, minX, minY, size);
- earcutLinked(c, triangles, dim, minX, minY, size);
+ earcutLinked(a, triangles, dim, minX, minY, invSize);
+ earcutLinked(c, triangles, dim, minX, minY, invSize);
return;
}
b = b.next;
@@ -11316,10 +11935,10 @@ function findHoleBridge(hole, outerNode) {
}
// interlink polygon nodes in z-order
-function indexCurve(start, minX, minY, size) {
+function indexCurve(start, minX, minY, invSize) {
var p = start;
do {
- if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);
+ if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);
p.prevZ = p.prev;
p.nextZ = p.next;
p = p.next;
@@ -11384,11 +12003,11 @@ function sortLinked(list) {
return list;
}
-// z-order of a point given coords and size of the data bounding box
-function zOrder(x, y, minX, minY, size) {
+// z-order of a point given coords and inverse of the longer side of data bbox
+function zOrder(x, y, minX, minY, invSize) {
// coords are transformed into non-negative 15-bit integer range
- x = 32767 * (x - minX) / size;
- y = 32767 * (y - minY) / size;
+ x = 32767 * (x - minX) * invSize;
+ y = 32767 * (y - minY) * invSize;
x = (x | (x << 8)) & 0x00FF00FF;
x = (x | (x << 4)) & 0x0F0F0F0F;
@@ -11530,14 +12149,14 @@ function removeNode(p) {
}
function Node(i, x, y) {
- // vertice index in coordinates array
+ // vertex index in coordinates array
this.i = i;
// vertex coordinates
this.x = x;
this.y = y;
- // previous and next vertice nodes in a polygon ring
+ // previous and next vertex nodes in a polygon ring
this.prev = null;
this.next = null;
@@ -11608,193 +12227,15 @@ earcut.flatten = function (data) {
return result;
};
+
/***/ }),
-/* 65 */
+/* 72 */,
+/* 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}
- */
-
-/**
- * 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.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -11817,28 +12258,28 @@ module.exports = Angle;
/***/ }),
-/* 69 */
+/* 74 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
// http://www.blackpawn.com/texts/pointinpoly/
/**
- * [description]
+ * Checks if a point (as a pair of coordinates) is inside a Triangle's bounds.
*
* @function Phaser.Geom.Triangle.Contains
* @since 3.0.0
*
- * @param {Phaser.Geom.Triangle} triangle - [description]
- * @param {number} x - [description]
- * @param {number} y - [description]
+ * @param {Phaser.Geom.Triangle} triangle - The Triangle to check.
+ * @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 point is inside the Triangle, otherwise `false`.
*/
var Contains = function (triangle, x, y)
{
@@ -11870,18 +12311,48 @@ module.exports = Contains;
/***/ }),
-/* 70 */
+/* 75 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @namespace Phaser.Loader.Events
+ */
+
+module.exports = {
+
+ ADD: __webpack_require__(945),
+ COMPLETE: __webpack_require__(944),
+ FILE_COMPLETE: __webpack_require__(943),
+ FILE_KEY_COMPLETE: __webpack_require__(942),
+ FILE_LOAD_ERROR: __webpack_require__(941),
+ FILE_LOAD: __webpack_require__(940),
+ FILE_PROGRESS: __webpack_require__(939),
+ POST_PROCESS: __webpack_require__(938),
+ PROGRESS: __webpack_require__(937),
+ START: __webpack_require__(936)
+
+};
+
+
+/***/ }),
+/* 76 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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__(173);
-var Rectangle = __webpack_require__(9);
+var FromPoints = __webpack_require__(180);
+var Rectangle = __webpack_require__(10);
var Vector2 = __webpack_require__(3);
/**
@@ -12445,20 +12916,20 @@ module.exports = Curve;
/***/ }),
-/* 71 */
+/* 77 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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__(40);
-var GetPoint = __webpack_require__(405);
-var GetPoints = __webpack_require__(403);
-var Random = __webpack_require__(191);
+var Contains = __webpack_require__(43);
+var GetPoint = __webpack_require__(438);
+var GetPoints = __webpack_require__(437);
+var Random = __webpack_require__(206);
/**
* @classdesc
@@ -12808,12 +13279,12 @@ module.exports = Circle;
/***/ }),
-/* 72 */
+/* 78 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -12836,12 +13307,12 @@ module.exports = GetCenterY;
/***/ }),
-/* 73 */
+/* 79 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -12871,12 +13342,12 @@ module.exports = SetCenterY;
/***/ }),
-/* 74 */
+/* 80 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -12906,12 +13377,12 @@ module.exports = SetCenterX;
/***/ }),
-/* 75 */
+/* 81 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -12934,19 +13405,42 @@ module.exports = GetCenterX;
/***/ }),
-/* 76 */,
-/* 77 */
+/* 82 */,
+/* 83 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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__(2);
+/**
+ * @typedef {object} MapDataConfig
+ * @property {string} [name] - The key in the Phaser cache that corresponds to the loaded tilemap data.
+ * @property {number} [width=0] - The width of the entire tilemap.
+ * @property {number} [height=0] - The height of the entire tilemap.
+ * @property {number} [tileWidth=0] - The width of the tiles.
+ * @property {number} [tileHeight=0] - The height of the tiles.
+ * @property {number} [widthInPixels] - The width in pixels of the entire tilemap.
+ * @property {number} [heightInPixels] - The height in pixels of the entire tilemap.
+ * @property {integer} [format] - The format of the Tilemap, as defined in Tiled.
+ * @property {string} [orientation] - The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'.
+ * @property {string} [renderOrder] - Determines the draw order of tilemap. Default is right-down.
+ * @property {number} [version] - The version of Tiled the map uses.
+ * @property {number} [properties] - Map specific properties (can be specified in Tiled).
+ * @property {Phaser.Tilemaps.LayerData[]} [layers] - The layers of the tilemap.
+ * @property {array} [images] - An array with all the layers configured to the MapData.
+ * @property {object} [objects] - An array of Tiled Image Layers.
+ * @property {object} [collision] - An object of Tiled Object Layers.
+ * @property {Phaser.Tilemaps.Tileset[]} [tilesets] - The tilesets the map uses.
+ * @property {array} [imageCollections] - The collection of images the map uses(specified in Tiled).
+ * @property {array} [tiles] - [description]
+ */
+
/**
* @classdesc
* A class for representing data about a map. Maps are parsed from CSV, Tiled, etc. into this
@@ -12958,7 +13452,7 @@ var GetFastValue = __webpack_require__(2);
* @constructor
* @since 3.0.0
*
- * @param {object} [config] - [description]
+ * @param {MapDataConfig} [config] - [description]
*/
var MapData = new Class({
@@ -12969,7 +13463,7 @@ var MapData = new Class({
if (config === undefined) { config = {}; }
/**
- * [description]
+ * The key in the Phaser cache that corresponds to the loaded tilemap data.
*
* @name Phaser.Tilemaps.MapData#name
* @type {string}
@@ -12978,7 +13472,7 @@ var MapData = new Class({
this.name = GetFastValue(config, 'name', 'map');
/**
- * [description]
+ * The width of the entire tilemap.
*
* @name Phaser.Tilemaps.MapData#width
* @type {number}
@@ -12987,7 +13481,7 @@ var MapData = new Class({
this.width = GetFastValue(config, 'width', 0);
/**
- * [description]
+ * The height of the entire tilemap.
*
* @name Phaser.Tilemaps.MapData#height
* @type {number}
@@ -12996,7 +13490,7 @@ var MapData = new Class({
this.height = GetFastValue(config, 'height', 0);
/**
- * [description]
+ * The width of the tiles.
*
* @name Phaser.Tilemaps.MapData#tileWidth
* @type {number}
@@ -13005,7 +13499,7 @@ var MapData = new Class({
this.tileWidth = GetFastValue(config, 'tileWidth', 0);
/**
- * [description]
+ * The height of the tiles.
*
* @name Phaser.Tilemaps.MapData#tileHeight
* @type {number}
@@ -13014,7 +13508,7 @@ var MapData = new Class({
this.tileHeight = GetFastValue(config, 'tileHeight', 0);
/**
- * [description]
+ * The width in pixels of the entire tilemap.
*
* @name Phaser.Tilemaps.MapData#widthInPixels
* @type {number}
@@ -13023,7 +13517,7 @@ var MapData = new Class({
this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.tileWidth);
/**
- * [description]
+ * The height in pixels of the entire tilemap.
*
* @name Phaser.Tilemaps.MapData#heightInPixels
* @type {number}
@@ -13041,7 +13535,7 @@ var MapData = new Class({
this.format = GetFastValue(config, 'format', null);
/**
- * [description]
+ * The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'.
*
* @name Phaser.Tilemaps.MapData#orientation
* @type {string}
@@ -13050,7 +13544,12 @@ var MapData = new Class({
this.orientation = GetFastValue(config, 'orientation', 'orthogonal');
/**
- * [description]
+ * Determines the draw order of tilemap. Default is right-down
+ *
+ * 0, or 'right-down'
+ * 1, or 'left-down'
+ * 2, or 'right-up'
+ * 3, or 'left-up'
*
* @name Phaser.Tilemaps.MapData#renderOrder
* @type {string}
@@ -13059,7 +13558,7 @@ var MapData = new Class({
this.renderOrder = GetFastValue(config, 'renderOrder', 'right-down');
/**
- * [description]
+ * The version of the map data (as specified in Tiled).
*
* @name Phaser.Tilemaps.MapData#version
* @type {string}
@@ -13068,7 +13567,7 @@ var MapData = new Class({
this.version = GetFastValue(config, 'version', '1');
/**
- * [description]
+ * Map specific properties (can be specified in Tiled)
*
* @name Phaser.Tilemaps.MapData#properties
* @type {object}
@@ -13077,16 +13576,16 @@ var MapData = new Class({
this.properties = GetFastValue(config, 'properties', {});
/**
- * [description]
+ * An array with all the layers configured to the MapData.
*
* @name Phaser.Tilemaps.MapData#layers
- * @type {array}
+ * @type {(Phaser.Tilemaps.LayerData[]|Phaser.Tilemaps.ObjectLayer)}
* @since 3.0.0
*/
this.layers = GetFastValue(config, 'layers', []);
/**
- * [description]
+ * An array of Tiled Image Layers.
*
* @name Phaser.Tilemaps.MapData#images
* @type {array}
@@ -13095,7 +13594,7 @@ var MapData = new Class({
this.images = GetFastValue(config, 'images', []);
/**
- * [description]
+ * An object of Tiled Object Layers.
*
* @name Phaser.Tilemaps.MapData#objects
* @type {object}
@@ -13104,7 +13603,7 @@ var MapData = new Class({
this.objects = GetFastValue(config, 'objects', {});
/**
- * [description]
+ * An object of collision data. Must be created as physics object or will return undefined.
*
* @name Phaser.Tilemaps.MapData#collision
* @type {object}
@@ -13113,16 +13612,16 @@ var MapData = new Class({
this.collision = GetFastValue(config, 'collision', {});
/**
- * [description]
+ * An array of Tilesets.
*
* @name Phaser.Tilemaps.MapData#tilesets
- * @type {array}
+ * @type {Phaser.Tilemaps.Tileset[]}
* @since 3.0.0
*/
this.tilesets = GetFastValue(config, 'tilesets', []);
/**
- * [description]
+ * The collection of images the map uses(specified in Tiled)
*
* @name Phaser.Tilemaps.MapData#imageCollections
* @type {array}
@@ -13146,12 +13645,12 @@ module.exports = MapData;
/***/ }),
-/* 78 */
+/* 84 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -13180,7 +13679,7 @@ var LayerData = new Class({
if (config === undefined) { config = {}; }
/**
- * [description]
+ * The name of the layer, if specified in Tiled.
*
* @name Phaser.Tilemaps.LayerData#name
* @type {string}
@@ -13189,7 +13688,7 @@ var LayerData = new Class({
this.name = GetFastValue(config, 'name', 'layer');
/**
- * [description]
+ * The x offset of where to draw from the top left
*
* @name Phaser.Tilemaps.LayerData#x
* @type {number}
@@ -13198,7 +13697,7 @@ var LayerData = new Class({
this.x = GetFastValue(config, 'x', 0);
/**
- * [description]
+ * The y offset of where to draw from the top left
*
* @name Phaser.Tilemaps.LayerData#y
* @type {number}
@@ -13207,7 +13706,7 @@ var LayerData = new Class({
this.y = GetFastValue(config, 'y', 0);
/**
- * [description]
+ * The width in tile of the layer.
*
* @name Phaser.Tilemaps.LayerData#width
* @type {number}
@@ -13216,7 +13715,7 @@ var LayerData = new Class({
this.width = GetFastValue(config, 'width', 0);
/**
- * [description]
+ * The height in tiles of the layer.
*
* @name Phaser.Tilemaps.LayerData#height
* @type {number}
@@ -13225,7 +13724,7 @@ var LayerData = new Class({
this.height = GetFastValue(config, 'height', 0);
/**
- * [description]
+ * The pixel width of the tiles.
*
* @name Phaser.Tilemaps.LayerData#tileWidth
* @type {number}
@@ -13234,7 +13733,7 @@ var LayerData = new Class({
this.tileWidth = GetFastValue(config, 'tileWidth', 0);
/**
- * [description]
+ * The pixel height of the tiles.
*
* @name Phaser.Tilemaps.LayerData#tileHeight
* @type {number}
@@ -13261,7 +13760,7 @@ var LayerData = new Class({
this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight);
/**
- * [description]
+ * The width in pixels of the entire layer.
*
* @name Phaser.Tilemaps.LayerData#widthInPixels
* @type {number}
@@ -13270,7 +13769,7 @@ var LayerData = new Class({
this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.baseTileWidth);
/**
- * [description]
+ * The height in pixels of the entire layer.
*
* @name Phaser.Tilemaps.LayerData#heightInPixels
* @type {number}
@@ -13297,7 +13796,7 @@ var LayerData = new Class({
this.visible = GetFastValue(config, 'visible', true);
/**
- * [description]
+ * Layer specific properties (can be specified in Tiled)
*
* @name Phaser.Tilemaps.LayerData#properties
* @type {object}
@@ -13342,10 +13841,10 @@ var LayerData = new Class({
this.bodies = GetFastValue(config, 'bodies', []);
/**
- * [description]
+ * An array of the tile indexes
*
* @name Phaser.Tilemaps.LayerData#data
- * @type {array}
+ * @type {(number[])}
* @since 3.0.0
*/
this.data = GetFastValue(config, 'data', []);
@@ -13366,12 +13865,12 @@ module.exports = LayerData;
/***/ }),
-/* 79 */
+/* 85 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -13397,18 +13896,18 @@ module.exports = IsInLayerBounds;
/***/ }),
-/* 80 */,
-/* 81 */,
-/* 82 */
+/* 86 */,
+/* 87 */,
+/* 88 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var Utils = __webpack_require__(10);
+var Utils = __webpack_require__(9);
/**
* Renders a filled path for the given Shape.
@@ -13463,12 +13962,12 @@ module.exports = FillPathWebGL;
/***/ }),
-/* 83 */
+/* 89 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -13635,12 +14134,12 @@ module.exports = TWEEN_CONST;
/***/ }),
-/* 84 */
+/* 90 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -13676,25 +14175,25 @@ module.exports = GetBoolean;
/***/ }),
-/* 85 */
+/* 91 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
- * [description]
+ * Determine whether the source object has a property with the specified key.
*
* @function Phaser.Utils.Objects.HasValue
* @since 3.0.0
*
- * @param {object} source - [description]
- * @param {string} key - [description]
+ * @param {object} source - The source object to be checked.
+ * @param {string} key - The property to check for within the object
*
- * @return {boolean} [description]
+ * @return {boolean} `true` if the provided `key` exists on the `source` object, otherwise `false`.
*/
var HasValue = function (source, key)
{
@@ -13705,16 +14204,16 @@ module.exports = HasValue;
/***/ }),
-/* 86 */
+/* 92 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var EaseMap = __webpack_require__(174);
+var EaseMap = __webpack_require__(188);
/**
* [description]
@@ -13767,19 +14266,19 @@ module.exports = GetEaseFunction;
/***/ }),
-/* 87 */
+/* 93 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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 ImageRender = __webpack_require__(826);
+var Components = __webpack_require__(13);
+var GameObject = __webpack_require__(18);
+var ImageRender = __webpack_require__(849);
/**
* @classdesc
@@ -13870,23 +14369,24 @@ module.exports = Image;
/***/ }),
-/* 88 */
+/* 94 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var Actions = __webpack_require__(417);
+var Actions = __webpack_require__(450);
var Class = __webpack_require__(0);
+var Events = __webpack_require__(133);
var GetFastValue = __webpack_require__(2);
var GetValue = __webpack_require__(4);
var IsPlainObject = __webpack_require__(8);
-var Range = __webpack_require__(312);
-var Set = __webpack_require__(95);
-var Sprite = __webpack_require__(61);
+var Range = __webpack_require__(316);
+var Set = __webpack_require__(102);
+var Sprite = __webpack_require__(67);
/**
* @callback GroupCallback
@@ -13903,7 +14403,7 @@ var Sprite = __webpack_require__(61);
/**
* @typedef {object} GroupConfig
*
- * @property {?object} [classType=Sprite] - Sets {@link Phaser.GameObjects.Group#classType}.
+ * @property {?GroupClassTypeConstructor} [classType=Sprite] - Sets {@link Phaser.GameObjects.Group#classType}.
* @property {?boolean} [active=true] - Sets {@link Phaser.GameObjects.Group#active}.
* @property {?number} [maxSize=-1] - Sets {@link Phaser.GameObjects.Group#maxSize}.
* @property {?string} [defaultKey=null] - Sets {@link Phaser.GameObjects.Group#defaultKey}.
@@ -13927,7 +14427,7 @@ var Sprite = __webpack_require__(61);
*
* `key` is required. {@link Phaser.GameObjects.Group#defaultKey} is not used.
*
- * @property {?object} [classType] - The class of each new Game Object.
+ * @property {?GroupClassTypeConstructor} [classType] - The class of each new Game Object.
* @property {string} [key] - The texture key of each new Game Object.
* @property {?(string|integer)} [frame=null] - The texture frame of each new Game Object.
* @property {?boolean} [visible=true] - The visible state of each new Game Object.
@@ -13968,6 +14468,18 @@ var Sprite = __webpack_require__(61);
* @see Phaser.Utils.Array.Range
*/
+/**
+ * A constructor function (class) that can be assigned to `classType`.
+ * @callback GroupClassTypeConstructor
+ * @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.
+ *
+ * @see Phaser.GameObjects.Group#classType
+ */
+
/**
* @classdesc A Group is a way for you to create, manipulate, or recycle similar Game Objects.
*
@@ -14060,7 +14572,7 @@ var Group = new Class({
* The class to create new group members from.
*
* @name Phaser.GameObjects.Group#classType
- * @type {object}
+ * @type {GroupClassTypeConstructor}
* @since 3.0.0
* @default Phaser.GameObjects.Sprite
*/
@@ -14435,7 +14947,7 @@ var Group = new Class({
}
}
- child.on('destroy', this.remove, this);
+ child.on(Events.DESTROY, this.remove, this);
return this;
},
@@ -14499,7 +15011,7 @@ var Group = new Class({
this.removeCallback.call(this, child);
}
- child.off('destroy', this.remove, this);
+ child.off(Events.DESTROY, this.remove, this);
if (destroyChild)
{
@@ -14542,7 +15054,7 @@ var Group = new Class({
{
var gameObject = children.entries[i];
- gameObject.off('destroy', this.remove, this);
+ gameObject.off(Events.DESTROY, this.remove, this);
if (destroyChild)
{
@@ -15074,7 +15586,7 @@ var Group = new Class({
var gameObject = children.entries[i];
// Remove the event hook first or it'll go all recursive hell on us
- gameObject.off('destroy', this.remove, this);
+ gameObject.off(Events.DESTROY, this.remove, this);
gameObject.destroy();
}
@@ -15092,12 +15604,12 @@ module.exports = Group;
/***/ }),
-/* 89 */
+/* 95 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -15134,20 +15646,20 @@ module.exports = Contains;
/***/ }),
-/* 90 */
+/* 96 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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__(89);
-var GetPoint = __webpack_require__(308);
-var GetPoints = __webpack_require__(307);
-var Random = __webpack_require__(185);
+var Contains = __webpack_require__(95);
+var GetPoint = __webpack_require__(311);
+var GetPoints = __webpack_require__(310);
+var Random = __webpack_require__(199);
/**
* @classdesc
@@ -15502,12 +16014,12 @@ module.exports = Ellipse;
/***/ }),
-/* 91 */
+/* 97 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -15518,10 +16030,10 @@ module.exports = Ellipse;
* @function Phaser.Utils.Array.SpliceOne
* @since 3.0.0
*
- * @param {array} array - [description]
- * @param {integer} index - [description]
+ * @param {array} array - The array to splice from.
+ * @param {integer} index - The index of the item which should be spliced.
*
- * @return {*} [description]
+ * @return {*} The item which was spliced (removed).
*/
var SpliceOne = function (array, index)
{
@@ -15548,12 +16060,56 @@ module.exports = SpliceOne;
/***/ }),
-/* 92 */
+/* 98 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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;
+
+
+/***/ }),
+/* 99 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -15735,15 +16291,15 @@ function init ()
module.exports = init();
-/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(907)))
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(1096)))
/***/ }),
-/* 93 */
+/* 100 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -15772,12 +16328,12 @@ module.exports = FromPercent;
/***/ }),
-/* 94 */
+/* 101 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -15818,25 +16374,24 @@ module.exports = {
/***/ }),
-/* 95 */
+/* 102 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
var Class = __webpack_require__(0);
/**
- * @callback EachSetCallback
- * @generic E - [entry]
+ * @callback EachSetCallback
*
- * @param {*} entry - [description]
- * @param {number} index - [description]
+ * @param {E} entry - The Set entry.
+ * @param {number} index - The index of the entry within the Set.
*
- * @return {?boolean} [description]
+ * @return {?boolean} The callback result.
*/
/**
@@ -16002,7 +16557,7 @@ var Set = new Class({
* @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.
+ * @param {*} [callbackScope] - The scope of the callback.
*
* @return {Phaser.Structs.Set} This Set object.
*/
@@ -16047,7 +16602,7 @@ var Set = new Class({
* @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.
+ * @param {*} [callbackScope] - The scope of the callback.
*
* @return {Phaser.Structs.Set} This Set object.
*/
@@ -16268,16 +16823,16 @@ module.exports = Set;
/***/ }),
-/* 96 */
+/* 103 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var Clone = __webpack_require__(63);
+var Clone = __webpack_require__(70);
/**
* Creates a new Object using all values from obj1 and obj2.
@@ -16286,10 +16841,10 @@ var Clone = __webpack_require__(63);
* @function Phaser.Utils.Objects.Merge
* @since 3.0.0
*
- * @param {object} obj1 - [description]
- * @param {object} obj2 - [description]
+ * @param {object} obj1 - The first object.
+ * @param {object} obj2 - The second object.
*
- * @return {object} [description]
+ * @return {object} A new object containing the union of obj1's and obj2's properties.
*/
var Merge = function (obj1, obj2)
{
@@ -16310,26 +16865,26 @@ module.exports = Merge;
/***/ }),
-/* 97 */
+/* 104 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var Defaults = __webpack_require__(129);
+var Defaults = __webpack_require__(141);
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 GetBoolean = __webpack_require__(90);
+var GetEaseFunction = __webpack_require__(92);
+var GetNewValue = __webpack_require__(105);
+var GetProps = __webpack_require__(221);
+var GetTargets = __webpack_require__(143);
var GetValue = __webpack_require__(4);
-var GetValueOp = __webpack_require__(130);
-var Tween = __webpack_require__(128);
-var TweenData = __webpack_require__(127);
+var GetValueOp = __webpack_require__(142);
+var Tween = __webpack_require__(140);
+var TweenData = __webpack_require__(139);
/**
* [description]
@@ -16339,7 +16894,33 @@ var TweenData = __webpack_require__(127);
*
* @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description]
* @param {object} config - [description]
- * @param {Phaser.Tweens.TweenConfigDefaults} defaults - [description]
+ * @param {Phaser.Tweens.TweenConfigDefaults} defaults - Tween configuration defaults.
+`
+ * @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.
+`
+{
+ targets: null,
+ delay: 0,
+ duration: 1000,
+ ease: 'Power0',
+ easeParams: null,
+ hold: 0,
+ repeat: 0,
+ repeatDelay: 0,
+ yoyo: false,
+ flipX: false,
+ flipY: false
+};
*
* @return {Phaser.Tweens.Tween} [description]
*/
@@ -16441,12 +17022,12 @@ module.exports = TweenBuilder;
/***/ }),
-/* 98 */
+/* 105 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -16504,12 +17085,12 @@ module.exports = GetNewValue;
/***/ }),
-/* 99 */
+/* 106 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -16908,12 +17489,12 @@ module.exports = Tileset;
/***/ }),
-/* 100 */
+/* 107 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -16953,12 +17534,12 @@ module.exports = TileToWorldY;
/***/ }),
-/* 101 */
+/* 108 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -16998,16 +17579,16 @@ module.exports = TileToWorldX;
/***/ }),
-/* 102 */
+/* 109 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var IsInLayerBounds = __webpack_require__(79);
+var IsInLayerBounds = __webpack_require__(85);
/**
* Gets a tile at the given tile coordinates from the given layer.
@@ -17030,7 +17611,7 @@ var GetTileAt = function (tileX, tileY, nonNull, layer)
if (IsInLayerBounds(tileX, tileY, layer))
{
- var tile = layer.data[tileY][tileX];
+ var tile = layer.data[tileY][tileX] || null;
if (tile === null)
{
return null;
@@ -17054,12 +17635,12 @@ module.exports = GetTileAt;
/***/ }),
-/* 103 */
+/* 110 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -17069,77 +17650,73 @@ module.exports = GetTileAt;
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)
+ CalculateFacesAt: __webpack_require__(148),
+ CalculateFacesWithin: __webpack_require__(37),
+ Copy: __webpack_require__(528),
+ CreateFromTiles: __webpack_require__(527),
+ CullTiles: __webpack_require__(526),
+ Fill: __webpack_require__(525),
+ FilterTiles: __webpack_require__(524),
+ FindByIndex: __webpack_require__(523),
+ FindTile: __webpack_require__(522),
+ ForEachTile: __webpack_require__(521),
+ GetTileAt: __webpack_require__(109),
+ GetTileAtWorldXY: __webpack_require__(520),
+ GetTilesWithin: __webpack_require__(21),
+ GetTilesWithinShape: __webpack_require__(519),
+ GetTilesWithinWorldXY: __webpack_require__(518),
+ HasTileAt: __webpack_require__(235),
+ HasTileAtWorldXY: __webpack_require__(517),
+ IsInLayerBounds: __webpack_require__(85),
+ PutTileAt: __webpack_require__(147),
+ PutTileAtWorldXY: __webpack_require__(516),
+ PutTilesAt: __webpack_require__(515),
+ Randomize: __webpack_require__(514),
+ RemoveTileAt: __webpack_require__(234),
+ RemoveTileAtWorldXY: __webpack_require__(513),
+ RenderDebug: __webpack_require__(512),
+ ReplaceByIndex: __webpack_require__(236),
+ SetCollision: __webpack_require__(511),
+ SetCollisionBetween: __webpack_require__(510),
+ SetCollisionByExclusion: __webpack_require__(509),
+ SetCollisionByProperty: __webpack_require__(508),
+ SetCollisionFromCollisionGroup: __webpack_require__(507),
+ SetTileIndexCallback: __webpack_require__(506),
+ SetTileLocationCallback: __webpack_require__(505),
+ Shuffle: __webpack_require__(504),
+ SwapByIndex: __webpack_require__(503),
+ TileToWorldX: __webpack_require__(108),
+ TileToWorldXY: __webpack_require__(502),
+ TileToWorldY: __webpack_require__(107),
+ WeightedRandomize: __webpack_require__(501),
+ WorldToTileX: __webpack_require__(54),
+ WorldToTileXY: __webpack_require__(500),
+ WorldToTileY: __webpack_require__(53)
};
/***/ }),
-/* 104 */
+/* 111 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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);
+var Components = __webpack_require__(253);
+var Sprite = __webpack_require__(67);
/**
* @classdesc
- * An Arcade Physics Sprite Game Object.
+ * An Arcade Physics Sprite is a Sprite with an Arcade Physics body and related components.
+ * The body can be dynamic or static.
*
- * 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.
+ * The main difference between an Arcade Sprite and an Arcade Image is that you cannot animate an Arcade Image.
+ * If you do not require animation then you can safely use Arcade Images instead of Arcade Sprites.
*
* @class Sprite
* @extends Phaser.GameObjects.Sprite
@@ -17222,12 +17799,12 @@ module.exports = ArcadeSprite;
/***/ }),
-/* 105 */
+/* 112 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -17300,12 +17877,39 @@ module.exports = XHRSettings;
/***/ }),
-/* 106 */
+/* 113 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @namespace Phaser.Input.Keyboard.Events
+ */
+
+module.exports = {
+
+ ANY_KEY_DOWN: __webpack_require__(619),
+ ANY_KEY_UP: __webpack_require__(618),
+ COMBO_MATCH: __webpack_require__(617),
+ DOWN: __webpack_require__(616),
+ KEY_DOWN: __webpack_require__(615),
+ KEY_UP: __webpack_require__(614),
+ UP: __webpack_require__(613)
+
+};
+
+
+/***/ }),
+/* 114 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -17323,6 +17927,10 @@ var inputPlugins = {};
* @property {string} [mapping] - If this plugin is to be injected into the Input Plugin, this is the property key map used.
*/
+/**
+ * @namespace Phaser.Input.InputPluginCache
+ */
+
var InputPluginCache = {};
/**
@@ -17331,7 +17939,9 @@ var InputPluginCache = {};
* 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
+ * @name Phaser.Input.InputPluginCache.register
+ * @type {function}
+ * @static
* @since 3.10.0
*
* @param {string} key - A reference used to get this plugin from the plugin cache.
@@ -17348,7 +17958,9 @@ InputPluginCache.register = function (key, plugin, mapping, settingsKey, configK
/**
* Returns the input plugin object from the cache based on the given key.
*
- * @method Phaser.Input.InputPluginCache.getCore
+ * @name Phaser.Input.InputPluginCache.getCore
+ * @type {function}
+ * @static
* @since 3.10.0
*
* @param {string} key - The key of the input plugin to get.
@@ -17363,7 +17975,9 @@ InputPluginCache.getPlugin = function (key)
/**
* Installs all of the registered Input Plugins into the given target.
*
- * @method Phaser.Input.InputPluginCache.install
+ * @name Phaser.Input.InputPluginCache.install
+ * @type {function}
+ * @static
* @since 3.10.0
*
* @param {Phaser.Input.InputPlugin} target - The target InputPlugin to install the plugins into.
@@ -17391,7 +18005,9 @@ InputPluginCache.install = function (target)
/**
* Removes an input plugin based on the given key.
*
- * @method Phaser.Input.InputPluginCache.remove
+ * @name Phaser.Input.InputPluginCache.remove
+ * @type {function}
+ * @static
* @since 3.10.0
*
* @param {string} key - The key of the input plugin to remove.
@@ -17408,12 +18024,12 @@ module.exports = InputPluginCache;
/***/ }),
-/* 107 */
+/* 115 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -17484,19 +18100,20 @@ module.exports = LineToLine;
/***/ }),
-/* 108 */
+/* 116 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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);
+var Components = __webpack_require__(13);
+var GameObject = __webpack_require__(18);
+var MeshRender = __webpack_require__(753);
+var NOOP = __webpack_require__(1);
/**
* @classdesc
@@ -17509,13 +18126,10 @@ var MeshRender = __webpack_require__(731);
* @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
@@ -17539,13 +18153,10 @@ 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,
@@ -17646,9 +18257,17 @@ var Mesh = new Class({
this.setTexture(texture, frame);
this.setPosition(x, y);
this.setSizeToFrame();
- this.setOrigin();
this.initPipeline();
- }
+ },
+
+ /**
+ * This method is left intentionally empty and does not do anything.
+ * It is retained to allow a Mesh or Quad to be added to a Container.
+ *
+ * @method Phaser.GameObjects.Mesh#setAlpha
+ * @since 3.17.0
+ */
+ setAlpha: NOOP
});
@@ -17656,21 +18275,21 @@ module.exports = Mesh;
/***/ }),
-/* 109 */
+/* 117 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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);
+var Components = __webpack_require__(13);
+var GameObject = __webpack_require__(18);
+var GetBitmapTextSize = __webpack_require__(872);
+var ParseFromAtlas = __webpack_require__(871);
+var Render = __webpack_require__(870);
/**
* The font data for an individual character of a Bitmap Font.
@@ -17729,12 +18348,12 @@ var Render = __webpack_require__(844);
*
* 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/
+ * BMFont (Windows, free): {@link http://www.angelcode.com/products/bmfont/|http://www.angelcode.com/products/bmfont/}
+ * Glyph Designer (OS X, commercial): {@link http://www.71squared.com/en/glyphdesigner|http://www.71squared.com/en/glyphdesigner}
+ * Littera (Web-based, free): {@link http://kvazars.com/littera/|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
+ * converting a valid XML file through the popular X2JS library. An online tool for conversion can be found here: {@link http://codebeautify.org/xmltojson|http://codebeautify.org/xmltojson}
*
* @class BitmapText
* @extends Phaser.GameObjects.GameObject
@@ -18300,33 +18919,76 @@ BitmapText.ALIGN_CENTER = 1;
*/
BitmapText.ALIGN_RIGHT = 2;
+/**
+ * Parse an XML Bitmap Font from an Atlas.
+ *
+ * Adds the parsed Bitmap Font data to the cache with the `fontName` key.
+ *
+ * @name Phaser.GameObjects.BitmapText.ParseFromAtlas
+ * @since 3.0.0
+ *
+ * @param {Phaser.Scene} scene - The Scene to parse the Bitmap Font for.
+ * @param {string} fontName - The key of the font to add to the Bitmap Font cache.
+ * @param {string} textureKey - The key of the BitmapFont's texture.
+ * @param {string} frameKey - The key of the BitmapFont texture's frame.
+ * @param {string} xmlKey - The key of the XML data of the font to parse.
+ * @param {integer} [xSpacing] - The x-axis spacing to add between each letter.
+ * @param {integer} [ySpacing] - The y-axis spacing to add to the line height.
+ *
+ * @return {boolean} Whether the parsing was successful or not.
+ */
BitmapText.ParseFromAtlas = ParseFromAtlas;
module.exports = BitmapText;
/***/ }),
-/* 110 */
+/* 118 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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.
+/**
+ * @namespace Phaser.Utils.Array.StableSortFunctions
+ */
+
(function() {
-// A stable array sort, because `Array#sort()` is not guaranteed stable.
-// This is an implementation of merge sort, without recursion.
-
+ /**
+ * A stable array sort, because `Array#sort()` is not guaranteed stable.
+ * This is an implementation of merge sort, without recursion.
+ *
+ * @function Phaser.Utils.Array.StableSort
+ * @since 3.0.0
+ *
+ * @param {array} arr - The input array to be sorted.
+ * @param {function} comp - The comparison handler.
+ *
+ * @return {array} The sorted result.
+ */
var stable = function(arr, comp) {
return exec(arr.slice(), comp);
};
+ /**
+ * Sort the input array and simply copy it back if the result isn't in the original array, which happens on an odd number of passes.
+ *
+ * @function Phaser.Utils.Array.StableSortFunctions.inplace
+ * @memberof Phaser.Utils.Array.StableSortFunctions
+ * @since 3.0.0
+ *
+ * @param {array} arr - The input array.
+ * @param {function} comp - The comparison handler.
+ *
+ * @return {array} The sorted array.
+ */
stable.inplace = function(arr, comp) {
var result = exec(arr, comp);
@@ -18426,28 +19088,31 @@ else {}
})();
/***/ }),
-/* 111 */
+/* 119 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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);
+var CheckMatrix = __webpack_require__(173);
+var TransposeMatrix = __webpack_require__(318);
/**
- * [description]
+ * Rotates the array matrix based on the given rotation value.
+ *
+ * The value can be given in degrees: 90, -90, 270, -270 or 180,
+ * or a string command: `rotateLeft`, `rotateRight` or `rotate180`.
+ *
+ * Based on the routine from {@link http://jsfiddle.net/MrPolywhirl/NH42z/}.
*
* @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`.
+ * @param {(number|string)} [direction=90] - The amount to rotate the matrix by.
*
* @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix.
*/
@@ -18492,25 +19157,24 @@ module.exports = RotateMatrix;
/***/ }),
-/* 112 */
+/* 120 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var ArrayUtils = __webpack_require__(164);
+var ArrayUtils = __webpack_require__(174);
var Class = __webpack_require__(0);
var NOOP = __webpack_require__(1);
-var StableSort = __webpack_require__(110);
+var StableSort = __webpack_require__(118);
/**
- * @callback EachListCallback
- * @generic I - [item]
+ * @callback EachListCallback
*
- * @param {*} item - The item which is currently being processed.
+ * @param {I} item - The item which is currently being processed.
* @param {...*} [args] - Additional arguments that will be passed to the callback, after the child.
*/
@@ -18681,9 +19345,8 @@ var List = new Class({
},
/**
- * 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.
+ * 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
@@ -18691,38 +19354,28 @@ var List = new Class({
* @genericUse {T[]} - [children,$return]
*
* @param {string} property - The property to lexically sort by.
+ * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean.
*
* @return {Phaser.Structs.List} This List object.
*/
- sort: function (property)
+ sort: function (property, handler)
{
- if (property)
+ if (!property)
{
- this._sortKey = property;
-
- StableSort.inplace(this.list, this.sortHandler);
+ return this;
}
- return this;
- },
+ if (handler === undefined)
+ {
+ handler = function (childA, childB)
+ {
+ return childA[property] - childB[property];
+ };
+ }
- /**
- * 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];
+ StableSort.inplace(this.list, handler);
+
+ return this;
},
/**
@@ -18768,7 +19421,6 @@ var List = new Class({
* @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.
@@ -18780,7 +19432,7 @@ var List = new Class({
*/
getFirst: function (property, value, startIndex, endIndex)
{
- return ArrayUtils.GetFirstElement(this.list, property, value, startIndex, endIndex);
+ return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex);
},
/**
@@ -18930,7 +19582,7 @@ var List = new Class({
* @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]
+ * @return {Array.<*>} An array of the items which were removed.
*/
removeBetween: function (startIndex, endIndex, skipCallback)
{
@@ -19207,7 +19859,8 @@ var List = new Class({
* The first item in the List or `null` for an empty List.
*
* @name Phaser.Structs.List#first
- * @type {integer}
+ * @genericUse {T} - [$type]
+ * @type {*}
* @readonly
* @since 3.0.0
*/
@@ -19233,7 +19886,8 @@ var List = new Class({
* The last item in the List, or `null` for an empty List.
*
* @name Phaser.Structs.List#last
- * @type {integer}
+ * @genericUse {T} - [$type]
+ * @type {*}
* @readonly
* @since 3.0.0
*/
@@ -19261,7 +19915,8 @@ var List = new Class({
* 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}
+ * @genericUse {T} - [$type]
+ * @type {*}
* @readonly
* @since 3.0.0
*/
@@ -19289,7 +19944,8 @@ var List = new Class({
* 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}
+ * @genericUse {T} - [$type]
+ * @type {*}
* @readonly
* @since 3.0.0
*/
@@ -19317,18 +19973,18 @@ module.exports = List;
/***/ }),
-/* 113 */
+/* 121 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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);
+var Extend = __webpack_require__(19);
/**
* @classdesc
@@ -20134,19 +20790,20 @@ module.exports = Frame;
/***/ }),
-/* 114 */
+/* 122 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
* @author Pavle Goloskokovic (http://prunegames.com)
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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 Events = __webpack_require__(69);
+var Extend = __webpack_require__(19);
var NOOP = __webpack_require__(1);
/**
@@ -20604,6 +21261,7 @@ var BaseSound = new Class({
* Destroys this sound and all associated events and marks it for removal from the sound manager.
*
* @method Phaser.Sound.BaseSound#destroy
+ * @fires Phaser.Sound.Events#DESTROY
* @since 3.0.0
*/
destroy: function ()
@@ -20613,7 +21271,7 @@ var BaseSound = new Class({
return;
}
- this.emit('destroy', this);
+ this.emit(Events.DESTROY, this);
this.pendingRemove = true;
this.manager = null;
this.key = '';
@@ -20632,19 +21290,21 @@ module.exports = BaseSound;
/***/ }),
-/* 115 */
+/* 123 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
* @author Pavle Goloskokovic (http://prunegames.com)
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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 Clone = __webpack_require__(70);
var EventEmitter = __webpack_require__(11);
+var Events = __webpack_require__(69);
+var GameEvents = __webpack_require__(26);
var NOOP = __webpack_require__(1);
/**
@@ -20659,7 +21319,7 @@ var NOOP = __webpack_require__(1);
/**
* Audio sprite sound type.
*
- * @typedef {Phaser.Sound.BaseSound} Phaser.Sound.BaseSound.AudioSpriteSound
+ * @typedef {object} AudioSpriteSound
*
* @property {object} spritemap - Local reference to 'spritemap' object form json file generated by audiosprite tool.
*/
@@ -20799,7 +21459,7 @@ var BaseSoundManager = new Class({
*/
this.unlocked = false;
- game.events.on('blur', function ()
+ game.events.on(GameEvents.BLUR, function ()
{
if (this.pauseOnBlur)
{
@@ -20807,7 +21467,7 @@ var BaseSoundManager = new Class({
}
}, this);
- game.events.on('focus', function ()
+ game.events.on(GameEvents.FOCUS, function ()
{
if (this.pauseOnBlur)
{
@@ -20815,8 +21475,8 @@ var BaseSoundManager = new Class({
}
}, this);
- game.events.on('prestep', this.update, this);
- game.events.once('destroy', this.destroy, this);
+ game.events.on(GameEvents.PRE_STEP, this.update, this);
+ game.events.once(GameEvents.DESTROY, this.destroy, this);
},
/**
@@ -20844,7 +21504,7 @@ var BaseSoundManager = new Class({
* @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.
+ * @return {AudioSpriteSound} The new audio sprite sound instance.
*/
addAudioSprite: function (key, config)
{
@@ -20883,6 +21543,7 @@ var BaseSoundManager = new Class({
* Sound will auto destroy once its playback ends.
*
* @method Phaser.Sound.BaseSoundManager#play
+ * @listens Phaser.Sound.Events#COMPLETE
* @since 3.0.0
*
* @param {string} key - Asset key for the sound.
@@ -20894,7 +21555,7 @@ var BaseSoundManager = new Class({
{
var sound = this.add(key);
- sound.once('ended', sound.destroy, sound);
+ sound.once(Events.COMPLETE, sound.destroy, sound);
if (extra)
{
@@ -20920,6 +21581,7 @@ var BaseSoundManager = new Class({
* Sound will auto destroy once its playback ends.
*
* @method Phaser.Sound.BaseSoundManager#playAudioSprite
+ * @listens Phaser.Sound.Events#COMPLETE
* @since 3.0.0
*
* @param {string} key - Asset key for the sound.
@@ -20932,7 +21594,7 @@ var BaseSoundManager = new Class({
{
var sound = this.addAudioSprite(key);
- sound.once('ended', sound.destroy, sound);
+ sound.once(Events.COMPLETE, sound.destroy, sound);
return sound.play(spriteName, config);
},
@@ -20996,16 +21658,11 @@ var BaseSoundManager = new Class({
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
+ * @fires Phaser.Sound.Events#PAUSE_ALL
* @since 3.0.0
*/
pauseAll: function ()
@@ -21015,19 +21672,14 @@ var BaseSoundManager = new Class({
sound.pause();
});
- this.emit('pauseall', this);
+ this.emit(Events.PAUSE_ALL, 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
+ * @fires Phaser.Sound.Events#RESUME_ALL
* @since 3.0.0
*/
resumeAll: function ()
@@ -21037,19 +21689,14 @@ var BaseSoundManager = new Class({
sound.resume();
});
- this.emit('resumeall', this);
+ this.emit(Events.RESUME_ALL, 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
+ * @fires Phaser.Sound.Events#STOP_ALL
* @since 3.0.0
*/
stopAll: function ()
@@ -21059,7 +21706,7 @@ var BaseSoundManager = new Class({
sound.stop();
});
- this.emit('stopall', this);
+ this.emit(Events.STOP_ALL, this);
},
/**
@@ -21103,6 +21750,7 @@ var BaseSoundManager = new Class({
*
* @method Phaser.Sound.BaseSoundManager#update
* @protected
+ * @fires Phaser.Sound.Events#UNLOCKED
* @since 3.0.0
*
* @param {number} time - The current timestamp as generated by the Request Animation Frame or SetTimeout.
@@ -21115,11 +21763,7 @@ var BaseSoundManager = new Class({
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);
+ this.emit(Events.UNLOCKED, this);
}
for (var i = this.sounds.length - 1; i >= 0; i--)
@@ -21180,12 +21824,6 @@ var BaseSoundManager = new Class({
});
},
- /**
- * @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.
*
@@ -21193,7 +21831,7 @@ var BaseSoundManager = new Class({
* and 2.0 doubles the audios playback speed.
*
* @method Phaser.Sound.BaseSoundManager#setRate
- * @fires Phaser.Sound.BaseSoundManager#rate
+ * @fires Phaser.Sound.Events#GLOBAL_RATE
* @since 3.3.0
*
* @param {number} value - Global playback rate at which all the sounds will be played.
@@ -21233,7 +21871,7 @@ var BaseSoundManager = new Class({
sound.calculateRate();
});
- this.emit('rate', this, value);
+ this.emit(Events.GLOBAL_RATE, this, value);
}
},
@@ -21243,7 +21881,7 @@ var BaseSoundManager = new Class({
* 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
+ * @fires Phaser.Sound.Events#GLOBAL_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).
@@ -21257,12 +21895,6 @@ var BaseSoundManager = new Class({
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).
@@ -21288,7 +21920,7 @@ var BaseSoundManager = new Class({
sound.calculateRate();
});
- this.emit('detune', this, value);
+ this.emit(Events.GLOBAL_DETUNE, this, value);
}
}
@@ -21299,12 +21931,12 @@ module.exports = BaseSoundManager;
/***/ }),
-/* 116 */
+/* 124 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -21421,6409 +22053,19 @@ var CONST = {
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.
+ * @copyright 2019 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
@@ -28281,37 +22523,5847 @@ var KeyCodes = {
/**
* @name Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET
*/
- CLOSED_BRACKET: 221
+ CLOSED_BRACKET: 221,
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.SEMICOLON_FIREFOX
+ */
+ SEMICOLON_FIREFOX: 59,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.COLON
+ */
+ COLON: 58,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX_WINDOWS
+ */
+ COMMA_FIREFOX_WINDOWS: 60,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.COMMA_FIREFOX
+ */
+ COMMA_FIREFOX: 62,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_RIGHT_FIREFOX
+ */
+ BRACKET_RIGHT_FIREFOX: 174,
+
+ /**
+ * @name Phaser.Input.Keyboard.KeyCodes.BRACKET_LEFT_FIREFOX
+ */
+ BRACKET_LEFT_FIREFOX: 175
};
module.exports = KeyCodes;
/***/ }),
-/* 144 */
-/***/ (function(module, exports) {
+/* 126 */
+/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
- * [description]
+ * @namespace Phaser.Textures.Events
+ */
+
+module.exports = {
+
+ ADD: __webpack_require__(1049),
+ ERROR: __webpack_require__(1048),
+ LOAD: __webpack_require__(1047),
+ READY: __webpack_require__(1046),
+ REMOVE: __webpack_require__(1045)
+
+};
+
+
+/***/ }),
+/* 127 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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;
+
+
+/***/ }),
+/* 128 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var OS = __webpack_require__(99);
+
+/**
+ * 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();
+
+
+/***/ }),
+/* 129 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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;
+
+
+/***/ }),
+/* 130 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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 - The canvas context to check.
+ *
+ * @return {string} The name of the property on the context which controls image smoothing (either `imageSmoothingEnabled` or a vendor-prefixed version thereof), or `null` if not supported.
+ */
+ 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 - The context on which to enable smoothing.
+ *
+ * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context.
+ */
+ 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 - The context on which to disable smoothing.
+ *
+ * @return {(CanvasRenderingContext2D|WebGLRenderingContext)} The provided context.
+ */
+ 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 - The context to check.
+ *
+ * @return {?boolean} `true` if smoothing is enabled on the context, otherwise `false`. `null` if not supported.
+ */
+ var isEnabled = function (context)
+ {
+ return (prefix !== null) ? context[prefix] : null;
+ };
+
+ return {
+ disable: disable,
+ enable: enable,
+ getPrefix: getPrefix,
+ isEnabled: isEnabled
+ };
+
+};
+
+module.exports = Smoothing();
+
+
+/***/ }),
+/* 131 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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__(13);
+var DegToRad = __webpack_require__(34);
+var EventEmitter = __webpack_require__(11);
+var Events = __webpack_require__(40);
+var Rectangle = __webpack_require__(10);
+var TransformMatrix = __webpack_require__(41);
+var ValueToColor = __webpack_require__(192);
+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 Scale Manager.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#scaleManager
+ * @type {Phaser.Scale.ScaleManager}
+ * @since 3.16.0
+ */
+ this.scaleManager;
+
+ /**
+ * 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 = '';
+
+ /**
+ * This property is un-used in v3.16.
+ *
+ * The resolution of the Game, used in most Camera calculations.
+ *
+ * @name Phaser.Cameras.Scene2D.BaseCamera#resolution
+ * @type {number}
+ * @readonly
+ * @deprecated
+ * @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` and `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 horizontally so that it is centered on the given x coordinate, bounds allowing.
+ * Calling this does not change the scrollY value.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#centerOnX
+ * @since 3.16.0
+ *
+ * @param {number} x - The horizontal coordinate to center on.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ centerOnX: function (x)
+ {
+ var originX = this.width * 0.5;
+
+ this.midPoint.x = x;
+
+ this.scrollX = x - originX;
+
+ if (this.useBounds)
+ {
+ this.scrollX = this.clampX(this.scrollX);
+ }
+
+ return this;
+ },
+
+ /**
+ * Moves the Camera vertically so that it is centered on the given y coordinate, bounds allowing.
+ * Calling this does not change the scrollX value.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#centerOnY
+ * @since 3.16.0
+ *
+ * @param {number} y - The vertical coordinate to center on.
+ *
+ * @return {Phaser.Cameras.Scene2D.BaseCamera} This Camera instance.
+ */
+ centerOnY: function (y)
+ {
+ var originY = this.height * 0.5;
+
+ this.midPoint.y = y;
+
+ this.scrollY = y - originY;
+
+ if (this.useBounds)
+ {
+ this.scrollY = this.clampY(this.scrollY);
+ }
+
+ return this;
+ },
+
+ /**
+ * 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)
+ {
+ this.centerOnX(x);
+ this.centerOnY(y);
+
+ 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 cullTop = this.y;
+ var cullBottom = cullTop + cameraH;
+ var cullLeft = this.x;
+ var cullRight = cullLeft + cameraW;
+
+ if ((tw > cullLeft && tx < cullRight) && (th > cullTop && ty < cullBottom))
+ {
+ 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} resolution - The game resolution, as set in the Scale Manager.
+ */
+ preRender: function (resolution)
+ {
+ var width = this.width;
+ var height = this.height;
+
+ var halfWidth = width * 0.5;
+ var halfHeight = height * 0.5;
+
+ var zoom = this.zoom * resolution;
+ 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.applyITRS(this.x + originX, this.y + originY, this.rotation, 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=false] - 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)
+ {
+ if (centerOn === undefined) { centerOn = false; }
+
+ 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;
+ },
+
+ /**
+ * Returns a rectangle containing the bounds of the Camera.
+ *
+ * If the Camera does not have any bounds the rectangle will be empty.
+ *
+ * The rectangle is a copy of the bounds, so is safe to modify.
+ *
+ * @method Phaser.Cameras.Scene2D.BaseCamera#getBounds
+ * @since 3.16.0
+ *
+ * @param {Phaser.Geom.Rectangle} [out] - An optional Rectangle to store the bounds in. If not given, a new Rectangle will be created.
+ *
+ * @return {Phaser.Geom.Rectangle} A rectangle containing the bounds of this Camera.
+ */
+ getBounds: function (out)
+ {
+ if (out === undefined) { out = new Rectangle(); }
+
+ var source = this._bounds;
+
+ out.setTo(source.x, source.y, source.width, source.height);
+
+ return out;
+ },
+
+ /**
+ * 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.sceneManager = scene.sys.game.scene;
+ this.scaleManager = scene.sys.scale;
+
+ var res = this.scaleManager.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.scaleManager)
+ {
+ return;
+ }
+
+ var custom = (this._x !== 0 || this._y !== 0 || this.scaleManager.width !== this._width || this.scaleManager.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;
+ },
+
+ /**
+ * 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 Phaser.Cameras.Scene2D.Events#DESTROY
+ * @since 3.0.0
+ */
+ destroy: function ()
+ {
+ this.emit(Events.DESTROY, 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.scaleManager = 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 horizontal position of the center of the Camera's viewport, relative to the 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 vertical position of the center of the Camera's viewport, relative to the top 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;
+
+
+/***/ }),
+/* 132 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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;
+
+
+/***/ }),
+/* 133 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @namespace Phaser.GameObjects.Events
+ */
+
+module.exports = { DESTROY: __webpack_require__(1234) };
+
+
+/***/ }),
+/* 134 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Class = __webpack_require__(0);
+var Events = __webpack_require__(420);
+
+/**
+ * @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 Manager 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
+ * @fires Phaser.Data.Events#SET_DATA
+ * @fires Phaser.Data.Events#CHANGE_DATA
+ * @fires Phaser.Data.Events#CHANGE_DATA_KEY
+ * @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
+ * @fires Phaser.Data.Events#SET_DATA
+ * @fires Phaser.Data.Events#CHANGE_DATA
+ * @fires Phaser.Data.Events#CHANGE_DATA_KEY
+ * @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(Events.CHANGE_DATA, parent, key, value, previousValue);
+ events.emit(Events.CHANGE_DATA_KEY + key, parent, value, previousValue);
+ }
+ }
+
+ });
+
+ list[key] = data;
+
+ events.emit(Events.SET_DATA, 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
+ * @fires Phaser.Data.Events#SET_DATA
+ * @fires Phaser.Data.Events#CHANGE_DATA
+ * @fires Phaser.Data.Events#CHANGE_DATA_KEY
+ * @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
+ * @fires Phaser.Data.Events#REMOVE_DATA
+ * @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
+ * @fires Phaser.Data.Events#REMOVE_DATA
+ * @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(Events.REMOVE_DATA, 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
+ * @fires Phaser.Data.Events#REMOVE_DATA
+ * @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(Events.REMOVE_DATA, this.parent, 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(Events.CHANGE_DATA);
+ this.events.off(Events.SET_DATA);
+ this.events.off(Events.REMOVE_DATA);
+
+ 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;
+
+
+/***/ }),
+/* 135 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Calculates the perimeter of a Rectangle.
+ *
+ * @function Phaser.Geom.Rectangle.Perimeter
+ * @since 3.0.0
+ *
+ * @param {Phaser.Geom.Rectangle} rect - The Rectangle to use.
+ *
+ * @return {number} The perimeter of the Rectangle, equal to `(width * 2) + (height * 2)`.
+ */
+var Perimeter = function (rect)
+{
+ return 2 * (rect.width + rect.height);
+};
+
+module.exports = Perimeter;
+
+
+/***/ }),
+/* 136 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @namespace Phaser.Animations.Events
+ */
+
+module.exports = {
+
+ ADD_ANIMATION: __webpack_require__(1266),
+ ANIMATION_COMPLETE: __webpack_require__(1265),
+ ANIMATION_REPEAT: __webpack_require__(1264),
+ ANIMATION_RESTART: __webpack_require__(1263),
+ ANIMATION_START: __webpack_require__(1262),
+ PAUSE_ALL: __webpack_require__(1261),
+ REMOVE_ANIMATION: __webpack_require__(1260),
+ RESUME_ALL: __webpack_require__(1259),
+ SPRITE_ANIMATION_COMPLETE: __webpack_require__(1258),
+ SPRITE_ANIMATION_KEY_COMPLETE: __webpack_require__(1257),
+ SPRITE_ANIMATION_KEY_REPEAT: __webpack_require__(1256),
+ SPRITE_ANIMATION_KEY_RESTART: __webpack_require__(1255),
+ SPRITE_ANIMATION_KEY_START: __webpack_require__(1254),
+ SPRITE_ANIMATION_KEY_UPDATE: __webpack_require__(1253),
+ SPRITE_ANIMATION_REPEAT: __webpack_require__(1252),
+ SPRITE_ANIMATION_RESTART: __webpack_require__(1251),
+ SPRITE_ANIMATION_START: __webpack_require__(1250),
+ SPRITE_ANIMATION_UPDATE: __webpack_require__(1249)
+
+};
+
+
+/***/ }),
+/* 137 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var BlendModes = __webpack_require__(60);
+var Circle = __webpack_require__(77);
+var CircleContains = __webpack_require__(43);
+var Class = __webpack_require__(0);
+var Components = __webpack_require__(13);
+var GameObject = __webpack_require__(18);
+var Rectangle = __webpack_require__(10);
+var RectangleContains = __webpack_require__(42);
+
+/**
+ * @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 NOOP method so you can pass a Zone to a Container in Canvas.
+ * Calling this method will do nothing. It is intentionally empty.
+ *
+ * @method Phaser.GameObjects.Zone#setBlendMode
+ * @private
+ * @since 3.16.2
+ */
+ setBlendMode: 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;
+
+
+/***/ }),
+/* 138 */,
+/* 139 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @typedef {object} TweenDataGenConfig
+ *
+ * @property {function} delay - Time in ms/frames before tween will start.
+ * @property {function} duration - Duration of the tween in ms/frames, excludes time for yoyo or repeats.
+ * @property {function} hold - Time in ms/frames the tween will pause before running the yoyo or starting a repeat.
+ * @property {function} repeat - 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 {function} repeatDelay - Time in ms/frames before the repeat will start.
+ */
+
+/**
+ * @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
+ */
+
+/**
+ * Returns a TweenDataConfig object that describes the tween data for a unique property of a unique target. A single Tween consists of multiple TweenDatas, depending on how many properties are being changed by the Tween.
+ *
+ * This is an internal function used by the TweenBuilder and should not be accessed directly, instead, Tweens should be created using the GameObjectFactory or GameObjectCreator.
+ *
+ * @function Phaser.Tweens.TweenData
+ * @since 3.0.0
+ *
+ * @param {object} target - The target to tween.
+ * @param {string} key - The property of the target to tween.
+ * @param {function} getEnd - What the property will be at the END of the Tween.
+ * @param {function} getStart - What the property will be at the START of the Tween.
+ * @param {function} ease - The ease function this tween uses.
+ * @param {number} delay - Time in ms/frames before tween will start.
+ * @param {number} duration - Duration of the tween in ms/frames.
+ * @param {boolean} yoyo - Determines whether the tween should return back to its start value after hold has expired.
+ * @param {number} hold - Time in ms/frames the tween will pause before repeating or returning to its starting value if yoyo is set to true.
+ * @param {number} repeat - 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.
+ * @param {number} repeatDelay - Time in ms/frames before the repeat will start.
+ * @param {boolean} flipX - Should toggleFlipX be called when yoyo or repeat happens?
+ * @param {boolean} flipY - Should toggleFlipY be called when yoyo or repeat happens?
+ *
+ * @return {TweenDataConfig} The config object describing this TweenData.
+ */
+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;
+
+
+/***/ }),
+/* 140 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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__(14);
+var GameObjectFactory = __webpack_require__(5);
+var TWEEN_CONST = __webpack_require__(89);
+
+/**
+ * @classdesc
+ * A Tween is able to manipulate the properties of one or more objects to any given value, based
+ * on a duration and type of ease. They are rarely instantiated directly and instead should be
+ * created via the TweenManager.
+ *
+ * @class Tween
+ * @memberof Phaser.Tweens
+ * @constructor
+ * @since 3.0.0
+ *
+ * @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - A reference to the parent of this Tween. Either the Tween Manager or a Tween Timeline instance.
+ * @param {Phaser.Tweens.TweenDataConfig[]} data - An array of TweenData objects, each containing a unique property to be tweened.
+ * @param {array} targets - An array of targets to be tweened.
+ */
+var Tween = new Class({
+
+ initialize:
+
+ function Tween (parent, data, targets)
+ {
+ /**
+ * A reference to the parent of this Tween.
+ * Either the Tween Manager or a Tween Timeline instance.
+ *
+ * @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;
+
+ /**
+ * The cached length of the data array.
+ *
+ * @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 element.
+ *
+ * @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;
+ },
+
+ /**
+ * Returns the current value of the Tween.
+ *
+ * @method Phaser.Tweens.Tween#getValue
+ * @since 3.0.0
+ *
+ * @return {number} The value of the Tween.
+ */
+ getValue: function ()
+ {
+ return this.data[0].current;
+ },
+
+ /**
+ * Set the scale 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.
+ *
+ * @method Phaser.Tweens.Tween#setTimeScale
+ * @since 3.0.0
+ *
+ * @param {number} value - The scale factor for timescale.
+ *
+ * @return {this} - This Tween instance.
+ */
+ setTimeScale: function (value)
+ {
+ this.timeScale = value;
+
+ return this;
+ },
+
+ /**
+ * Returns the scale of the time applied to this Tween.
+ *
+ * @method Phaser.Tweens.Tween#getTimeScale
+ * @since 3.0.0
+ *
+ * @return {number} The timescale of this tween (between 0 and 1)
+ */
+ 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);
+ },
+
+ /**
+ * See if this Tween is currently acting upon the given target.
+ *
+ * @method Phaser.Tweens.Tween#hasTarget
+ * @since 3.0.0
+ *
+ * @param {object} target - The target to check against this Tween.
+ *
+ * @return {boolean} `true` if the given target is a target of this Tween, otherwise `false`.
+ */
+ hasTarget: function (target)
+ {
+ return (this.targets.indexOf(target) !== -1);
+ },
+
+ /**
+ * Updates the value of a property of this Tween to a new value, without adjusting the
+ * Tween duration or current progress.
+ *
+ * You can optionally tell it to set the 'start' value to be the current value (before the change).
+ *
+ * @method Phaser.Tweens.Tween#updateTo
+ * @since 3.0.0
+ *
+ * @param {string} key - The property to set the new value for.
+ * @param {*} value - The new value of the property.
+ * @param {boolean} [startToCurrent=false] - Should this change set the start value to be the current value?
+ *
+ * @return {this} - This Tween instance.
+ */
+ updateTo: function (key, value, startToCurrent)
+ {
+ if (startToCurrent === undefined) { startToCurrent = false; }
+
+ 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;
+ },
+
+ /**
+ * Restarts the tween from the beginning.
+ *
+ * @method Phaser.Tweens.Tween#restart
+ * @since 3.0.0
+ *
+ * @return {this} This Tween instance.
+ */
+ restart: function ()
+ {
+ if (this.state === TWEEN_CONST.REMOVED)
+ {
+ this.seek(0);
+ this.parent.makeActive(this);
+ }
+ else
+ {
+ this.stop();
+ this.play();
+ }
+
+ return this;
+ },
+
+ /**
+ * Internal method that calculates the overall duration of the Tween.
+ *
+ * @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;
+ }
+ },
+
+ /**
+ * Internal method that advances to the next state of the Tween during playback.
+ *
+ * @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;
+ }
+ },
+
+ /**
+ * Pauses the Tween immediately. Use `resume` to continue playback.
+ *
+ * @method Phaser.Tweens.Tween#pause
+ * @since 3.0.0
+ *
+ * @return {this} - This Tween instance.
+ */
+ pause: function ()
+ {
+ if (this.state === TWEEN_CONST.PAUSED)
+ {
+ return;
+ }
+
+ this.paused = true;
+
+ this._pausedState = this.state;
+
+ this.state = TWEEN_CONST.PAUSED;
+
+ return this;
+ },
+
+ /**
+ * Starts a Tween playing.
+ *
+ * You only need to call this method if you have configured the tween to be paused on creation.
+ *
+ * @method Phaser.Tweens.Tween#play
+ * @since 3.0.0
+ *
+ * @param {boolean} resetFromTimeline - Is this Tween being played as part of a Timeline?
+ *
+ * @return {this} This Tween instance.
+ */
+ play: function (resetFromTimeline)
+ {
+ if (this.state === TWEEN_CONST.ACTIVE)
+ {
+ return this;
+ }
+ 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);
+ }
+
+ return this;
+ },
+
+ /**
+ * Internal method that resets all of the Tween Data, including the progress and elapsed values.
+ *
+ * @method Phaser.Tweens.Tween#resetTweenData
+ * @since 3.0.0
+ *
+ * @param {boolean} resetFromLoop - Has this method been called as part of a loop?
+ */
+ 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 {this} - This Tween instance.
+ */
+ resume: function ()
+ {
+ if (this.state === TWEEN_CONST.PAUSED)
+ {
+ this.paused = false;
+
+ this.state = this._pausedState;
+ }
+ else
+ {
+ this.play();
+ }
+
+ return this;
+ },
+
+ /**
+ * Attempts to seek to a specific position in a Tween.
+ *
+ * @method Phaser.Tweens.Tween#seek
+ * @since 3.0.0
+ *
+ * @param {number} toPosition - A value between 0 and 1 which represents the progress point to seek to.
+ *
+ * @return {this} This Tween instance.
+ */
+ 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);
+
+ tweenData.target[tweenData.key] = tweenData.current;
+ }
+
+ return this;
+ },
+
+ /**
+ * Sets an event based callback to be invoked during playback.
+ *
+ * @method Phaser.Tweens.Tween#setCallback
+ * @since 3.0.0
+ *
+ * @param {string} type - Type of the callback.
+ * @param {function} callback - Callback function.
+ * @param {array} [params] - An array of parameters for specified callbacks types.
+ * @param {object} [scope] - The context the callback will be invoked in.
+ *
+ * @return {this} This Tween instance.
+ */
+ 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.
+ *
+ * @return {this} This Tween instance.
+ */
+ 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;
+ }
+
+ return this;
+ },
+
+ /**
+ * 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.
+ *
+ * @return {this} This Tween instance.
+ */
+ 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;
+ }
+
+ return this;
+ },
+
+ /**
+ * Internal method that advances the Tween based on the time values.
+ *
+ * @method Phaser.Tweens.Tween#update
+ * @since 3.0.0
+ *
+ * @param {number} timestamp - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
+ * @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);
+ },
+
+ /**
+ * Internal method used as part of the playback process that sets a tween to play in reverse.
+ *
+ * @method Phaser.Tweens.Tween#setStateFromEnd
+ * @since 3.0.0
+ *
+ * @param {Phaser.Tweens.Tween} tween - The Tween to update.
+ * @param {Phaser.Tweens.TweenDataConfig} tweenData - The TweenData property to update.
+ * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values.
+ *
+ * @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;
+ },
+
+ /**
+ * Internal method used as part of the playback process that sets a tween to play from the start.
+ *
+ * @method Phaser.Tweens.Tween#setStateFromStart
+ * @since 3.0.0
+ *
+ * @param {Phaser.Tweens.Tween} tween - The Tween to update.
+ * @param {Phaser.Tweens.TweenDataConfig} tweenData - The TweenData property to update.
+ * @param {number} diff - Any extra time that needs to be accounted for in the elapsed and progress values.
+ *
+ * @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;
+ },
+
+ /**
+ * Internal method that advances the TweenData based on the time value given.
+ *
+ * @method Phaser.Tweens.Tween#updateTweenData
+ * @since 3.0.0
+ *
+ * @param {Phaser.Tweens.Tween} tween - The Tween to update.
+ * @param {Phaser.Tweens.TweenDataConfig} tweenData - The TweenData property to update.
+ * @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;
+
+
+/***/ }),
+/* 141 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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;
+
+
+/***/ }),
+/* 142 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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);
+}
+
+/**
+ * Returns `getStart` and `getEnd` functions for a Tween's Data based on a target property and end value.
+ *
+ * If the end value is a number, it will be treated as an absolute value and the property will be tweened to it. A string can be provided to specify a relative end value which consists of an operation (`+=` to add to the current value, `-=` to subtract from the current value, `*=` to multiply the current value, or `/=` to divide the current value) followed by its operand. A function can be provided to allow greater control over the end value; it will receive the target object being tweened, the name of the property being tweened, and the current value of the property as its arguments. If both the starting and the ending values need to be controlled, an object with `getStart` and `getEnd` callbacks, which will receive the same arguments, can be provided instead. If an object with a `value` property is provided, the property will be used as the effective value under the same rules described here.
+ *
+ * @function Phaser.Tweens.Builders.GetValueOp
+ * @since 3.0.0
+ *
+ * @param {string} key - The name of the property to modify.
+ * @param {*} propertyValue - The ending value of the property, as described above.
+ *
+ * @return {function} An array of two functions, `getStart` and `getEnd`, which return the starting and the ending value of the property based on the provided value.
+ */
+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;
+
+
+/***/ }),
+/* 143 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var GetValue = __webpack_require__(4);
+
+/**
+ * Extracts an array of targets from a Tween configuration object.
+ *
+ * The targets will be looked for in a `targets` property. If it's a function, its return value will be used as the result.
+ *
+ * @function Phaser.Tweens.Builders.GetTargets
+ * @since 3.0.0
+ *
+ * @param {object} config - The configuration object to use.
+ *
+ * @return {array} An array of targets (may contain only one element), or `null` if no targets were specified.
+ */
+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;
+
+
+/***/ }),
+/* 144 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Formats = __webpack_require__(31);
+var MapData = __webpack_require__(83);
+var Parse = __webpack_require__(233);
+var Tilemap = __webpack_require__(225);
+
+/**
+ * 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;
+
+
+/***/ }),
+/* 145 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Formats = __webpack_require__(31);
+var LayerData = __webpack_require__(84);
+var MapData = __webpack_require__(83);
+var Tile = __webpack_require__(61);
+
+/**
+ * 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;
+
+
+/***/ }),
+/* 146 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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;
+
+
+/***/ }),
+/* 147 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Tile = __webpack_require__(61);
+var IsInLayerBounds = __webpack_require__(85);
+var CalculateFacesAt = __webpack_require__(148);
+var SetTileCollision = __webpack_require__(62);
+
+/**
+ * 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;
+
+
+
+/***/ }),
+/* 148 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var GetTileAt = __webpack_require__(109);
+
+/**
+ * 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;
+
+
+/***/ }),
+/* 149 */,
+/* 150 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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__(15);
+var File = __webpack_require__(22);
+var FileTypesManager = __webpack_require__(7);
+var GetFastValue = __webpack_require__(2);
+var IsPlainObject = __webpack_require__(8);
+var ParseXML = __webpack_require__(344);
+
+/**
+ * @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;
+
+
+/***/ }),
+/* 151 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Extend = __webpack_require__(19);
+var XHRSettings = __webpack_require__(112);
+
+/**
+ * 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;
+
+
+/***/ }),
+/* 152 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 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;
+
+
+/***/ }),
+/* 153 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * @namespace Phaser.Input.Gamepad.Events
+ */
+
+module.exports = {
+
+ BUTTON_DOWN: __webpack_require__(633),
+ BUTTON_UP: __webpack_require__(632),
+ CONNECTED: __webpack_require__(631),
+ DISCONNECTED: __webpack_require__(630),
+ GAMEPAD_BUTTON_DOWN: __webpack_require__(629),
+ GAMEPAD_BUTTON_UP: __webpack_require__(628)
+
+};
+
+
+/***/ }),
+/* 154 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Rotates an entire Triangle at a given angle about a specific point.
*
* @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]
+ * @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate.
+ * @param {number} x - The X coordinate of the point to rotate the Triangle about.
+ * @param {number} y - The Y coordinate of the point to rotate the Triangle about.
+ * @param {number} angle - The angle by which to rotate the Triangle, in radians.
*
- * @return {Phaser.Geom.Triangle} [description]
+ * @return {Phaser.Geom.Triangle} The rotated Triangle.
*/
var RotateAroundXY = function (triangle, x, y, angle)
{
@@ -28343,24 +28395,24 @@ module.exports = RotateAroundXY;
/***/ }),
-/* 145 */
+/* 155 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
- * [description]
+ * Calculates the width/height ratio of a rectangle.
*
* @function Phaser.Geom.Rectangle.GetAspectRatio
* @since 3.0.0
*
- * @param {Phaser.Geom.Rectangle} rect - [description]
+ * @param {Phaser.Geom.Rectangle} rect - The rectangle.
*
- * @return {number} [description]
+ * @return {number} The width/height ratio of the rectangle.
*/
var GetAspectRatio = function (rect)
{
@@ -28371,12 +28423,12 @@ module.exports = GetAspectRatio;
/***/ }),
-/* 146 */
+/* 156 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -28419,12 +28471,12 @@ module.exports = RotateAroundXY;
/***/ }),
-/* 147 */
+/* 157 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -28506,25 +28558,27 @@ module.exports = ContainsArray;
/***/ }),
-/* 148 */
+/* 158 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
- * [description]
+ * Checks if two Rectangles intersect.
+ *
+ * A Rectangle intersects another Rectangle if any part of its bounds is within the other Rectangle's bounds. As such, the two Rectangles are considered "solid". A Rectangle with no width or no height will never intersect another Rectangle.
*
* @function Phaser.Geom.Intersects.RectangleToRectangle
* @since 3.0.0
*
- * @param {Phaser.Geom.Rectangle} rectA - [description]
- * @param {Phaser.Geom.Rectangle} rectB - [description]
+ * @param {Phaser.Geom.Rectangle} rectA - The first Rectangle to check for intersection.
+ * @param {Phaser.Geom.Rectangle} rectB - The second Rectangle to check for intersection.
*
- * @return {boolean} [description]
+ * @return {boolean} `true` if the two Rectangles intersect, otherwise `false`.
*/
var RectangleToRectangle = function (rectA, rectB)
{
@@ -28540,17 +28594,17 @@ module.exports = RectangleToRectangle;
/***/ }),
-/* 149 */
+/* 159 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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);
+var Mesh = __webpack_require__(116);
/**
* @classdesc
@@ -29201,12 +29255,12 @@ module.exports = Quad;
/***/ }),
-/* 150 */
+/* 160 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -29250,29 +29304,41 @@ module.exports = Contains;
/***/ }),
-/* 151 */
+/* 161 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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);
+var Contains = __webpack_require__(160);
+var GetPoints = __webpack_require__(289);
/**
* @classdesc
- * [description]
+ * A Polygon object
+ *
+
+ * The polygon is a closed shape consists of a series of connected straight lines defined by list of ordered points.
+ * Several formats are supported to define the list of points, check the setTo method for details.
+ * This is a geometry object allowing you to define and inspect the shape.
+ * It is not a Game Object, in that you cannot add it to the display list, and it has no texture.
+ * To render a Polygon you should look at the capabilities of the Graphics class.
*
* @class Polygon
* @memberof Phaser.Geom
* @constructor
* @since 3.0.0
*
- * @param {Phaser.Geom.Point[]} [points] - [description]
+ * @param {Phaser.Geom.Point[]} [points] - List of points defining the perimeter of this Polygon. Several formats are supported:
+ * - A string containing paired x y 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], ...]`
*/
var Polygon = new Class({
@@ -29337,7 +29403,7 @@ var Polygon = new Class({
* @method Phaser.Geom.Polygon#setTo
* @since 3.0.0
*
- * @param {array} points - [description]
+ * @param {array} points - Points defining the perimeter of this polygon. Please check function description above for the different supported formats.
*
* @return {Phaser.Geom.Polygon} This Polygon object.
*/
@@ -29459,23 +29525,23 @@ module.exports = Polygon;
/***/ }),
-/* 152 */
+/* 162 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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 Components = __webpack_require__(13);
+var CONST = __webpack_require__(28);
+var GameObject = __webpack_require__(18);
+var GetPowerOfTwo = __webpack_require__(376);
+var Smoothing = __webpack_require__(130);
+var TileSpriteRender = __webpack_require__(828);
var Vector2 = __webpack_require__(3);
// bitmask flag for GameObject.renderMask
@@ -29488,8 +29554,8 @@ var _FLAG = 8; // 1000
* 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`
+ * You shouldn't ever create a TileSprite any larger than your actual canvas 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 canvas 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.
@@ -29840,22 +29906,18 @@ var TileSprite = new Class({
* @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.
+ * @param {number} [x] - The horizontal scale of the tiling texture. If not given it will use the current `tileScaleX` value.
+ * @param {number} [y=x] - The vertical scale of the tiling texture. If not given it will use the `x` value.
*
* @return {this} This Tile Sprite instance.
*/
setTileScale: function (x, y)
{
- if (x !== undefined)
- {
- this.tileScaleX = x;
- }
+ if (x === undefined) { x = this.tileScaleX; }
+ if (y === undefined) { y = x; }
- if (y !== undefined)
- {
- this.tileScaleY = y;
- }
+ this.tileScaleX = x;
+ this.tileScaleY = y;
return this;
},
@@ -29869,7 +29931,7 @@ var TileSprite = new Class({
*/
updateTileTexture: function ()
{
- if (!this.dirty)
+ if (!this.dirty || !this.renderer)
{
return;
}
@@ -29934,6 +29996,9 @@ var TileSprite = new Class({
canvas.height = this.height;
this.frame.setSize(this.width, this.height);
+ this.updateDisplayOrigin();
+
+ this.dirty = true;
}
if (!this.dirty || this.renderer && this.renderer.gl)
@@ -30099,26 +30164,26 @@ module.exports = TileSprite;
/***/ }),
-/* 153 */
+/* 163 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var AddToDOM = __webpack_require__(169);
+var AddToDOM = __webpack_require__(179);
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 Components = __webpack_require__(13);
+var CONST = __webpack_require__(28);
+var GameObject = __webpack_require__(18);
+var GetTextSize = __webpack_require__(834);
var GetValue = __webpack_require__(4);
-var RemoveFromDOM = __webpack_require__(342);
-var TextRender = __webpack_require__(810);
-var TextStyle = __webpack_require__(807);
+var RemoveFromDOM = __webpack_require__(343);
+var TextRender = __webpack_require__(833);
+var TextStyle = __webpack_require__(830);
/**
* @classdesc
@@ -30131,6 +30196,21 @@ var TextStyle = __webpack_require__(807);
* 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.
+ *
+ * **Important:** If the font you wish to use has a space or digit in its name, such as
+ * 'Press Start 2P' or 'Roboto Condensed', then you _must_ put the font name in quotes, either
+ * when creating the Text object, or when setting the font via `setFont` or `setFontFamily`. I.e.:
+ *
+ * ```javascript
+ * this.add.text(0, 0, 'Hello World', { fontFamily: '"Roboto Condensed"' });
+ * ```
+ *
+ * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all
+ * quoted properly, too:
+ *
+ * ```javascript
+ * this.add.text(0, 0, 'Hello World', { fontFamily: 'Verdana, "Times New Roman", Tahoma, serif' });
+ * ```
*
* 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,
@@ -30242,7 +30322,7 @@ var Text = new Class({
* Manages the style of this Text object.
*
* @name Phaser.GameObjects.Text#style
- * @type {Phaser.GameObjects.Text.TextStyle}
+ * @type {Phaser.GameObjects.TextStyle}
* @since 3.0.0
*/
this.style = new TextStyle(this, style);
@@ -30733,6 +30813,20 @@ var Text = new Class({
*
* If an object is given, the `fontFamily`, `fontSize` and `fontStyle`
* properties of that object are set.
+ *
+ * **Important:** If the font you wish to use has a space or digit in its name, such as
+ * 'Press Start 2P' or 'Roboto Condensed', then you _must_ put the font name in quotes:
+ *
+ * ```javascript
+ * Text.setFont('"Roboto Condensed"');
+ * ```
+ *
+ * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all
+ * quoted properly, too:
+ *
+ * ```javascript
+ * Text.setFont('Verdana, "Times New Roman", Tahoma, serif');
+ * ```
*
* @method Phaser.GameObjects.Text#setFont
* @since 3.0.0
@@ -30748,6 +30842,20 @@ var Text = new Class({
/**
* Set the font family.
+ *
+ * **Important:** If the font you wish to use has a space or digit in its name, such as
+ * 'Press Start 2P' or 'Roboto Condensed', then you _must_ put the font name in quotes:
+ *
+ * ```javascript
+ * Text.setFont('"Roboto Condensed"');
+ * ```
+ *
+ * Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all
+ * quoted properly, too:
+ *
+ * ```javascript
+ * Text.setFont('Verdana, "Times New Roman", Tahoma, serif');
+ * ```
*
* @method Phaser.GameObjects.Text#setFontFamily
* @since 3.0.0
@@ -30825,18 +30933,23 @@ var Text = new Class({
},
/**
- * Set the text fill color.
+ * Set the fill style to be used by the Text object.
+ *
+ * This can be any valid CanvasRenderingContext2D fillStyle value, such as
+ * a color (in hex, rgb, rgba, hsl or named values), a gradient or a pattern.
+ *
+ * See the [MDN fillStyle docs](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle) for more details.
*
* @method Phaser.GameObjects.Text#setFill
* @since 3.0.0
*
- * @param {string} color - The text fill color.
+ * @param {(string|any)} color - The text fill style. Can be any valid CanvasRenderingContext `fillStyle` value.
*
* @return {Phaser.GameObjects.Text} This Text object.
*/
- setFill: function (color)
+ setFill: function (fillStyle)
{
- return this.style.setFill(color);
+ return this.style.setFill(fillStyle);
},
/**
@@ -31380,24 +31493,26 @@ module.exports = Text;
/***/ }),
-/* 154 */
+/* 164 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var Camera = __webpack_require__(121);
+var BlendModes = __webpack_require__(60);
+var Camera = __webpack_require__(131);
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);
+var Components = __webpack_require__(13);
+var CONST = __webpack_require__(28);
+var Frame = __webpack_require__(121);
+var GameObject = __webpack_require__(18);
+var Render = __webpack_require__(840);
+var Utils = __webpack_require__(9);
+var UUID = __webpack_require__(299);
/**
* @classdesc
@@ -31406,6 +31521,11 @@ var UUID = __webpack_require__(295);
* 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.
+ *
+ * Note that under WebGL a FrameBuffer, which is what the Render Texture uses internally, cannot be anti-aliased. This means
+ * that when drawing objects such as Shapes to a Render Texture they will appear to be drawn with no aliasing, however this
+ * is a technical limitation of WebGL. To get around it, create your shape as a texture in an art package, then draw that
+ * to the Render Texture.
*
* @class RenderTexture
* @extends Phaser.GameObjects.GameObject
@@ -31507,8 +31627,7 @@ var RenderTexture = new Class({
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.
+ * The HTML Canvas Element that the Render Texture is drawing to when using the Canvas Renderer.
*
* @name Phaser.GameObjects.RenderTexture#canvas
* @type {HTMLCanvasElement}
@@ -31573,6 +31692,16 @@ var RenderTexture = new Class({
*/
this._saved = false;
+ /**
+ * Internal erase mode flag.
+ *
+ * @name Phaser.GameObjects.RenderTexture#_eraseMode
+ * @type {boolean}
+ * @private
+ * @since 3.16.0
+ */
+ this._eraseMode = 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
@@ -31629,7 +31758,7 @@ var RenderTexture = new Class({
/**
* Sets the size of this Game Object.
*
- * @method Phaser.GameObjects.Components.Size#setSize
+ * @method Phaser.GameObjects.RenderTexture#setSize
* @since 3.0.0
*
* @param {number} width - The width of this Game Object.
@@ -31784,25 +31913,31 @@ var RenderTexture = new Class({
{
if (alpha === undefined) { alpha = 1; }
- var ur = ((rgb >> 16)|0) & 0xff;
- var ug = ((rgb >> 8)|0) & 0xff;
- var ub = (rgb|0) & 0xff;
+ var r = ((rgb >> 16) | 0) & 0xff;
+ var g = ((rgb >> 8) | 0) & 0xff;
+ var b = (rgb | 0) & 0xff;
- if (this.gl)
+ var gl = this.gl;
+
+ if (gl)
{
- this.renderer.setFramebuffer(this.framebuffer);
+ var renderer = this.renderer;
- 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);
+ var bounds = this.getBounds();
+
+ renderer.setFramebuffer(this.framebuffer, true);
+
+ this.pipeline.drawFillRect(
+ bounds.x, bounds.y, bounds.right, bounds.bottom,
+ Utils.getTintFromFloats(r / 255, g / 255, b / 255, 1),
+ alpha
+ );
+
+ renderer.setFramebuffer(null, true);
}
else
{
- this.context.fillStyle = 'rgb(' + ur + ',' + ug + ',' + ub + ')';
+ this.context.fillStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + alpha + ')';
this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
}
@@ -31821,17 +31956,18 @@ var RenderTexture = new Class({
{
if (this.dirty)
{
- if (this.gl)
- {
- this.renderer.setFramebuffer(this.framebuffer);
+ var gl = this.gl;
+
+ if (gl)
+ {
+ var renderer = this.renderer;
+
+ renderer.setFramebuffer(this.framebuffer, true);
- var gl = this.gl;
-
gl.clearColor(0, 0, 0, 0);
-
gl.clear(gl.COLOR_BUFFER_BIT);
-
- this.renderer.setFramebuffer(null);
+
+ renderer.setFramebuffer(null, true);
}
else
{
@@ -31849,6 +31985,70 @@ var RenderTexture = new Class({
return this;
},
+ /**
+ * Draws the given object, or an array of objects, to this Render Texture using a blend mode of ERASE.
+ * This has the effect of erasing any filled pixels in the objects from 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 erase a Render Texture from itself.
+ *
+ * If passing in a Group or Container it will only draw children that return `true`
+ * when their `willRender()` method is called. I.e. a Container with 10 children,
+ * 5 of which have `visible=false` will only draw the 5 visible ones.
+ *
+ * If passing in an array of Game Objects it will draw them all, regardless if
+ * they pass a `willRender` check or not.
+ *
+ * You can pass in a string in which case it will look for a texture in the Texture
+ * Manager matching that string, and draw the base frame.
+ *
+ * You can pass in the `x` and `y` coordinates to draw the objects at. The use of
+ * the coordinates differ based on what objects are being drawn. If the object is
+ * a Group, Container or Display List, the coordinates are _added_ to the positions
+ * of the children. For all other types of object, the coordinates are exact.
+ *
+ * Calling this method causes the WebGL batch to flush, so it can write the texture
+ * data to the framebuffer being used internally. The batch is flushed at the end,
+ * after the entries have been iterated. So if you've a bunch of objects to draw,
+ * try and pass them in an array in one single call, rather than making lots of
+ * separate calls.
+ *
+ * @method Phaser.GameObjects.RenderTexture#erase
+ * @since 3.16.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.
+ *
+ * @return {this} This Render Texture instance.
+ */
+ erase: function (entries, x, y)
+ {
+ this._eraseMode = true;
+
+ var blendMode = this.renderer.currentBlendMode;
+
+ this.renderer.setBlendMode(BlendModes.ERASE);
+
+ this.draw(entries, x, y, 1, 16777215);
+
+ this.renderer.setBlendMode(blendMode);
+
+ this._eraseMode = false;
+
+ return this;
+ },
+
/**
* Draws the given object, or an array of objects, to this Render Texture.
*
@@ -31921,11 +32121,18 @@ var RenderTexture = new Class({
var gl = this.gl;
- this.camera.preRender(1, 1, 1);
+ this.camera.preRender(1, 1);
if (gl)
{
- this.renderer.setFramebuffer(this.framebuffer);
+ var cx = this.camera._cx;
+ var cy = this.camera._cy;
+ var cw = this.camera._cw;
+ var ch = this.camera._ch;
+
+ this.renderer.setFramebuffer(this.framebuffer, false);
+
+ this.renderer.pushScissor(cx, cy, cw, ch, ch);
var pipeline = this.pipeline;
@@ -31935,7 +32142,9 @@ var RenderTexture = new Class({
pipeline.flush();
- this.renderer.setFramebuffer(null);
+ this.renderer.setFramebuffer(null, false);
+
+ this.renderer.popScissor();
pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0);
}
@@ -32003,11 +32212,18 @@ var RenderTexture = new Class({
if (textureFrame)
{
- this.camera.preRender(1, 1, 1);
+ this.camera.preRender(1, 1);
if (gl)
{
- this.renderer.setFramebuffer(this.framebuffer);
+ var cx = this.camera._cx;
+ var cy = this.camera._cy;
+ var cw = this.camera._cw;
+ var ch = this.camera._ch;
+
+ this.renderer.setFramebuffer(this.framebuffer, false);
+
+ this.renderer.pushScissor(cx, cy, cw, ch, ch);
var pipeline = this.pipeline;
@@ -32017,8 +32233,10 @@ var RenderTexture = new Class({
pipeline.flush();
- this.renderer.setFramebuffer(null);
-
+ this.renderer.setFramebuffer(null, false);
+
+ this.renderer.popScissor();
+
pipeline.projOrtho(0, pipeline.width, pipeline.height, 0, -1000.0, 1000.0);
}
else
@@ -32133,7 +32351,10 @@ var RenderTexture = new Class({
var prevX = gameObject.x;
var prevY = gameObject.y;
- this.renderer.setBlendMode(gameObject.blendMode);
+ if (!this._eraseMode)
+ {
+ this.renderer.setBlendMode(gameObject.blendMode);
+ }
gameObject.setPosition(x, y);
@@ -32161,11 +32382,23 @@ var RenderTexture = new Class({
var prevX = gameObject.x;
var prevY = gameObject.y;
+ if (this._eraseMode)
+ {
+ var blendMode = gameObject.blendMode;
+
+ gameObject.blendMode = BlendModes.ERASE;
+ }
+
gameObject.setPosition(x, y);
gameObject.renderCanvas(this.renderer, gameObject, 0, this.camera, null);
gameObject.setPosition(prevX, prevY);
+
+ if (this._eraseMode)
+ {
+ gameObject.blendMode = blendMode;
+ }
},
/**
@@ -32250,6 +32483,12 @@ var RenderTexture = new Class({
}
this.texture.destroy();
+ this.camera.destroy();
+
+ this.canvas = null;
+ this.context = null;
+ this.framebuffer = null;
+ this.texture = null;
}
}
@@ -32259,22 +32498,22 @@ module.exports = RenderTexture;
/***/ }),
-/* 155 */
+/* 165 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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);
+var Components = __webpack_require__(13);
+var GameObject = __webpack_require__(18);
+var GravityWell = __webpack_require__(307);
+var List = __webpack_require__(120);
+var ParticleEmitter = __webpack_require__(305);
+var Render = __webpack_require__(844);
/**
* @classdesc
@@ -32731,12 +32970,12 @@ module.exports = ParticleEmitterManager;
/***/ }),
-/* 156 */
+/* 166 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -32773,19 +33012,15 @@ module.exports = CircumferencePoint;
/***/ }),
-/* 157 */
+/* 167 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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,
@@ -32816,33 +33051,33 @@ module.exports = {
/***/ }),
-/* 158 */
+/* 168 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var BaseCamera = __webpack_require__(121);
+var BaseCamera = __webpack_require__(131);
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 Commands = __webpack_require__(167);
+var ComponentsAlpha = __webpack_require__(435);
+var ComponentsBlendMode = __webpack_require__(432);
+var ComponentsDepth = __webpack_require__(431);
+var ComponentsMask = __webpack_require__(427);
+var ComponentsPipeline = __webpack_require__(200);
+var ComponentsTransform = __webpack_require__(422);
+var ComponentsVisible = __webpack_require__(421);
+var ComponentsScrollFactor = __webpack_require__(424);
-var Ellipse = __webpack_require__(90);
-var GameObject = __webpack_require__(19);
+var Ellipse = __webpack_require__(96);
+var GameObject = __webpack_require__(18);
var GetFastValue = __webpack_require__(2);
var GetValue = __webpack_require__(4);
-var MATH_CONST = __webpack_require__(16);
-var Render = __webpack_require__(831);
+var MATH_CONST = __webpack_require__(20);
+var Render = __webpack_require__(854);
/**
* Graphics line style (or stroke style) settings.
@@ -33327,6 +33562,26 @@ var Graphics = new Class({
return this;
},
+ /**
+ * Fill the current path.
+ *
+ * This is an alias for `Graphics.fillPath` and does the same thing.
+ * It was added to match the CanvasRenderingContext 2D API.
+ *
+ * @method Phaser.GameObjects.Graphics#fill
+ * @since 3.16.0
+ *
+ * @return {Phaser.GameObjects.Graphics} This Game Object.
+ */
+ fill: function ()
+ {
+ this.commandBuffer.push(
+ Commands.FILL_PATH
+ );
+
+ return this;
+ },
+
/**
* Stroke the current path.
*
@@ -33344,6 +33599,26 @@ var Graphics = new Class({
return this;
},
+ /**
+ * Stroke the current path.
+ *
+ * This is an alias for `Graphics.strokePath` and does the same thing.
+ * It was added to match the CanvasRenderingContext 2D API.
+ *
+ * @method Phaser.GameObjects.Graphics#stroke
+ * @since 3.16.0
+ *
+ * @return {Phaser.GameObjects.Graphics} This Game Object.
+ */
+ stroke: function ()
+ {
+ this.commandBuffer.push(
+ Commands.STROKE_PATH
+ );
+
+ return this;
+ },
+
/**
* Fill the given circle.
*
@@ -33511,6 +33786,15 @@ var Graphics = new Class({
return this;
},
+ /**
+ * @typedef {object} RoundedRectRadius
+ *
+ * @property {number} [tl=20] - Top left
+ * @property {number} [tr=20] - Top right
+ * @property {number} [br=20] - Bottom right
+ * @property {number} [bl=20] - Bottom left
+ */
+
/**
* Fill a rounded rectangle with the given position, size and radius.
*
@@ -33521,11 +33805,7 @@ var Graphics = new Class({
* @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
+ * @param {(RoundedRectRadius|number)} [radius=20] - The corner radius; It can also be an object to specify different radii for corners.
*
* @return {Phaser.GameObjects.Graphics} This Game Object.
*/
@@ -33571,11 +33851,7 @@ var Graphics = new Class({
* @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
+ * @param {(RoundedRectRadius|number)} [radius=20] - The corner radius; It can also be an object to specify different radii for corners.
*
* @return {Phaser.GameObjects.Graphics} This Game Object.
*/
@@ -33826,15 +34102,15 @@ var Graphics = new Class({
},
/**
- * [description]
+ * Draw a line from the current drawing position to the given position with a specific width and color.
*
* @method Phaser.GameObjects.Graphics#lineFxTo
* @since 3.0.0
*
- * @param {number} x - [description]
- * @param {number} y - [description]
- * @param {number} width - [description]
- * @param {number} rgb - [description]
+ * @param {number} x - The x coordinate to draw the line to.
+ * @param {number} y - The y coordinate to draw the line to.
+ * @param {number} width - The width of the stroke.
+ * @param {number} rgb - The color of the stroke.
*
* @return {Phaser.GameObjects.Graphics} This Game Object.
*/
@@ -33849,15 +34125,15 @@ var Graphics = new Class({
},
/**
- * [description]
+ * Move the current drawing position to the given position and change the pen width and color.
*
* @method Phaser.GameObjects.Graphics#moveFxTo
* @since 3.0.0
*
- * @param {number} x - [description]
- * @param {number} y - [description]
- * @param {number} width - [description]
- * @param {number} rgb - [description]
+ * @param {number} x - The x coordinate to move to.
+ * @param {number} y - The y coordinate to move to.
+ * @param {number} width - The new stroke width.
+ * @param {number} rgb - The new stroke color.
*
* @return {Phaser.GameObjects.Graphics} This Game Object.
*/
@@ -34267,8 +34543,8 @@ var Graphics = new Class({
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; }
+ if (width === undefined) { width = sys.scale.width; }
+ if (height === undefined) { height = sys.scale.height; }
Graphics.TargetCamera.setScene(this.scene);
Graphics.TargetCamera.setViewport(0, 0, width, height);
@@ -34350,23 +34626,24 @@ module.exports = Graphics;
/***/ }),
-/* 159 */
+/* 169 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var BitmapText = __webpack_require__(109);
+var BitmapText = __webpack_require__(117);
var Class = __webpack_require__(0);
-var Render = __webpack_require__(834);
+var Render = __webpack_require__(860);
/**
* @typedef {object} DisplayCallbackConfig
*
- * @property {{topLeft:number, topRight:number, bottomLeft:number, bottomRight:number}} tint - The tint of the character being rendered.
+ * @property {Phaser.GameObjects.DynamicBitmapText} parent - The Dynamic Bitmap Text object that owns this character being rendered.
+ * @property {{topLeft:number, topRight:number, bottomLeft:number, bottomRight:number}} tint - The tint of the character being rendered. Always zero in Canvas.
* @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.
@@ -34504,6 +34781,7 @@ var DynamicBitmapText = new Class({
* @since 3.11.0
*/
this.callbackData = {
+ parent: this,
color: 0,
tint: {
topLeft: 0,
@@ -34603,24 +34881,25 @@ module.exports = DynamicBitmapText;
/***/ }),
-/* 160 */
+/* 170 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
* @author Felipe Alfonso <@bitnenfer>
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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 ArrayUtils = __webpack_require__(174);
+var BlendModes = __webpack_require__(60);
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 Components = __webpack_require__(13);
+var Events = __webpack_require__(133);
+var GameObject = __webpack_require__(18);
+var Rectangle = __webpack_require__(10);
+var Render = __webpack_require__(863);
+var Union = __webpack_require__(313);
var Vector2 = __webpack_require__(3);
/**
@@ -34971,7 +35250,7 @@ var Container = new Class({
*/
addHandler: function (gameObject)
{
- gameObject.once('destroy', this.remove, this);
+ gameObject.once(Events.DESTROY, this.remove, this);
if (this.exclusive)
{
@@ -34997,7 +35276,7 @@ var Container = new Class({
*/
removeHandler: function (gameObject)
{
- gameObject.off('destroy', this.remove);
+ gameObject.off(Events.DESTROY, this.remove);
if (this.exclusive)
{
@@ -35132,36 +35411,28 @@ var Container = new Class({
* @since 3.4.0
*
* @param {string} property - The property to lexically sort by.
+ * @param {function} [handler] - Provide your own custom handler function. Will receive 2 children which it should compare and return a boolean.
*
* @return {Phaser.GameObjects.Container} This Container instance.
*/
- sort: function (property)
+ sort: function (property, handler)
{
- if (property)
+ if (!property)
{
- this._sortKey = property;
-
- ArrayUtils.StableSort.inplace(this.list, this.sortHandler);
+ return this;
}
- return this;
- },
+ if (handler === undefined)
+ {
+ handler = function (childA, childB)
+ {
+ return childA[property] - childB[property];
+ };
+ }
- /**
- * 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];
+ ArrayUtils.StableSort.inplace(this.list, handler);
+
+ return this;
},
/**
@@ -35209,8 +35480,8 @@ var Container = new Class({
* @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 {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)
*
@@ -35218,7 +35489,7 @@ var Container = new Class({
*/
getFirst: function (property, value, startIndex, endIndex)
{
- return ArrayUtils.GetFirstElement(this.list, property, value, startIndex, endIndex);
+ return ArrayUtils.GetFirst(this.list, property, value, startIndex, endIndex);
},
/**
@@ -35840,27 +36111,27 @@ module.exports = Container;
/***/ }),
-/* 161 */
+/* 171 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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 BlitterRender = __webpack_require__(867);
+var Bob = __webpack_require__(864);
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);
+var Components = __webpack_require__(13);
+var Frame = __webpack_require__(121);
+var GameObject = __webpack_require__(18);
+var List = __webpack_require__(120);
/**
- * @callback Phaser.GameObjects.Blitter.CreateCallback
+ * @callback CreateCallback
*
- * @param {Phaser.GameObjects.Blitter.Bob} bob - The Bob that was created by the Blitter.
+ * @param {Phaser.GameObjects.Bob} bob - The Bob that was created by the Blitter.
* @param {integer} index - The position of the Bob within the Blitter display list.
*/
@@ -35938,7 +36209,7 @@ var Blitter = new Class({
* This List contains all of the Bob objects created by the Blitter.
*
* @name Phaser.GameObjects.Blitter#children
- * @type {Phaser.Structs.List.}
+ * @type {Phaser.Structs.List.}
* @since 3.0.0
*/
this.children = new List();
@@ -35948,7 +36219,7 @@ var Blitter = new Class({
* The array is re-populated whenever the dirty flag is set.
*
* @name Phaser.GameObjects.Blitter#renderList
- * @type {Phaser.GameObjects.Blitter.Bob[]}
+ * @type {Phaser.GameObjects.Bob[]}
* @default []
* @private
* @since 3.0.0
@@ -35981,7 +36252,7 @@ var Blitter = new Class({
* @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.
+ * @return {Phaser.GameObjects.Bob} The newly created Bob object.
*/
create: function (x, y, frame, visible, index)
{
@@ -36012,12 +36283,12 @@ var Blitter = new Class({
* @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 {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.
+ * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created.
*/
createFromCallback: function (callback, quantity, frame, visible)
{
@@ -36048,7 +36319,7 @@ var Blitter = new Class({
* @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.
+ * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that were created.
*/
createMultiple: function (quantity, frame, visible)
{
@@ -36080,7 +36351,7 @@ var Blitter = new Class({
* @method Phaser.GameObjects.Blitter#childCanRender
* @since 3.0.0
*
- * @param {Phaser.GameObjects.Blitter.Bob} child - The Bob to check for rendering.
+ * @param {Phaser.GameObjects.Bob} child - The Bob to check for rendering.
*
* @return {boolean} Returns `true` if the given child can render, otherwise `false`.
*/
@@ -36096,7 +36367,7 @@ var Blitter = new Class({
* @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.
+ * @return {Phaser.GameObjects.Bob[]} An array of Bob objects that will be rendered this frame.
*/
getRenderList: function ()
{
@@ -36141,12 +36412,12 @@ module.exports = Blitter;
/***/ }),
-/* 162 */
+/* 172 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -36176,37 +36447,37 @@ module.exports = GetRandom;
/***/ }),
-/* 163 */
+/* 173 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
-* A Matrix is simply an array of arrays, where each sub-array (the rows) have the same length:
-*
-* let matrix2 = [
-* [ 1, 1, 1, 1, 1, 1 ],
-* [ 2, 0, 0, 0, 0, 4 ],
-* [ 2, 0, 1, 2, 0, 4 ],
-* [ 2, 0, 3, 4, 0, 4 ],
-* [ 2, 0, 0, 0, 0, 4 ],
-* [ 3, 3, 3, 3, 3, 3 ]
-*];
-*/
-
-/**
- * [description]
+ * Checks if an array can be used as a matrix.
+ *
+ * A matrix is a two-dimensional array (array of arrays), where all sub-arrays (rows) have the same length. There must be at least two rows:
+ *
+ * ```
+ * [
+ * [ 1, 1, 1, 1, 1, 1 ],
+ * [ 2, 0, 0, 0, 0, 4 ],
+ * [ 2, 0, 1, 2, 0, 4 ],
+ * [ 2, 0, 3, 4, 0, 4 ],
+ * [ 2, 0, 0, 0, 0, 4 ],
+ * [ 3, 3, 3, 3, 3, 3 ]
+ * ]
+ * ```
*
* @function Phaser.Utils.Array.Matrix.CheckMatrix
* @since 3.0.0
*
- * @param {array} matrix - [description]
+ * @param {array} matrix - The array to check.
*
- * @return {boolean} [description]
+ * @return {boolean} `true` if the given `matrix` array is a valid matrix.
*/
var CheckMatrix = function (matrix)
{
@@ -36234,12 +36505,12 @@ module.exports = CheckMatrix;
/***/ }),
-/* 164 */
+/* 174 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -36249,56 +36520,56 @@ module.exports = CheckMatrix;
module.exports = {
- Matrix: __webpack_require__(874),
+ Matrix: __webpack_require__(900),
- 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)
+ Add: __webpack_require__(893),
+ AddAt: __webpack_require__(892),
+ BringToTop: __webpack_require__(891),
+ CountAllMatching: __webpack_require__(890),
+ Each: __webpack_require__(889),
+ EachInRange: __webpack_require__(888),
+ FindClosestInSorted: __webpack_require__(434),
+ GetAll: __webpack_require__(887),
+ GetFirst: __webpack_require__(886),
+ GetRandom: __webpack_require__(172),
+ MoveDown: __webpack_require__(885),
+ MoveTo: __webpack_require__(884),
+ MoveUp: __webpack_require__(883),
+ NumberArray: __webpack_require__(882),
+ NumberArrayStep: __webpack_require__(881),
+ QuickSelect: __webpack_require__(317),
+ Range: __webpack_require__(316),
+ Remove: __webpack_require__(177),
+ RemoveAt: __webpack_require__(880),
+ RemoveBetween: __webpack_require__(879),
+ RemoveRandomElement: __webpack_require__(878),
+ Replace: __webpack_require__(877),
+ RotateLeft: __webpack_require__(418),
+ RotateRight: __webpack_require__(417),
+ SafeRange: __webpack_require__(68),
+ SendToBack: __webpack_require__(876),
+ SetAll: __webpack_require__(875),
+ Shuffle: __webpack_require__(132),
+ SpliceOne: __webpack_require__(97),
+ StableSort: __webpack_require__(118),
+ Swap: __webpack_require__(874)
};
/***/ }),
-/* 165 */
+/* 175 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
var Class = __webpack_require__(0);
-var Frame = __webpack_require__(113);
-var TextureSource = __webpack_require__(317);
+var Frame = __webpack_require__(121);
+var TextureSource = __webpack_require__(320);
var TEXTURE_MISSING_ERROR = 'Texture.frame missing: ';
@@ -36321,7 +36592,7 @@ var TEXTURE_MISSING_ERROR = 'Texture.frame missing: ';
*
* @param {Phaser.Textures.TextureManager} manager - A reference to the Texture Manager this Texture belongs to.
* @param {string} key - The unique string-based key of this Texture.
- * @param {(HTMLImageElement[]|HTMLCanvasElement[])} source - An array of sources that are used to create the texture. Usually Images, but can also be a Canvas.
+ * @param {(HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[])} source - An array of sources that are used to create the texture. Usually Images, but can also be a Canvas.
* @param {number} [width] - The width of the Texture. This is optional and automatically derived from the source images.
* @param {number} [height] - The height of the Texture. This is optional and automatically derived from the source images.
*/
@@ -36677,7 +36948,7 @@ var Texture = new Class({
* @method Phaser.Textures.Texture#setDataSource
* @since 3.0.0
*
- * @param {(HTMLImageElement|HTMLCanvasElement)} data - The source image.
+ * @param {(HTMLImageElement|HTMLCanvasElement|HTMLImageElement[]|HTMLCanvasElement[])} data - The source image.
*/
setDataSource: function (data)
{
@@ -36762,22 +37033,23 @@ module.exports = Texture;
/***/ }),
-/* 166 */
+/* 176 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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__(116);
-var DefaultPlugins = __webpack_require__(167);
-var GetPhysicsPlugins = __webpack_require__(890);
-var GetScenePlugins = __webpack_require__(889);
+var CONST = __webpack_require__(124);
+var DefaultPlugins = __webpack_require__(181);
+var Events = __webpack_require__(16);
+var GetPhysicsPlugins = __webpack_require__(935);
+var GetScenePlugins = __webpack_require__(934);
var NOOP = __webpack_require__(1);
-var Settings = __webpack_require__(326);
+var Settings = __webpack_require__(329);
/**
* @classdesc
@@ -36906,6 +37178,17 @@ var Systems = new Class({
*/
this.registry;
+ /**
+ * A reference to the global Scale Manager.
+ *
+ * In the default set-up you can access this from within a Scene via the `this.scale` property.
+ *
+ * @name Phaser.Scenes.Systems#scale
+ * @type {Phaser.Scale.ScaleManager}
+ * @since 3.15.0
+ */
+ this.scale;
+
/**
* A reference to the global Sound Manager.
*
@@ -37048,6 +37331,7 @@ var Systems = new Class({
*
* @method Phaser.Scenes.Systems#init
* @protected
+ * @fires Phaser.Scenes.Events#BOOT
* @since 3.0.0
*
* @param {Phaser.Game} game - A reference to the Phaser Game instance.
@@ -37070,7 +37354,7 @@ var Systems = new Class({
pluginManager.addToScene(this, DefaultPlugins.Global, [ DefaultPlugins.CoreScene, GetScenePlugins(this), GetPhysicsPlugins(this) ]);
- this.events.emit('boot', this);
+ this.events.emit(Events.BOOT, this);
this.settings.isBooted = true;
},
@@ -37099,6 +37383,9 @@ var Systems = new Class({
* Frame or Set Timeout call to the main Game instance.
*
* @method Phaser.Scenes.Systems#step
+ * @fires Phaser.Scenes.Events#PRE_UPDATE
+ * @fires Phaser.Scenes.Events#_UPDATE
+ * @fires Phaser.Scenes.Events#POST_UPDATE
* @since 3.0.0
*
* @param {number} time - The time value from the most recent Game step. Typically a high-resolution timer value, or Date.now().
@@ -37106,13 +37393,13 @@ var Systems = new Class({
*/
step: function (time, delta)
{
- this.events.emit('preupdate', time, delta);
+ this.events.emit(Events.PRE_UPDATE, time, delta);
- this.events.emit('update', time, delta);
+ this.events.emit(Events.UPDATE, time, delta);
this.sceneUpdate.call(this.scene, time, delta);
- this.events.emit('postupdate', time, delta);
+ this.events.emit(Events.POST_UPDATE, time, delta);
},
/**
@@ -37120,6 +37407,7 @@ var Systems = new Class({
* Instructs the Scene to render itself via its Camera Manager to the renderer given.
*
* @method Phaser.Scenes.Systems#render
+ * @fires Phaser.Scenes.Events#RENDER
* @since 3.0.0
*
* @param {(Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer)} renderer - The renderer that invoked the render call.
@@ -37132,7 +37420,7 @@ var Systems = new Class({
this.cameras.render(renderer, displayList);
- this.events.emit('render', renderer);
+ this.events.emit(Events.RENDER, renderer);
},
/**
@@ -37162,6 +37450,7 @@ var Systems = new Class({
* A paused Scene still renders, it just doesn't run ANY of its update handlers or systems.
*
* @method Phaser.Scenes.Systems#pause
+ * @fires Phaser.Scenes.Events#PAUSE
* @since 3.0.0
*
* @param {object} [data] - A data object that will be passed in the 'pause' event.
@@ -37176,7 +37465,7 @@ var Systems = new Class({
this.settings.active = false;
- this.events.emit('pause', this, data);
+ this.events.emit(Events.PAUSE, this, data);
}
return this;
@@ -37186,6 +37475,7 @@ var Systems = new Class({
* Resume this Scene from a paused state.
*
* @method Phaser.Scenes.Systems#resume
+ * @fires Phaser.Scenes.Events#RESUME
* @since 3.0.0
*
* @param {object} [data] - A data object that will be passed in the 'resume' event.
@@ -37200,7 +37490,7 @@ var Systems = new Class({
this.settings.active = true;
- this.events.emit('resume', this, data);
+ this.events.emit(Events.RESUME, this, data);
}
return this;
@@ -37215,6 +37505,7 @@ var Systems = new Class({
* from other Scenes may still invoke changes within it, so be careful what is left active.
*
* @method Phaser.Scenes.Systems#sleep
+ * @fires Phaser.Scenes.Events#SLEEP
* @since 3.0.0
*
* @param {object} [data] - A data object that will be passed in the 'sleep' event.
@@ -37228,7 +37519,7 @@ var Systems = new Class({
this.settings.active = false;
this.settings.visible = false;
- this.events.emit('sleep', this, data);
+ this.events.emit(Events.SLEEP, this, data);
return this;
},
@@ -37237,6 +37528,7 @@ var Systems = new Class({
* Wake-up this Scene if it was previously asleep.
*
* @method Phaser.Scenes.Systems#wake
+ * @fires Phaser.Scenes.Events#WAKE
* @since 3.0.0
*
* @param {object} [data] - A data object that will be passed in the 'wake' event.
@@ -37252,11 +37544,11 @@ var Systems = new Class({
settings.active = true;
settings.visible = true;
- this.events.emit('wake', this, data);
+ this.events.emit(Events.WAKE, this, data);
if (settings.isTransition)
{
- this.events.emit('transitionwake', settings.transitionFrom, settings.transitionDuration);
+ this.events.emit(Events.TRANSITION_WAKE, settings.transitionFrom, settings.transitionDuration);
}
return this;
@@ -37401,6 +37693,8 @@ var Systems = new Class({
* Called automatically by the SceneManager.
*
* @method Phaser.Scenes.Systems#start
+ * @fires Phaser.Scenes.Events#START
+ * @fires Phaser.Scenes.Events#READY
* @since 3.0.0
*
* @param {object} data - Optional data object that may have been passed to this Scene from another.
@@ -37418,25 +37712,10 @@ var Systems = new Class({
this.settings.visible = true;
// For plugins to listen out for
- this.events.emit('start', this);
+ this.events.emit(Events.START, this);
// For user-land code to listen out for
- this.events.emit('ready', this, data);
- },
-
- /**
- * Called automatically by the SceneManager if the Game resizes.
- * Dispatches an event you can respond to in your game code.
- *
- * @method Phaser.Scenes.Systems#resize
- * @since 3.2.0
- *
- * @param {number} width - The new width of the game.
- * @param {number} height - The new height of the game.
- */
- resize: function (width, height)
- {
- this.events.emit('resize', width, height);
+ this.events.emit(Events.READY, this, data);
},
/**
@@ -37447,23 +37726,24 @@ var Systems = new Class({
* to free-up resources.
*
* @method Phaser.Scenes.Systems#shutdown
+ * @fires Phaser.Scenes.Events#SHUTDOWN
* @since 3.0.0
*
* @param {object} [data] - A data object that will be passed in the 'shutdown' event.
*/
shutdown: function (data)
{
- this.events.off('transitioninit');
- this.events.off('transitionstart');
- this.events.off('transitioncomplete');
- this.events.off('transitionout');
+ this.events.off(Events.TRANSITION_INIT);
+ this.events.off(Events.TRANSITION_START);
+ this.events.off(Events.TRANSITION_COMPLETE);
+ this.events.off(Events.TRANSITION_OUT);
this.settings.status = CONST.SHUTDOWN;
this.settings.active = false;
this.settings.visible = false;
- this.events.emit('shutdown', this, data);
+ this.events.emit(Events.SHUTDOWN, this, data);
},
/**
@@ -37473,6 +37753,7 @@ var Systems = new Class({
*
* @method Phaser.Scenes.Systems#destroy
* @private
+ * @fires Phaser.Scenes.Events#DESTROY
* @since 3.0.0
*/
destroy: function ()
@@ -37482,7 +37763,7 @@ var Systems = new Class({
this.settings.active = false;
this.settings.visible = false;
- this.events.emit('destroy', this);
+ this.events.emit(Events.DESTROY, this);
this.events.removeAllListeners();
@@ -37500,12 +37781,268 @@ module.exports = Systems;
/***/ }),
-/* 167 */
+/* 177 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var SpliceOne = __webpack_require__(97);
+
+/**
+ * Removes the given item, or array of items, from the array.
+ *
+ * The array is modified in-place.
+ *
+ * You can optionally specify a callback to be invoked for each item successfully removed from the array.
+ *
+ * @function Phaser.Utils.Array.Remove
+ * @since 3.4.0
+ *
+ * @param {array} array - The array to be modified.
+ * @param {*|Array.<*>} item - The item, or array of items, to be removed from the array.
+ * @param {function} [callback] - A callback to be invoked for each item successfully removed from the array.
+ * @param {object} [context] - The context in which the callback is invoked.
+ *
+ * @return {*|Array.<*>} The item, or array of items, that were successfully removed from the array.
+ */
+var Remove = function (array, item, callback, context)
+{
+ if (context === undefined) { context = array; }
+
+ var index;
+
+ // Fast path to avoid array mutation and iteration
+ if (!Array.isArray(item))
+ {
+ index = array.indexOf(item);
+
+ if (index !== -1)
+ {
+ SpliceOne(array, index);
+
+ if (callback)
+ {
+ callback.call(context, item);
+ }
+
+ return item;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ // If we got this far, we have an array of items to remove
+
+ var itemLength = item.length - 1;
+
+ while (itemLength >= 0)
+ {
+ var entry = item[itemLength];
+
+ index = array.indexOf(entry);
+
+ if (index !== -1)
+ {
+ SpliceOne(array, index);
+
+ if (callback)
+ {
+ callback.call(context, entry);
+ }
+ }
+ else
+ {
+ // Item wasn't found in the array, so remove it from our return results
+ item.pop();
+ }
+
+ itemLength--;
+ }
+
+ return item;
+};
+
+module.exports = Remove;
+
+
+/***/ }),
+/* 178 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var CONST = {
+
+ CENTER: __webpack_require__(349),
+ ORIENTATION: __webpack_require__(348),
+ SCALE_MODE: __webpack_require__(347),
+ ZOOM: __webpack_require__(346)
+
+};
+
+module.exports = CONST;
+
+
+/***/ }),
+/* 179 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Adds the given element to the DOM. If a parent is provided the element is added as a child of the parent, providing it was able to access it.
+ * If no parent was given it falls back to using `document.body`.
+ *
+ * @function Phaser.DOM.AddToDOM
+ * @since 3.0.0
+ *
+ * @param {HTMLElement} element - The element to be added to the DOM. Usually a Canvas object.
+ * @param {(string|HTMLElement)} [parent] - The parent in which to add the element. Can be a string which is passed to `getElementById` or an actual DOM object.
+ *
+ * @return {HTMLElement} The element that was added to the DOM.
+ */
+var AddToDOM = function (element, parent)
+{
+ var target;
+
+ if (parent)
+ {
+ if (typeof parent === 'string')
+ {
+ // Hopefully an element ID
+ target = document.getElementById(parent);
+ }
+ else if (typeof parent === 'object' && parent.nodeType === 1)
+ {
+ // Quick test for a HTMLElement
+ target = parent;
+ }
+ }
+ else if (element.parentElement)
+ {
+ return element;
+ }
+
+ // Fallback, covers an invalid ID and a non HTMLElement object
+ if (!target)
+ {
+ target = document.body;
+ }
+
+ target.appendChild(element);
+
+ return element;
+};
+
+module.exports = AddToDOM;
+
+
+/***/ }),
+/* 180 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var Rectangle = __webpack_require__(10);
+
+// points is an array of Point-like objects,
+// either 2 dimensional arrays, or objects with public x/y properties:
+// var points = [
+// [100, 200],
+// [200, 400],
+// { x: 30, y: 60 }
+// ]
+
+/**
+ * Constructs new Rectangle or repositions and resizes an existing Rectangle so that all of the given points are on or within its bounds.
+ *
+ * @function Phaser.Geom.Rectangle.FromPoints
+ * @since 3.0.0
+ *
+ * @generic {Phaser.Geom.Rectangle} O - [out,$return]
+ *
+ * @param {array} points - An array of points (either arrays with two elements corresponding to the X and Y coordinate or an object with public `x` and `y` properties) which should be surrounded by the Rectangle.
+ * @param {Phaser.Geom.Rectangle} [out] - Optional Rectangle to adjust.
+ *
+ * @return {Phaser.Geom.Rectangle} The adjusted `out` Rectangle, or a new Rectangle if none was provided.
+ */
+var FromPoints = function (points, out)
+{
+ if (out === undefined) { out = new Rectangle(); }
+
+ if (points.length === 0)
+ {
+ return out;
+ }
+
+ var minX = Number.MAX_VALUE;
+ var minY = Number.MAX_VALUE;
+
+ var maxX = Number.MIN_SAFE_INTEGER;
+ var maxY = Number.MIN_SAFE_INTEGER;
+
+ var p;
+ var px;
+ var py;
+
+ for (var i = 0; i < points.length; i++)
+ {
+ p = points[i];
+
+ if (Array.isArray(p))
+ {
+ px = p[0];
+ py = p[1];
+ }
+ else
+ {
+ px = p.x;
+ py = p.y;
+ }
+
+ minX = Math.min(minX, px);
+ minY = Math.min(minY, py);
+
+ maxX = Math.max(maxX, px);
+ maxY = Math.max(maxY, py);
+ }
+
+ out.x = minX;
+ out.y = minY;
+ out.width = maxX - minX;
+ out.height = maxY - minY;
+
+ return out;
+};
+
+module.exports = FromPoints;
+
+
+/***/ }),
+/* 181 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -37601,17 +38138,957 @@ module.exports = DefaultPlugins;
/***/ }),
-/* 168 */
+/* 182 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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);
+// 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;
+ },
+
+ /**
+ * Transforms the coordinates of this Vector3 with the given Matrix4.
+ *
+ * @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;
+ }
+
+});
+
+/**
+ * A static zero Vector3 for use by reference.
+ *
+ * This constant is meant for comparison operations and should not be modified directly.
+ *
+ * @constant
+ * @name Phaser.Math.Vector3.ZERO
+ * @type {Phaser.Math.Vector3}
+ * @since 3.16.0
+ */
+Vector3.ZERO = new Vector3();
+
+/**
+ * A static right Vector3 for use by reference.
+ *
+ * This constant is meant for comparison operations and should not be modified directly.
+ *
+ * @constant
+ * @name Phaser.Math.Vector3.RIGHT
+ * @type {Phaser.Math.Vector3}
+ * @since 3.16.0
+ */
+Vector3.RIGHT = new Vector3(1, 0, 0);
+
+/**
+ * A static left Vector3 for use by reference.
+ *
+ * This constant is meant for comparison operations and should not be modified directly.
+ *
+ * @constant
+ * @name Phaser.Math.Vector3.LEFT
+ * @type {Phaser.Math.Vector3}
+ * @since 3.16.0
+ */
+Vector3.LEFT = new Vector3(-1, 0, 0);
+
+/**
+ * A static up Vector3 for use by reference.
+ *
+ * This constant is meant for comparison operations and should not be modified directly.
+ *
+ * @constant
+ * @name Phaser.Math.Vector3.UP
+ * @type {Phaser.Math.Vector3}
+ * @since 3.16.0
+ */
+Vector3.UP = new Vector3(0, -1, 0);
+
+/**
+ * A static down Vector3 for use by reference.
+ *
+ * This constant is meant for comparison operations and should not be modified directly.
+ *
+ * @constant
+ * @name Phaser.Math.Vector3.DOWN
+ * @type {Phaser.Math.Vector3}
+ * @since 3.16.0
+ */
+Vector3.DOWN = new Vector3(0, 1, 0);
+
+/**
+ * A static forward Vector3 for use by reference.
+ *
+ * This constant is meant for comparison operations and should not be modified directly.
+ *
+ * @constant
+ * @name Phaser.Math.Vector3.FORWARD
+ * @type {Phaser.Math.Vector3}
+ * @since 3.16.0
+ */
+Vector3.FORWARD = new Vector3(0, 0, 1);
+
+/**
+ * A static back Vector3 for use by reference.
+ *
+ * This constant is meant for comparison operations and should not be modified directly.
+ *
+ * @constant
+ * @name Phaser.Math.Vector3.BACK
+ * @type {Phaser.Math.Vector3}
+ * @since 3.16.0
+ */
+Vector3.BACK = new Vector3(0, 0, -1);
+
+/**
+ * A static one Vector3 for use by reference.
+ *
+ * This constant is meant for comparison operations and should not be modified directly.
+ *
+ * @constant
+ * @name Phaser.Math.Vector3.ONE
+ * @type {Phaser.Math.Vector3}
+ * @since 3.16.0
+ */
+Vector3.ONE = new Vector3(1, 1, 1);
+
+module.exports = Vector3;
+
+
+/***/ }),
+/* 183 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var CONST = __webpack_require__(20);
+
+/**
+ * Convert the given angle in radians, to the equivalent angle in degrees.
+ *
+ * @function Phaser.Math.RadToDeg
+ * @since 3.0.0
+ *
+ * @param {number} radians - The angle in radians to convert ot degrees.
+ *
+ * @return {integer} The given angle converted to degrees.
+ */
+var RadToDeg = function (radians)
+{
+ return radians * CONST.RAD_TO_DEG;
+};
+
+module.exports = RadToDeg;
+
+
+/***/ }),
+/* 184 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Compute a random integer between the `min` and `max` values, inclusive.
+ *
+ * @function Phaser.Math.Between
+ * @since 3.0.0
+ *
+ * @param {integer} min - The minimum value.
+ * @param {integer} max - The maximum value.
+ *
+ * @return {integer} The random integer.
+ */
+var Between = function (min, max)
+{
+ return Math.floor(Math.random() * (max - min + 1) + min);
+};
+
+module.exports = Between;
+
+
+/***/ }),
+/* 185 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Calculates a Catmull-Rom value.
+ *
+ * @function Phaser.Math.CatmullRom
+ * @since 3.0.0
+ *
+ * @param {number} t - [description]
+ * @param {number} p0 - [description]
+ * @param {number} p1 - [description]
+ * @param {number} p2 - [description]
+ * @param {number} p3 - [description]
+ *
+ * @return {number} The Catmull-Rom value.
+ */
+var CatmullRom = function (t, p0, p1, p2, p3)
+{
+ var v0 = (p2 - p0) * 0.5;
+ var v1 = (p3 - p1) * 0.5;
+ var t2 = t * t;
+ var t3 = t * t2;
+
+ return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
+};
+
+module.exports = CatmullRom;
+
+
+/***/ }),
+/* 186 */
+/***/ (function(module, exports) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+/**
+ * Check whether the given values are fuzzily equal.
+ *
+ * Two numbers are fuzzily equal if their difference is less than `epsilon`.
+ *
+ * @function Phaser.Math.Fuzzy.Equal
+ * @since 3.0.0
+ *
+ * @param {number} a - The first value.
+ * @param {number} b - The second value.
+ * @param {number} [epsilon=0.0001] - The epsilon.
+ *
+ * @return {boolean} `true` if the values are fuzzily equal, otherwise `false`.
+ */
+var Equal = function (a, b, epsilon)
+{
+ if (epsilon === undefined) { epsilon = 0.0001; }
+
+ return Math.abs(a - b) < epsilon;
+};
+
+module.exports = Equal;
+
+
+/***/ }),
+/* 187 */
+/***/ (function(module, exports, __webpack_require__) {
+
+/**
+ * @author Richard Davey
+ * @copyright 2019 Photon Storm Ltd.
+ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+ */
+
+var OS = __webpack_require__(99);
+var Browser = __webpack_require__(128);
var CanvasPool = __webpack_require__(24);
/**
@@ -37798,274 +39275,27 @@ module.exports = init();
/***/ }),
-/* 169 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Adds the given element to the DOM. If a parent is provided the element is added as a child of the parent, providing it was able to access it.
- * If no parent was given it falls back to using `document.body`.
- *
- * @function Phaser.DOM.AddToDOM
- * @since 3.0.0
- *
- * @param {HTMLElement} element - The element to be added to the DOM. Usually a Canvas object.
- * @param {(string|HTMLElement)} [parent] - The parent in which to add the element. Can be a string which is passed to `getElementById` or an actual DOM object.
- * @param {boolean} [overflowHidden=true] - Whether or not to hide overflowing content inside the parent.
- *
- * @return {HTMLElement} The element that was added to the DOM.
- */
-var AddToDOM = function (element, parent, overflowHidden)
-{
- if (overflowHidden === undefined) { overflowHidden = true; }
-
- var target;
-
- if (parent)
- {
- if (typeof parent === 'string')
- {
- // Hopefully an element ID
- target = document.getElementById(parent);
- }
- else if (typeof parent === 'object' && parent.nodeType === 1)
- {
- // Quick test for a HTMLElement
- target = parent;
- }
- }
- else if (element.parentElement)
- {
- return element;
- }
-
- // Fallback, covers an invalid ID and a non HTMLElement object
- if (!target)
- {
- target = document.body;
- }
-
- if (overflowHidden && target.style)
- {
- target.style.overflow = 'hidden';
- }
-
- target.appendChild(element);
-
- return element;
-};
-
-module.exports = AddToDOM;
-
-
-/***/ }),
-/* 170 */
-/***/ (function(module, exports) {
-
-/**
- * @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
- * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
- */
-
-/**
- * Compute a random integer between the `min` and `max` values, inclusive.
- *
- * @function Phaser.Math.Between
- * @since 3.0.0
- *
- * @param {integer} min - The minimum value.
- * @param {integer} max - The maximum value.
- *
- * @return {integer} The random integer.
- */
-var Between = function (min, max)
-{
- return Math.floor(Math.random() * (max - min + 1) + min);
-};
-
-module.exports = Between;
-
-
-/***/ }),
-/* 171 */
-/***/ (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 Catmull-Rom value.
- *
- * @function Phaser.Math.CatmullRom
- * @since 3.0.0
- *
- * @param {number} t - [description]
- * @param {number} p0 - [description]
- * @param {number} p1 - [description]
- * @param {number} p2 - [description]
- * @param {number} p3 - [description]
- *
- * @return {number} The Catmull-Rom value.
- */
-var CatmullRom = function (t, p0, p1, p2, p3)
-{
- var v0 = (p2 - p0) * 0.5;
- var v1 = (p3 - p1) * 0.5;
- var t2 = t * t;
- var t3 = t * t2;
-
- return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
-};
-
-module.exports = CatmullRom;
-
-
-/***/ }),
-/* 172 */
+/* 188 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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 in radians, to the equivalent angle in degrees.
- *
- * @function Phaser.Math.RadToDeg
- * @since 3.0.0
- *
- * @param {number} radians - The angle in radians to convert ot degrees.
- *
- * @return {integer} The given angle converted to degrees.
- */
-var RadToDeg = function (radians)
-{
- return radians * CONST.RAD_TO_DEG;
-};
-
-module.exports = RadToDeg;
-
-
-/***/ }),
-/* 173 */
-/***/ (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 Rectangle = __webpack_require__(9);
-
-// points is an array of Point-like objects,
-// either 2 dimensional arrays, or objects with public x/y properties:
-// var points = [
-// [100, 200],
-// [200, 400],
-// { x: 30, y: 60 }
-// ]
-
-/**
- * Constructs new Rectangle or repositions and resizes an existing Rectangle so that all of the given points are on or within its bounds.
- *
- * @function Phaser.Geom.Rectangle.FromPoints
- * @since 3.0.0
- *
- * @generic {Phaser.Geom.Rectangle} O - [out,$return]
- *
- * @param {array} points - An array of points (either arrays with two elements corresponding to the X and Y coordinate or an object with public `x` and `y` properties) which should be surrounded by the Rectangle.
- * @param {Phaser.Geom.Rectangle} [out] - Optional Rectangle to adjust.
- *
- * @return {Phaser.Geom.Rectangle} The adjusted `out` Rectangle, or a new Rectangle if none was provided.
- */
-var FromPoints = function (points, out)
-{
- if (out === undefined) { out = new Rectangle(); }
-
- if (points.length === 0)
- {
- return out;
- }
-
- var minX = Number.MAX_VALUE;
- var minY = Number.MAX_VALUE;
-
- var maxX = Number.MIN_SAFE_INTEGER;
- var maxY = Number.MIN_SAFE_INTEGER;
-
- var p;
- var px;
- var py;
-
- for (var i = 0; i < points.length; i++)
- {
- p = points[i];
-
- if (Array.isArray(p))
- {
- px = p[0];
- py = p[1];
- }
- else
- {
- px = p.x;
- py = p.y;
- }
-
- minX = Math.min(minX, px);
- minY = Math.min(minY, py);
-
- maxX = Math.max(maxX, px);
- maxY = Math.max(maxY, py);
- }
-
- out.x = minX;
- out.y = minY;
- out.width = maxX - minX;
- out.height = maxY - minY;
-
- return out;
-};
-
-module.exports = FromPoints;
-
-
-/***/ }),
-/* 174 */
-/***/ (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 Back = __webpack_require__(369);
-var Bounce = __webpack_require__(368);
-var Circular = __webpack_require__(367);
-var Cubic = __webpack_require__(366);
-var Elastic = __webpack_require__(365);
-var Expo = __webpack_require__(364);
-var Linear = __webpack_require__(363);
-var Quadratic = __webpack_require__(362);
-var Quartic = __webpack_require__(361);
-var Quintic = __webpack_require__(360);
-var Sine = __webpack_require__(359);
-var Stepped = __webpack_require__(358);
+var Back = __webpack_require__(402);
+var Bounce = __webpack_require__(401);
+var Circular = __webpack_require__(400);
+var Cubic = __webpack_require__(399);
+var Elastic = __webpack_require__(398);
+var Expo = __webpack_require__(397);
+var Linear = __webpack_require__(396);
+var Quadratic = __webpack_require__(395);
+var Quartic = __webpack_require__(394);
+var Quintic = __webpack_require__(393);
+var Sine = __webpack_require__(392);
+var Stepped = __webpack_require__(391);
// EaseMap
module.exports = {
@@ -38126,12 +39356,12 @@ module.exports = {
/***/ }),
-/* 175 */
+/* 189 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -38163,16 +39393,16 @@ module.exports = CenterOn;
/***/ }),
-/* 176 */
+/* 190 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var GetColor = __webpack_require__(177);
+var GetColor = __webpack_require__(191);
/**
* Converts an HSV (hue, saturation and value) color value to RGB.
@@ -38264,12 +39494,12 @@ module.exports = HSVToRGB;
/***/ }),
-/* 177 */
+/* 191 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -38294,19 +39524,19 @@ module.exports = GetColor;
/***/ }),
-/* 178 */
+/* 192 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
-var HexStringToColor = __webpack_require__(377);
-var IntegerToColor = __webpack_require__(374);
-var ObjectToColor = __webpack_require__(372);
-var RGBStringToColor = __webpack_require__(371);
+var HexStringToColor = __webpack_require__(410);
+var IntegerToColor = __webpack_require__(407);
+var ObjectToColor = __webpack_require__(405);
+var RGBStringToColor = __webpack_require__(404);
/**
* Converts the given source color value into an instance of a Color class.
@@ -38350,12 +39580,12 @@ module.exports = ValueToColor;
/***/ }),
-/* 179 */
+/* 193 */
/***/ (function(module, exports) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
@@ -38426,25 +39656,24 @@ module.exports = Pad;
/***/ }),
-/* 180 */
+/* 194 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @author Richard Davey
- * @copyright 2018 Photon Storm Ltd.
+ * @copyright 2019 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]
+ * @callback EachMapCallback
*
- * @param {string} key - [description]
- * @param {*} entry - [description]
+ * @param {string} key - The key of the Map entry.
+ * @param {E} entry - The value of the Map entry.
*
- * @return {?boolean} [description]
+ * @return {?boolean} The callback result.
*/
/**
@@ -38509,6 +39738,7 @@ var Map = new Class({
/**
* Adds an element with a specified `key` and `value` to this Map.
+ * If the `key` already exists, the value will be replaced.
*
* @method Phaser.Structs.Map#set
* @since 3.0.0
@@ -38526,10 +39756,11 @@ var Map = new Class({
{
if (!this.has(key))
{
- this.entries[key] = value;
this.size++;
}
+ this.entries[key] = value;
+
return this;
},
@@ -38798,12 +40029,12 @@ module.exports = Map;
/***/ }),
-/* 181 */
+/* 195 */
/***/ (function(module, exports) {
/**
* @author Richard Davey