Releases: phaserjs/phaser
Phaser v3.88.2
Bug Fixes
- Reverted an incorrect change made to the Scale Manager that prevented the
autoCenter: Phaser.Scale.CENTER_BOTH
from working.
Phaser v3.88.1
Bug Fixes
- Fixed
ReferenceError: GetFastValueOp is not defined
in NumberTweenBuilder (thanks Flow) - Reverted incorrect change made to
SafeRange
array util function. - Fixed
Array.Utils.GetFirst
so it correctly handles a negative start index. Fixes Container.getByName returning null and various other similar methods. Fix #7040 (thanks @XWILKINX)
Phaser v3.88
New Features
Transform.getWorldPoint
is a new method that will return the World point as a Vector2 of a Game Object, factoring in parents if applicable (thanks @samme)Utils.Array.GetFirst
can now search from the end of the array when settingstartIndex
to -1.DynamicTexture
and by extensionRenderTexture
now have a new boolean propertyforceEven
in their constructor,setSize
andresize
methods. This will force the given width and height values to be rounded up to the nearest even value. This significantly improves the rendering quality of the render texture in most circumstances, so the flag istrue
by default. This is a potentially breaking change, so if you know you need an odd sized texture, please set the value tofalse
. Fix #6988 (thanks @rexrainbow)
Updates
Tween.isNumberTween
is a new boolean property that tells if the Tween is a NumberTween, or not.- The
TransformMatrix.setTransform
method has been updated so that it uses the old way of passing in matrix values for Canvas 2D. This fixes the error "Failed to execute 'setTransform' on 'CanvasRenderingContext2D': 6 arguments required, but only 1 present." in old legacy browsers such as Chromium Embedded Framework. Fix #6965 (thanks @rafa-fie) - Handlers for both
mousedown
andmouseup
have been added for unlocking Web Audio. Both events occur before aclick
event, allowing for earlier audio unlocking on devices that use a mouse (thanks @pavle-goloskokovic) - In both the Canvas and WebGL Renderer the background color, as set in the game config, is applied directly to the canvas immediately upon creation, rather than at the first render step. This may avoid some 'flashes' of color in certain circumstances (thanks @pavle-goloskokovic)
- The Texture Manager will now fail gracefully when a texture isn't created as a result of calling the
addBase64
method. Rather than the error "TypeError: null is not an object (evaluating 'texture.source')" is will not return early (thanks @samme) - Both
TweenBuilder
andNumberTweenBuilder
have been updated to useGetFastValue
for most properties instead ofGetValue
. - The
Transform.getWorldTransformMatrix
method will now destroy the parent matrix at the end, if it was created within the method. - The Arcade Physics
Body.setGameObject
andStaticBody.setGameObject
methods have been updated to do the following: Return if no valid Game Object is passed. Disable and null the body of the existing Game Object if the Body has one. Set thebody
property, even if it doesn't exist (converts non-physics objects into physics objects). CallssetSize
to update the body dimensions to make the new Game Object and finally setsenable
based on the given parameter, which is now correctly referenced. The StaticBody version also has a new parameter,enable
which matches that of the Dynamic Body and defaults totrue
(the original state). Fix #6969 (thanks @yongzheng7) - The Arcade Physics
ArcadeColliderType
has been updated to includePhysics.Arcade.StaticBody
. Fix #6967 (thanks @yongzheng7) Phaser.Types.GameObjects.Text.TextStyle
now includesletterSpacing
: a positive or negative amount to add to the spacing between characters. Fix #7002 (thanks @Stever1388)Tilemaps.Parsers.Tiled.ParseTilesets
,Tilemaps.Parsers.Tiled.BuildTilesetIndex
andTilemaps.ImageCollection.addImage
have been updated to includewidth
andheight
of each individual image. Fix #6990 (thanks @stickleprojects)Tilemaps.Components.RenderDebug
andTilemaps.Parsers.Tiled.BuildTilesetIndex
have been updated to includewidth
andheight
offsets in Image Collections.- Added a warning to
Tilemaps.Components.GetTilesWithinShape
when attempting to use this method with non orthogonal tilemaps. - Changed the
Cameras.Scene2D.Camera.preRender
method from protected to public. Fix #7020 (thanks @zoubingwu)
Bug Fixes
TweenData.update
will now check if the Tween is a Number Tween and apply the final start/end value to the result on completion, instead of the eased value as calculated by the change made in v3.87.BaseTweenData.duration
can now never be zero or less than zero, which would trigger NaN errors. It's now clamped to a minimum of 0.01ms. Fix #6955 (thanks @kainage)- Fixed the properties in the
FontFileConfig
(thanks @samme) Matter.World.update
could hang and crash the browser if a large delta value was given to it, such as returning to a long-dormant tab. The Matter Runner config values are now properly passed through, preventing this from happening. Fix #6977 (thanks @ubershmekel @samme)Phaser.Physics.Matter.Components.Transform#scale
correctly scales the physics body with the GameObject. Fix #7001 (thanks @Stever1388)Phaser.Textures.Frame.setCropUVs
updated crop calculation to include thespriteSourceSize
. Fix #6996 (thanks @CrispMind)Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled
updated hexagonal tilemaps to correctly calculate thewidthInPixels
andheightInPixels
based on the hexagonal overlapping tiles. Fix #6992 (thanks @ptantiku)Phaser.Display.Color.Interpolate.RGBWithRGB
now correctly returns aPhaser.Types.Display.ColorObject
that includesr
,g
,b
,a
andcolor
values. Fix #6979 (thanks @XWILKINX)- Fixed incorrect Arcade Physics circle separation logic for circle to circle, and circle to rectangle collisions. The logic was incorrectly moving only one body, even if both could be moved. Fix #6963 (thanks @samme)
Phaser.Plugins.PluginManager
automatically boots plugins when the game config render type is set toPhaser.HEADLESS
. Fix #6893 (thanks @hubertgrzeskowiak)- Tweens created with
persist
set totrue
and given acompleteDelay
value are no longer destroyed and can be replayed. Fix #7008 (thanks @Stever1388) - The
Tweens.TweenChain
onStart
event is now dispatched properly. Fix #7007 (thanks @Stever1388) GameObjects.Particles.Zones.DeathZone
now uses world position coordinates instead of local position coordinates following the particle emitter position. Fix #7006 (thanks @Stever1388)- Merged pull request #7009 from @samme that prevents hanging timer events with repeats and negative delays. Fix #7004 (thanks @Stever1388)
- When adding a new Tween, passing an event listener callback outside the
Phaser.Types.Tweens.TweenBuilderConfig
object is now correctly executed without errors. Fix #7003 (thanks @Stever1388) - A
GameObjects.Text
created withwordwrap
and withletterSpacing
applied now takes into account the providedletterSpacing
value to correctly wrap lines. Fix #7002 (thanks @Stever1388) - Creating new
GameObjects.DOMElement
sets the GameObject'sdisplayWidth
anddisplayHeight
using itsscaleX
andscaleY
values instead of the DOM elementsgetBoundingClientRect()
values. Fix #6871 (thanks @HawkenKing) - Setting scale
mode
toPhaser.Scale.FIT
andautoCenter
toPhaser.Scale.CENTER_BOTH
correctly centres canvas on iOS devices. Fix #6862 (thanks @HawkenKing) - On hex maps, creating a blank layer with the
Tilemaps.Tilemap.createBlankLayer
method now correctly sets thehexSideLength
as loaded from the hex tilemap. Fix #6074 (thanks @wwoods) - The
Input.InputPlugin.processDragUpEvent
now correctly returnsx
andy
coordinates in world space. Animations.AnimationState.play
method now prioritises theframeRate
property when it is set in thePlayAnimationConfig
object over animation data loaded from an external file.- Fixed an issue where sounds / music would stop playing in iOS 17.5.1+ or iOS18+ after losing/gaining focus in Safari. The Web Audio Sound Manager will now listen for the 'visible' event and suspend and resume the context as a result. Fix #6829 (thanks @JanAmbrozic @condeagustin)
- The
Layer
Game Object methodsetToTop
would throw an exception:getDisplayList is not a function
. This method has now been added to the Game Object. Fix #7014 (thanks @leha-games @rexrainbow) - Fixed an issue where the Particle
EmitterOp
defaultEmit()
always returnedundefined
, causing particle problems if you gave only anonUpdate
callback. Also if you configured an EmitterOp withonEmit
oronUpdate
, the op's current value would be incorrect (an object) until the first emit. Fix #7016 (thanks @urueda @samme)
Examples, Documentation, Beta Testing and TypeScript
Thanks to the following for helping with the Phaser Examples, Beta Testing, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
Phaser v4.0.0 Beta 5
As well as bug fixes, beta 5 includes two major components:
- SpriteGPULayer game object. This advanced renderer is designed to handle millions of background objects.
- Texture coordinates now match WebGL standards. This should bring greater compatibility with other technologies. Note that compressed textures must be re-compressed to work with this system: ensure that the Y axis starts at the bottom and increases upwards.
Fixes and Improvements
- Limit
roundPixels
to only operate when objects are axis-aligned and unscaled. This prevents flicker on transforming objects. - Fix
TextureSource.resolution
being ignored in WebGL.- This fixes an issue where increasing text resolution increased text size.
- Fix
DynamicTexture
using a camera without the required methods. - Remove
WebGLAttribLocationWrapper
as it is unused. - Remove
WebGLRenderer.textureIndexes
asglTextureUnits.unitIndices
now fills this role. - Remove dead code and unused/unconnected properties from
WebGLRenderer
. - Switch texture orientation to match WebGL standards.
- Add SpriteGPULayer game object.
Phaser v4.0.0 Beta 4
Fixes and Improvements
- Fix Arcade Physics group collisions,
nearest
andfurthest
, and static group refresh. Thanks samme! - Fail gracefully when a texture isn't created in
addBase64()
- Improve RenderSteps initialization, removing a private method substitution
- Fix Layer's use of RenderSteps
- Fix reversion that removed camera zoom on separate axes
- Fix filter padding precision
- Fix filter padding offset with internal filters
- Improve
TransformMatrix.setQuad
documentation - Fix shader not switching when TilemapLayer and TileSprite are in the same scene
Phaser v4.0.0 Beta 3
Thanks to the community feedback in the Phaser Discord we decided to rework the way RenderFilters work:
Previously, the RenderFilters object wrapped game objects to apply Filters. This worked well in several ways, but because it replaced the existing game object, it made object references less reliable.
The decision was made to change Filters to a component on game objects. This is similar to the old FX system, but it is now built into the base GameObject, so it can be used everywhere. Filters are not FX (they're better).
For those who have been using Phaser 4 beta 1 or 2, this will change the way you use filters. The core principles are the same, however: filters are still divided into internal and external lists.
The new way to use filters is thus:
// Set up filter systems.
gameObject.enableFilters();
// Create filter controllers.
const blur = gameObject.filters.internal.addBlur();
When you run enableFilters()
, Phaser creates an internal camera to handle the object's filters, and adds a RenderStep function.
By default, when there are no active filters to render, the RenderStep skips straight to renderWebGL
. If you want the object to render to a framebuffer without rendering a filter, you can set gameObject.filtersForceComposite = true
. This can be useful when you want to composite alpha, e.g. when you have several objects in a Container or Layer and you don't want to see them through each other, you can leave their alpha at 1, set filtersForceComposite
, and reduce the alpha of gameObject.filterCamera
.
Filters run focusFilters
every time they render by default. This differs from RenderFilters.focus
, which didn't run every time. This method ensures that the filterCamera
is always locked onto the object. Some objects don't have enough properties to accurately lock on to, so the system will guess, and fall back to the screen resolution. You can run gameObject.focusFiltersOverride
to manually set the camera target.
In general, this runs much like FX did - but with more control and better compatibility.
For more details about this release, please see the Dev Logs in Issue 211 of our Phaser World newsletter (due out on Friday 27th December)
Phaser v4.0.0 Beta 2
- Better roundPixels handling via bias.
- UUIDs for DynamicTexture names.
- Masks work (again). Big feature!
- DynamicTexture can resize immediately after creation.
- Fix shader compilation issues on diverse systems.
* Shapes/Graphics should work again in Firefox.
* Issues with inTexDatum should be eliminated in affected Linux systems. - Fix Extern and extend its rendering potential (see Beam Examples).
- TileSprite now assigns default dimensions to each dimension separately.
- BaseFilterShader now accesses loaded shader cache keys correctly.
Phaser v4.0.0 Beta 1
This is the first beta release of Phaser v4.0.0. This build includes the brand new Phaser Beam renderer, that powers all of the WebGL rendering internally. We will be publishing more details about this in the coming days, but for now, you can drop in this build as a direct v3.80+ replacement and see how your game runs! Check out the README for more internal changes.
Phaser v3.87
New Features
FontFile
is a new File Type loader that allows you to load TTF/OTF fonts directly into Phaser, without the need for a 3rd party web font loader or CSS hacks. The loaded fonts can be used in the Text Game Objects, such as the example below:
preload ()
{
this.load.font('Caroni', 'assets/fonts/ttf/caroni.otf', 'opentype');
this.load.font('troika', 'assets/fonts/ttf/troika.otf', 'opentype');
}
create ()
{
this.add.text(32, 32, 'The face of the moon was in shadow.', { fontFamily: 'troika', fontSize: 80, color: '#ff0000' });
this.add.text(150, 350, 'Waves flung themselves at the blue evening.', { fontFamily: 'Caroni', fontSize: 64, color: '#5656ee' });
}
Updates
- The Particle Animation State is now optional. A Particle will not create an Animation State controller unless the
anim
property exists within the emitter configuration. By not creating the controller it leads to less memory overhead and a much faster clean-up time when destroying particles. Fix #6482 (thanks @samme) - Optimized
TweenData.update
to achieve the same result with my less repetition. Also fixes an issue where a Tween that used a customease
callback would glitch when the final value was set, as it would be set outside of the ease callback. It's now passed through it, no matter what. Fix #6939 (thanks @SBCGames)
Bug Fixes
- Fixed the calculation of the index in
GetBitmapTextSize
that would lead to incorrect indexes vs. the docs and previous releases (thanks @bagyoni) Utils.String.RemoveAt
would incorrectly calculate the slice index if it was > 0. It will now remove the correctly specified character.
Examples, Documentation, Beta Testing and TypeScript
Thanks to the following for helping with the Phaser Examples, Beta Testing, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
Phaser v3.86.0
Updates
RenderTarget.init
is a new method that will create the underlying framebuffer and texture for a Render Target. This is called in the constructor only, avoiding the need to call theresize
method.Phaser.GameObjects.Container#tempTransformMatrix
has been removed. This was an internal private Transform Matrix. It has been replaced by a global single matrix that is used instead. This removes the need for every Container to have its own instance of this temporary matrix, reducing object allocation and memory overhead.BaseCamera.renderRoundPixels
is a new read-only property that is set during the CamerapreRender
method every frame. It is true if the Camera is set to render round pixels and the zoom values are integers, otherwise it is false. This is then fed into the MultiPipeline when rendering sprites and textures.
Bug Fixes
- The Canvas Renderer and WebGL Multi Pipeline now uses the new
renderRoundPixels
boolean to determine if it can render a Sprite or a Texture with rounded position values, or not. This fixes an issue where black lines would appear between tightly grouped sprites or tiles at non-integer Camera zoom values. Fix #6907 (thanks @MarcJamesIO) RenderTarget.resize
will now check theautoResize
property before applying the change. Textures that have been locked to a fixed size, such as FX POT buffers, will no longer be resized to the full canvas dimensions, causing Out of Memory errors on some mobile devices. Fix #6914 (thanks @mikaleerhart @DavidTalevski)- The
Array.MoveAbove
function didn't recalculate the baseIndex after the splice, meaning the item would end up in the wrong location. - The
HexagonalTileToWorldXY
function incorrectly usedthis
instead oflayer
causing it to error in hex tilemaps with x axis staggering. Fix #6913 (thanks @jummy123) - The
Text
Game Object could truncate the length of the Text whensetLetterSpacing
was used. Fix #6915 (thanks @monteiz @rexrainbow) - The
EXPAND
Scale Mode would cause the error "Framebuffer status: Incomplete Attachment" under WebGL if the Phaser game loaded into an iframe or element with a size of 0 on either axis, such as when you load the game into a 0x0 iframe before expanding it. It now protects against divide by zero errors. - The
RenderTarget.willResize
method will now check if the values given to it are actually numbers. If not it will return false.
Examples, Documentation, Beta Testing and TypeScript
Thanks to the following for helping with the Phaser Examples, Beta Testing, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs: