mirror of
https://github.com/photonstorm/phaser
synced 2024-11-15 09:27:37 +00:00
12 KiB
12 KiB
New Features
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 andText.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)- The
GameObject.setTexture
method has 2 new optional parameters:updateSize
andupdateOrigin
, which are both passed to thesetFrame
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) - Both the Animation Config and the Play Animation Config allow you to set a new boolean property
randomFrame
. This isfalse
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 newAnimation.randomFrame
andAnimationState.randomFrame
properties. - You can now use a
Phaser.Types.Animations.PlayAnimationConfig
object in theanims
property of theParticleEmitter
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)
Updates
- The
WebAudioSoundManager
will now bind thebody
to theremoveEventListener
method, if it exists, to prevent memory leaks (thanks @wjaykim) - The
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) - The
Rope
Game Object now callsinitPostPipeline
allowing you to use Post FX directly on it, such as glow, blur, etc. Fix #6550 (thanks @rexrainbow) - The
Tween.stop
method will now check to see ifTween.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 whereTween.stop
is called by mistake on already destroyed tweens (thanks @orcomarcio) - The
Tween.remove
method will now check to see ifTween.parent
exists before trying to remove it from the parent. This should help guard against errors whereTween.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 theupdate
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)- The
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) - The WebGLRenderer will now validate that the
mipmapFilter
property in the Game Config is a valid mipmap before assigning it. - A small amount of unused code has been removed from the
Polygon.setTo
method (thanks @Trissolo) - The
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 theRENDERERBUFFER_BINDING
has also been removed to avoid side-effects. - If you make a
Mesh
Game Object interactive, it will now bind to the scope of the Mesh and uses the currentfaces
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) - iOS and any browser identifying as
AppleWebKit
will now set theDevice.es2019
flag totrue
. 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) - The
Text.dirty
Game Object property has been removed. It wasn't used internally at all, so was just adding confusion and using space. - The Request Video Frame polyfill will now check first to see if the browser supports
HTMLVideoElement
before trying to inspect its prototype. This should help in non-browser environments.
Bug Fixes
- The
PostFXPipeline
will now setautoResize
totrue
on all of itsRenderTarget
instances. This fixes an issue where thePostFXPipeline
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 thescaleX
value, even if given a different one within the config. It will now use its own value correctly.Array.Matrix.RotateLeft
was missing thetotal
parameter, which controls how many times to rotate the matrix.Array.Matrix.RotateRight
was missing thetotal
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 inRotateLeft
andRotateRight
FX.Blur
didn't set thequality
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).- The
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. - The
FXBlurLow
fragment shader didn't have theoffset
uniform. This is now passed in and applied to the resulting blur, preventing it from creating 45 degree artifacts (thanks Wayfinder) - The
Tilemap.createFromObjects
method wouldn't always copy custom properties to the target objects or Data Manager. Fix #6391 (thanks @samme @paxperscientiam) - The
scale.min
andscale.max
width
andheight
properties in Game Config were ignored by the Game constructor, which was expectingminWidth
andminHeight
. This now matches the documentation. Fix #6501 (thanks @NikitaShpanko @wpederzoli) - Due to a copy-paste bug, the
Actions.GetLast
function had the same code as theGetFirst
function. It now does what you'd expect it to do. Fix #6513 (thanks @dmokel) - The
TilemapLayer.PutTileAt
method would use an incorrect local GID if the Tilemap Layer wasn't using all available tilesets. Fix #5931 (thanks @christianvoigt @wjaykim) - The
TextureManager.addSpriteSheet
method would fail if aTexture
instance was given as the second parameter, throwing aCannot read property 'key' of null
(thanks @charlieschwabacher) - The
HexagonalCullBounds
function incorrectly referencedthis
within it, instead oflayer
(thanks @DaliborTrampota) - The
HexagonalGetTileCorners
function incorrectly referencedthis
within it, instead oflayer
(thanks @DaliborTrampota) - The
HexagonalTileToWorldXY
function incorrectly referencedthis
within it, instead oflayer
(thanks @DaliborTrampota) - The
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) - When using interpolation for a Particle Emitter operation, such as:
x: { values: [ 50, 500, 200, 800 ] }
it would fail to set the final value unless you specified theinterpolation
property as well. It now defaults tolinear
if not given. Fix #6551 (thanks @orcomarcio) - The Matter Physics
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 eitherinternalCreateCallback
orinternalRemoveCallback
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 theclassType
and null theconfig
when an array of single configuration objects is given in the constructor. Fix #6519 (thanks @samme)- The
PathFollower.pathUpdate
method will now check if thetween
property has a validdata
component before running the update. This prevents a call toPathFollower.stopFollow
from throwing aCannot read properties of null (reading '0')
error as it tried to do a single update post stop. Fix #6508 (thanks @francois-dibulo) - Added missing parameter to some function calls in
Structs.ProcessQueue#add
(thanks @Trissolo) Tile
was incorrectly using theAlpha
Game Object component, instead of theAlphaSingle
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)- The
TextureManager.addAtlasJSONArray
method would fail if aTexture
instance was given as the second parameter, throwing aCannot read property 'key' of null
(thanks @1DAfT) - The
TextureManager.addAtlasJSONHash
method would fail if aTexture
instance was given as the second parameter, throwing aCannot read property 'key' of null
(thanks @1DAfT) - The
TextureManager.addAtlasXML
method would fail if aTexture
instance was given as the second parameter, throwing aCannot read property 'key' of null
(thanks @1DAfT) - The
TextureManager.addUnityAtlas
method would fail if aTexture
instance was given as the second parameter, throwing aCannot 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 todestroy
and cleans all references correctly.- If you gave the
width
orheight
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. - The
ParticleEmitterWebGLRenderer
has been refactored so that theparticle.frame
is used as the source of theglTexture
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)
Examples, Documentation, Beta Testing and TypeScript
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