Phaser 3.61.0 Beta 3 #6651
photonstorm
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
New Features - Arcade Physics
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.setSlideFactoris a new method that sets the Body'sslideFactorproperty.nextCategorywhich will create a new collision category and return it. You can define up to 32 unique collision categories per world.collisionCategoryandcollisionMask. 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.setCollisionCategoryis 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.setCollidesWithis 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.resetCollisionis 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
collideoroverlapmethods, 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.New Features
Text.setRTLis 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.backgroundAlphais 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.singleStepis a new method that will advance the Arcade Physics World simulation by exactly 1 step (thanks @monteiz)Tilemaps.ObjectLayer.idis 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.idis a new property that returns the ID of the Data Layer, if specified within Tiled, or zero otherwise (thanks @rui-han-crh)Text.setLetterSpacingis a new method andText.lineSpacingis 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.clearDeathZonesis a new method that will clear all previously created Death Zones from a Particle Emitter (thanks @rexrainbow)ParticleEmitter.clearEmitZonesis a new method that will clear all previously created Emission Zones from a Particle Emitter (thanks @rexrainbow)GameObject.setTexturemethod has 2 new optional parameters:updateSizeandupdateOrigin, which are both passed to thesetFramemethod 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 isfalseby 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.randomFrameandAnimationState.randomFrameproperties.Phaser.Types.Animations.PlayAnimationConfigobject in theanimsproperty of theParticleEmitterconfiguration 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 Allow animated particles to each start individually at a random frame #6478 (thanks @michalfialadev)TilemapLayer.setTintFillis 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 thesetTintmethod uses.Tile.tintFillis a new boolean property that controls if the tile tint is additive or fill based. This is used in the TilemapLayerWebGLRenderer function.Updates
WebAudioSoundManagerwill now bind thebodyto theremoveEventListenermethod, if it exists, to prevent memory leaks (thanks @wjaykim)AnimationManager.globalTimeScaleproperty 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)RopeGame Object now callsinitPostPipelineallowing you to use Post FX directly on it, such as glow, blur, etc. Fix PostFX of Rope game object #6550 (thanks @rexrainbow)Tween.stopmethod will now check to see ifTween.parentis set. If not, it won't try to set a pending removal state or dispatch an event, which should help guard against errors whereTween.stopis called by mistake on already destroyed tweens (thanks @orcomarcio)Tween.removemethod will now check to see ifTween.parentexists before trying to remove it from the parent. This should help guard against errors whereTween.removeis called by mistake on already removed or destroyed tweens. Fix Tween.remove() causes error "Cannot read properties of null (reading 'remove')" #6539 (thanks @orcomarcio)Particle.alphais now clamped to the range 0 to 1 within theupdatemethod, preventing it from going out of range. Fix Particles' alpha value "wraps" if greater than 1 (ex. 1.7 behaves like 0.7) #6551 (thanks @orcomarcio)Math.Wraphas been reverted to the previous version. Fix Phaser.Math.Wrap inconsitent behaviour #6479 (thanks @EmilSV)GraphicsGame 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)mipmapFilterproperty in the Game Config is a valid mipmap before assigning it.Polygon.setTomethod (thanks @Trissolo)WebGLRenderer.deleteFramebuffermethod 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 theRENDERERBUFFER_BINDINGhas also been removed to avoid side-effects.MeshGame Object interactive, it will now bind to the scope of the Mesh and uses the currentfacesin 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)AppleWebKitwill now set theDevice.es2019flag totrue. This causes Phaser to use the native array Stable Sort. This fixes an issue where overlapping particles could flicker on iOS. Fix Particles flickering on iOS with Phaser 3.60.0 #6483 (thanks @mattkelliher @spayton)Text.dirtyGame Object property has been removed. It wasn't used internally at all, so was just adding confusion and using space.HTMLVideoElementbefore trying to inspect its prototype. This should help in non-browser environments.Plane.originXandoriginYare two new read-only properties that return the origin of the Plane, which is always 0.5 (thanks @rexrainbow)LoaderPluginwill now callremoveAllListeners()as part of itsshutdownmethod, which will clear any event listeners bound to a Loader instance of the Scene, during the Scene shutdown. Fix LoaderPlugin should clear its event listeners when the scene is shutdown or removed #6633 (thanks @samme)SetCollisionObjectis a new function that Arcade Physics bodies use internally to create and reset theirArcadeBodyCollisiondata objects.DynamicTexture.setFromRenderTargetis a new method that syncs the internal Frame and TextureSource GL textures with the Render Target GL textures.renderTextureproperty toundefinedto ensure the reference is cleared.Bug Fixes
PostFXPipelinewill now setautoResizetotrueon all of itsRenderTargetinstances. This fixes an issue where thePostFXPipelinewould not resize the render targets when the game size changed, causing them to become out of sync with the game canvas. Fix PostFX effects distort image while resizing canvas #6503 (thanks @Waclaw-I)Particle.scaleYwould always be set to thescaleXvalue, even if given a different one within the config. It will now use its own value correctly.Array.Matrix.RotateLeftwas missing thetotalparameter, which controls how many times to rotate the matrix.Array.Matrix.RotateRightwas missing thetotalparameter, which controls how many times to rotate the matrix.Array.Matrix.TranslateMatrixdidn't work with any translation values above 1 due to missing parameters inRotateLeftandRotateRightFX.Blurdidn't set thequalityparameter to its property, meaning it wasn't applied in the shader, causing it to always use a Low Blur quality (unless modified post-creation).BlurFXPipelinedidn'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.FXBlurLowfragment shader didn't have theoffsetuniform. This is now passed in and applied to the resulting blur, preventing it from creating 45 degree artifacts (thanks Wayfinder)Tilemap.createFromObjectsmethod wouldn't always copy custom properties to the target objects or Data Manager. FixcreateFromObjects()doesn't copy custom properties #6391 (thanks @samme @paxperscientiam)scale.minandscale.maxwidthandheightproperties in Game Config were ignored by the Game constructor, which was expectingminWidthandminHeight. This now matches the documentation. Fix Min/max width and height in game config are ignored by Phaser.Game constructor #6501 (thanks @NikitaShpanko @wpederzoli)Actions.GetLastfunction had the same code as theGetFirstfunction. It now does what you'd expect it to do. Fix Error: GetLast function not implemented correctly #6513 (thanks @dmokel)TilemapLayer.PutTileAtmethod would use an incorrect local GID if the Tilemap Layer wasn't using all available tilesets. Fix PutTileAt sid wrong if layer does not use all tilesets #5931 (thanks @christianvoigt @wjaykim)TextureManager.addSpriteSheetmethod would fail if aTextureinstance was given as the second parameter, throwing aCannot read property 'key' of null(thanks @charlieschwabacher)HexagonalCullBoundsfunction incorrectly referencedthiswithin it, instead oflayer(thanks @DaliborTrampota)HexagonalGetTileCornersfunction incorrectly referencedthiswithin it, instead oflayer(thanks @DaliborTrampota)HexagonalTileToWorldXYfunction incorrectly referencedthiswithin it, instead oflayer(thanks @DaliborTrampota)BitmapTextGame 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 theinterpolationproperty as well. It now defaults tolinearif not given. Fix Particles' alpha value "wraps" if greater than 1 (ex. 1.7 behaves like 0.7) #6551 (thanks @orcomarcio)ignoreGravityboolean is now checked during the Matter Engine internal functions, allowing this property to now work again. Fix Ignore gravity is not working for matter physics #6473 (thanks @peer2p)Group.createFromConfigwill now check to see if the config contains eitherinternalCreateCallbackorinternalRemoveCallbackand set them accordingly. This fixes an issue where the callbacks would never be set if specified in an array of single configuration objects. Fix Arcade Physics group create from array config result is incorrect #6519 (thanks @samme)PhysicsGroupwill now set theclassTypeand null theconfigwhen an array of single configuration objects is given in the constructor. Fix Arcade Physics group create from array config result is incorrect #6519 (thanks @samme)PathFollower.pathUpdatemethod will now check if thetweenproperty has a validdatacomponent before running the update. This prevents a call toPathFollower.stopFollowfrom throwing aCannot read properties of null (reading '0')error as it tried to do a single update post stop. Fix stopFollow() throws Cannot read properties of null Error #6508 (thanks @francois-dibulo)Structs.ProcessQueue#add(thanks @Trissolo)Tilewas incorrectly using theAlphaGame Object component, instead of theAlphaSinglecomponent, 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 Cannot set Phaser.Tilemap.Tile corner alphas as it is stated in the Documentation #6594 (thanks @jcoppage)TextureManager.addAtlasJSONArraymethod would fail if aTextureinstance was given as the second parameter, throwing aCannot read property 'key' of null(thanks @1DAfT)TextureManager.addAtlasJSONHashmethod would fail if aTextureinstance was given as the second parameter, throwing aCannot read property 'key' of null(thanks @1DAfT)TextureManager.addAtlasXMLmethod would fail if aTextureinstance was given as the second parameter, throwing aCannot read property 'key' of null(thanks @1DAfT)TextureManager.addUnityAtlasmethod would fail if aTextureinstance was given as the second parameter, throwing aCannot read property 'key' of null(thanks @1DAfT)DynamicTexture.preDestroywas never called, leading to an accumulation of framebuffers in memory. This method has now been renamed todestroyand cleans all references correctly.widthorheightin 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.ParticleEmitterWebGLRendererhas been refactored so that theparticle.frameis used as the source of theglTextureused 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 Wrong glTexture when adding particles using multi-atlas, in 3.60 #6515 (thanks @Demeno)StaticBody.setSizewill now check to see if the body has a Game Object or not, and only callgetCenterand the frame sizes if it has. This fixes a bug where callingphysics.add.staticBodywould throw an error if you provided a width and height. Fix Scenephysics.add.staticBodythrows when called with both width and height #6630 (thanks @Legend-Master)DynamicTexture.fillmethod will now correctly draw the fill rectangle if thewidthandheightare provided in WebGL, where-as before it would assume the y axis started from the bottom-left instead of top-left. Fix [RenderTexture] postion of fill rectangle is not correct #6615 (thanks @rexrainbow)Line.setLineWidthmethod 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 GameObject.Line.setLineWidth() works different between Canvas and WebGL render #6604 (thanks @AlvaroNeuronup)DynamicTexturewas leaking memory by leaving a WebGLTexture in memory when itssetSizemethod 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.widthandheightwere missing from the class definition, even though they were set and used internally. They're now exposed as read-only properties.BitmapMaskwouldn't correctly set the gl viewport when binding, which caused the mask to distort in games where the canvas resizes from its default. Fix Bitmapmask distort image while resizing canvas #6527 (thanks @rexrainbow)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
This discussion was created from the release Phaser 3.61.0 Beta 3.
Beta Was this translation helpful? Give feedback.
All reactions