Skip to content

Commit 72fcae3

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 327bf13 + 2e722b0 commit 72fcae3

74 files changed

Lines changed: 3209 additions & 904 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
### New Features
66

7-
* A new property was added to Matter.World, `correction` which is used in the Engine.update call and allows you to adjust the time
8-
being passed to the simulation. The default value is 1 to remain consistent with previous releases.
9-
* Group.destroy has a new optional argument `destroyChildren` which will automatically call `destroy` on all children of a Group if set to true (the default is false, hence it doesn't change the public API). Fix #3246 (thanks @DouglasLapsley)
7+
* A new property was added to Matter.World, `correction` which is used in the Engine.update call and allows you to adjust the time being passed to the simulation. The default value is 1 to remain consistent with previous releases.
108
* Matter Physics now has a new config property `getDelta` which allows you to specify your own function to calculate the delta value given to the Matter Engine when it updates.
119
* Matter Physics has two new methods: `set60Hz` and `set30Hz` which will set an Engine update rate of 60Hz and 30Hz respectively. 60Hz being the default.
1210
* Matter Physics has a new config and run-time property `autoUpdate`, which defaults to `true`. When enabled the Matter Engine will update in sync with the game step (set by Request Animation Frame). The delta value given to Matter is now controlled by the `getDelta` function.
1311
* Matter Physics has a new method `step` which manually advances the physics simulation by one iteration, using whatever delta and correction values you pass in to it. When used in combination with `autoUpdate=false` you can now explicitly control the update frequency of the physics simulation and unbind it from the game step.
12+
* Matter Physics has two new debug properties: `debugShowJoint` and `debugJointColor`. If defined they will display joints in Matter bodies during the postUpdate debug phase (only if debug is enabled) (thanks @OmarShehata)
13+
* Group.destroy has a new optional argument `destroyChildren` which will automatically call `destroy` on all children of a Group if set to true (the default is false, hence it doesn't change the public API). Fix #3246 (thanks @DouglasLapsley)
1414
* WebAudioSound.setMute is a chainable way to mute a single Sound instance.
1515
* WebAudioSound.setVolume is a chainable way to set the volume of a single Sound instance.
1616
* WebAudioSound.setSeek is a chainable way to set seek to a point of a single Sound instance.
@@ -20,11 +20,33 @@ being passed to the simulation. The default value is 1 to remain consistent with
2020
* HTML5AudioSound.setSeek is a chainable way to set seek to a point of a single Sound instance.
2121
* HTML5AudioSound.setLoop is a chainable way to set the loop state of a single Sound instance.
2222
* BitmapText has a new property `letterSpacing` which accepts a positive or negative number to add / reduce spacing between characters (thanks @wtravO)
23-
* Matter Physics has two new debug properties: `debugShowJoint` and `debugJointColor`. If defined they will display joints in Matter bodies during the postUpdate debug phase (only if debug is enabled) (thanks @OmarShehata)
2423
* You can now pass a Sprite Sheet or Canvas as the Texture key to `Tilemap.addTileset` and it will work in WebGL, where-as before it would display a corrupted tilemap. Fix #3407 (thanks @Zykino)
2524
* Graphics.slice allows you to easily draw a Pacman, or slice of pie shape to a Graphics object.
2625
* List.addCallback is a new optional callback that is invoked every time a new child is added to the List. You can use this to have a callback fire when children are added to the Display List.
2726
* List.removeCallback is a new optional callback that is invoked every time a new child is removed from the List. You can use this to have a callback fire when children are removed from the Display List.
27+
* ScenePlugin.restart allows you to restart the current Scene. It's the same result as calling `ScenePlugin.start` without any arguments, but is more clear.
28+
* Utils.Array.Add allows you to add one or more items safely to an array, with optional limits and callbacks.
29+
* Utils.Array.AddAt allows you to add one or more items safely to an array at a specified position, with optional limits and callbacks.
30+
* Utils.Array.BringToTop allows you to bring an array element to the top of the array.
31+
* Utils.Array.CountAllMatching will scan an array and count all elements with properties matching the given value.
32+
* Utils.Array.Each will pass each element of an array to a given callback, with optional arguments.
33+
* Utils.Array.EachInRange will pass each element of an array in a given range to a callback, with optional arguments.
34+
* Utils.Array.GetAll will return all elements from an array, with optional property and value comparisons.
35+
* Utils.Array.GetFirst will return the first element in an array, with optional property and value comparisons.
36+
* Utils.Array.GetRandomElement has been renamed to GetRandom and will return a random element from an array.
37+
* Utils.Array.MoveDown will move the given array element down one position in the array.
38+
* Utils.Array.MoveTo will move the given array element to the given position in the array.
39+
* Utils.Array.MoveUp will move the given array element up one position in the array.
40+
* Utils.Array.Remove will remove the given element or array of elements from the array, with an optional callback.
41+
* Utils.Array.RemoveAt will remove the element from the given position in the array, with an optional callback.
42+
* Utils.Array.RemoveBetween will remove the elements between the given range in the array, with an optional callback.
43+
* Utils.Array.Replace will replace an existing element in an array with a new one.
44+
* Utils.Array.SendToBack allows you to send an array element to the bottom of the array.
45+
* Utils.Array.SetAll will set a property on all elements of an array to the given value, with optional range limits.
46+
* Utils.Array.Swap will swap the position of two elements in an array.
47+
* TransformMatrix.destroy is a new method that will clear out the array and object used by a Matrix internally.
48+
* BaseSound, and by extension WebAudioSound and HTMLAudioSound, will now emit a `destroy` event when they are destroyed (thanks @rexrainbow)
49+
* A new property was added to the Scene config: `mapAdd` which is used to extend the default injection map of a scene instead of overwriting it (thanks @sebashwa)
2850

2951
### Bug Fixes
3052

@@ -44,10 +66,21 @@ being passed to the simulation. The default value is 1 to remain consistent with
4466
* Line.getPointA and Line.getPointB incorrectly set the values into the Vector2 (thanks @Tomas2h)
4567
* DynamicTilemapLayer now uses the ComputedSize component, which stops it breaking if you call `setDisplaySize` (thanks Babsobar)
4668
* StaticTilemapLayer now uses the ComputedSize component, which stops it breaking if you call `setDisplaySize` (thanks Babsobar)
69+
* CanvasPool.first always returned `null`, and now returns the first available Canvas. Fix #3520 (thanks @mchiasson)
70+
* When starting a new Scene with an optional `data` argument it wouldn't get passed through if the Scene was not yet available (i.e. the game had not fully booted). The data is now passed to the Scene `init` and `create` methods and stored in the Scene Settings `data` property. Fix #3363 (thanks @pixelhijack)
71+
* Tween.restart handles removed tweens properly and reads them back into the active queue for the TweenManager (thanks @wtravO)
72+
* Tween.resume will now call `Tween.play` on a tween that was paused due to its config object, not as a result of having its paused method called. Fix #3452 (thanks @jazen)
73+
* LoaderPlugin.isReady referenced a constant that no longer exists. Fix #3503 (thanks @Twilrom)
74+
* Tween Timeline.destroy was trying to call `destroy` on Tweens instead of `stop` (thanks @Antriel)
75+
* Calling `setOffset` on a Static Arcade Physics Body would break because the method was missing. It has been added and now functions as expected. Fix #3465 (thanks @josephjaniga and @DouglasLapsley)
76+
* Calling Impact.World.remove(body) during a Body.updateCallback would cause the internal loop to crash when trying to access a now missing body. Two extra checks are in place to avoid this (thanks @iamDecode)
77+
* If `setInteractive` is called on a Game Object that fails to set a hit area, it will no longer try to assign `dropZone` to an undefined `input` property.
78+
* The Matter SetBody Component will no longer try to call `setOrigin` unless the Game Object has the origin component (which not all do, like Graphics and Container)
79+
* Matter Image and Matter Sprite didn't define a `destroy` method, causing an error when trying to destroy the parent Game Object. Fix #3516 (thanks @RollinSafary)
4780

4881
### Updates
4982

50-
* The RTree library (rbush) used by Phaser 3 suffered from violating CSP policies by dynamically creating Functions at run-time in an eval-like manner. These are now defined via generators. Fix #3441 (thanks @jamierocks @Colbydude)
83+
* The RTree library (rbush) used by Phaser 3 suffered from violating CSP policies by dynamically creating Functions at run-time in an eval-like manner. These are now defined via generators. Fix #3441 (thanks @jamierocks @Colbydude @jdotrjs)
5184
* BaseSound has had its `rate` and `detune` properties removed as they are always set in the overriding class.
5285
* BaseSound `setRate` and `setDetune` from the 3.3.0 release have moved to the WebAudioSound and HTML5AudioSound classes respectively, as they each handle the values differently.
5386
* The file `InteractiveObject.js` has been renamed to `CreateInteractiveObject.js` to more accurately reflect what it does and to avoid type errors in the docs.
@@ -65,12 +98,31 @@ being passed to the simulation. The default value is 1 to remain consistent with
6598
* List.removeAt has a new optional argument `skipCallback`.
6699
* List.removeBetween has a new optional argument `skipCallback`.
67100
* List.removeAll has a new optional argument `skipCallback`.
68-
69-
### Animation Component Updates
101+
* When using the `extend` property of a Scene config object it will now block overwriting the Scene `sys` property.
102+
* When using the `extend` property of a Scene config object, if you define a property called `data` that has an object set, it will populate the Scenes Data Manager with those values.
103+
* SceneManager._processing has been renamed to `isProcessing` which is now a boolean, not an integer. It's also now public and read-only.
104+
* SceneManager.isBooted is a new boolean read-only property that lets you know if the Scene Manager has performed its initial boot sequence.
105+
* TransformMatrix has the following new getter and setters: `a`, `b`, `c`, `d`, `tx` and `ty`. It also has the following new getters: `scaleX`, `scaleY` and `rotation`.
106+
* List.getByKey has been removed. Use `List.getFirst` instead which offers the exact same functionality.
107+
* List.sortIndexHandler has been removed because it's no longer required.
108+
* List.sort no longer takes an array as its argument, instead it only sorts the List contents by the defined property.
109+
* List.addMultiple has been removed. Used `List.add` instead which offers the exact same functionality.
110+
* List is now internally using all of the new Utils.Array functions.
111+
* Rectangle.Union will now cache all vars internally so you can use one of the input rectangles as the output rectangle without corrupting it.
112+
* When shutting down a Matter World it will now call MatterEvents.off, clearing all events, and also `removeAllListeners` for any local events.
113+
* Removed InputPlugin.sortInteractiveObjects because the method isn't used anywhere internally.
114+
115+
### Animation System Updates
70116

71117
We have refactored the Animation API to make it more consistent with the rest of Phaser 3 and to fix some issues. All of the following changes apply to the Animation Component:
72118

73119
* Animation durations, delays and repeatDelays are all now specified in milliseconds, not seconds like before. This makes them consistent with Tweens, Sounds and other parts of v3. You can still use the `frameRate` property to set the speed of an animation in frames per second.
120+
* All of the Animation callbacks have been removed, including `onStart`, `onRepeat`, `onUpdate` and `onComplete` and the corresponding params arrays like `onStartParams` and the property `callbackScope`. The reason for this is that they were all set on a global level, meaning that if you had 100 Sprites sharing the same animation, it was impossible to set the callbacks to fire for just one of those Sprites, but instead they would fire for all 100 and it was up to you to figure out which Sprite you wanted to update. Instead of callbacks animations now dispatch events on the Game Objects in which they are running. This means you can now do `sprite.on('animationstart')` and it will be invoked at the same point the old `onStart` callback would have been. The new events are: `animationstart`, `animtionrepeat`, `animationupdate` and `animationcomplete`. They're all dispatched from the Game Object that has the animation playing, not from the animation itself. This allows you far more control over what happens in the callbacks and we believe generally makes them more useful.
121+
* The AnimationFrame.onUpdate callback has been removed. You can now use the `animationupdate` event dispatched from the Game Object itself and check the 2nd argument, which is the animation frame.
122+
* Animation.stopAfterDelay is a new method that will stop a Sprites animation after the given time in ms.
123+
* Animation.stopOnRepeat is a new method that will stop a Sprites animation when it goes to repeat.
124+
* Animation.stopOnFrame is a new method that will stop a Sprites animation when it sets the given frame.
125+
* Animation.stop no longer has the `dispatchCallbacks` argument, because it dispatches an event which you can choose to ignore.
74126
* `delay` method has been removed.
75127
* `setDelay` allows you to define the delay before playback begins.
76128
* `getDelay` returns the animation playback delay value.
@@ -112,7 +164,7 @@ We have refactored the Animation API to make it more consistent with the rest of
112164

113165
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:
114166

115-
@gabegordon @melissaelopez @samid737 @nbs @tgrajewski @pagesrichie @hexus @mbrickn @erd0s @icbat @Matthew-Herman @ampled
167+
@gabegordon @melissaelopez @samid737 @nbs @tgrajewski @pagesrichie @hexus @mbrickn @erd0s @icbat @Matthew-Herman @ampled @mkimmet @PaNaVTEC
116168

117169

118170

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ The documentation for Phaser 3 is an on-going project. Please help us by searchi
118118

119119
They are automatically generated from the jsdoc comments in the Phaser source code. If you wish to help refine them then you must edit the Phaser jsdoc blocks directly. You can find more details, including the source to the conversion tool we wrote in the Docs repo.
120120

121+
### Webpack
122+
123+
We use Webpack to build Phaser and we take advantage of several features specific to Webpack to do this, including `raw-loader` to handle our shader files and build-time flags for renderer swapping.
124+
125+
If you wish to use Webpack with Phaser then please use our [Phaser 3 Project Template](https://github.com/photonstorm/phaser3-project-template) as it's already set-up to handle the build conditions Phaser needs.
126+
121127
### License
122128

123129
Phaser is released under the [MIT License](https://opensource.org/licenses/MIT).

src/actions/RotateAround.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ var RotateAroundDistance = require('../math/RotateAroundDistance');
88
var DistanceBetween = require('../math/distance/DistanceBetween');
99

1010
/**
11-
* [description]
11+
* Rotates each item around the given point by the given angle.
1212
*
1313
* @function Phaser.Actions.RotateAround
1414
* @since 3.0.0
15+
* @see Phaser.Math.RotateAroundDistance
1516
*
1617
* @generic {Phaser.GameObjects.GameObject[]} G - [items,$return]
1718
*

src/actions/Shuffle.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
var ArrayShuffle = require('../utils/array/Shuffle');
88

99
/**
10-
* [description]
10+
* Shuffles the array in place. The shuffled array is both modified and returned.
1111
*
1212
* @function Phaser.Actions.Shuffle
1313
* @since 3.0.0
14+
* @see Phaser.Utils.Array.Shuffle
1415
*
1516
* @generic {Phaser.GameObjects.GameObject[]} G - [items,$return]
1617
*

0 commit comments

Comments
 (0)