Skip to content

Commit 3707651

Browse files
authored
Merge branch 'master' into docs/arcade-physics-2
2 parents adb2181 + 5a4d1e5 commit 3707651

65 files changed

Lines changed: 1559 additions & 701 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: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,100 @@
22

33
## Version 3.14.0 - Tachikoma - in development
44

5+
### Tilemap New Features, Updates and Fixes
6+
7+
* Both Static and Dynamic Tilemap layers now support rendering multiple tilesets per layer in both Canvas and WebGL. To use multiple tilesets pass in an array of Tileset objects, or strings, to the `createStaticLayer` and `createDynamicLayer` methods respectively.
8+
* `Tilemap.createStaticLayer` now supports passing either a Tileset reference, or a string, or an array of them as the 2nd argument. If strings, the string should be the Tileset name (usually defined in Tiled).
9+
* `Tilemap.createDynamicLayer` now supports passing either a Tileset reference, or a string, or an array of them as the 2nd argument. If strings, the string should be the Tileset name (usually defined in Tiled).
10+
* `Tilemap.createBlankDynamicLayer` now supports passing either a Tileset reference, or a string, or an array of them as the 2nd argument. If strings, the string should be the Tileset name (usually defined in Tiled).
11+
* Static Tilemap Layers now support tile rotation and flipping. Previously this was a feature only for Dynamic Tilemap Layers, but now both have it. Close #4037 (thanks @thisredone)
12+
* `Tilemap.getTileset` is a new method that will return a Tileset based on its name.
13+
* `ParseTilesets` has been rewritten so it will convert the new data structures of Tiled 1.2 into the format expected by Phaser, allowing you to use either Tiled 1.2.x or Tiled 1.1 JSON exports. Fix #3998 (thanks @martin-pabst @halgorithm)
14+
* `Tilemap.setBaseTileSize` now sets the size into the LayerData `baseTileWidth` and `baseTileHeight` properties accordingly. Fix #4057 (thanks @imilo)
15+
* Calling `Tilemap.renderDebug` ignored the layer world position when drawing to the Graphics object. It will now translate to the layer position before drawing. Fix #4061 (thanks @Zax37)
16+
* Calling `Tilemap.renderDebug` ignored the layer scale when drawing to the Graphics object. It will now scale the layer before drawing. Fix #4026 (thanks @JasonHK)
17+
* The Static Tilemap Layer would stop drawing all tiles from that point on, if it encountered a tile which had invalid texture coordinates (such as a tile from another tileset). It now skips invalid tiles properly again. Fix #4002 (thanks @jdotrjs)
18+
* If you used a RenderTexture as a tileset then Dynamic Tilemap Layers would render the tiles inversed on the y-axis in WebGL. Fix #4017 (thanks @s-s)
19+
* If you used a scaled Dynamic Tilemap Layer and rotated or flipped tiles, the tiles that were rotated or flipped would be positioned incorrectly in WebGL. Fix #3778 (thanks @nkholski)
20+
* `StaticTilemapLayer.tileset` is now an array of Tileset objects, where-as before it was a single reference.
21+
* `StaticTilemapLayer.vertexBuffer` is now an array of WebGLBuffer objects, where-as before it was a single instance.
22+
* `StaticTilemapLayer.bufferData` is now an array of ArrayBuffer objects, where-as before it was a single instance.
23+
* `StaticTilemapLayer.vertexViewF32` is now an array of Float3Array objects, where-as before it was a single instance.
24+
* `StaticTilemapLayer.vertexViewU32` is now an array of Uint32Array objects, where-as before it was a single instance.
25+
* `StaticTilemapLayer.dirty` is now an array of booleans, where-as before it was a single boolean.
26+
* `StaticTilemapLayer.vertextCount` is now an array of integers, where-as before it was a single integer.
27+
* `StaticTilemapLayer.updateVBOData()` is a new private method that creates the internal VBO data arrays for the WebGL renderer.
28+
* The `StaticTilemapLayer.upload()` method has a new parameter `tilesetIndex` which controls which tileset to prepare the VBO data for.
29+
* The `StaticTilemapLayer.batchTile()` method has a new parameter `tilesetIndex` which controls which tileset to batch the tile for.
30+
* `StaticTilemapLayer.setTilesets()` is a new private method that creates the internal tileset references array.
31+
* `DynamicTilemapLayer.tileset` is now an array of Tileset objects, where-as before it was a single reference.
32+
* `DynamicTilemapLayer.setTilesets()` is a new private method that creates the internal tileset references array.
33+
534
### New Features
635

36+
* `bodyDebugFillColor` is a new Matter Physics debug option that allows you to set a color used when drawing filled bodies to the debug Graphic.
37+
* `debugWireframes` is a new Matter Physics debug option that allows you to control if the wireframes of the bodies are used when drawing to the debug Graphic. The default is `true`. If enabled bodies are not filled.
38+
* `debugShowInternalEdges` is a new Matter Physics debug option that allows you to set if the internal edges of a body are rendered to the debug Graphic.
39+
* `debugShowConvexHulls` is a new Matter Physics debug option that allows you to control if the convex hull of a body is drawn to the debug Graphic. The default is `false`.
40+
* `debugConvexHullColor` is a new Matter Physics debug option that lets you set the color of the convex hull, if being drawn to the debug Graphic.
41+
* `debugShowSleeping` is a new Matter Physics debug option that lets you draw sleeping bodies at 50% opacity.
42+
* `Curves.Ellipse.angle` is a new getter / setter that handles the rotation of the curve in degrees instead of radians.
43+
744
### Updates
845

46+
* The Loader has been updated to handle the impact of you destroying the game instance while still processing files. It will no longer throw cache and texture related errors. Fix #4049 (thanks @pantoninho)
47+
* `Polygon.setTo` can now take a string of space separated numbers when creating the polygon data, i.e.: `'40 0 40 20 100 20 100 80 40 80 40 100 0 50'`. This update also impacts the Polygon Shape object, which can now also take this format as well.
48+
* The `poly-decomp` library, as used by Matter.js, has been updated to 0.3.0.
49+
* `Matter.verts`, available via `this.matter.verts` from within a Scene, is a quick way of accessing the Matter Vertices functions.
50+
* You can now specify the vertices for a Matter `fromVerts` body as a string.
51+
* `TextureTintPipeline.batchTexture` has a new optional argument `skipFlip` which allows you to control the internal render texture flip Y check.
52+
* The Device.OS check for `node` will now do a `typeof` first to avoid issues with rollup packaged builds needing to shim the variable out. Fix #4058 (thanks @hollowdoor)
53+
* Arcade Physics Bodies will now sync the display origin of the parent Game Object to the body properties as part of the `updateBounds` call. This means if you change the origin of an AP enabled Game Object, after creation of the body, it will be reflected in the body position. This may or may not be a breaking change for your game. Previously it was expected that the origin should always be 0.5 and you adjust the body using `setOffset`, but this change makes a bit more sense logically. If you find that your bodies are offset after upgrading to this version then this is likely why. Close #4052 (thanks @SolarOmni)
54+
* The `Texture.getFramesFromTextureSource` method has a new boolean argument `includeBase`, which defaults to `false` and allows you to set if the base frame should be returned into the array or not.
55+
* There is a new Animation Event that is dispatched when an animation restarts. Listen for it via `Sprite.on('animationrestart')`.
56+
* All of the Animation Events now pass the Game Object as the final argument, this includes `animationstart`, `animationrestart`, `animationrepeat`, `animationupdate` and `animationcomplete`.
57+
* `Curves.Ellipse.rotation` is a getter / setter that holds the rotation of the curve. Previously it expected the value in degrees and when getting it returned the value in radians. It now expects the value in radians and returns radians to keep it logical.
58+
959
### Bug Fixes
1060

61+
* GameObjects added to and removed from Containers no longer listen for the `shutdown` event at all (thanks Vitali)
62+
* Sprites now have `preDestroy` method, which is called automatically by `destroy`. The method destroys the Animation component, unregistering the `remove` event in the process and freeing-up resources. Fix #4051 (thanks @Aveyder)
63+
* `UpdateList.shutdown` wasn't correctly iterating over the pending lists (thanks @felipeprov)
64+
* Input detection was known to be broken when the game resolution was !== 1 and the Camera zoom level was !== 1. Fix #4010 (thanks @s-s)
65+
* The `Shape.Line` object was missing a `lineWidth` property unless you called the `setLineWidth` method, causing the line to not render in Canvas only. Fix #4068 (thanks @netgfx)
66+
* All parts of Matter Body now have the `gameObject` property set correctly. Previously only the first part of the Body did.
67+
* When using `MatterGameObject` and `fromVerts` as the shape type it wouldn't pass the values to `Bodies.fromVertices` because of a previous conditional. It now passes them over correctly and the body is only set if the result is valid.
68+
* The `Texture.getFramesFromTextureSource` method was returning an array of Frame names by mistake, instead of Frame references. It now returns the Frames themselves.
69+
* When using `CanvasTexture.refresh` or `Graphics.generateTexture` it would throw WebGL warnings like 'bindTexture: Attempt to bind a deleted texture'. This was due to the Frames losing sync with the glTexture reference used by their TextureSource. Fix #4050 (thanks @kanthi0802)
70+
* Fixed an error in the `batchSprite` methods in the Canvas and WebGL Renderers that would incorrectly set the frame dimensions on Sprites with the crop component. This was particularly noticeable on Sprites with trimmed animation frames (thanks @sergeod9)
71+
72+
### Examples, Documentation and TypeScript
73+
74+
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:
75+
76+
@shaneMLK
77+
@wemyss
78+
Arian Fornaris
79+
cyantree
80+
DannyT
81+
Elliott Wallace
82+
felixnemis
83+
griga
84+
Hsaka
85+
icbat
86+
Lee
87+
Nathaniel Foldan
88+
Peter Pedersen
89+
rootasjey
90+
Sam Frantz
91+
snowbillr
92+
Stephen Hamilton
93+
STuFF
94+
TadejZupancic
95+
ajmetal
96+
henriacle
97+
@rgk
98+
@samme
1199

12100
## Version 3.13.0 - Yuuki - 20th September 2018
13101

plugins/fbinstant/src/FacebookInstantGamesPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ var FacebookInstantGamesPlugin = new Class({
279279
* Contains all of the leaderboard data, as populated by the `getLeaderboard()` method.
280280
*
281281
* @name Phaser.FacebookInstantGamesPlugin#leaderboards
282-
* @type {Leaderboard[]}
282+
* @type {Phaser.FacebookInstantGamesPlugin.Leaderboard[]}
283283
* @since 3.13.0
284284
*/
285285
this.leaderboards = {};

src/animations/Animation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ var Animation = new Class({
797797

798798
component.pendingRepeat = false;
799799

800-
component.parent.emit('animationrepeat', this, component.currentFrame, component.repeatCounter);
800+
component.parent.emit('animationrepeat', this, component.currentFrame, component.repeatCounter, component.parent);
801801
}
802802
}
803803
},

src/animations/AnimationManager.js

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var Pad = require('../utils/string/Pad');
3434
* @constructor
3535
* @since 3.0.0
3636
*
37-
* @param {Phaser.Game} game - [description]
37+
* @param {Phaser.Game} game - A reference to the Phaser.Game instance.
3838
*/
3939
var AnimationManager = new Class({
4040

@@ -47,7 +47,7 @@ var AnimationManager = new Class({
4747
EventEmitter.call(this);
4848

4949
/**
50-
* [description]
50+
* A reference to the Phaser.Game instance.
5151
*
5252
* @name Phaser.Animations.AnimationManager#game
5353
* @type {Phaser.Game}
@@ -57,7 +57,7 @@ var AnimationManager = new Class({
5757
this.game = game;
5858

5959
/**
60-
* [description]
60+
* A reference to the Texture Manager.
6161
*
6262
* @name Phaser.Animations.AnimationManager#textureManager
6363
* @type {Phaser.Textures.TextureManager}
@@ -187,7 +187,7 @@ var AnimationManager = new Class({
187187
* @since 3.0.0
188188
*
189189
* @param {(string|JSONAnimationManager|JSONAnimation)} data - [description]
190-
* @param {boolean} [clearCurrentAnimations=false] - [description]
190+
* @param {boolean} [clearCurrentAnimations=false] - If set to `true`, the current animations will be removed (`anims.clear()`). If set to `false` (default), the animations in `data` will be added.
191191
*
192192
* @return {Phaser.Animations.Animation[]} An array containing all of the Animation objects that were created as a result of this call.
193193
*/
@@ -242,15 +242,17 @@ var AnimationManager = new Class({
242242
*/
243243

244244
/**
245-
* [description]
245+
* Generate an array of {@link AnimationFrameConfig} objects from a texture key and configuration object.
246+
*
247+
* Generates objects with string frame names, as configured by the given {@link AnimationFrameConfig}.
246248
*
247249
* @method Phaser.Animations.AnimationManager#generateFrameNames
248250
* @since 3.0.0
249251
*
250-
* @param {string} key - [description]
251-
* @param {GenerateFrameNamesConfig} [config] - [description]
252+
* @param {string} key - The key for the texture containing the animation frames.
253+
* @param {GenerateFrameNamesConfig} [config] - The configuration object for the animation frame names.
252254
*
253-
* @return {AnimationFrameConfig[]} [description]
255+
* @return {AnimationFrameConfig[]} The array of {@link AnimationFrameConfig} objects.
254256
*/
255257
generateFrameNames: function (key, config)
256258
{
@@ -327,7 +329,9 @@ var AnimationManager = new Class({
327329
*/
328330

329331
/**
330-
* Generates an array of {@link AnimationFrameConfig} objects from a texture key and configuration object.
332+
* Generate an array of {@link AnimationFrameConfig} objects from a texture key and configuration object.
333+
*
334+
* Generates objects with numbered frame names, as configured by the given {@link GenerateFrameNumbersConfig}.
331335
*
332336
* @method Phaser.Animations.AnimationManager#generateFrameNumbers
333337
* @since 3.0.0
@@ -391,29 +395,29 @@ var AnimationManager = new Class({
391395
},
392396

393397
/**
394-
* [description]
398+
* Get an Animation.
395399
*
396400
* @method Phaser.Animations.AnimationManager#get
397401
* @since 3.0.0
398402
*
399-
* @param {string} key - [description]
403+
* @param {string} key - The key of the Animation to retrieve.
400404
*
401-
* @return {Phaser.Animations.Animation} [description]
405+
* @return {Phaser.Animations.Animation} The Animation.
402406
*/
403407
get: function (key)
404408
{
405409
return this.anims.get(key);
406410
},
407411

408412
/**
409-
* Load an Animation into a Game Objects Animation Component.
413+
* Load an Animation into a Game Object's Animation Component.
410414
*
411415
* @method Phaser.Animations.AnimationManager#load
412416
* @since 3.0.0
413417
*
414-
* @param {Phaser.GameObjects.GameObject} child - [description]
415-
* @param {string} key - [description]
416-
* @param {(string|integer)} [startFrame] - [description]
418+
* @param {Phaser.GameObjects.GameObject} child - The Game Object to load the animation into.
419+
* @param {string} key - The key of the animation to load.
420+
* @param {(string|integer)} [startFrame] - The name of a start frame to set on the loaded animation.
417421
*
418422
* @return {Phaser.GameObjects.GameObject} [description]
419423
*/
@@ -430,7 +434,7 @@ var AnimationManager = new Class({
430434
},
431435

432436
/**
433-
* [description]
437+
* Pause all animations.
434438
*
435439
* @method Phaser.Animations.AnimationManager#pauseAll
436440
* @fires PauseAllAnimationEvent
@@ -451,13 +455,13 @@ var AnimationManager = new Class({
451455
},
452456

453457
/**
454-
* [description]
458+
* Play an animation on the given Game Objects that have an Animation Component.
455459
*
456460
* @method Phaser.Animations.AnimationManager#play
457461
* @since 3.0.0
458462
*
459-
* @param {string} key - [description]
460-
* @param {Phaser.GameObjects.GameObject} child - [description]
463+
* @param {string} key - The key of the animation to play on the Game Object.
464+
* @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} child - The Game Objects to play the animation on.
461465
*
462466
* @return {Phaser.Animations.AnimationManager} This Animation Manager.
463467
*/
@@ -484,13 +488,13 @@ var AnimationManager = new Class({
484488
},
485489

486490
/**
487-
* [description]
491+
* Remove an animation.
488492
*
489493
* @method Phaser.Animations.AnimationManager#remove
490494
* @fires RemoveAnimationEvent
491495
* @since 3.0.0
492496
*
493-
* @param {string} key - [description]
497+
* @param {string} key - The key of the animation to remove.
494498
*
495499
* @return {Phaser.Animations.Animation} [description]
496500
*/
@@ -509,7 +513,7 @@ var AnimationManager = new Class({
509513
},
510514

511515
/**
512-
* [description]
516+
* Resume all paused animations.
513517
*
514518
* @method Phaser.Animations.AnimationManager#resumeAll
515519
* @fires ResumeAllAnimationEvent
@@ -530,17 +534,17 @@ var AnimationManager = new Class({
530534
},
531535

532536
/**
533-
* Takes an array of Game Objects that have the Animation Component and then
537+
* Takes an array of Game Objects that have an Animation Component and then
534538
* starts the given animation playing on them, each one offset by the
535539
* `stagger` amount given to this method.
536540
*
537541
* @method Phaser.Animations.AnimationManager#staggerPlay
538542
* @since 3.0.0
539-
*
543+
*
540544
* @generic {Phaser.GameObjects.GameObject[]} G - [items,$return]
541545
*
542546
* @param {string} key - The key of the animation to play on the Game Objects.
543-
* @param {Phaser.GameObjects.GameObject[]} children - An array of Game Objects to play the animation on. They must have the Animation Component.
547+
* @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} children - An array of Game Objects to play the animation on. They must have an Animation Component.
544548
* @param {number} [stagger=0] - The amount of time, in milliseconds, to offset each play time by.
545549
*
546550
* @return {Phaser.Animations.AnimationManager} This Animation Manager.

0 commit comments

Comments
 (0)