Phaser v3.60 Beta 10 #6224
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.
-
Version 3.60.0 - Miku - in development
New Features - Sprite FX
renderTargetsin a WebGL Pipeline config, you can now set optionalwidthandheightproperties, which will create a Render Target of that exact size, ignoring thescalevalue (if also given).WebGLPipeline.isSpriteFXis a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default isfalse.GameObjects.Components.FXis a new component that provides access to FX specific properties and methods. The Image and Sprite Game Objects have this component by default.fxPaddingand its related methodsetFXPaddingallow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.WebGLPipeline.setShadermethod has a new optional parameterbufferthat allows you to set the vertex buffer to be bound before the shader is activated.WebGLPipeline.setVertexBuffermethod has a new optional parameterbufferthat allows you to set the vertex buffer to be bound if you don't want to bind the default one.WebGLRenderer.createTextureFromSourcemethod has a new optional boolean parameterforceClampthat will for the clamp wrapping mode even if the texture is a power-of-two.RenderTargetwill now automatically set the wrapping mode to clamp.WebGLPipeline.flipProjectionMatrixis a new method that allows you to flip the y and bottom projection matrix values via a parameter.PipelineManager.renderTargetsis a new property that holds an array ofRenderTargetobjects that allSpriteFXpipelines can share, to keep texture memory as low as possible.PipelineManager.maxDimensionis a new property that holds the largest possible target dimension.PipelineManager.frameIncis a new property that holds the amount theRenderTargets will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.PipelineManager.targetIndexis a new property that holds the internal target array offset index. Treat it as read-only.RenderTargetobjects during itsbootmethod. These are sized incrementally from 32px and up (use theframeIncvalue to alter this). These targets are shared by all Sprite FX Pipelines.PipelineManager.getRenderTargetis a new method that will return the aRenderTargetthat best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.PipelineManager.getSwapRenderTargetis a new method that will return a 'swap'RenderTargetthat matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.PipelineManager.getAltSwapRenderTargetis a new method that will return a 'alternative swap'RenderTargetthat matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.New Features - Compressed Texture Support
Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.
Compressed Textures are loaded using the new
this.load.texturemethod, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.Development of this feature was kindly sponsored by Club Penguin Rewritten (https://cprewritten.net).
TextureSoure.compressionAlgorithmis now populated with the compression format used by the texture.Types.Textures.CompressedTextureDatais the new compressed texture configuration object type.TextureManager.addCompressedTextureis a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return aTextureobject than any Sprite can use.Textures.Parsers.KTXParseris a new parser for the KTX compression container format.Textures.Parsers.PVRParseris a new parser for the PVR compression container format.WebGLRenderer.compressionproperty now holds a more in-depth object containing supported compression formats.WebGLRenderer.createTextureFromSourcemethod now accepts theCompressedTextureDatadata objects and creates WebGL textures from them.WebGLRenderer.getCompressedTexturesis a new method that will populate theWebGLRenderer.compressionobject and return its value. This is called automatically when the renderer boots.WebGLRenderer.getCompressedTextureNameis a new method that will return a compressed texture format GLenum based on the given format.New Features - Multi Tint Pipeline
%forloop%declaration, you should update it to follow the new format defined inMulti.frag. This new shader uses a function calledgetSamplerinstead. Please see the shader code and update your own shaders accordingly. You can also see the documentation for the MultiPipeline for details.Multi.fragshader now uses ahighpprecision instead ofmediump.WebGL.Utils.checkShaderMaxfunction will no longer use a massive if/else glsl shader check and will instead rely on the value given ingl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS).WebGL.Utils.parseFragmentShaderMaxTexturesfunction no longer supports the%forloop%declaration.GenerateSrchas been removed as it's no longer required internally.Removed - Graphics Pipeline
The WebGL Graphics Pipeline has been removed. This pipeline wasn't used in v3.55, as all Graphics rendering is handled by the MultiTint pipeline, for better batching support. No Phaser Game Objects use the Graphics pipeline any longer, so to save space it has been removed and is no longer installed by the Pipeline Manager.
New Features - Matter Physics v0.18
We have updated the version of Matter Physics to the latest v0.18 release. This is a big jump and brings with it quite a few internal changes to Matter. The following are the differences we have identified in this release:
Matter.Gridwith a faster and more efficient broadphase inMatter.Detector.Matter.SATrelated to collision reuse.Matter.Grid.MatterPhysics.collisionis a new reference to theCollisionmodule, which now handles all Matter collision events.MatterPhysics.gridhas been removed as this is now handled by theCollisionmodule.MatterPhysics.sathas been removed as this is now handled by theCollisionmodule.Matter.Body.previousPositionImpulseproperty has been removed as it's no longer used.New Features - New Tween Manager
TODO - TweenData to class
TODO - TweenData and Tween State methods
TODO - CONST removals
The Phaser 3.60 Tween system has been recoded to help with performance and resolving some of its lingering issues and unifying the Tween events and callbacks.
The following are breaking changes:
chainmethod. This should give most developers the same level of sequencing they had using Timelines, without the timing issues.duration,hold,repeatandrepeatDelay. These should be numbers only. You can, however, still provide a function fordelay, to keep it compatible with the StaggerBuilder.TweenManager#getAllTweensmethod has been renamed toTweenManager#getTweens. Functionally, it is the same.Tween.useFrameshas been removed and is no longer a valid Tween Config option. Tweens are now entirely ms/time based.TweenOnUpdateCallbacknow has the following parameters:tween,targets,key(the property being tweened),current(the current value of the property),previous(the previous value of the property) and finally any of the params that were passed in theonUpdateParamsarray when the Tween was created.TweenOnYoyoCallbacknow has the following parameters:tween,targets,key(the property being tweened),current(the current value of the property),previous(the previous value of the property) and finally any of the params that were passed in theonYoyoParamsarray when the Tween was created.TweenOnRepeatCallbacknow has the following parameters:tween,targets,key(the property being tweened),current(the current value of the property),previous(the previous value of the property) and finally any of the params that were passed in theonRepeatParamsarray when the Tween was created.Tween.stophas had theresetToparameter removed from it. Callingstopon a Tween will now prepare the tween for immediate destruction. If you only wish to pause the tween, seeTween.pauseinstead.persistsboolean flag when creating it, or toggle theTween.persistproperty before playback. This will force the Tween to not be destroyed by the Tween Manager, allowing you to replay it at any later point. The trade-off is that you are now entirely responsible for destroying the Tween when you are finished with it, in order to free-up resources.onActiveScope,onCompleteScope,onLoopScope,onPauseScope,onRepeatScope,onResumeScope,onStartScope,onStopScope,onUpdateScopeandonYoyoScope. You should set thecallbackScopeproperty instead, which will globally set the scope for all callbacks. You can also set theTween.callbackScopeproperty.The following are to do with the new Chained Tweens feature:
TweenManager.chain- TODOTween.getChainedTweensis a new method that will return all of the tweens in a chained sequence, starting from the point of the Tween this is called on.TweenManager.getChainedTweens(tween)is a new method that will return all of the tweens in a chained sequence, starting from the given tween.You can now specify a target property as 'random' to have the Tween pick a random float between two given values, for example:
alpha: 'random(0.25, 0.75)'. If you wish to force it to select a random integer, use 'int' instead:x: 'int(300, 600)'.The following are further updates within the Tween system:
TweenManager.addandTweenManager.createcan now optionally take an array of Tween Configuration objects. Each Tween will be created, added to the Tween Manager and then returned in an array. You can still pass in a single config if you wish.Tween.pauseis a new method that allows you to pause a Tween. This will emit the PAUSE event and, if set, fire theonPausecallback.Tween.resumeis a new method that allows you to resume a paused Tween. This will emit the RESUME event and, if set, fire theonResumecallback.TweenOnPauseCallbackavailable when creating a Tween (via theonPauseproperty). This comes with associatedonPauseParamsandonPauseScopeproperties, too, like all other callbacks and can also be added via theTween.setCallbacksmethod. This callback is invoked if you pause the Tween.TweenOnResumeCallbackavailable when creating a Tween (via theonResumeproperty). This comes with associatedonResumeParamsandonResumeScopeproperties, too, like all other callbacks and can also be added via theTween.setCallbacksmethod. This callback is invoked if you resume a previously paused Tween.x: [ 100, 300, 200, 600 ]in which case the Tween will use interpolation to determine the value.interpolationproperty in the Tween config to set which interpolation method the Tween will use if an array of numeric values have been given as the tween value. Valid values includeslinear,bezierandcatmull(orcatmullrom), or you can provide your own function to use.scaleproperty in a Tween config and, if the target does not have ascaleproperty itself (i.e. a GameObject) then it will automatically apply the value to bothscaleXandscaleYtogether during the tween. This is a nice short-cut way to tween the scale of Game Objects by only specifying one property, instead of two.killTweensOf(targets)now supports deeply-nested arrays of items as thetargetparameter. Fix scene.tweens.killTweensOf(myArray, myObject) doesnt kill tweens on myArray objects #6016 (thanks @michalfialadev)killTweensOf(target)did not stop target tweens if called immediately after tween creation. Fix killTweensOf(target) does not stop target tweens, if called immediately after tween creation. #6173 (thanks @michalfialadev)Tween.setCallback()without specifying theparamsargument would cause an error invoking the callback params. This parameter is now fully optional. Fix Tween.setCallback bugs if optional argument (param) is not passed, also the function gets called 3 times instead of once #6047 (thanks @orcomarcio)Tween.playimmediately after creating a tween withpaused: truein the config wouldn't start playback. Fix Calling play() on fresh paused tween doesn't play it #6005 (thanks @MartinEyebab)timeScalevalue unless they were using frame-based timing instead of delta timing.Tween.seek,toPositionnow defaults to zero. Previously, you had to specify a value.TweenBuildernow uses the newGetInterpolationFunctionfunction internally.TweenBuilderhas been optimized to perform far less functions when creating the TweenData instances.interpolationhas been added to the Reserved Words list and Defaults list (it defaults tonull).persistshas been added to the Reserved Words list and Defaults list (it defaults tofalse).Tween.initTweenDatais a new method that handles the initialisation of all the Tween Data and Tween values. This replaces what took place in theinitandseekmethods previously. This is called automatically and should not usually be invoked directly.Tween.calcDurationmethod has been removed. This is now handled as part of theinitTweenDatacall.repeatandholdwould cause the Tween to include one final hold before marking itself as complete. It now completes as soon as the final repeat concludes, not after an addition hold.TimeStep Updates
fps: { limit: 30 }value in your game config. In this case, it will set an fps rate of 30. This forces Phaser to not run the game step more than 30 times per second (or whatever value you set) and works for both Request Animation Frame and SetTimeOut.TimeStep._limitRateis a new internal private property allowing the Timestep to keep track of fps-limited steps.TimeStep.hasFpsLimitis a new internal boolean so the Timestep knows if the step is fps rate limited, or not.TimeStep.stepmethod andTimeStep.setLimitFPSmethod. Which one is called depends on if you have fps limited your game, or not. This switch is made internally, automatically.TimeStep.smoothDeltais a new method that encapsulates the delta smoothing.TimeStep.updateFPSis a new method that calculates the moving frame rate average.TimeStep.wakewill now automatically reset the fps limits and internal update counters.TimeStep.destroywill now callRequestAnimationFrame.destroy, properly cleaning it down.RequestAnimationFrame.stepwill now no longer callrequestAnimationFrameifisRunninghas been set tofalse(via thestopmethod)TimeStepno longer calculates or passes theinterpolationvalue to Game.step as it was removed several versions ago, so is redundant.RequestAnimationFrame.tickproperty has been removed as it's no longer used internally.RequestAnimationFrame.lastTimeproperty has been removed as it's no longer used internally.RequestAnimationFrameclass no longer calculates the tick or lastTime values and doesn't callperformance.nowas these values were never used internally and were not used by the receiving callback either.RequestAnimationFrame.targetproperty has been renamed todelayto better describe what it does.deltaSmoothingMaxvalue set in the game config. This is now clamped correctly (thanks @vzhou842)New Features
TextureManager.addSpriteSheetmethod will now allow you to pass in a Phaser Texture as the 2nd parameter. This allows you to add sprite sheet data to textures that came from external sources, such as SVG files or canvas elements.Game.pauseis a new method that will pause the entire game and all Phaser systems.Game.resumeis a new method that will resume the entire game and resume all of Phaser's systems.RenderTexture.fillFrameis a new method that will take a given texture and draw it to the Render Texture as a fill-pattern. You can control the offset, alpha and tint of the draw (thanks xlapiz)ScaleManager.getViewPortis a new method that will return a Rectangle geometry object that matches the visible area of the screen (thanks @rexrainbow)GameObjects.Layer.addToDisplayListandremoveFromDisplayListare new methods that allows for you to now add a Layer as a child of another Layer. Fix Error adding Layer to Layer #5799 (thanks @samme)GameObjects.Video.loadURLhas a new optional 4th parametercrossOrigin. This allows you to specify a cross origin request type when loading the video cross-domain (thanks @rmartell)loader.imageLoadType: "HTMLImageElement"in your Game Configuration and the Phaser Loader will use an Image Tag to load all images, rather than XHR and a Blob object which is the default. This is a global setting, so all file types that use images, such as Atlas or Spritesheet, will be changed via this flag (thanks @hanzooo)Tileset.tileOffset(which is a Vector2). This property is set automatically when Tiled data is parsed and found to contain it. Fix Phaser 3.54 draw offset layer #5633 (thanks @moJiXiang @kainage)Tilemap.createFromObjectsmethod has been overhauled to support typed tiles from the Tiled Map Editor (https://doc.mapeditor.org/en/stable/manual/custom-properties/#typed-tiles). It will now also examine the Tileset to inherit properties based on the tile gid. It will also now attempt to use the same texture and frame as Tiled when creating the object (thanks @lackhand)TweenManager.resetis a new method that will take a tween, remove it from all internal arrays, then seek it back to its start and set it as being active.Videoconfig will now detect forx-m4vplayback support for video formats and store it in theVideo.m4vproperty. This is used automatically by theVideoFilefile loader. Fix Using M4V extension instead of mp4 breaks loading #5719 (thanks @patrickkeenan)KeyboardPlugin.removeKeymethod has a new optional parameterremoveCapture. This will remove any keyboard capture events for the given Key. Fix Removing aKeydoesn't remove capturing fromKeyboardPlugin#5693 (thanks @cyantree)KeyboardPlugin.removeAllKeysmethod has a new optional parameterremoveCapture. This will remove any keyboard capture events for all of the Keys owned by the plugin.WebGLShader.fragSrcis a new property that holds the source of the fragment shader.WebGLShader.vertSrcis a new property that holds the source of the vertex shader.WebGLShader#.createProgramis a new method that will destroy and then re-create the shader program based on the given (or stored) vertex and fragment shader source.WebGLShader.setBooleanis a new method that allows you to set a boolean uniform on a shader.WebGLPipeline.setBooleanis a new method that allows you to set a boolean uniform on a shader.Phaser.Scenes.Systems.getStatusis a new method that will return the current status of the Scene.Phaser.Scenes.ScenePlugin.getStatusis a new method that will return the current status of the given Scene.Math.LinearXYis a new function that will interpolate between 2 given Vector2s and return a new Vector2 as a result (thanks @GregDevProjects)Curves.Path.getCurveAtis a new method that will return the curve that forms the path at the given location (thanks @natureofcode)ShapeGame Object as a Geometry Mask. Fix [Feature request] Allow Shape game object to be a mask #5900 (thanks @rexrainbow)Mesh.setTintis a new method that will set the tint color across all vertices of a Mesh (thanks @rexrainbow)Mesh.tintis a new setter that will set the tint color across all vertices of a Mesh (thanks @rexrainbow)Mesh.clearTintis a new method that will clear the tint from all vertices of a Mesh (thanks @rexrainbow)Vector2.projectis a new method that will project the vector onto the given vector (thanks @samme)TilemapLayernow has theMaskcomponent - meaning you can apply a mask to tilemaps (thanks @samme)TilemapLayer.setTintis a new method that allows you to set the tint color of all tiles in the given area, optionally based on the filtering search options. This is a WebGL only feature.RenderTexture.setIsSpriteTextureis a new method that allows you to flag a Render Texture as being used as the source for Sprite Game Object textures. Doing this ensures that images drawn to the Render Texture are correctly inverted for rendering in WebGL. Not doing so can cause inverted frames. If you use this method, you must use it before drawing anything to the Render Texture. Fix WebGL: RenderTexture frames do not render correctly #6057 Spritsheet to texture is reversed #6017 (thanks @andymikulski @Grandnainconnu)UtilityPipeline.blitFramehas a new optional boolean parameterflipYwhich, if set, will invert the source Render Target while drawing it to the destination Render Target.GameObjects.Polygon.setTois a new method that allows you to change the points being used to render a Polygon Shape Game Object. Fix The GO Polygon is missing a method for adding points #6151 (thanks @PhaserEditor2D)maxAliveParticlesis a new Particle Emitter config property that sets the maximum number of alive particles the emitter is allowed to update. When this limit is reached a particle will have to die before another can be spawned.Utils.Array.Flattenis a new function that will return a flattened version of an array, regardless of how deeply-nested it is.GameObjects.Text.appendTextis a new method that will append the given text, or array of text, to the end of the content already stored in the Text object.Textures.Events.ADD_KEYis a new event dispatched by the Texture Manager when a texture with the given key is added, allowing you to listen for the addition of a specific texture (thanks @samme)Textures.Events.REMOVE_KEYis a new event dispatched by the Texture Manager when a texture with the given key is removed, allowing you to listen for the removal of a specific texture (thanks @samme)Geom Updates
The following are API-breaking, in that a new optional parameter has been inserted prior to the output parameter. If you use any of the following functions, please update your code:
Geom.Intersects.GetLineToLinemethod has a new optional parameterisRay. Iftrueit will treat the first line parameter as a ray, if false, as a line segment (the default).Geom.Intersects.GetLineToPointsmethod has a new optional parameterisRay. Iftrueit will treat the line parameter as a ray, if false, as a line segment (the default).Geom.Intersects.GetLineToPolygonmethod has a new optional parameterisRay. Iftrueit will treat the line parameter as a ray, if false, as a line segment (the default).Geom.Intersects.GetRaysFromPointToPolygonuses the newisRayparameter to enable this function to work fully again.Loader Updates
MultiFile.pendingDestroyis a new method that is called by the Loader Plugin and manages preparing the file for deletion. It also emits theFILE_COMPLETEandFILE_KEY_COMPLETEevents, fixing a bug whereMultiFilerelated files, such as an Atlas JSON or a Bitmap Font File, wouldn't emit thefilecompleteevents for the parent file, only for the sub-files. This means you can now listen for the file completion event formultiatlasfiles, among others.MultiFile.destroyis a new method that clears down all external references of the file, helping free-up resources.File.addToCacheno longer callsFile.pendingDestroy, instead this is now handled by the Loader Plugin.FILE_PENDING_DESTROYwhich is used to ensure Files aren't flagged for destruction more than once.LoaderPlugin.localSchemesis a new array of scheme strings that the Loader considers as being local files. This is populated by the newPhaser.Core.Config#loaderLocalSchemegame / scene config property. It defaults to[ 'file://', 'capacitor://' ]but additional schemes can be defined or pushed onto this array. Based on Fix WebAudio for Crodova based apps #6010 (thanks @kglogocki)Updates
Display.Masks.BitmapMaskdestroymethod will now remove the context-lost event handler.hitAreaparameter of theGameObjects.Zone.setDropZonemethod is now optional and if not given it will try to create a hit area based on the size of the Zone Game Object (thanks @rexrainbow)BitmapMask.sceneis a new property that allows the Bitmap Mask to reference the Scene it was created in.DOMElement.preUpdatemethod has been removed. If you overrode this method, please now seepreRenderinstead.DOMElement.preRenderis a new method that will check parent visibility and improve its behavior, responding to the parent even if the Scene is paused or the element is inactive. Dom Elements are also no longer added to the Scene Update List. Fix setVisible not working for DOM elements in a container #5816 (thanks @prakol16 @samme)Particle.firewill now throw an error if the particle has no texture frame. This prevents an uncaught error later when the particle fails to render. Fix Please add useful information when a particles emitter has an invalid/null frame #5838 (thanks @samme @monteiz)ParticleEmitterManager.setEmitterFrameswill now print out console warnings if an invalid texture frame is given, or if no texture frames were set. Fix Please add useful information when a particles emitter has an invalid/null frame #5838 (thanks @samme @monteiz)SceneManager.stopandsleepwill now ignore the call if the Scene has already been shut down, avoiding potential problems with duplicate event handles. Fix Shutdown shouldn't be repeated for stopped scenes #5826 (thanks @samme)TintandFlipcomponents from theCameraclass. Neither were ever used internally, or during rendering, so it was just confusing having them in the API.console.errorwill be printed if theFile,MultiFile,JSONFileorXMLFilefail to process or parse correctly, even if they manage to load. Fix Warn for file processing failures #5862 Warn when there is a multiFile load failure #5851 (thanks @samme @ubershmekel)ScriptFileLoader File Type has a new optional parameter:type. This is a string that controls the type attribute of the<script>tag that is generated by the Loader. By default it is 'script', but you can change it to 'module' or any other valid type.Scene.pausewill now check to see if the Scene is in either a RUNNING or CREATING state and throw a warning if not. You cannot pause non-running Scenes.Mesh.addVerticeswill now throw a console warning if invalid vertices data is given to the method (thanks @omniowl)Mesh.addVerticesFromObjwill now throw a console warning if invalid vertices data is given to the method (thanks @omniowl)TouchManager.onTouchOverandonTouchOuthave been removed, along with all of their related event calls as they're not used by any browser any more.TouchManager.isTopis a new property, copied from the MouseManager, that retains if the window the touch is interacting with is the top one, or not.InputManager.onTouchMovemethod will now check if the changed touch is over the canvas, or not, via the DOMelementFromPointfunction. This means if the touch leaves the canvas, it will now trigger theGAME_OUTandGAME_OVERevents, where-as before this would only happen for a Mouse. If the touch isn't over the canvas, no Pointer touch move happens, just like with the mouse. Fix Touch moving event still fires when moving outside of canvas at mobile device #5592 (thanks @rexrainbow)TileMap.createBlankDynamicLayerhas now been removed as it was deprecated in 3.50.TileMap.createDynamicLayerhas now been removed as it was deprecated in 3.50.TileMap.createStaticLayerhas now been removed as it was deprecated in 3.50.Animations.AnimationManager.createFromAsepritehas a new optional 3rd parametertarget. This allows you to create the animations directly on a Sprite, instead of in the global Animation Manager (thanks Telemako)Animations.AnimationState.createFromAsepriteis a new method that allows you to create animations from exported Aseprite data directly on a Sprite, rather than always in the global Animation Manager (thanks Telemako)pathpackage used by the TS Defs generator has been moved todevDependencies(thanks @antkhnvsk)GetValuefunction has a new optional parameteraltSourcewhich allows you to provide an alternative object to source the value from.Renderer.Snapshot.WebGLfunction has had its first parameter changed from anHTMLCanvasElementto aWebGLRenderingContext. This is now passed in from thesnapshotmethods inside the WebGL Renderer. The change was made to allow it to work with WebGL2 custom contexts (thanks @andymikulski)disableContextMenufunction, but instead now uses the MouseManager / TouchManager targets, which if not specified defaults to the game canvas. Fix # (thanks @lukashass)Key.resetmethod no longer resets theKey.enabledorKey.preventDefaultbooleans back totrueagain, but only resets the state of the Key. Fix key.enabled = false losing effect when changing window/tab #6098 (thanks @descodifica)gameObject.hitAreaDebug.strokeColorin real-time (thanks @spayton)LightGame Object now has theOriginandTransformcomponents, along with 4 new properties:width,height,displayWidthanddisplayHeight. This allows you to add a Light to a Container, or enable it for physics. Fix Possible Bug?? #6126 (thanks @jcoppage)TransformComponent has a new boolean read-only propertyhasTransformComponentwhich is set totrueby default.World.enableBodymethod will now only create and add aBodyto an object if it has the Transform component, tested by checking thehasTransformComponentproperty. Without the Transform component, creating a Body would error with NaN values, causing the rest of the bodies in the world to fail.ProcessQueue.isActiveis a new method that tests if the given object is in the active list, or not.ProcessQueue.isPendingis a new method that tests if the given object is in the pending insertion list, or not.ProcessQueue.isDestroyingis a new method that tests if the given object is pending destruction, or not.ProcessQueue.addwill no longer place the item into the pending list if it's already active or pending.ProcessQueue.removewill check if the item is in the pending list, and simply remove it, rather than destroying it.Container.addHandlerwill now callGameObject.addedToScene.Container.removeHandlerwill now callGameObject.removedFromScene.TextStyleconfiguration object to the Text Game ObjectssetStylemethod, it would ignore anymetricsdata it may contain and reset it back to the defaults. It will now respect themetricsconfig and use it, if present. Fix Setting TextStyle with TextMetrics doesn't apply TextMetrics #6149 (thanks @michalfialadev)ScaleModewill now override the Game Configantialiassetting under the Canvas Renderer, where-as before ifantialiaswastruethen it would ignore the scale mode of the texture (thanks @cirras)Device.Audiomodule has been rewritten to use a new internalCanPlayfunction that cuts down on the amount of code required greatly.Device.Audio.aacis a new boolean property that defines if the browser can play aac audio files or not, allowing them to be loaded via the Loader (thanks @Ariorh1337)Device.Audio.flacis a new boolean property that defines if the browser can play flac audio files or not, allowing them to be loaded via the Loader (thanks @Ariorh1337)Physics.Arcade.Body.reset()method will now callBody.checkWorldBoundsas part of the process, moving the body outside of the bounds, should you have positioned it so they overlap during the reset. Fix Body Center is wrong when reset(x,y) and collideWorldBounds is enabled #5978 (thanks @lukasharing)CanvasFeaturesfor thecheckInverseAlphatest is now removed from the CanvasPool after use.CanvasFeaturestests and the TextureManager_tempContextnow specify the{ willReadFrequently: true }hint to inform the browser the canvas is to be read from, not composited.TextureManager.getTextureKeysit will now exclude the default__WHITEtexture from the results (thanks @samme)snapshotPixelfunction, used by the Canvas and WebGL Renderers and the RenderTexture would mistakenly divide the alpha value. These values now return correctly (thanks @samme)NoAudioSoundManagernow has all of the missing methods, such asremoveAllandgetto allow it to be a direct replacement for the HTML5 and WebAudio Sound Managers (thanks @orjandh @samme)Bug Fixes
WebAudioSoundin the same game step as destroying the Game itself would cause an error when trying to disconnect already disconnected Web Audio nodes.WebAudioSoundwill now bail out of its destroy sequence if it's already pending removal.Animation.createFromAsepritewould calculate an incorrect frame duration if the frames didn't all have the same speed.capacitor://has been added to the protocol check to prevent malformed double-urls in some environments (thanks @consolenaut)Config.domBehindCanvasproperty as it's never used internally. Fix GameConfig dom behindCanvas setting true not working #5749 (thanks @iamallenchang)dispatchTweenEventwould overwrite one of the callback's parameters. This fix ensures thatTween.setCallbacknow works consistently. Fix dispatchTweenEvent overwrites one of the callback's parameters #5753 (thanks @andrei-pmbcn @samme)Phaser.WEBGLwill now fail with an error. Previously, it would fall back to Canvas. Now it will not fall back to Canvas. If you require that feature, use the AUTO render type. Fix WEBGL still falls back to CANVAS #5583 (thanks @samme)Tilemap.createFromObjectsmethod will now correctly place both tiles and other objects. Previously, it made the assumption that the origin was 0x1 for all objects, but Tiled only uses this for tiles and uses 0x0 for its other objects. It now handles both. Fix Some offsets are incorrect in createFromObjects() #5789 (thanks @samme)CanvasRenderer.snapshotCanvasmethod used an incorrect reference to the canvas, causing the operation to fail. It will now snapshot a canvas correctly. Fix snapshotCanvas function bug in CanvasRenderer #5792 Cannot use renderTexture.snapshot in canvas rendering mode #5448 (thanks @rollinsafary-inomma @samme @akeboshi1)Tilemap.tileToWorldYmethod incorrectly had the parametertileX. It will worked, but didn't make sense. It is nowtileY(thanks @mayacoda)Tilemap.convertTilemapLayermethod would fail for isometric tilemaps by not setting the physic body alignment properly. It will now callgetBoundscorrectly, allowing for use on non-orthagonal maps. Fix convertTilemapLayer for isometric tilemaps not setting bodies properly #5764 (thanks @mayacoda)PluginManager.installScenePluginmethod will now check if the plugin is missing from the local keys array and add it back in, if it is (thanks @xiamidaxia)GameObject.Shapes.Rectangle.setSizeit will now correctly update the Rectangle object's display origin and default hitArea (thanks @rexrainbow)ParseTileLayersfunction has been updated so that it no longer breaks when using a Tiled infinite map with empty chunks (thanks @jonnytest1)PutTileAtfunction will now set the Tile dimensions from the source Tileset, fixing size related issues when placing tiles manually. Fix Different tile sizes not accounted for when adding tiles with PutTileAt #5644 (thanks @moJiXiang @stuffisthings)Tileset.tileOffsetproperty fixes an issue with drawing isometric tiles when an offset had been defined in the map data (thanks @moJiXiang)Geom.Intersects.GetLineToLinefunction that would fail with colinear lines (thanks @Skel0t)CameraManager.destroyfunction will now remove the Scale ManagerRESIZEevent listener created as part ofboot, where-as before it didn't clean it up, leading to gc issues. Fix 2d CameraManager do not unregister RESIZE event when be destroyed #5791 (thanks @liuhongxuan23)roundPixelsset to true in the game or camera config, Sprites will no longer render at sub-pixel positions under CANVAS. Fix Images can be blurry with CANVAS renderer and roundPixels #5774 (thanks @samme)PRE_RENDERandPOST_RENDERevents under the Canvas Renderer. Fix No camera postrender event with Phaser.CANVAS #5729 (thanks @ddanushkin)highp floatprecision by default, instead ofmediump. This fixes issues with strange blue 'spots' appearing under WebGL on some Android devices. Fix glsl precision mediump float #5751 Blue Artifacts in WEBGL on Mobile #5659 spots appear when rendering #5655 (thanks @actionmoon @DuncanPriebe @ddanushkin)Tilemaps.Tile.getBoundsmethod would take acameraparameter but then not pass it to the methods called internally, thus ignoring it. It now factors the camera into the returned Rectangle.Tilemap.createFromObjectshas had the rendering of Tiled object layers on isometric maps fixed. Objects contained in object layers generated by Tiled use orthogonal positioning even when the map is isometric and this update accounts for that (thanks @lfarroco)Text,TileSpriteandRenderTextureGame Objects would call the pre and post batch functions twice by mistake, potentially applying a post fx twice to them.ScaleManager.getParentBoundswill now also check to see if the canvas bounds have changed x or y position, and if so returntrue, causing the Scale Manager to refresh all of its internal cached values. This fixes an issue where the canvas may have changed position on the page, but not its width or height, so a refresh wasn't triggered. Fix ScaleManager miscalculates mouse position should the canvas move on the page without changing size #5884 (thanks @jameswilddev)SceneManager.bootScenemethod will now always callLoaderPlugin.start, even if there are no files in the queue. This means that the Loader will always dispatch itsSTARTandCOMPLETEevents, even if the queue is empty because the files are already cached. You can now rely on theSTARTandCOMPLETEevents to be fired, regardless, using them safely in your preload scene. Fix Loader plugin 'start' and 'complete' events are not fired in preload #5877 (thanks @sipals)TimerEvent.resetin the Timer callback would cause the timer to be added to the Clock's pending removal and insertion lists together, throwing an error. It will now not add to pending removal if the timer was reset. Fix Can't start the same timer when time-out #5887 (thanks @rexrainbow)ParticleEmitter.setScalewould set thescaleYproperty tonull, causing calls tosetScaleYto throw a runtime error.scaleYis now a required property across both the Particle and Emitter classes and all of the conditional checks for it have been removed (thanks ojg15)Tween.resetwhen a tween was in a state ofPENDING_REMOVEwould cause it to fail to restart. It now restarts fully. Fix Tween restart() doesn't always work #4793 (thanks @spayton)Tween._pausedStatehas changed fromINITtoPENDING_ADD. This fixes a bug where if you calledTween.playimmediately after creating it, it would force the tween to freeze. Fix Calling play() on freshly added tween stops it from playing #5454 (thanks @michal-bures)PathFollowerwith atovalue it will now tween and complete at that value, rather than the end of the path as before (thanks @samme)Textwith RTL enabled wouldn't factor in the left / right padding correctly, causing the text to be cut off. It will now account for padding in the line width calculations. Fix Text with RTL enable and padding left/right #5830 (thanks @rexrainbow)Path.fromJSONfunction would use the wrong name for a Quadratic Bezier curve class, meaning it would be skipped in the exported JSON. It's now included correctly (thanks @natureofcode)Input.Touch.TouchManager.stopListenersforgot to remove thetouchcancelhandler. This is now removed correctly (thanks @teng-z)BitmapMaskshader has been recoded so it now works correctly if you mask a Game Object that has alpha set on it, or in its texture. Previously it would alpha the Game Object against black (thanks stever1388)Uncaught TypeError: Cannot read properties of undefined (reading 'renderList')if multiple children existed in the pointer-out array. Fix Pointer-out bug #5867 Error when dragging constrained object on top of another interactive object #5699 (thanks @rexrainbow @lyger)InputPlugin.sortGameObjectswill now assign a value of 0 to any game object not in the render list, but still viable for input, such as an invisible object withalwaysEnabledset to true. This fixes an issue where non-render list objects would be skipped. Fix Input.alwaysEnabled does not work when a interactive game object is below it #5507 (thanks @EmilSV)GameObject.willRendermethod will now factor in the parentdisplayList, if it has one, to the end result. This fixes issues like that where an invisible Layer will still process input events. Fix Game object on a camera-ignored layer is still touchable #5883 (thanks @rexrainbow)InputPlugin.disablewill now also reset the drag state of the Game Object as well as remove it from all of the internal temporary arrays. This fixes issues where if you disabled a Game Object for input during an input event it would still remain in the temporary internal arrays. This method now also returns the Input Plugin, to matchenable. Fix "pointerout" interaction event triggers afterdisableInteractive()#5828 (thank @natureofcode @thewaver)GetBoundscomponent has been removed from the Point Light Game Object. Fix Reset a point light that has a body takes a lot of time #5934 (thanks @x-wk @samme)SceneManager.moveAboveandmoveBelownow take into account the modified indexes after the move (thanks @EmilSV)setTimeoutand then sending the game to sleep, it would accidentally restart by using Request Animation Frame instead (thanks @andymikulski)renderobject within the Game Config will no longer erase any top-level config render settings. Therenderobject will now take priority over the game config, but both will be used (thanks @vzhou842)Tween.stop(0)would run for an additional delta before stopping, causing the Tween to not be truly 100% "reset". Fix Calling tween.stop(0) runs for an additional delta before stopping, so tween isn't truly 100% "reset" #5986 (thanks @Mesonyx)Utils.Array.SafeRangefunction would exclude valid certain ranges. Fix SafeRange bug restricts certain ranges #5979 (thanks @ksritharan)Container.pointToContainermethod would ignore the providedoutputparameter, but now uses it (thanks @vforsh)PolygonGame Object would ignore itsclosePathproperty when rendering in Canvas. Fix Phaser.GameObject.Polygon ignores closePath with Phaser.CANVAS #5983 (thanks @optimumsuave)RenderTexture.batchTextureFramewill now skip thedrawImagecall in canvas if the frame width or height are zero. Fix iOS drawImage fails with IndexSizeError: The index is not in allowed range #5951 (thanks @Hoshinokoe)BlitterCanvasRendererwill now skip thedrawImagecall in canvas if the frame width or height are zero.ParticleManagerCanvasRendererwill now skip thedrawImagecall in canvas if the frame width or height are zero.CanvasSnapshotwill now skip thedrawImagecall in canvas if the frame width or height are zero.TextureManager.getBase64will now skip thedrawImagecall in canvas if the frame width or height are zero.TilemapLayerCanvasRendererwill now skip thedrawImagecall in canvas if the frame width or height are zero.RenderTexture.fillin CANVAS mode only would produce a nearly always black color due to float conversion (thanks @andymikulski)moveToXandmoveToYnow default to null instead of 0 (thanks @samme)GetBitmapTextSizefunction caused kerning to not be applied correctly to Bitmap Text objects. This now works across WebGL and Canvas (thanks @arbassic @TJ09)WebGLSnapshotandCanvasSnapshotwill now Math.floor the width/height values to ensure no sub-pixel dimensions, which corrupts the resulting texture. Fix snapshotArea function not working properly if size is not integer #6099 (thanks @orjandh)ContainerCanvasRendererwould pass in a 5thcontainerparameter to the childrenderCanvascall, which was breaking theGraphicsCanvasRendererand isn't needed by any Game Object, so has been removed. Fix Graphics inside a Container bugs out since v3.60 #6093 (thanks @Antriel)Utils.Objects.GetValuewhere it would return an incorrect result if asourceandaltSourcewere provided that didn't match in structure. Fix Possible bug in latest GetValue method #5952 (thanks @rexrainbow)render: {}would cause set properties to be overriden with the default value. Fix Having render: {} in phaser's config adds black background to Phaser. #6097 (thanks @michalfialadev)SceneManager.moveAboveandmoveBelowmethods didn't check the order of the Scenes being moved, so moved them even if one was already above / below the other. Both methods now check the indexes first. Fix Phaser.Scenes.ScenePlugin moveBelow swaps scenes regardless of order #6040 (thanks @yuupsup)scale.modein the Game Config would be ignored. It now accepts either this, orscaleModedirectly. Fixscale.modein game config is ignored #5970 (thanks @samme)AnimationManager.createFromAsepritemethod would be incorrect if they contained a mixture of long and very short duration frames (thanks @martincapello)TilemapLayer.getTilesWithinShapemethod would not return valid results when used with a Line geometry object. Fix TilemapLayer#getTilesWithinShape does not return valid results when run with Phaser.Geom.Line #5640 (thanks @hrecker @samme)requirestatements in order to fix an issue in Google's closure-compiler when variables are re-assigned to new values (thanks @TJ09)MatterTileBodyfrom an isometric tile the tiles top value would be incorrect. ThegetTopmethod has been fixed to address this (thanks @adamazmil)Container.removeHandlernow specifies the context forEvents.DESTROY, fixing an issue where objects moved from one container, to another, then destroyed, would causesysreference errors. Fix 5846 (thanks @sreadixl)Container.removeAll(which is also called when a Container is destroyed) will now directly destroy the children, if the given parameter is set, rather than doing it after removing them via the event handler. This fixes an issue where nested Containers would add destroyed children back to the Scene as part of their shutdown process. Fix Phaser.GameObjects.Container inside another Container call addedToScene when the scene is removed only #6078 (thanks @BenoitFreslon)DisplayList.addChildCallbackmethod will now check to see if the child has a parent container, and if it does, remove it from there before adding it to the Scene Display List. Fix GameObject duplication when moving GO between Scene and Container. #6091 (thanks @michalfialadev)Display.RGB.equalswill now return the correct result. Previously, it would always returnfalse(thanks @samme)Graphics.strokeRoundedRectwould incorrectly draw the rectangle if you passed in a radius greater than half of the smaller side. This is now clamped internally (thanks @temajm)Examples, Documentation and TypeScript
My thanks to the following for helping with the Phaser 3 Examples, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
@necrokot Golen @Pythux @samme @danfoster @eltociear @sylvainpolletvillard @hanzooo @etherealmachine @DeweyHur @twoco @austinlyon @Arcanorum OmniOwl @EsteFilipe @PhaserEditor2D @Fake @jonasrundberg @xmahle @arosemena @monteiz @VanaMartin @lolimay @201flaviosilva
This discussion was created from the release Phaser v3.60 Beta 10.
Beta Was this translation helpful? Give feedback.
All reactions