Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
Please also see the 3.80 Change Log for details about the major 3.80 release.
RenderTexture
crashing in the presence of a light.Shader.setRenderToTexture()
after the game has started running. Actually, the root cause was leaving new WebGL textures bound after creation.TextureSource.setFlipY
always updates the texture.flipY
from render textures in Shader
and DynamicTexture
.TouchManager
that would prevent clicks from outside the game window from being registered. Fix #6747 (thanks @ulsoftnaver @jaxtheking)onMouseUpWindow
and onMouseDownWindow
in the MouseManager
so they now check for sourceCapabilities.firesTouchEvents
and if found, abort registering the event. This new browser event property is designed to prevent you accidentally registering a Mouse Event when a Touch Event has just occurred (see https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceCapabilities/firesTouchEvents)The Phaser LoaderPlugin and related classes have been updated so that they now work natively with base64 encoded files and Data URIs. This means you can now load a base64 encoded image, audio file or text file directly into the Loader. The Loader will then decode the data and process it as if it was a normal file. This is particularly useful for environments such as Playable Ads where you have to provide a single html file with all assets embedded and no XHR requests.
Loader.File.base64
is a new read-only boolean property that is set if the file contains a Data URI encoded string.Loader.File.onBase64Load
is a new method that is called when the file has finished decoding from a Data URI.ImageFile
will now default to using the Image Load Element if a base64 file is detected, instead of throwing a console warning about unsupported types.XHRLoader
will now return a fake XHR result object containing the decoded base64 data if a base64 file is detected, skipping the creation of a real XML Http Request object.The Game Config has a new Scale Manager property called snap
. This allows you to set a 'snapping' value for the width and height of your game. This is especially useful for games where you want to keep a fixed dimension: for example, you want the game to always snap to a multiple of 16 pixels for the width. Or, if you want to scale a pixel-art game up by integer values, you can now set the game size as the snap
value and the Scale Manager will ensure the game size is always a multiple of that value.
snap: { width, height }
in the game config. This is then passed to the display size by the Scale Manager and used to control the snap values. Fix #6629 (thanks @musjj @samme)ScaleManager.setSnap
is a new method that allows you to set the snap values for the game size, should you need to do it post-boot and not in the game config.Config#snapWidth
and Config#snapHeight
are new properties in the Game Config that hold the parsed snap
config values, as used by the Scale Manager.EXPAND
. This is inspired by the Expand mode in Godot: "Keep aspect ratio when stretching the screen, but keep neither the base width nor height. Depending on the screen aspect ratio, the viewport will either be larger in the horizontal direction (if the screen is wider than the base size) or in the vertical direction (if the screen is taller than the original size)" (thanks @rexrainbow)Tilemap.createFromTiles
method has been updated. It will now copy the following properties, if set in the Tile, to the Sprites it creates: rotation
, flipX
, flipY
, alpha
, visible
and tint
. If these properties are declared in the spriteConfig
passed to the method, those will be used instead, otherwise the Tile values are used. Fix #6711 (thanks @Nerodon)Tilemap.createFromTiles
method has a new property called useSpriteSheet
. If this is set to true
and you have loaded the tileset as a sprite sheet (not an image), then it will set the Sprite key and frame to match the sprite texture and tile index. Also, if you have not specified an origin
in the spriteConfig, it will adjust the sprite positions by half the tile size, to position them accurately on the map.Texture#getFrameBounds
is a new method that will return the bounds that all of the frames of a given Texture Source encompass. This is useful for things like calculating the bounds of a Sprite Sheet embedded within a Texture Atlas.Math.RectangleLike
is a new typedef that defines a rectangle-like object with public x
, y
, width
and height
properties.WebGLRenderer.getCompressedTextures
can now identify BPTC and RGTC support correctly. These were previously skipped.S3TCRGB
to S3TCSRGB
in WebGLTextureCompression
, CompressedTextureFileConfig
, and FileConfig
typedefs.BloomFX
and BlurFX
and any custom pipeline that relies on using the UtilityPipeline
full or half frame targets will now correctly draw even after the renderer size changes. Fix #6677 (thanks @Nerodon)PostFXPipeline.postBatch
method will now bind the current Render Target after the pipeline has booted for the first time. This fixes glitch errors on mobile devices where Post FX would appear corrupted for a single frame. Fix #6681 (thanks @moufmouf @tongliang999)mipmapFilter
set. Fix #6721 (thanks @saintflow and @rexrainbow)UtilityPipeline
now sets autoResize
to true
in its Render Target Config, so that the global fullFrame
and halfFrame
Render Targets will automatically resize if the renderer changes.WebGLPipeline.resizeUniform
is a new property that is defined in the WebGLPipelineConfig
. This is a string that defines a uResolution
property, or similar, within the pipeline shader. If the WebGL Renderer resizes, this uniform will now be updated automatically as part of the pipeline resize method. It has been added to both the Multi and Mobile pipelines as default. This fixes issues where the pipelines were rendering with old resolution values, causing graphical glitches in mostly pixel-art games. Fix #6674 #6678 (thanks @Nerodon @LazeKer)preUpdate
automatically when the play
method is called. This forces the new animation state to update and apply itself to the skeleton. This fixes an issue where Spine object would show the default frame in the Spine atlas for a single update before the animation started. Fix #5443 (thanks @spayton)SpineGameObject.setSlotAlpha
is a new method that allows you to set the alpha on a specific slot in a Spine skeleton.SpineGameObject.setAlpha
method has had its 2nd parameter removed. This fixes needless slot look-ups during rendering when a Spine Game Object is inside a regular Container. If you need to set slot alpha, use the new setSlotAlpha
method instead. Fix #6571 (thanks @spayton)SpineFile.onFileComplete
handler was running a regular expression against file.src
instead of file.url
, sometimes leading to double paths in the atlas paths on loading. Fix #6642 (thanks @rez23)The Phaser Input and related classes have been updated to be more consistent with each Game Object.
Mesh
based Game Objects now can use an input config with the setInteractive
method, which supports the options draggable
, dropzone
, cursor
and userHandCursor
. Fix #6510 #6652 (thanks @Baegus @Neppord)onTouchEndWindow
now stops pointer events when clicking through DOM elements to input. Fix #6697 (thanks @laineus)Input.InputPlugin
method disable
which is called by GameObjects.GameObject#disableInteractive
keeps its temp hit box value which stops propagation to interactive Game Objects in another scene. Fix #6601 (thanks @UnaiNeuronUp)setInteractive
and removeInteractive
methods of a Game Object outside of the game loop would cause an error in which Input.InputManager#resetCursor
would lose input context. Fix #6387 (thanks @TomorrowToday)TweenChainBuilder
was incorrectly setting the persist
flag on the Chain to true
, which goes against what the documentation says. It now correctly sets it to false
. This means if you previously had a Tween Chain that was persisting, it will no longer do so, so add the property to regain the feature.dropped
argument has now been added to the documentation for the DRAG_END
and GAMEOBJECT_DRAG_END
events. (thanks @samme)Container.onChildDestroyed
is a new internal method used to destroy Container children. Previously, if you destroyed a Game Object in an exclusive Container, the game object would (momentarily) move onto the Scene display list and emit an ADDED_TO_SCENE event. Also, if you added a Sprite to a non-exclusive Container and stopped the Scene, you would get a TypeError (evaluating 'this.anims.destroy'). This happened because the fromChild argument in the DESTROY event was misinterpreted as destroyChild in the Container's remove(), and the Container was calling the Sprite's destroy() again. (thanks @samme)Text
and TileSprite
Game Objects now place their textures into the global TextureManager
and a _textureKey
private string property has been added which contains a UUID to reference that texture.Tilemaps.Components.WeightedRandomize
method now uses the Phaser Math.RND.frac
method with a seed instead of the Math.Random
static method. (thanks @jorbascrumps)Tilemaps.Components.IsometricCullTiles
does the CheckIsoBounds
method check last when building the outputArray, as to help optimize in situations where the tile would not be visible anyway. (thanks @zegenie)Tilemaps.Components.WeightedRandomize
now uses the Phaser Math.RND.frac
method with a seed instead the Math.Random
static method. (thanks @jorbascrumps)Layer
Game Object has had its removeAll
, remove
and add
methods removed. These methods are all still available via the List
class that Layer inherits, but the destroyChild
parameters are no longer available.Renderer.Canvas
and Renderer.WebGL
will now only be included in the build file if the corresponding feature flags CANVAS_RENDERER
and/or WEBGL_RENDERER
are set to true
. For Canvas only builds this saves a lot of space in the build. (thanks @samme)autoResize
boolean in the RenderTargetConfig
which is passed to the Render Targets when they are created by a pipeline.Actions
method PlaceOnLine
now has an added ease
parameter which accepts a string from the EaseMap or a custom ease function to allow for different distributions along a line. (thanks @sB3p)XHRLoader
will now listen for ontimeout
and if triggered it will hand over to the File.onError
handler. This prevents the Loader from stalling if a file times out. Fix #6472 (thanks @343dev)LightPipeline.currentNormalMap
was incorrectly documented as being a property of WebGLRenderer
.Video
Game Object now emits a metadata
event, which emits once the video metadata is available.Time.Timeline
class now supports looping via the repeat
method. Types.Time.TimelineEvent
now has a loop
callback which will be called before its next iteration. Fix #6560 (thanks @micsun-al)Curves.Path
methods lineTo
and moveTo
now support Types.Math.Vector2Like
as the first parameter. Fix #6557 (thanks @wayfu)BitmapText.setFont
method will now set the texture, size and alignment even if the same font key has been given as is already in use. Fix #6740 (thanks @AlvaroNeuronup)WebAudioSound
will now set hasEnded = false
as part of stopAndRemoveBufferSource
, after the source has been stopped and disconnected. This should prevent it from being left in a true
state if the source onended
callback fired late, after the sound had been re-played. Fix #6657 (thanks @Demeno)ScaleManager.orientationChange
event listener will now directly refresh the Scale Manager internals. This fixes an issue where the orientation change event would fire after the window resize event, causing the Scale Manager to incorrectly report the new orientation on Chrome on iOS. Fix #6484 #5762 (thanks @spayton @meetpatel1989)Tileset.updateTileData
method has two new optional parameters offsetX
and offsetY
which allow you to set the offset that the tile data starts from within the base source texture.Factory.staticBody
had the wrong return type in the docs/TS defs. Fix #6693 (thanks @ddhaiby)Time.Timeline
class didn't show as extending the Event Emitter, or have config
as an optional argument in the docs / TS defs. Fix #6673 (thanks @ghclark2)Animations.AnimationFrame
member duration
is now the complete duration of the frame, which is a breaking change. Before this Animations.AnimationState#msPerFrame
was combined with Animations.AnimationFrame#duration
which wasn't intuitive. The fix to remove Animations.AnimationState#msPerFrame
from Animations.AnimationFrame#duration
has been removed from the Animations.AnimationManager
method createFromAseprite
because of this clarification. Fix #6712 (thanks @Nerodon @TomMalitz)NineSlice
Game Object method setSize
now recalculates its origin by calling the updateDisplayOrigin
method. Fix #6713 (thanks @dhashvir)NineSlice
Game Object method no longer defaults origin to 0.5
. Fix #6655 (thanks @michalfialadev)Layer
Game Object is destroyed, i.e. from changing or restarting a Scene, it will no longer cause an error when trying to destroy the children on its display list. Fix #6675 (thanks @crockergd @gm0nk)DynamicTexture
will now automatically call setSize(width, height)
for both WebGL and Canvas. Previously it only did it for WebGL. This fixes an issue where DynamicTextures in Canvas mode would have a width and height of -1. Fix #6682 (thanks @samme)DynamicTexture.setSize
will now check to see if the glTexture
bound to the current frame is stale, and if so, destroy it before binding the one from the Render Target. This fixes an issue where constantly destroying and creating Dynamic Textures would cause a memory leak in WebGL. Fix #6669 (thanks @DavidTalevski)Matter.Body
function scale
has been updated so if the Body originally had an inertia
of Infinity
this will be restored at the end of the call. This happens if you set a Matter Body to have fixed rotation. Fix #6369 (thanks @sushovande)RandomDataGenerator.weightedPick
method to avoid sampling past the last element. Fix #6701 (thanks @jameskirkwood)Physics.Matter.Factory
method pointerConstraint
no longer returns an error when it can't find the camera. Fix #6684 (thanks @spritus)Physics.Arcade.StaticBody
method reset
now re-applies offset
values. Fix #6729 (thanks @samme)Video
Game Object now has a starting texture, which stops errors with accessing frame
before the video loads the first frame. Fix #6475 (thanks @rexrainbow @JoeSiu)Device.Browser.safari
regular expression has been strenghtened so it now captures versions with double or triple periods in. Previously it would fail for Version/17.2.1
due to the minor value. (thanks watcher)Browser
Device class will no longer think that Chrome is Mobile Safari on iOS devices. Fix #6739 (thanks @michalfialadev)GameObjectCreator
method container
now includes all children in the config, accessed via Scene.make.container
. Fix #6743 (thanks @Fake)addSpriteSheetFromAtlas
and Tilemap.addTilesetImage
) will now render correctly. Fix #6691 (thanks @Antriel)TilemapWebGLRenderer
function has been fixed so it now uses the TileSet width and height for the tile draw command. This fixes an issue where the Tilemap would render incorrectly if the base tile size was different to the tile size. Fix #5988 (thanks @samme)ArcadePhysics.World.collideSpriteVsTilemapLayer
method has been modified so that the body bounds are now expanded by the size of the scaled base tile in the Tilemap Layer. This fixes an issue where the check would skip over-sized tiles that were outside the bounds of the body. Mostly noticeable on layers that had a different base tile size to the map itself. Fix #4479 (thanks @KingCosmic)My thanks to the following for helping with the Phaser 3 Examples, Beta Testing, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
@actionmoon @AlvaroEstradaDev @Byvire @Creepypoke @Flashfyre @orcomarcio @paxperscientiam @michalfialadev @rafael-lua @samme @Stan-Stani @stevenwithaph @yaustar @rexrainbow
EXPAND
. This is inspired by the Expand mode in Godot: "Keep aspect ratio when stretching the screen, but keep neither the base width nor height. Depending on the screen aspect ratio, the viewport will either be larger in the horizontal direction (if the screen is wider than the base size) or in the vertical direction (if the screen is taller than the original size)" (thanks @rexrainbow)The Phaser LoaderPlugin and related classes have been updated so that they now work natively with base64 encoded files and Data URIs. This means you can now load a base64 encoded image, audio file or text file directly into the Loader. The Loader will then decode the data and process it as if it was a normal file. This is particularly useful for environments such as Playable Ads where you have to provide a single html file with all assets embedded and no XHR requests.
Loader.File.base64
is a new read-only boolean property that is set if the file contains a Data URI encoded string.Loader.File.onBase64Load
is a new method that is called when the file has finished decoding from a Data URI.ImageFile
will now default to using the Image Load Element if a base64 file is detected, instead of throwing a console warning about unsupported types.XHRLoader
will now return a fake XHR result object containing the decoded base64 data if a base64 file is detected, skipping the creation of a real XML Http Request object.preUpdate
automatically when the play
method is called. This forces the new animation state to update and apply itself to the skeleton. This fixes an issue where Spine object would show the default frame in the Spine atlas for a single update before the animation started. Fix #5443 (thanks @spayton)SpineGameObject.setSlotAlpha
is a new method that allows you to set the alpha on a specific slot in a Spine skeleton.SpineGameObject.setAlpha
method has had its 2nd parameter removed. This fixes needless slot look-ups during rendering when a Spine Game Object is inside a regular Container. If you need to set slot alpha, use the new setSlotAlpha
method instead. Fix #6571 (thanks @spayton)SpineFile.onFileComplete
handler was running a regular expression against file.src
instead of file.url
, sometimes leading to double paths in the atlas paths on loading. Fix #6642 (thanks @rez23)TweenChainBuilder
was incorrectly setting the persist
flag on the Chain to true
, which goes against what the documentation says. It now correctly sets it to false
. This means if you previously had a Tween Chain that was persisting, it will no longer do so, so add the property to regain the feature.dropped
argument has now been adeded to the documentation for the DRAG_END
and GAMEOBJECT_DRAG_END
events. (thanks @samme)Container.onChildDestroyed
is a new internal method used to destroy Container children. Previously, if you destroyed a Game Object in an exclusive Container, the game object would (momentarily) move onto the Scene display list and emit an ADDED_TO_SCENE event. Also, if you added a Sprite to a non-exclusive Container and stopped the Scene, you would get a TypeError (evaluating 'this.anims.destroy'). This happened because the fromChild argument in the DESTROY event was misinterpreted as destroyChild in the Container's remove(), and the Container was calling the Sprite's destroy() again. (thanks @samme)Text
and TileSprite
Game Objects now place their textures into the global TextureManager
and a _textureKey
private string property has been added which contains a UUID to reference that texture.Tilemaps.Components.WeightedRandomize
method now uses the Phaser Math.RND.frac
method with a seed instead of the Math.Random
static method. (thanks @jorbascrumps)Tilemaps.Components.IsometricCullTiles
does the CheckIsoBounds
method check last when building the outputArray, as to help optimize in situations where the tile would not be visible anyways. (thanks @zegenie)Tilemaps.Components.WeightedRandomize
now uses the Phaser Math.RND.frac
method with a seed instead the Math.Random
static method. (thanks @jorbascrumps)Layer
Game Object has had its removeAll
, remove
and add
methods removed. These methods are all still available via the List
class that Layer inherits, but the destroyChild
parameters are no longer available.Renderer.Canvas
and Renderer.WebGL
will now only be included in the build file if the corresponding feature flags CANVAS_RENDERER
and/or WEBGL_RENDERER
are set to true
. For Canvas only builds this saves a lot of space in the build. (thanks @samme)autoResize
boolean in the RenderTargetConfig
which is passed to the Render Targets when they are created by a pipeline.UtilityPipeline
now sets autoResize
to true
in its Render Target Config, so that the global fullFrame
and halfFrame
Render Targets will automatically resize if the renderer changes.Actions.PlaceOnLine
now has an added ease
parameter which accepts a string from the EaseMap or a custom ease function to allow for different distrubutions along a line. (thanks @sB3p)XHRLoader
will now listen for ontimeout
and if triggered it will hand over to the File.onError
handler. This prevents the Loader from stalling if a file times out. Fix #6472 (thanks @343dev)LightPipeline.currentNormalMap
was incorrectly documented as being a property of WebGLRenderer
.Mesh
based Game Objects now can use an input config with the setInteractive
method, which supports the options draggable
, dropzone
, cursor
and userHandCursor
. Fix #6510 #6652 (thanks @Baegus @Neppord)InputManager.onTouchMove
function has been fixed so it now correctly handles touch events on pages that have scrolled horizontally or vertically and shifted the viewport. Fix #6489 (thanks @somechris @hyewonjo)Factory.staticBody
had the wrong return type in the docs/TS defs. Fix #6693 (thanks @ddhaiby)Time.Timeline
class didn't show as extending the Event Emitter, or have config
as an optional argument in the docs / TS defs. Fix #6673 (thanks @ghclark2)Animations.AnimationFrame
member duration
is now the complete duration of the frame, which is a breaking change. Before this Animations.AnimationState#msPerFrame
was combined with Animations.AnimationFrame#duration
which wasn't intuitive. The fix to remove Animations.AnimationState#msPerFrame
from Animations.AnimationFrame#duration
has been removed from the Animations.AnimationManager
method createFromAseprite
because of this clarification. Fix #6712 (thanks @Nerodon @TomMalitz)NineSlice
Game Object method setSize
now recalculates its origin by calling the updateDisplayOrigin
method. (thanks @dhashvir)Layer
Game Object is destroyed, i.e. from changing or restarting a Scene, it will no longer cause an error when trying to destroy the children on its display list. Fix #6675 (thanks @crockergd @gm0nk)DynamicTexture
will now automatically call setSize(width, height)
for both WebGL and Canvas. Previously it only did it for WebGL. This fixes an issue where DynamicTextures in Canvas mode would have a width and height of -1. Fix #6682 (thanks @samme)DynamicTexture.setSize
will now check to see if the glTexture
bound to the current frame is stale, and if so, destroy it before binding the one from the Render Target. This fixes an issue where constantly destroying and creating Dynamic Textures would cause a memory leak in WebGL. Fix #6669 (thanks @DavidTalevski)BloomFX
and BlurFX
and any custom pipeline that relies on using the UtilityPipeline
full or half frame targets will now correctly draw even after the renderer size changes. Fix #6677 (thanks @Nerodon)PostFXPipeline.postBatch
method will now skip onDraw
if the pipeline hasn't booted, introducing an artificial frame skip. This should potentially fix glitch errors on mobile devices where Post FX would appear corrupted for a single frame. Fix #6681 (thanks @moufmouf @tongliang999)Matter.Body
function scale
has been updated so if the Body originally had an inertia
of Infinity
this will be restored at the end of the call. This happens if you set a Matter Body to have fixed rotation. Fix #6369 (thanks @sushovande)RandomDataGenerator.weightedPick
method to avoid sampling past the last element. Fix #6701 (thanks @jameskirkwood)onTouchEndWindow
now stops pointer events when clicking through DOM elements to input. Fix #6697 (thanks @laineus)Physics.Matter.Factory
method pointerConstraint
no longer returns an error when it can't find the camera. Fix #6684 (thanks @spritus)Physics.Arcade.StaticBody
method reset
now re-applies offset
values. Fix #6729 (thanks @samme)Input.InputPlugin
method disable
which is called by GameObjects.GameObject#disableInteractive
keeps its temp hit box value which stops propagation to interactive Game Objects in another scene. Fix #6601 (thanks @UnaiNeuronUp)setInteractive
and removeInteractive
methods of a Game Object outside of the game loop would cause an error in which Input.InputManager#resetCursor
would lose input context. Fix #6387 (thanks @TomorrowToday)My thanks to the following for helping with the Phaser 3 Examples, Beta Testing, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
@AlvaroEstradaDev @stevenwithaph @paxperscientiam @samme @actionmoon @rafael-lua @Byvire
EXPAND
. This is inspired by the Expand mode in Godot: "Keep aspect ratio when stretching the screen, but keep neither the base width nor height. Depending on the screen aspect ratio, the viewport will either be larger in the horizontal direction (if the screen is wider than the base size) or in the vertical direction (if the screen is taller than the original size)" (thanks @rexrainbow)The Phaser LoaderPlugin and related classes have been updated so that they now work natively with base64 encoded files and Data URIs. This means you can now load a base64 encoded image, audio file or text file directly into the Loader. The Loader will then decode the data and process it as if it was a normal file. This is particularly useful for environments such as Playable Ads where you have to provide a single html file with all assets embedded and no XHR requests.
Loader.File.base64
is a new read-only boolean property that is set if the file contains a Data URI encoded string.Loader.File.onBase64Load
is a new method that is called when the file has finished decoding from a Data URI.ImageFile
will now default to using the Image Load Element if a base64 file is detected, instead of throwing a console warning about unsupported types.XHRLoader
will now return a fake XHR result object containing the decoded base64 data if a base64 file is detected, skipping the creation of a real XML Http Request object.preUpdate
automatically when the play
method is called. This forces the new animation state to update and apply itself to the skeleton. This fixes an issue where Spine object would show the default frame in the Spine atlas for a single update before the animation started. Fix #5443 (thanks @spayton)SpineGameObject.setSlotAlpha
is a new method that allows you to set the alpha on a specific slot in a Spine skeleton.SpineGameObject.setAlpha
method has had its 2nd parameter removed. This fixes needless slot look-ups during rendering when a Spine Game Object is inside a regular Container. If you need to set slot alpha, use the new setSlotAlpha
method instead. Fix #6571 (thanks @spayton)SpineFile.onFileComplete
handler was running a regular expression against file.src
instead of file.url
, sometimes leading to double paths in the atlas paths on loading. Fix #6642 (thanks @rez23)TweenChainBuilder
was incorrectly setting the persist
flag on the Chain to true
, which goes against what the documentation says. It now correctly sets it to false
. This means if you previously had a Tween Chain that was persisting, it will no longer do so, so add the property to regain the feature.dropped
argument has now been adeded to the documentation for the DRAG_END
and GAMEOBJECT_DRAG_END
events. (thanks @samme)Container.onChildDestroyed
is a new internal method used to destroy Container children. Previously, if you destroyed a Game Object in an exclusive Container, the game object would (momentarily) move onto the Scene display list and emit an ADDED_TO_SCENE event. Also, if you added a Sprite to a non-exclusive Container and stopped the Scene, you would get a TypeError (evaluating 'this.anims.destroy'). This happened because the fromChild argument in the DESTROY event was misinterpreted as destroyChild in the Container's remove(), and the Container was calling the Sprite's destroy() again. (thanks @samme)Text
and TileSprite
Game Objects now place their textures into the global TextureManager
and a _textureKey
private string property has been added which contains a UUID to reference that texture.Tilemaps.Components.WeightedRandomize
method now uses the Phaser Math.RND.frac
method with a seed instead of the Math.Random
static method. (thanks @jorbascrumps)Tilemaps.Components.IsometricCullTiles
does the CheckIsoBounds
method check last when building the outputArray, as to help optimize in situations where the tile would not be visible anyways. (thanks @zegenie)Tilemaps.Components.WeightedRandomize
now uses the Phaser Math.RND.frac
method with a seed instead the Math.Random
static method. (thanks @jorbascrumps)Layer
Game Object has had its removeAll
, remove
and add
methods removed. These methods are all still available via the List
class that Layer inherits, but the destroyChild
parameters are no longer available.Renderer.Canvas
and Renderer.WebGL
will now only be included in the build file if the corresponding feature flags CANVAS_RENDERER
and/or WEBGL_RENDERER
are set to true
. For Canvas only builds this saves a lot of space in the build. (thanks @samme)autoResize
boolean in the RenderTargetConfig
which is passed to the Render Targets when they are created by a pipeline.UtilityPipeline
now sets autoResize
to true
in its Render Target Config, so that the global fullFrame
and halfFrame
Render Targets will automatically resize if the renderer changes.Actions.PlaceOnLine
now has an added ease
parameter which accepts a string from the EaseMap or a custom ease function to allow for different distrubutions along a line. (thanks @sB3p)XHRLoader
will now listen for ontimeout
and if triggered it will hand over to the File.onError
handler. This prevents the Loader from stalling if a file times out. Fix #6472 (thanks @343dev)InputManager.onTouchMove
function has been fixed so it now correctly handles touch events on pages that have scrolled horizontally or vertically and shifted the viewport. Fix #6489 (thanks @somechris @hyewonjo)Factory.staticBody
had the wrong return type in the docs/TS defs. Fix #6693 (thanks @ddhaiby)Time.Timeline
class didn't show as extending the Event Emitter, or have config
as an optional argument in the docs / TS defs. Fix #6673 (thanks @ghclark2)Animations.AnimationFrame
member duration
is now the complete duration of the frame, which is a breaking change. Before this Animations.AnimationState#msPerFrame
was combined with Animations.AnimationFrame#duration
which wasn't intuitive. The fix to remove Animations.AnimationState#msPerFrame
from Animations.AnimationFrame#duration
has been removed from the Animations.AnimationManager
method createFromAseprite
because of this clarification. Fix #6712 (thanks @Nerodon @TomMalitz)NineSlice
Game Object method setSize
now recalculates its origin by calling the updateDisplayOrigin
method. (thanks @dhashvir)Layer
Game Object is destroyed, i.e. from changing or restarting a Scene, it will no longer cause an error when trying to destroy the children on its display list. Fix #6675 (thanks @crockergd @gm0nk)DynamicTexture
will now automatically call setSize(width, height)
for both WebGL and Canvas. Previously it only did it for WebGL. This fixes an issue where DynamicTextures in Canvas mode would have a width and height of -1. Fix #6682 (thanks @samme)DynamicTexture.setSize
will now check to see if the glTexture
bound to the current frame is stale, and if so, destroy it before binding the one from the Render Target. This fixes an issue where constantly destroying and creating Dynamic Textures would cause a memory leak in WebGL. Fix #6669 (thanks @DavidTalevski)BloomFX
and BlurFX
and any custom pipeline that relies on using the UtilityPipeline
full or half frame targets will now correctly draw even after the renderer size changes. Fix #6677 (thanks @Nerodon)PostFXPipeline.postBatch
method will now skip onDraw
if the pipeline hasn't booted, introducing an artificial frame skip. This should potentially fix glitch errors on mobile devices where Post FX would appear corrupted for a single frame. Fix #6681 (thanks @moufmouf @tongliang999)Matter.Body
function scale
has been updated so if the Body originally had an inertia
of Infinity
this will be restored at the end of the call. This happens if you set a Matter Body to have fixed rotation. Fix #6369 (thanks @sushovande)RandomDataGenerator.weightedPick
method to avoid sampling past the last element. Fix #6701 (thanks @jameskirkwood)onTouchEndWindow
now stops pointer events when clicking through DOM elements to input. Fix #6697 (thanks @laineus)Physics.Matter.Factory
method pointerConstraint
no longer returns an error when it can't find the camera. Fix #6684 (thanks @spritus)My thanks to the following for helping with the Phaser 3 Examples, Beta Testing, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
@AlvaroEstradaDev @stevenwithaph @paxperscientiam @samme @actionmoon @rafael-lua @Byvire
All pixel rounding math is now handled on the GPU instead of on the CPU. This feature has now been enabled by default.
roundPixels
property is now true
by default. This means that all Game Objects will be positioned and rendered with pixel-perfect precision, which is by far the most common use-case for Phaser games. This will prevent sub-pixelation when rendering at non-integer offsets and allows for smoother camera scrolling, especially at higher zoom scales. If you wish to disable this, you can do so by setting the roundPixels
property in the Game Config to false
. Note that only roundPixels
has been set to true
. The pixelArt
property remains false
. So if you're creating a pixel-art style game, please still enable this in your config.uRoundPixels
which is set in all of the corresponding pipelines. This means that all pixel rounding calculations are now done on the GPU instead of the CPU, which can save a lot of math in intensive games.CanvasRenderer.batchSprite
has been updated to correctly use the Camera roundPixels
property and apply it to the drawImage
call.Camera.preRender
will no longer round the origin, follow coordinates or scrollX/Y coordinates. It will still round the World view.MultiPipeline.batchSprite
method (which is also used by the Single Pipeline and Mobile Pipeline) will no longer use roundPixels
when calculating the quad vertex data. It also won't apply it to any of the sprite values. This is all now handled in the shader directly.TransformMatrix.setQuad
no longer uses an anonymous function for roundPixels
, which will help with performance.TransformMatrix.setQuad
method signature has changed slightly. The roundPixels
parameter is now optional and defaults to false
. Previously, you always had to set it.The new version of Texture Packer (v7.1.0) and above will now allow you to export scale9 sprite data in your Phaser 3 Atlas JSON. This allows you to create Nine Slice Sprites directly from the data, without having to specify the border sizes directly in your code. To use this feature, simply edit the sprite in Texture Packer, enable the 'scale9' checkbox and then drag the guides as required. When you export the atlas, the JSON will contain the new scale9
object, which Phaser will parse and use when creating Nine Slice Game Objects.
NineSlice
Game Object without specifying a width or height for it. If you do this, it will use the size of the texture frame instead.NineSlice
Game Object will now check to see if its associated Frame has any scale9 data set, and if so this is now used automatically to populate all of the border values.NineSlice.setSlices
method has a new optional boolean parameter skipScale9
which will allow you to set the border values of the Nine Slice directly, even if its Frame has associated scale9 dataFrame.setScale9
is a new method that allows you to set the scale9 data associated with the given Frame. This is used internally by the Texture Packer parsers, but can also be called directly.Frame.scale9
is a new read-only boolean property that returns true
if the Frame has scale9 data associated with it.Frame.is3Slice
is a new read-only boolean property that returns true
if the Frame has scale9 data associated with it that is 3-slice instead of 9-slice.JSONHash
texture parser will now check for scale9
data in the JSON and if found, set it via the Frame.setScale9
method.JSONArray
texture parser will now check for scale9
data in the JSON and if found, set it via the Frame.setScale9
method.setDirectControl
which toggles a new boolean property directControl
. When enabled (it's false by default) it means the Body will calculate its velocity based on its change in position compared to the previous frame. This allows you to directly move a Body around the physics world by just changing its position, without having to use acceleration or velocity. This is useful if you want to move it via a Tween, or follow a Pointer, or a Path. Because its velocity is calculated based on this movement it will still resolve collisions with other bodies, imparting velocity to them as usual.slideFactor
. This is a Vector2 that controls how much velocity is retained by a Body after it has been pushed by another Body. The default value is 1, which means it retains all of its velocity. If set to zero, it will retain none of it. This allows you to create a Body that can be pushed around without imparting any velocity to it.Body.setSlideFactor
is a new method that sets the Body's slideFactor
property.nextCategory
which will create a new collision category and return it. You can define up to 32 unique collision categories per world.collisionCategory
and collisionMask
. These allow you to set a specific collision category and list of categories the body will collide with. This allows for fine-grained control over which bodies collide with which others. The default is that all bodies collide with all others, just like before.setCollisionCategory
is a new method available on Arcade Physics Bodies that allows you to set the collision category of the body. It's also available on Arcade Sprites, Images, Tilemap Layers, Groups and Static Groups directly.setCollidesWith
is a new method available on Arcade Physics Bodies that allows you to set which collision categories the body should collide with. It's also available on Arcade Sprites, Images, Tilemap Layers, Groups and Static Groups directly.resetCollision
is a new method available on Arcade Physics Bodies that allows you to reset the collision category and mask to their defaults. It's also available on Arcade Sprites, Images, Tilemap Layers, Groups and Static Groups directly.The default is as before: all bodies collide with each other. However, by using the categories you now have much more fine-grained control over which objects collide together, or not. They are filtered out at the top-level, meaning you can have a Sprite set to not collide with a Physics Group and it will skip checking every single child in the Group, potentially saving a lot of processing time.
The new collision categories are used automatically by either directly calling the collide
or overlap
methods, or by creating a Collider object. This allows you to use far less colliders than you may have needed previously and skip needing to filter the pairs in the collision handlers.
You can now set in your game config two new boolean properties that control if the built-in FX are enabled, or not. If you don't need to use the FX then disabling these will help save on texture memory and will compile less shaders, which can help with startup time. These are single-set flags, you cannot toggle them after the game has booted.
disablePreFX
set this to true
in your game config to disable the creation and use of Pre FX on all Game Objects.disablePostFX
set this to true
in your game config to disable the creation and use of Post FX on all Game Objects.PipelineManager
will now delay the creation of the FX Pipelines until its boot
method, using these config values to determine if it should proceed.PipelineManager.renderTargets
array will no longer be pre-populated if you disable Pre FX, saving on texture memory.FX.Circle.backgroundAlpha
is a new property that allows you to set the amount of the alpha of the background color in the Circle FX (thanks @rexrainbow)PostFXPipeline.bootFX
is a new method, which is the previous boot
method but renamed. This is no longer called from the constructor, but instead when the Post FX Pipeline is activated by the Pipeline Manager. This means that the resources the Post FX requires, such as creating Render Targets and shaders, is delayed until the FX is actually used, saving on memory.PostFXPipeline
will now set autoResize
to true
on all of its RenderTarget
instances. This fixes an issue where the PostFXPipeline
would not resize the render targets when the game size changed, causing them to become out of sync with the game canvas. Fix #6503 (thanks @Waclaw-I)FX.Blur
didn't set the quality
parameter to its property, meaning it wasn't applied in the shader, causing it to always use a Low Blur quality (unless modified post-creation).BlurFXPipeline
didn't bind the quality of shader specified in the controller, meaning it always used the Low Blur shader, regardless of what the FX controller asked for.FXBlurLow
fragment shader didn't have the offset
uniform. This is now passed in and applied to the resulting blur, preventing it from creating 45 degree artifacts (thanks Wayfinder)batchTexture
that meant if you applied a PostFX to a Tilemap Layer it would apply the fx for every single tile in the layer, instead of just once per layer. In a simple map this fix has reduced draw calls from over 12,000 to just 52, and it no longer matters how many tiles are on the layer, the cost of applying the FX is consistent regardless.Text.setRTL
is a new method that allows you to set a Text Game Object as being rendered from right-to-left, instead of the default left to right (thanks @rexrainbow)Physics.Arcade.World.singleStep
is a new method that will advance the Arcade Physics World simulation by exactly 1 step (thanks @monteiz)Tilemaps.ObjectLayer.id
is a new property that returns the ID of the Object Layer, if specified within Tiled, or zero otherwise. You can now access the unique layer ID of Tiled layers if the event a map doesn't have unique layer names (thanks @rui-han-crh)Tilemaps.LayerData.id
is a new property that returns the ID of the Data Layer, if specified within Tiled, or zero otherwise (thanks @rui-han-crh)Text.setLetterSpacing
is a new method and Text.letterSpacing
is the related property that allows you to set the spacing between each character of a Text Game Object. The value can be either negative or positive, causing the characters to get closer or further apart. Please understand that enabling this feature will cause Phaser to render each character in this Text object one by one, rather than use a draw for the whole string. This makes it extremely expensive when used with either long strings, or lots of strings in total. You will be better off creating bitmap font text if you need to display large quantities of characters with fine control over the letter spacing (thanks @Ariorh1337)ParticleEmitter.clearDeathZones
is a new method that will clear all previously created Death Zones from a Particle Emitter (thanks @rexrainbow)ParticleEmitter.clearEmitZones
is a new method that will clear all previously created Emission Zones from a Particle Emitter (thanks @rexrainbow)GameObject.setTexture
method has 2 new optional parameters: updateSize
and updateOrigin
, which are both passed to the setFrame
method and allows you to control if the size and origin of the Game Object should be updated when the texture is set (thanks @Trissolo)randomFrame
. This is false
by default, but if set, it will pick a random frame from the animation when it starts playback. This allows for much more variety in groups of sprites created at the same time, using the same animation. This is also reflected in the new Animation.randomFrame
and AnimationState.randomFrame
properties.Phaser.Types.Animations.PlayAnimationConfig
object in the anims
property of the ParticleEmitter
configuration object. This gives you far more control over what happens to the animation when used by particles, including setting random start frames, repeat delays, yoyo, etc. Close #6478 (thanks @michalfialadev)TilemapLayer.setTintFill
is a new method that will apply a fill-based tint to the tiles in the given area, rather than an additive-based tint, which is what the setTint
method uses.Tile.tintFill
is a new boolean property that controls if the tile tint is additive or fill based. This is used in the TilemapLayerWebGLRenderer function.RenderTarget.willResize
is a new method that will return true
if the Render Target will be resized as a result of the new given width and height values.Structs.Map.setAll
is a new method that allows you to pass an array of elements to be set into the Map. This is a chainable method.TimelineEvent
you can now set a new optional callback: if
. If set, this callback is invoked at the start of the TimelineEvent. If it returns true
, then the rest of the event is processed (i.e. tweens started, sound played, etc) otherwise the event is skipped. This allows you to create conditional events within a Timeline.Geom.Line.setFromObjects
is a new method that will set the Line start and end points to match those of the two given objects, which can be Game Objects, or anything Vector2-like (thanks @Trissolo)WebAudioSoundManager
will now bind the body
to the removeEventListener
method, if it exists, to prevent memory leaks (thanks @wjaykim)AnimationManager.globalTimeScale
property is now applied to all Game Objects using the Animation component, allowing you to globally speed-up or slow down all animating objects (thanks @TJ09)Rope
Game Object now calls initPostPipeline
allowing you to use Post FX directly on it, such as glow, blur, etc. Fix #6550 (thanks @rexrainbow)Tween.stop
method will now check to see if Tween.parent
is set. If not, it won't try to set a pending removal state or dispatch an event, which should help guard against errors where Tween.stop
is called by mistake on already destroyed tweens (thanks @orcomarcio)Tween.remove
method will now check to see if Tween.parent
exists before trying to remove it from the parent. This should help guard against errors where Tween.remove
is called by mistake on already removed or destroyed tweens. Fix #6539 (thanks @orcomarcio)Particle.alpha
is now clamped to the range 0 to 1 within the update
method, preventing it from going out of range. Fix #6551 (thanks @orcomarcio)Math.Wrap
has been reverted to the previous version. Fix #6479 (thanks @EmilSV)Graphics
Game Object will now set a default line and fill style to fully transparent and black. This prevents issues where a Graphics object would render with a color set in other Shape Game Objects if it had been drawn to and no style was previous set (thanks Whitesmith)mipmapFilter
property in the Game Config is a valid mipmap before assigning it.Polygon.setTo
method (thanks @Trissolo)WebGLRenderer.deleteFramebuffer
method has been updated so it now tests for the existence of a COLOR and DEPTH_STENCIL attachments, and if found, removes the bindings and deletes the stencil buffer. The code that previously deleted the RENDERERBUFFER_BINDING
has also been removed to avoid side-effects.Mesh
Game Object interactive, it will now bind to the scope of the Mesh and uses the current faces
in the hit area callback, rather than the faces as defined when the Mesh was made interactive. This will help keep the input in sync with a potentially changing Mesh structure (thanks @rexrainbow)AppleWebKit
will now set the Device.es2019
flag to true
. This causes Phaser to use the native array Stable Sort. This fixes an issue where overlapping particles could flicker on iOS. Fix #6483 (thanks @mattkelliher @spayton)Text.dirty
Game Object property has been removed. It wasn't used internally at all, so was just adding confusion and using space.HTMLVideoElement
before trying to inspect its prototype. This should help in non-browser environments.Plane.originX
and originY
are two new read-only properties that return the origin of the Plane, which is always 0.5 (thanks @rexrainbow)LoaderPlugin
will now call removeAllListeners()
as part of its shutdown
method, which will clear any event listeners bound to a Loader instance of the Scene, during the Scene shutdown. Fix #6633 (thanks @samme)SetCollisionObject
is a new function that Arcade Physics bodies use internally to create and reset their ArcadeBodyCollision
data objects.DynamicTexture.setFromRenderTarget
is a new method that syncs the internal Frame and TextureSource GL textures with the Render Target GL textures.renderTexture
property to undefined
to ensure the reference is cleared.TransformMatrix.setToContext
will now use setTransform(this)
as 'this' is an equivalent object that this method can natively take.WebGLRenderer.setTextureFilter
so it no longer uses a temporary array for the filter mode.MultiPipeline.batchTexture
method has a new optional boolean parameter skipPrePost
that will force the call to ignore calling the preBatch
and postBatch
Pipeline Manager methods for the Game Object. This allows you to skip the overhead of calling them if you know you don't need them.tint
property can now act as a getter and a setter, where-as previously it was only a setter. Reading this property returns the equivalent of the tintTopLeft
value (thanks @rexrainbow)ParticleEmitter.addDeathZone
now returns an array of the Death Zone instances created, rather than just a single zone. This makes it functionally the same as addEmitZone
(thanks @AlvaroEstradaDev)GameObjects.Layer.add
method is now chainable (thanks @rexrainbow)GameObjects.Layer.remove
and removeAll
methods are now chainable and have a new optional boolean parameter destroyChild
, which will destroy the Game Objects removed from the Layer (thanks @rexrainbow)Curves.Path.defaultDivisions
is a new property that holds the default number of divisions to split the Path in to (thanks @AlvaroEstradaDev)Curves.Path.getPoints
method has a new optional parameter stepRate
which allows you to set the distance between points on the curve, and defaults to defaultDivisions
(thanks @AlvaroEstradaDev)Timeline
class will now emit the new Phaser.Time.Events#COMPLETE
event when it completes. It will also no longer process its update
method once the Timeline has completed (thanks @rexrainbow)BaseSound.destroy
method will now call BaseSound.stop
which will reset the isPlaying
and other flags. Fix #6645 (thanks @rexrainbow)RandomDataGenerator#weightedPick
method will no longer under-sample the first and last elements in the given array, leading to better distribution of results. Fix #6562 (thanks @wayfinder @shy @samme)Game.runDestroy
it will now check for this.domContainer.parentNode
before trying to remove it, preventing errors if the DOM Container has already been removed. Fix #6559 (thanks @orcomarcio)SYSTEM_READY
event, which indicates that the internal Scene System has been created by the Scene Manager and is ready for use. The Texture Manager now listens for this event in order to create the stamp
Image. This fixes an issue where the stamp would throw a run-time error if the game didn't feature a preload
function. Fix #6616 (thanks @rexrainbow)Particle.scaleY
would always be set to the scaleX
value, even if given a different one within the config. It will now use its own value correctly.Array.Matrix.RotateLeft
was missing the total
parameter, which controls how many times to rotate the matrix.Array.Matrix.RotateRight
was missing the total
parameter, which controls how many times to rotate the matrix.Array.Matrix.TranslateMatrix
didn't work with any translation values above 1 due to missing parameters in RotateLeft
and RotateRight
Tilemap.createFromObjects
method wouldn't always copy custom properties to the target objects or Data Manager. Fix #6391 (thanks @samme @paxperscientiam)scale.min
and scale.max
width
and height
properties in Game Config were ignored by the Game constructor, which was expecting minWidth
and minHeight
. This now matches the documentation. Fix #6501 (thanks @NikitaShpanko @wpederzoli)Actions.GetLast
function had the same code as the GetFirst
function. It now does what you'd expect it to do. Fix #6513 (thanks @dmokel)TilemapLayer.PutTileAt
method would use an incorrect local GID if the Tilemap Layer wasn't using all available tilesets. Fix #5931 (thanks @christianvoigt @wjaykim)TextureManager.addSpriteSheet
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @charlieschwabacher)HexagonalCullBounds
function incorrectly referenced this
within it, instead of layer
(thanks @DaliborTrampota)HexagonalGetTileCorners
function incorrectly referenced this
within it, instead of layer
(thanks @DaliborTrampota)HexagonalTileToWorldXY
function incorrectly referenced this
within it, instead of layer
(thanks @DaliborTrampota)BitmapText
Game Object will now reset the WebGL Texture unit on flush, which fixes an issue of a flush happening part-way during the rendering a BitmapText (thanks @EmilSV)x: { values: [ 50, 500, 200, 800 ] }
it would fail to set the final value unless you specified the interpolation
property as well. It now defaults to linear
if not given. Fix #6551 (thanks @orcomarcio)ignoreGravity
boolean is now checked during the Matter Engine internal functions, allowing this property to now work again. Fix #6473 (thanks @peer2p)Group.createFromConfig
will now check to see if the config contains either internalCreateCallback
or internalRemoveCallback
and set them accordingly. This fixes an issue where the callbacks would never be set if specified in an array of single configuration objects. Fix #6519 (thanks @samme)PhysicsGroup
will now set the classType
and null the config
when an array of single configuration objects is given in the constructor. Fix #6519 (thanks @samme)PathFollower.pathUpdate
method will now check if the tween
property has a valid data
component before running the update. This prevents a call to PathFollower.stopFollow
from throwing a Cannot read properties of null (reading '0')
error as it tried to do a single update post stop. Fix #6508 (thanks @francois-dibulo)Structs.ProcessQueue#add
(thanks @Trissolo)Tile
was incorrectly using the Alpha
Game Object component, instead of the AlphaSingle
component, which meant although the methods implied you could set a different alpha per tile corner, it was never reflected in the rendering. It has now been updated to use just the single alpha value. Fix #6594 (thanks @jcoppage)TextureManager.addAtlasJSONArray
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)TextureManager.addAtlasJSONHash
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)TextureManager.addAtlasXML
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)TextureManager.addUnityAtlas
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)DynamicTexture.preDestroy
was never called, leading to an accumulation of framebuffers in memory. This method has now been renamed to destroy
and cleans all references correctly.width
or height
in the Game Config object as a string it would multiply the value given by the parent size, often leading to a huge game canvas, or causing WebGL errors as it tried to create a texture larger than the GPU could handle. This has now been strengthened. If you give a string with a % at the end, it works as before, i.e. "100%"
or "50%"
to set the scale based on the parent. If you don't include the %, or use another unit, such as "800px"
it will now be treated as a fixed value, not a percentage.ParticleEmitterWebGLRenderer
has been refactored so that the particle.frame
is used as the source of the glTexture
used in the batch and also if a new texture unit is required. This fixes issues where a Particle Emitter would fail to use the correct frame from a multi-atlas texture. Fix #6515 (thanks @Demeno)StaticBody.setSize
will now check to see if the body has a Game Object or not, and only call getCenter
and the frame sizes if it has. This fixes a bug where calling physics.add.staticBody
would throw an error if you provided a width and height. Fix #6630 (thanks @Legend-Master)DynamicTexture.fill
method will now correctly draw the fill rectangle if the width
and height
are provided in WebGL, where-as before it would assume the y axis started from the bottom-left instead of top-left. Fix #6615 (thanks @rexrainbow)Line.setLineWidth
method on the Line Shape Game Object would result in a line with double the thickness it should have had in WebGL. In Canvas it was the correct width. Both renderers now match. Fix #6604 (thanks @AlvaroNeuronup)DynamicTexture
was leaking memory by leaving a WebGLTexture in memory when its setSize
method was called. This happens automatically on instantiation, meaning that if you created DynamicTextures and then destroyed them frequently, memory would continue to increase (thanks David)DynamicTexture.width
and height
were missing from the class definition, even though they were set and used internally. They're now exposed as read-only properties.BitmapMask
wouldn't correctly set the gl viewport when binding, which caused the mask to distort in games where the canvas resizes from its default. Fix #6527 (thanks @rexrainbow)Geom.Intersects.GetLineToPoints
function has been fixed to correct an oversight where the for loop prevented an intersection test between the given line and the line segment between the first and last point. Fix #6467 (thanks @Trissolo @Abspirit)MultiAtlas
File Loader didn't prepend the Loader.prefix
if set. This now forms part of the key, leading to the correct keys used for the Texture Manager. Fix #6614 (thanks @machineman1357)TextureSource.setFilter
method will now check to see if renderer
is defined before accessing its gl
property. This avoids Phaser crashing if you're in headless mode and set anti-aliasing to false in the game config. Fix #6663 (thanks @moufmouf)SpineGameObject.setSkeletonFromJSON
has been fixed so it now passes the parameters in the correct order to the setSkeleton
method. Fix #6585 (thanks @machineman1357)My thanks to the following for helping with the Phaser 3 Examples, Beta Testing, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
@AlvaroEstradaDev @emadkhezri @gohack0322 @johnhyde @julescubtree @neki-dev @paxperscientiam @samme
setDirectControl
which toggles a new boolean property directControl
. When enabled (it's false by default) it means the Body will calculate its velocity based on its change in position compared to the previous frame. This allows you to directly move a Body around the physics world by just changing its position, without having to use acceleration or velocity. This is useful if you want to move it via a Tween, or follow a Pointer, or a Path. Because its velocity is calculated based on this movement it will still resolve collisions with other bodies, imparting velocity to them as usual.slideFactor
. This is a Vector2 that controls how much velocity is retained by a Body after it has been pushed by another Body. The default value is 1, which means it retains all of its velocity. If set to zero, it will retain none of it. This allows you to create a Body that can be pushed around without imparting any velocity to it.Body.setSlideFactor
is a new method that sets the Body's slideFactor
property.nextCategory
which will create a new collision category and return it. You can define up to 32 unique collision categories per world.collisionCategory
and collisionMask
. These allow you to set a specific collision category and list of categories the body will collide with. This allows for fine-grained control over which bodies collide with which others. The default is that all bodies collide with all others, just like before.setCollisionCategory
is a new method available on Arcade Physics Bodies that allows you to set the collision category of the body. It's also available on Arcade Sprites, Images, Tilemap Layers, Groups and Static Groups directly.setCollidesWith
is a new method available on Arcade Physics Bodies that allows you to set which collision categories the body should collide with. It's also available on Arcade Sprites, Images, Tilemap Layers, Groups and Static Groups directly.resetCollision
is a new method available on Arcade Physics Bodies that allows you to reset the collision category and mask to their defaults. It's also available on Arcade Sprites, Images, Tilemap Layers, Groups and Static Groups directly.The default is as before: all bodies collide with each other. However, by using the categories you now have much more fine-grained control over which objects collide together, or not. They are filtered out at the top-level, meaning you can have a Sprite set to not collide with a Physics Group and it will skip checking every single child in the Group, potentially saving a lot of processing time.
The new collision categories are used automatically by either directly calling the collide
or overlap
methods, or by creating a Collider object. This allows you to use far less colliders than you may have needed previously and skip needing to filter the pairs in the collision handlers.
Text.setRTL
is a new method that allows you to set a Text Game Object as being rendered from right-to-left, instead of the default left to right (thanks @rexrainbow)FX.Circle.backgroundAlpha
is a new property that allows you to set the amount of the alpha of the background color in the Circle FX (thanks @rexrainbow)Physics.Arcade.World.singleStep
is a new method that will advance the Arcade Physics World simulation by exactly 1 step (thanks @monteiz)Tilemaps.ObjectLayer.id
is a new property that returns the ID of the Object Layer, if specified within Tiled, or zero otherwise. You can now access the unique layer ID of Tiled layers if the event a map doesn't have unique layer names (thanks @rui-han-crh)Tilemaps.LayerData.id
is a new property that returns the ID of the Data Layer, if specified within Tiled, or zero otherwise (thanks @rui-han-crh)Text.setLetterSpacing
is a new method and Text.lineSpacing
is the related property that allows you to set the spacing between each character of a Text Game Object. The value can be either negative or positive, causing the characters to get closer or further apart. Please understand that enabling this feature will cause Phaser to render each character in this Text object one by one, rather than use a draw for the whole string. This makes it extremely expensive when used with either long strings, or lots of strings in total. You will be better off creating bitmap font text if you need to display large quantities of characters with fine control over the letter spacing (thanks @Ariorh1337)ParticleEmitter.clearDeathZones
is a new method that will clear all previously created Death Zones from a Particle Emitter (thanks @rexrainbow)ParticleEmitter.clearEmitZones
is a new method that will clear all previously created Emission Zones from a Particle Emitter (thanks @rexrainbow)GameObject.setTexture
method has 2 new optional parameters: updateSize
and updateOrigin
, which are both passed to the setFrame
method and allows you to control if the size and origin of the Game Object should be updated when the texture is set (thanks @Trissolo)randomFrame
. This is false
by default, but if set, it will pick a random frame from the animation when it starts playback. This allows for much more variety in groups of sprites created at the same time, using the same animation. This is also reflected in the new Animation.randomFrame
and AnimationState.randomFrame
properties.Phaser.Types.Animations.PlayAnimationConfig
object in the anims
property of the ParticleEmitter
configuration object. This gives you far more control over what happens to the animation when used by particles, including setting random start frames, repeat delays, yoyo, etc. Close #6478 (thanks @michalfialadev)TilemapLayer.setTintFill
is a new method that will apply a fill-based tint to the tiles in the given area, rather than an additive-based tint, which is what the setTint
method uses.Tile.tintFill
is a new boolean property that controls if the tile tint is additive or fill based. This is used in the TilemapLayerWebGLRenderer function.WebAudioSoundManager
will now bind the body
to the removeEventListener
method, if it exists, to prevent memory leaks (thanks @wjaykim)AnimationManager.globalTimeScale
property is now applied to all Game Objects using the Animation component, allowing you to globally speed-up or slow down all animating objects (thanks @TJ09)Rope
Game Object now calls initPostPipeline
allowing you to use Post FX directly on it, such as glow, blur, etc. Fix #6550 (thanks @rexrainbow)Tween.stop
method will now check to see if Tween.parent
is set. If not, it won't try to set a pending removal state or dispatch an event, which should help guard against errors where Tween.stop
is called by mistake on already destroyed tweens (thanks @orcomarcio)Tween.remove
method will now check to see if Tween.parent
exists before trying to remove it from the parent. This should help guard against errors where Tween.remove
is called by mistake on already removed or destroyed tweens. Fix #6539 (thanks @orcomarcio)Particle.alpha
is now clamped to the range 0 to 1 within the update
method, preventing it from going out of range. Fix #6551 (thanks @orcomarcio)Math.Wrap
has been reverted to the previous version. Fix #6479 (thanks @EmilSV)Graphics
Game Object will now set a default line and fill style to fully transparent and black. This prevents issues where a Graphics object would render with a color set in other Shape Game Objects if it had been drawn to and no style was previous set (thanks Whitesmith)mipmapFilter
property in the Game Config is a valid mipmap before assigning it.Polygon.setTo
method (thanks @Trissolo)WebGLRenderer.deleteFramebuffer
method has been updated so it now tests for the existence of a COLOR and DEPTH_STENCIL attachments, and if found, removes the bindings and deletes the stencil buffer. The code that previously deleted the RENDERERBUFFER_BINDING
has also been removed to avoid side-effects.Mesh
Game Object interactive, it will now bind to the scope of the Mesh and uses the current faces
in the hit area callback, rather than the faces as defined when the Mesh was made interactive. This will help keep the input in sync with a potentially changing Mesh structure (thanks @rexrainbow)AppleWebKit
will now set the Device.es2019
flag to true
. This causes Phaser to use the native array Stable Sort. This fixes an issue where overlapping particles could flicker on iOS. Fix #6483 (thanks @mattkelliher @spayton)Text.dirty
Game Object property has been removed. It wasn't used internally at all, so was just adding confusion and using space.HTMLVideoElement
before trying to inspect its prototype. This should help in non-browser environments.Plane.originX
and originY
are two new read-only properties that return the origin of the Plane, which is always 0.5 (thanks @rexrainbow)LoaderPlugin
will now call removeAllListeners()
as part of its shutdown
method, which will clear any event listeners bound to a Loader instance of the Scene, during the Scene shutdown. Fix #6633 (thanks @samme)SetCollisionObject
is a new function that Arcade Physics bodies use internally to create and reset their ArcadeBodyCollision
data objects.DynamicTexture.setFromRenderTarget
is a new method that syncs the internal Frame and TextureSource GL textures with the Render Target GL textures.renderTexture
property to undefined
to ensure the reference is cleared.PostFXPipeline
will now set autoResize
to true
on all of its RenderTarget
instances. This fixes an issue where the PostFXPipeline
would not resize the render targets when the game size changed, causing them to become out of sync with the game canvas. Fix #6503 (thanks @Waclaw-I)Particle.scaleY
would always be set to the scaleX
value, even if given a different one within the config. It will now use its own value correctly.Array.Matrix.RotateLeft
was missing the total
parameter, which controls how many times to rotate the matrix.Array.Matrix.RotateRight
was missing the total
parameter, which controls how many times to rotate the matrix.Array.Matrix.TranslateMatrix
didn't work with any translation values above 1 due to missing parameters in RotateLeft
and RotateRight
FX.Blur
didn't set the quality
parameter to its property, meaning it wasn't applied in the shader, causing it to always use a Low Blur quality (unless modified post-creation).BlurFXPipeline
didn't bind the quality of shader specified in the controller, meaning it always used the Low Blur shader, regardless of what the FX controller asked for.FXBlurLow
fragment shader didn't have the offset
uniform. This is now passed in and applied to the resulting blur, preventing it from creating 45 degree artifacts (thanks Wayfinder)Tilemap.createFromObjects
method wouldn't always copy custom properties to the target objects or Data Manager. Fix #6391 (thanks @samme @paxperscientiam)scale.min
and scale.max
width
and height
properties in Game Config were ignored by the Game constructor, which was expecting minWidth
and minHeight
. This now matches the documentation. Fix #6501 (thanks @NikitaShpanko @wpederzoli)Actions.GetLast
function had the same code as the GetFirst
function. It now does what you'd expect it to do. Fix #6513 (thanks @dmokel)TilemapLayer.PutTileAt
method would use an incorrect local GID if the Tilemap Layer wasn't using all available tilesets. Fix #5931 (thanks @christianvoigt @wjaykim)TextureManager.addSpriteSheet
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @charlieschwabacher)HexagonalCullBounds
function incorrectly referenced this
within it, instead of layer
(thanks @DaliborTrampota)HexagonalGetTileCorners
function incorrectly referenced this
within it, instead of layer
(thanks @DaliborTrampota)HexagonalTileToWorldXY
function incorrectly referenced this
within it, instead of layer
(thanks @DaliborTrampota)BitmapText
Game Object will now reset the WebGL Texture unit on flush, which fixes an issue of a flush happening part-way during the rendering a BitmapText (thanks @EmilSV)x: { values: [ 50, 500, 200, 800 ] }
it would fail to set the final value unless you specified the interpolation
property as well. It now defaults to linear
if not given. Fix #6551 (thanks @orcomarcio)ignoreGravity
boolean is now checked during the Matter Engine internal functions, allowing this property to now work again. Fix #6473 (thanks @peer2p)Group.createFromConfig
will now check to see if the config contains either internalCreateCallback
or internalRemoveCallback
and set them accordingly. This fixes an issue where the callbacks would never be set if specified in an array of single configuration objects. Fix #6519 (thanks @samme)PhysicsGroup
will now set the classType
and null the config
when an array of single configuration objects is given in the constructor. Fix #6519 (thanks @samme)PathFollower.pathUpdate
method will now check if the tween
property has a valid data
component before running the update. This prevents a call to PathFollower.stopFollow
from throwing a Cannot read properties of null (reading '0')
error as it tried to do a single update post stop. Fix #6508 (thanks @francois-dibulo)Structs.ProcessQueue#add
(thanks @Trissolo)Tile
was incorrectly using the Alpha
Game Object component, instead of the AlphaSingle
component, which meant although the methods implied you could set a different alpha per tile corner, it was never reflected in the rendering. It has now been updated to use just the single alpha value. Fix #6594 (thanks @jcoppage)TextureManager.addAtlasJSONArray
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)TextureManager.addAtlasJSONHash
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)TextureManager.addAtlasXML
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)TextureManager.addUnityAtlas
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)DynamicTexture.preDestroy
was never called, leading to an accumulation of framebuffers in memory. This method has now been renamed to destroy
and cleans all references correctly.width
or height
in the Game Config object as a string it would multiply the value given by the parent size, often leading to a huge game canvas, or causing WebGL errors as it tried to create a texture larger than the GPU could handle. This has now been strengthened. If you give a string with a % at the end, it works as before, i.e. "100%"
or "50%"
to set the scale based on the parent. If you don't include the %, or use another unit, such as "800px"
it will now be treated as a fixed value, not a percentage.ParticleEmitterWebGLRenderer
has been refactored so that the particle.frame
is used as the source of the glTexture
used in the batch and also if a new texture unit is required. This fixes issues where a Particle Emitter would fail to use the correct frame from a multi-atlas texture. Fix #6515 (thanks @Demeno)StaticBody.setSize
will now check to see if the body has a Game Object or not, and only call getCenter
and the frame sizes if it has. This fixes a bug where calling physics.add.staticBody
would throw an error if you provided a width and height. Fix #6630 (thanks @Legend-Master)DynamicTexture.fill
method will now correctly draw the fill rectangle if the width
and height
are provided in WebGL, where-as before it would assume the y axis started from the bottom-left instead of top-left. Fix #6615 (thanks @rexrainbow)Line.setLineWidth
method on the Line Shape Game Object would result in a line with double the thickness it should have had in WebGL. In Canvas it was the correct width. Both renderers now match. Fix #6604 (thanks @AlvaroNeuronup)DynamicTexture
was leaking memory by leaving a WebGLTexture in memory when its setSize
method was called. This happens automatically on instantiation, meaning that if you created DynamicTextures and then destroyed them frequently, memory would continue to increase (thanks David)DynamicTexture.width
and height
were missing from the class definition, even though they were set and used internally. They're now exposed as read-only properties.BitmapMask
wouldn't correctly set the gl viewport when binding, which caused the mask to distort in games where the canvas resizes from its default. Fix #6527 (thanks @rexrainbow)My thanks to the following for helping with the Phaser 3 Examples, Beta Testing, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
@samme @AlvaroEstradaDev @julescubtree @emadkhezri
slideFactor
. This is a Vector2 that controls how much velocity is retained by a Body after it has been pushed by another Body. The default value is 1, which means it retains all of its velocity. If set to zero, it will retain none of it. This allows you to create a Body that can be pushed around without imparting any velocity to it.Body.setSlideFactor
is a new method that sets the Body's slideFactor
property.nextCategory
which will create a new collision category and return it. You can define up to 32 unique collision categories per world.collisionCategory
and collisionMask
. These allow you to set a specific collision category and list of categories the body will collide with. This allows for fine-grained control over which bodies collide with which others. The default is that all bodies collide with all others, just like before.setCollisionCategory
is a new method available on Arcade Physics Bodies that allows you to set the collision category of the body. It's also available on Arcade Sprites, Images, Tilemap Layers, Groups and Static Groups directly.setCollidesWith
is a new method available on Arcade Physics Bodies that allows you to set which collision categories the body should collide with. It's also available on Arcade Sprites, Images, Tilemap Layers, Groups and Static Groups directly.resetCollision
is a new method available on Arcade Physics Bodies that allows you to reset the collision category and mask to their defaults. It's also available on Arcade Sprites, Images, Tilemap Layers, Groups and Static Groups directly.The default is as before: all bodies collide with each other. However, by using the categories you now have much more fine-grained control over which objects collide together, or not. They are filtered out at the top-level, meaning you can have a Sprite set to not collide with a Physics Group and it will skip checking every single child in the Group, potentially saving a lot of processing time.
The new collision categories are used automatically by either directly calling the collide
or overlap
methods, or by creating a Collider object. This allows you to use far less colliders than you may have needed previously and skip needing to filter the pairs in the collision handlers.
Text.setRTL
is a new method that allows you to set a Text Game Object as being rendered from right-to-left, instead of the default left to right (thanks @rexrainbow)FX.Circle.backgroundAlpha
is a new property that allows you to set the amount of the alpha of the background color in the Circle FX (thanks @rexrainbow)Physics.Arcade.World.singleStep
is a new method that will advance the Arcade Physics World simulation by exactly 1 step (thanks @monteiz)Tilemaps.ObjectLayer.id
is a new property that returns the ID of the Object Layer, if specified within Tiled, or zero otherwise. You can now access the unique layer ID of Tiled layers if the event a map doesn't have unique layer names (thanks @rui-han-crh)Tilemaps.LayerData.id
is a new property that returns the ID of the Data Layer, if specified within Tiled, or zero otherwise (thanks @rui-han-crh)Text.setLetterSpacing
is a new method and Text.lineSpacing
is the related property that allows you to set the spacing between each character of a Text Game Object. The value can be either negative or positive, causing the characters to get closer or further apart. Please understand that enabling this feature will cause Phaser to render each character in this Text object one by one, rather than use a draw for the whole string. This makes it extremely expensive when used with either long strings, or lots of strings in total. You will be better off creating bitmap font text if you need to display large quantities of characters with fine control over the letter spacing (thanks @Ariorh1337)ParticleEmitter.clearDeathZones
is a new method that will clear all previously created Death Zones from a Particle Emitter (thanks @rexrainbow)ParticleEmitter.clearEmitZones
is a new method that will clear all previously created Emission Zones from a Particle Emitter (thanks @rexrainbow)GameObject.setTexture
method has 2 new optional parameters: updateSize
and updateOrigin
, which are both passed to the setFrame
method and allows you to control if the size and origin of the Game Object should be updated when the texture is set (thanks @Trissolo)randomFrame
. This is false
by default, but if set, it will pick a random frame from the animation when it starts playback. This allows for much more variety in groups of sprites created at the same time, using the same animation. This is also reflected in the new Animation.randomFrame
and AnimationState.randomFrame
properties.Phaser.Types.Animations.PlayAnimationConfig
object in the anims
property of the ParticleEmitter
configuration object. This gives you far more control over what happens to the animation when used by particles, including setting random start frames, repeat delays, yoyo, etc. Close #6478 (thanks @michalfialadev)TilemapLayer.setTintFill
is a new method that will apply a fill-based tint to the tiles in the given area, rather than an additive-based tint, which is what the setTint
method uses.Tile.tintFill
is a new boolean property that controls if the tile tint is additive or fill based. This is used in the TilemapLayerWebGLRenderer function.WebAudioSoundManager
will now bind the body
to the removeEventListener
method, if it exists, to prevent memory leaks (thanks @wjaykim)AnimationManager.globalTimeScale
property is now applied to all Game Objects using the Animation component, allowing you to globally speed-up or slow down all animating objects (thanks @TJ09)Rope
Game Object now calls initPostPipeline
allowing you to use Post FX directly on it, such as glow, blur, etc. Fix #6550 (thanks @rexrainbow)Tween.stop
method will now check to see if Tween.parent
is set. If not, it won't try to set a pending removal state or dispatch an event, which should help guard against errors where Tween.stop
is called by mistake on already destroyed tweens (thanks @orcomarcio)Tween.remove
method will now check to see if Tween.parent
exists before trying to remove it from the parent. This should help guard against errors where Tween.remove
is called by mistake on already removed or destroyed tweens. Fix #6539 (thanks @orcomarcio)Particle.alpha
is now clamped to the range 0 to 1 within the update
method, preventing it from going out of range. Fix #6551 (thanks @orcomarcio)Math.Wrap
has been reverted to the previous version. Fix #6479 (thanks @EmilSV)Graphics
Game Object will now set a default line and fill style to fully transparent and black. This prevents issues where a Graphics object would render with a color set in other Shape Game Objects if it had been drawn to and no style was previous set (thanks Whitesmith)mipmapFilter
property in the Game Config is a valid mipmap before assigning it.Polygon.setTo
method (thanks @Trissolo)WebGLRenderer.deleteFramebuffer
method has been updated so it now tests for the existence of a COLOR and DEPTH_STENCIL attachments, and if found, removes the bindings and deletes the stencil buffer. The code that previously deleted the RENDERERBUFFER_BINDING
has also been removed to avoid side-effects.Mesh
Game Object interactive, it will now bind to the scope of the Mesh and uses the current faces
in the hit area callback, rather than the faces as defined when the Mesh was made interactive. This will help keep the input in sync with a potentially changing Mesh structure (thanks @rexrainbow)AppleWebKit
will now set the Device.es2019
flag to true
. This causes Phaser to use the native array Stable Sort. This fixes an issue where overlapping particles could flicker on iOS. Fix #6483 (thanks @mattkelliher @spayton)Text.dirty
Game Object property has been removed. It wasn't used internally at all, so was just adding confusion and using space.HTMLVideoElement
before trying to inspect its prototype. This should help in non-browser environments.Plane.originX
and originY
are two new read-only properties that return the origin of the Plane, which is always 0.5 (thanks @rexrainbow)LoaderPlugin
will now call removeAllListeners()
as part of its shutdown
method, which will clear any event listeners bound to a Loader instance of the Scene, during the Scene shutdown. Fix #6633 (thanks @samme)SetCollisionObject
is a new function that Arcade Physics bodies use internally to create and reset their ArcadeBodyCollision
data objects.DynamicTexture.setFromRenderTarget
is a new method that syncs the internal Frame and TextureSource GL textures with the Render Target GL textures.renderTexture
property to undefined
to ensure the reference is cleared.PostFXPipeline
will now set autoResize
to true
on all of its RenderTarget
instances. This fixes an issue where the PostFXPipeline
would not resize the render targets when the game size changed, causing them to become out of sync with the game canvas. Fix #6503 (thanks @Waclaw-I)Particle.scaleY
would always be set to the scaleX
value, even if given a different one within the config. It will now use its own value correctly.Array.Matrix.RotateLeft
was missing the total
parameter, which controls how many times to rotate the matrix.Array.Matrix.RotateRight
was missing the total
parameter, which controls how many times to rotate the matrix.Array.Matrix.TranslateMatrix
didn't work with any translation values above 1 due to missing parameters in RotateLeft
and RotateRight
FX.Blur
didn't set the quality
parameter to its property, meaning it wasn't applied in the shader, causing it to always use a Low Blur quality (unless modified post-creation).BlurFXPipeline
didn't bind the quality of shader specified in the controller, meaning it always used the Low Blur shader, regardless of what the FX controller asked for.FXBlurLow
fragment shader didn't have the offset
uniform. This is now passed in and applied to the resulting blur, preventing it from creating 45 degree artifacts (thanks Wayfinder)Tilemap.createFromObjects
method wouldn't always copy custom properties to the target objects or Data Manager. Fix #6391 (thanks @samme @paxperscientiam)scale.min
and scale.max
width
and height
properties in Game Config were ignored by the Game constructor, which was expecting minWidth
and minHeight
. This now matches the documentation. Fix #6501 (thanks @NikitaShpanko @wpederzoli)Actions.GetLast
function had the same code as the GetFirst
function. It now does what you'd expect it to do. Fix #6513 (thanks @dmokel)TilemapLayer.PutTileAt
method would use an incorrect local GID if the Tilemap Layer wasn't using all available tilesets. Fix #5931 (thanks @christianvoigt @wjaykim)TextureManager.addSpriteSheet
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @charlieschwabacher)HexagonalCullBounds
function incorrectly referenced this
within it, instead of layer
(thanks @DaliborTrampota)HexagonalGetTileCorners
function incorrectly referenced this
within it, instead of layer
(thanks @DaliborTrampota)HexagonalTileToWorldXY
function incorrectly referenced this
within it, instead of layer
(thanks @DaliborTrampota)BitmapText
Game Object will now reset the WebGL Texture unit on flush, which fixes an issue of a flush happening part-way during the rendering a BitmapText (thanks @EmilSV)x: { values: [ 50, 500, 200, 800 ] }
it would fail to set the final value unless you specified the interpolation
property as well. It now defaults to linear
if not given. Fix #6551 (thanks @orcomarcio)ignoreGravity
boolean is now checked during the Matter Engine internal functions, allowing this property to now work again. Fix #6473 (thanks @peer2p)Group.createFromConfig
will now check to see if the config contains either internalCreateCallback
or internalRemoveCallback
and set them accordingly. This fixes an issue where the callbacks would never be set if specified in an array of single configuration objects. Fix #6519 (thanks @samme)PhysicsGroup
will now set the classType
and null the config
when an array of single configuration objects is given in the constructor. Fix #6519 (thanks @samme)PathFollower.pathUpdate
method will now check if the tween
property has a valid data
component before running the update. This prevents a call to PathFollower.stopFollow
from throwing a Cannot read properties of null (reading '0')
error as it tried to do a single update post stop. Fix #6508 (thanks @francois-dibulo)Structs.ProcessQueue#add
(thanks @Trissolo)Tile
was incorrectly using the Alpha
Game Object component, instead of the AlphaSingle
component, which meant although the methods implied you could set a different alpha per tile corner, it was never reflected in the rendering. It has now been updated to use just the single alpha value. Fix #6594 (thanks @jcoppage)TextureManager.addAtlasJSONArray
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)TextureManager.addAtlasJSONHash
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)TextureManager.addAtlasXML
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)TextureManager.addUnityAtlas
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)DynamicTexture.preDestroy
was never called, leading to an accumulation of framebuffers in memory. This method has now been renamed to destroy
and cleans all references correctly.width
or height
in the Game Config object as a string it would multiply the value given by the parent size, often leading to a huge game canvas, or causing WebGL errors as it tried to create a texture larger than the GPU could handle. This has now been strengthened. If you give a string with a % at the end, it works as before, i.e. "100%"
or "50%"
to set the scale based on the parent. If you don't include the %, or use another unit, such as "800px"
it will now be treated as a fixed value, not a percentage.ParticleEmitterWebGLRenderer
has been refactored so that the particle.frame
is used as the source of the glTexture
used in the batch and also if a new texture unit is required. This fixes issues where a Particle Emitter would fail to use the correct frame from a multi-atlas texture. Fix #6515 (thanks @Demeno)StaticBody.setSize
will now check to see if the body has a Game Object or not, and only call getCenter
and the frame sizes if it has. This fixes a bug where calling physics.add.staticBody
would throw an error if you provided a width and height. Fix #6630 (thanks @Legend-Master)DynamicTexture.fill
method will now correctly draw the fill rectangle if the width
and height
are provided in WebGL, where-as before it would assume the y axis started from the bottom-left instead of top-left. Fix #6615 (thanks @rexrainbow)Line.setLineWidth
method on the Line Shape Game Object would result in a line with double the thickness it should have had in WebGL. In Canvas it was the correct width. Both renderers now match. Fix #6604 (thanks @AlvaroNeuronup)DynamicTexture
was leaking memory by leaving a WebGLTexture in memory when its setSize
method was called. This happens automatically on instantiation, meaning that if you created DynamicTextures and then destroyed them frequently, memory would continue to increase (thanks David)DynamicTexture.width
and height
were missing from the class definition, even though they were set and used internally. They're now exposed as read-only properties.BitmapMask
wouldn't correctly set the gl viewport when binding, which caused the mask to distort in games where the canvas resizes from its default. Fix #6527 (thanks @rexrainbow)My thanks to the following for helping with the Phaser 3 Examples, Beta Testing, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
@samme @AlvaroEstradaDev @julescubtree @emadkhezri
Text.setRTL
is a new method that allows you to set a Text Game Object as being rendered from right-to-left, instead of the default left to right (thanks @rexrainbow)FX.Circle.backgroundAlpha
is a new property that allows you to set the amount of the alpha of the background color in the Circle FX (thanks @rexrainbow)Physics.Arcade.World.singleStep
is a new method that will advance the Arcade Physics World simulation by exactly 1 step (thanks @monteiz)Tilemaps.ObjectLayer.id
is a new property that returns the ID of the Object Layer, if specified within Tiled, or zero otherwise. You can now access the unique layer ID of Tiled layers if the event a map doesn't have unique layer names (thanks @rui-han-crh)Tilemaps.LayerData.id
is a new property that returns the ID of the Data Layer, if specified within Tiled, or zero otherwise (thanks @rui-han-crh)Text.setLetterSpacing
is a new method and Text.lineSpacing
is the related property that allows you to set the spacing between each character of a Text Game Object. The value can be either negative or positive, causing the characters to get closer or further apart. Please understand that enabling this feature will cause Phaser to render each character in this Text object one by one, rather than use a draw for the whole string. This makes it extremely expensive when used with either long strings, or lots of strings in total. You will be better off creating bitmap font text if you need to display large quantities of characters with fine control over the letter spacing (thanks @Ariorh1337)ParticleEmitter.clearDeathZones
is a new method that will clear all previously created Death Zones from a Particle Emitter (thanks @rexrainbow)ParticleEmitter.clearEmitZones
is a new method that will clear all previously created Emission Zones from a Particle Emitter (thanks @rexrainbow)GameObject.setTexture
method has 2 new optional parameters: updateSize
and updateOrigin
, which are both passed to the setFrame
method and allows you to control if the size and origin of the Game Object should be updated when the texture is set (thanks @Trissolo)randomFrame
. This is false
by default, but if set, it will pick a random frame from the animation when it starts playback. This allows for much more variety in groups of sprites created at the same time, using the same animation. This is also reflected in the new Animation.randomFrame
and AnimationState.randomFrame
properties.Phaser.Types.Animations.PlayAnimationConfig
object in the anims
property of the ParticleEmitter
configuration object. This gives you far more control over what happens to the animation when used by particles, including setting random start frames, repeat delays, yoyo, etc. Close #6478 (thanks @michalfialadev)WebAudioSoundManager
will now bind the body
to the removeEventListener
method, if it exists, to prevent memory leaks (thanks @wjaykim)AnimationManager.globalTimeScale
property is now applied to all Game Objects using the Animation component, allowing you to globally speed-up or slow down all animating objects (thanks @TJ09)Rope
Game Object now calls initPostPipeline
allowing you to use Post FX directly on it, such as glow, blur, etc. Fix #6550 (thanks @rexrainbow)Tween.stop
method will now check to see if Tween.parent
is set. If not, it won't try to set a pending removal state or dispatch an event, which should help guard against errors where Tween.stop
is called by mistake on already destroyed tweens (thanks @orcomarcio)Tween.remove
method will now check to see if Tween.parent
exists before trying to remove it from the parent. This should help guard against errors where Tween.remove
is called by mistake on already removed or destroyed tweens. Fix #6539 (thanks @orcomarcio)Particle.alpha
is now clamped to the range 0 to 1 within the update
method, preventing it from going out of range. Fix #6551 (thanks @orcomarcio)Math.Wrap
has been reverted to the previous version. Fix #6479 (thanks @EmilSV)Graphics
Game Object will now set a default line and fill style to fully transparent and black. This prevents issues where a Graphics object would render with a color set in other Shape Game Objects if it had been drawn to and no style was previous set (thanks Whitesmith)mipmapFilter
property in the Game Config is a valid mipmap before assigning it.Polygon.setTo
method (thanks @Trissolo)WebGLRenderer.deleteFramebuffer
method has been updated so it now tests for the exitennce of a COLOR and DEPTH_STENCIL attachments, and if found, removes the bindings and deletes the stencil buffer. The code that previously deelted the RENDERERBUFFER_BINDING
has also been removed to avoid side-effects.Mesh
Game Object interactive, it will now bind to the scope of the Mesh and uses the current faces
in the hit area callback, rather than the faces as defined when the Mesh was made interactive. This will help keep the input in sync with a potentially changing Mesh structure (thanks @rexrainbow)AppleWebKit
will now set the Device.es2019
flag to true
. This causes Phaser to use the native array Stable Sort. This fixes an issue where overlapping particles could flicker on iOS. Fix #6483 (thanks @mattkelliher @spayton)PostFXPipeline
will now set autoResize
to true
on all of its RenderTarget
instances. This fixes an issue where the PostFXPipeline
would not resize the render targets when the game size changed, causing them to become out of sync with the game canvas. Fix #6503 #6527 (thanks @Waclaw-I @rexrainbow)Particle.scaleY
would always be set to the scaleX
value, even if given a different one within the config. It will now use its own value correctly.Array.Matrix.RotateLeft
was missing the total
parameter, which controls how many times to rotate the matrix.Array.Matrix.RotateRight
was missing the total
parameter, which controls how many times to rotate the matrix.Array.Matrix.TranslateMatrix
didn't work with any translation values above 1 due to missing parameters in RotateLeft
and RotateRight
FX.Blur
didn't set the quality
parameter to its property, meaning it wasn't applied in the shader, causing it to always use a Low Blur quality (unless modified post-creation).BlurFXPipeline
didn't bind the quality of shader specified in the controller, meaning it always used the Low Blur shader, regardless of what the FX controller asked for.FXBlurLow
fragment shader didn't have the offset
uniform. This is now passed in and applied to the resulting blur, preventing it from creating 45 degree artifacts (thanks Wayfinder)Tilemap.createFromObjects
method wouldn't always copy custom properties to the target objects or Data Manager. Fix #6391 (thanks @samme @paxperscientiam)scale.min
and scale.max
width
and height
properties in Game Config were ignored by the Game constructor, which was expecting minWidth
and minHeight
. This now matches the documentation. Fix #6501 (thanks @NikitaShpanko @wpederzoli)Actions.GetLast
function had the same code as the GetFirst
function. It now does what you'd expect it to do. Fix #6513 (thanks @dmokel)TilemapLayer.PutTileAt
method would use an incorrect local GID if the Tilemap Layer wasn't using all available tilesets. Fix #5931 (thanks @christianvoigt @wjaykim)TextureManager.addSpriteSheet
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @charlieschwabacher)HexagonalCullBounds
function incorrectly referenced this
within it, instead of layer
(thanks @DaliborTrampota)HexagonalGetTileCorners
function incorrectly referenced this
within it, instead of layer
(thanks @DaliborTrampota)HexagonalTileToWorldXY
function incorrectly referenced this
within it, instead of layer
(thanks @DaliborTrampota)BitmapText
Game Object will now reset the WebGL Texture unit on flush, which fixes an issue of a flush happening part-way during the rendering a BitmapText (thanks @EmilSV)x: { values: [ 50, 500, 200, 800 ] }
it would fail to set the final value unless you specified the interpolation
property as well. It now defaults to linear
if not given. Fix #6551 (thanks @orcomarcio)ignoreGravity
boolean is now checked during the Matter Engine internal functions, allowing this property to now work again. Fix #6473 (thanks @peer2p)Group.createFromConfig
will now check to see if the config contains either internalCreateCallback
or internalRemoveCallback
and set them accordingly. This fixes an issue where the callbacks would never be set if specified in an array of single configuration objects. Fix #6519 (thanks @samme)PhysicsGroup
will now set the classType
and null the config
when an array of single configuration objects is given in the constructor. Fix #6519 (thanks @samme)PathFollower.pathUpdate
method will now check if the tween
property has a valid data
component before running the update. This prevents a call to PathFollower.stopFollow
from throwing a Cannot read properties of null (reading '0')
error as it tried to do a single update post stop. Fix #6508 (thanks @francois-dibulo)Structs.ProcessQueue#add
(thanks @Trissolo)Tile
was incorrectly using the Alpha
Game Object component, instead of the AlphaSingle
component, which meant although the methods implied you could set a different alpha per tile corner, it was never reflected in the rendering. It has now been updated to use just the single alpha value. Fix #6594 (thanks @jcoppage)TextureManager.addAtlasJSONArray
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)TextureManager.addAtlasJSONHash
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)TextureManager.addAtlasXML
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)TextureManager.addUnityAtlas
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @1DAfT)DynamicTexture.preDestroy
was never called, leading to an accumulation of framebuffers in memory. This method has now been renamed to destroy
and cleans all references correctly.width
or height
in the Game Config object as a string it would multiply the value given by the parent size, often leading to a huge game canvas, or causing WebGL errors as it tried to create a texture larger than the GPU could handle. This has now been strengthened. If you give a string with a % at the end, it works as before, i.e. "100%"
or "50%"
to set the scale based on the parent. If you don't include the %, or use another unit, such as "800px"
it will now be treated as a fixed value, not a percentage.ParticleEmitterWebGLRenderer
has been refactored so that the particle.frame
is used as the source of the glTexture
used in the batch and also if a new texture unit is required. This fixes issues where a Particle Emitter would fail to use the correct frame from a multi-atlas texture. Fix #6515 (thanks @Demeno)My thanks to the following for helping with the Phaser 3 Examples, Beta Testing, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
@samme @AlvaroEstradaDev @julescubtree @emadkhezri
Text.setRTL
is a new method that allows you to set a Text Game Object as being rendered from right-to-left, instead of the default left to right (thanks @rexrainbow)FX.Circle.backgroundAlpha
is a new property that allows you to set the amount of the alpha of the background color in the Circle FX (thanks @rexrainbow)Physics.Arcade.World.singleStep
is a new method that will advance the Arcade Physics World simulation by exactly 1 step (thanks @monteiz)Tilemaps.ObjectLayer.id
is a new property that returns the ID of the Object Layer, if specified within Tiled, or zero otherwise. You can now access the unique layer ID of Tiled layers if the event a map doesn't have unique layer names (thanks @rui-han-crh)Tilemaps.LayerData.id
is a new property that returns the ID of the Data Layer, if specified within Tiled, or zero otherwise (thanks @rui-han-crh)Text.setLetterSpacing
is a new method and Text.lineSpacing
is the related property that allows you to set the spacing between each character of a Text Game Object. The value can be either negative or positive, causing the characters to get closer or further apart. Please understand that enabling this feature will cause Phaser to render each character in this Text object one by one, rather than use a draw for the whole string. This makes it extremely expensive when used with either long strings, or lots of strings in total. You will be better off creating bitmap font text if you need to display large quantities of characters with fine control over the letter spacing (thanks @Ariorh1337)ParticleEmitter.clearDeathZones
is a new method that will clear all previously created Death Zones from a Particle Emitter (thanks @rexrainbow)ParticleEmitter.clearEmitZones
is a new method that will clear all previously created Emission Zones from a Particle Emitter (thanks @rexrainbow)WebAudioSoundManager
will now bind the body
to the removeEventListener
method, if it exists, to prevent memory leaks (thanks @wjaykim)AnimationManager.globalTimeScale
property is now applied to all Game Objects using the Animation component, allowing you to globally speed-up or slow down all animating objects (thanks @TJ09)Rope
Game Object now calls initPostPipeline
allowing you to use Post FX directly on it, such as glow, blur, etc. Fix #6550 (thanks @rexrainbow)Tween.stop
method will now check to see if Tween.parent
is set. If not, it won't try to set a pending removal state or dispatch an event, which should help guard against errors where Tween.stop
is called by mistake on already destroyed tweens (thanks @orcomarcio)Tween.remove
method will now check to see if Tween.parent
exists before trying to remove it from the parent. This should help guard against errors where Tween.remove
is called by mistake on already removed or destroyed tweens. Fix #6539 (thanks @orcomarcio)Particle.alpha
is now clamped to the range 0 to 1 within the update
method, preventing it from going out of range. Fix #6551 (thanks @orcomarcio)Math.Wrap
has been reverted to the previous version. Fix #6479 (thanks @EmilSV)Particle.scaleY
would always be set to the scaleX
value, even if given a different one within the config. It will now use its own value correctly.Array.Matrix.RotateLeft
was missing the total
parameter, which controls how many times to rotate the matrix.Array.Matrix.RotateRight
was missing the total
parameter, which controls how many times to rotate the matrix.Array.Matrix.TranslateMatrix
didn't work with any translation values above 1 due to missing parameters in RotateLeft
and RotateRight
FX.Blur
didn't set the quality
parameter to its property, meaning it wasn't applied in the shader, causing it to always use a Low Blur quality (unless modified post-creation).BlurFXPipeline
didn't bind the quality of shader specified in the controller, meaning it always used the Low Blur shader, regardless of what the FX controller asked for.FXBlurLow
fragment shader didn't have the offset
uniform. This is now passed in and applued to the resulting blur, preventing it from creating 45 degree artifacts (thanks Wayfinder)Tilemap.createFromObjects
method wouldn't always copy custom properties to the target objects or Data Manager. Fix #6391 (thanks @samme @paxperscientiam)scale.min
and scale.max
width
and height
properties in Game Config were ignored by the Game constructor, which was expecting minWidth
and minHeight
. This now matches the documnentation. Fix #6501 (thanks @NikitaShpanko @wpederzoli)Actions.GetLast
function had the same code as the GetFirst
function. It now does what you'd expect it to do. Fix #6513 (thanks @dmokel)TilemapLayer.PutTileAt
method would use an incorrect local GID if the Tilemap Layer wasn't using all available tilesets. Fix #5931 (thanks @christianvoigt @wjaykim)TextureManager.addSpriteSheet
method would fail if a Texture
instance was given as the second parameter, throwing a Cannot read property 'key' of null
(thanks @charlieschwabacher)HexagonalCullBounds
function incorrectly referenced this
within it, instead of layer
(thanks @DaliborTrampota)HexagonalGetTileCorners
function incorrectly referenced this
within it, instead of layer
(thanks @DaliborTrampota)HexagonalTileToWorldXY
function incorrectly referenced this
within it, instead of layer
(thanks @DaliborTrampota)BitmapText
Game Object will now reset the WebGL Texture unit on flush, which fixes an issue of a flush happened part-way during the rendering a BitmapText (thanks @EmilSV)x: { values: [ 50, 500, 200, 800 ] }
it would fail to set the final value unless you specified the interpolation
property as well. It now defaults to linear
if not given. Fix #6551 (thanks @orcomarcio)ignoreGravity
boolean is now checked during the Matter Engine internal functions, allowing this property to now work again. Fix #6473 (thanks @peer2p)Group.createFromConfig
will now check to see if the config contains either internalCreateCallback
or internalRemoveCallback
and set them accordingly. This fixes an issue where the callbacks would never be set if specified in an array of single configuration objects. Fix #6519 (thanks @samme)PhysicsGroup
will now set the classType
and null the config
when an array of single configuration objects is given in the constructor. Fix #6519 (thanks @samme)PathFollower.pathUpdate
method will now check if the tween
property has a valid data
component before running the update. This prevents a call to PathFollower.stopFollow
from throwing a Cannot read properties of null (reading '0')
error as it tried to do a single update post stop. Fix #6508 (thanks @francois-dibulo)My thanks to the following for helping with the Phaser 3 Examples, Beta Testing, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
@samme
Due to the size and importance of the v3.60 release, we have split the Change Log up into multiple sections.
This makes it easier for you to browse and find the information you need.
These are the headliner features in this release:
Pick any of the following sections to see the breaking changes, new features, updates, and bug fixes for that area of the API.
Finally, here are the updates related to Game Objects:
My thanks to the following for helping with the Phaser 3 Examples, Beta Testing, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
💖 | 💖 | 💖 | 💖 |
---|---|---|---|
@0day-oni | @201flaviosilva | @AlbertMontagutCasero | @Arcanorum |
@arosemena | @austinlyon | @chrisl8 | @christian-post |
@danfoster | @darrylpizarro | @DeweyHur | @drunkcat |
@ef4 | @eltociear | @EsteFilipe | @etherealmachine |
@EmilSV | @Fake | @florestankorp | @hacheraw |
@hanzooo | @jerricko | @joegaffey | @jonasrundberg |
@kainage | @kootoopas | @lolimay | @MaffDev |
@michalfialadev | @monteiz | @necrokot | @Nero0 |
@OdinvonDoom | @orjandh | @pavle-goloskokovic | @PhaserEditor2D |
@Pythux | @quocsinh | @rgk | @rollinsafary-inomma |
@rstanuwijaya | 👑 @samme 👑 | @Smirnov48 | @steveja42 |
@sylvainpolletvillard | @twoco | @ubershmekel | @ultimoistante |
@VanaMartin | @vforsh | @Vidminas | @x-wk |
@xmahle | @xuxucode | @YeloPartyHat | @ZekeLu |
FromChris | Golen | OmniOwl | and you ... |
📖 Read the Phaser 3 API Docs 💻 Browse 2000+ Code Examples 🤝 Join the awesome Phaser Discord