Phaser v3.80.0 #6744
photonstorm
announced in
Announcements
Phaser v3.80.0
#6744
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
New Features - WebGL Context Loss Handling
New Feature - Base64 Loader
The Phaser LoaderPlugin and related classes have been updated so that they now work natively with base64 encoded files and Data URIs. This means you can now load a base64 encoded image, audio file or text file directly into the Loader. The Loader will then decode the data and process it as if it was a normal file. This is particularly useful for environments such as Playable Ads where you have to provide a single html file with all assets embedded and no XHR requests.
Loader.File.base64
is a new read-only boolean property that is set if the file contains a Data URI encoded string.Loader.File.onBase64Load
is a new method that is called when the file has finished decoding from a Data URI.ImageFile
will now default to using the Image Load Element if a base64 file is detected, instead of throwing a console warning about unsupported types.XHRLoader
will now return a fake XHR result object containing the decoded base64 data if a base64 file is detected, skipping the creation of a real XML Http Request object.New Feature - Scale Manager Snap Mode
The Game Config has a new Scale Manager property called
snap
. This allows you to set a 'snapping' value for the width and height of your game. This is especially useful for games where you want to keep a fixed dimension: for example, you want the game to always snap to a multiple of 16 pixels for the width. Or, if you want to scale a pixel-art game up by integer values, you can now set the game size as thesnap
value and the Scale Manager will ensure the game size is always a multiple of that value.snap: { width, height }
in the game config. This is then passed to the display size by the Scale Manager and used to control the snap values. FixPhaser.Scale
for pixel-perfect games #6629 (thanks @musjj @samme)ScaleManager.setSnap
is a new method that allows you to set the snap values for the game size, should you need to do it post-boot and not in the game config.Config#snapWidth
andConfig#snapHeight
are new properties in the Game Config that hold the parsedsnap
config values, as used by the Scale Manager.New Features
EXPAND
. This is inspired by the Expand mode in Godot: "Keep aspect ratio when stretching the screen, but keep neither the base width nor height. Depending on the screen aspect ratio, the viewport will either be larger in the horizontal direction (if the screen is wider than the base size) or in the vertical direction (if the screen is taller than the original size)" (thanks @rexrainbow)Tilemap.createFromTiles
method has been updated. It will now copy the following properties, if set in the Tile, to the Sprites it creates:rotation
,flipX
,flipY
,alpha
,visible
andtint
. If these properties are declared in thespriteConfig
passed to the method, those will be used instead, otherwise the Tile values are used. Fix createFromTiles should take into account flip/rotation from tiled #6711 (thanks @Nerodon)Tilemap.createFromTiles
method has a new property calleduseSpriteSheet
. If this is set totrue
and you have loaded the tileset as a sprite sheet (not an image), then it will set the Sprite key and frame to match the sprite texture and tile index. Also, if you have not specified anorigin
in the spriteConfig, it will adjust the sprite positions by half the tile size, to position them accurately on the map.Texture#getFrameBounds
is a new method that will return the bounds that all of the frames of a given Texture Source encompass. This is useful for things like calculating the bounds of a Sprite Sheet embedded within a Texture Atlas.Math.RectangleLike
is a new typedef that defines a rectangle-like object with publicx
,y
,width
andheight
properties.WebGL Renderer Updates
WebGLRenderer.getCompressedTextures
can now identify BPTC and RGTC support correctly. These were previously skipped.S3TCRGB
toS3TCSRGB
inWebGLTextureCompression
,CompressedTextureFileConfig
, andFileConfig
typedefs.BloomFX
andBlurFX
and any custom pipeline that relies on using theUtilityPipeline
full or half frame targets will now correctly draw even after the renderer size changes. Fix Post FX Bloom does not take into account canvas Resize #6677 (thanks @Nerodon)PostFXPipeline.postBatch
method will now bind the current Render Target after the pipeline has booted for the first time. This fixes glitch errors on mobile devices where Post FX would appear corrupted for a single frame. Fix First frame of PostFX pipeline displays glitches #6681 (thanks @moufmouf @tongliang999)mipmapFilter
set. Fix Text at certain font sizes renders as a black box for render: { mipmapFilter: 'LINEAR_MIPMAP_LINEAR' } #6721 (thanks @SaintFlow and @rexrainbow)UtilityPipeline
now setsautoResize
totrue
in its Render Target Config, so that the globalfullFrame
andhalfFrame
Render Targets will automatically resize if the renderer changes.WebGLPipeline.resizeUniform
is a new property that is defined in theWebGLPipelineConfig
. This is a string that defines auResolution
property, or similar, within the pipeline shader. If the WebGL Renderer resizes, this uniform will now be updated automatically as part of the pipeline resize method. It has been added to both the Multi and Mobile pipelines as default. This fixes issues where the pipelines were rendering with old resolution values, causing graphical glitches in mostly pixel-art games. Fix Phaser.Scale.RESIZE causes bleeding on tilemaps #6674 Phaser.Scale.RESIZE WebGL has weird scaling and positioning #6678 (thanks @Nerodon @LazeKer)Spine Updates
preUpdate
automatically when theplay
method is called. This forces the new animation state to update and apply itself to the skeleton. This fixes an issue where Spine object would show the default frame in the Spine atlas for a single update before the animation started. Fix [3.50-beta13] Initial glitch in Spine animation #5443 (thanks @spayton)SpineGameObject.setSlotAlpha
is a new method that allows you to set the alpha on a specific slot in a Spine skeleton.SpineGameObject.setAlpha
method has had its 2nd parameter removed. This fixes needless slot look-ups during rendering when a Spine Game Object is inside a regular Container. If you need to set slot alpha, use the newsetSlotAlpha
method instead. Fix Spine gameobject setAlpha() broken #6571 (thanks @spayton)SpineFile.onFileComplete
handler was running a regular expression againstfile.src
instead offile.url
, sometimes leading to double paths in the atlas paths on loading. Fix SpinePlugin breaks generated images file path #6642 (thanks @rez23)Input Updates
The Phaser Input and related classes have been updated to be more consistent with each Game Object.
Mesh
based Game Objects now can use an input config with thesetInteractive
method, which supports the optionsdraggable
,dropzone
,cursor
anduserHandCursor
. Fix useHandCursor not working for planes #6510 Support drag with Mesh and Plane #6652 (thanks @Baegus @Neppord)onTouchEndWindow
now stops pointer events when clicking through DOM elements to input. Fix Repeated Pointer Events in Phaser with Overlapping HTML Elements #6697 (thanks @laineus)Input.InputPlugin
methoddisable
which is called byGameObjects.GameObject#disableInteractive
keeps its temp hit box value which stops propagation to interactive Game Objects in another scene. Fix Pointerup event propagates to below scene if the interactive of the game object is disabled during the pointerup #6601 (thanks @UnaiNeuronUp)setInteractive
andremoveInteractive
methods of a Game Object outside of the game loop would cause an error in whichInput.InputManager#resetCursor
would lose input context. Fix removeInteractive() error when called in pointerover event's handler #6387 (thanks @TomorrowToday)Updates
TweenChainBuilder
was incorrectly setting thepersist
flag on the Chain totrue
, which goes against what the documentation says. It now correctly sets it tofalse
. This means if you previously had a Tween Chain that was persisting, it will no longer do so, so add the property to regain the feature.dropped
argument has now been added to the documentation for theDRAG_END
andGAMEOBJECT_DRAG_END
events. (thanks @samme)Container.onChildDestroyed
is a new internal method used to destroy Container children. Previously, if you destroyed a Game Object in an exclusive Container, the game object would (momentarily) move onto the Scene display list and emit an ADDED_TO_SCENE event. Also, if you added a Sprite to a non-exclusive Container and stopped the Scene, you would get a TypeError (evaluating 'this.anims.destroy'). This happened because the fromChild argument in the DESTROY event was misinterpreted as destroyChild in the Container's remove(), and the Container was calling the Sprite's destroy() again. (thanks @samme)Text
andTileSprite
Game Objects now place their textures into the globalTextureManager
and a_textureKey
private string property has been added which contains a UUID to reference that texture.Tilemaps.Components.WeightedRandomize
method now uses the PhaserMath.RND.frac
method with a seed instead of theMath.Random
static method. (thanks @jorbascrumps)Tilemaps.Components.IsometricCullTiles
does theCheckIsoBounds
method check last when building the outputArray, as to help optimize in situations where the tile would not be visible anyway. (thanks @zegenie)Tilemaps.Components.WeightedRandomize
now uses the PhaserMath.RND.frac
method with a seed instead theMath.Random
static method. (thanks @jorbascrumps)Layer
Game Object has had itsremoveAll
,remove
andadd
methods removed. These methods are all still available via theList
class that Layer inherits, but thedestroyChild
parameters are no longer available.Renderer.Canvas
andRenderer.WebGL
will now only be included in the build file if the corresponding feature flagsCANVAS_RENDERER
and/orWEBGL_RENDERER
are set totrue
. For Canvas only builds this saves a lot of space in the build. (thanks @samme)autoResize
boolean in theRenderTargetConfig
which is passed to the Render Targets when they are created by a pipeline.Actions
methodPlaceOnLine
now has an addedease
parameter which accepts a string from the EaseMap or a custom ease function to allow for different distributions along a line. (thanks @sB3p)XHRLoader
will now listen forontimeout
and if triggered it will hand over to theFile.onError
handler. This prevents the Loader from stalling if a file times out. Fix LoaderPlugin XHR timeout is not handled #6472 (thanks @343dev)LightPipeline.currentNormalMap
was incorrectly documented as being a property ofWebGLRenderer
.Video
Game Object now emits ametadata
event, which emits once the video metadata is available.Time.Timeline
class now supports looping via therepeat
method.Types.Time.TimelineEvent
now has aloop
callback which will be called before its next iteration. Fix Phaser.Time.Timeline: Loop functionality (including events and callbacks) #6560 (thanks @micsun-al)Curves.Path
methodslineTo
andmoveTo
now supportTypes.Math.Vector2Like
as the first parameter. Fix Accept Vector2Likes for Path creation #6557 (thanks @wayfu)BitmapText.setFont
method will now set the texture, size and alignment even if the same font key has been given as is already in use. Fix GameObjects.BitmapText.setFont -> setFont function ignores arguments when the texture doesnt changes #6740 (thanks @AlvaroNeuronup)WebAudioSound
will now sethasEnded = false
as part ofstopAndRemoveBufferSource
, after the source has been stopped and disconnected. This should prevent it from being left in atrue
state if the sourceonended
callback fired late, after the sound had been re-played. Fix Replaying a WebAudioSound right when it ends would sometimes not work (have workaround) #6657 (thanks @Demeno)ScaleManager.orientationChange
event listener will now directly refresh the Scale Manager internals. This fixes an issue where the orientation change event would fire after the window resize event, causing the Scale Manager to incorrectly report the new orientation on Chrome on iOS. Fix Orientation fault #6484 Event orientationchange being fired with wrong orientation on iOS Chrome #5762 (thanks @spayton @meetpatel1989)Tileset.updateTileData
method has two new optional parametersoffsetX
andoffsetY
which allow you to set the offset that the tile data starts from within the base source texture.Bug Fixes
Factory.staticBody
had the wrong return type in the docs/TS defs. Fix Factory.staticBody wrong return type description (body instead of staticbody) #6693 (thanks @ddhaiby)Time.Timeline
class didn't show as extending the Event Emitter, or haveconfig
as an optional argument in the docs / TS defs. Fix Typedefs for new Phaser.Time.Timeline don't show it extending eventEmitter #6673 (thanks @ghclark2)Animations.AnimationFrame
memberduration
is now the complete duration of the frame, which is a breaking change. Before thisAnimations.AnimationState#msPerFrame
was combined withAnimations.AnimationFrame#duration
which wasn't intuitive. The fix to removeAnimations.AnimationState#msPerFrame
fromAnimations.AnimationFrame#duration
has been removed from theAnimations.AnimationManager
methodcreateFromAseprite
because of this clarification. Fix When providing frames with duration to anims.create(), 41.6ms is added to every frame (1 frame time @24 FPS) #6712 (thanks @Nerodon @TomMalitz)NineSlice
Game Object methodsetSize
now recalculates its origin by calling theupdateDisplayOrigin
method. Fix Changing Nineslice size using setSize causes hitareas to be incorrect #6713 (thanks @dhashvir)NineSlice
Game Object method no longer defaults origin to0.5
. Fix NineSlice does not respect pivot point of texture set by TexturePacker #6655 (thanks @michalfialadev)Layer
Game Object is destroyed, i.e. from changing or restarting a Scene, it will no longer cause an error when trying to destroy the children on its display list. Fix GameObjects added to Layers are destroyed twice on Scene shutdown causing crashes #6675 (thanks @crockergd @gm0nk)DynamicTexture
will now automatically callsetSize(width, height)
for both WebGL and Canvas. Previously it only did it for WebGL. This fixes an issue where DynamicTextures in Canvas mode would have a width and height of -1. Fix Dynamic Texture fill fails in Canvas mode #6682 (thanks @samme)DynamicTexture.setSize
will now check to see if theglTexture
bound to the current frame is stale, and if so, destroy it before binding the one from the Render Target. This fixes an issue where constantly destroying and creating Dynamic Textures would cause a memory leak in WebGL. Fix Phaser 3.70 reintroduced the dynamic texture memory leak #6669 (thanks @DavidTalevski)Matter.Body
functionscale
has been updated so if the Body originally had aninertia
ofInfinity
this will be restored at the end of the call. This happens if you set a Matter Body to have fixed rotation. Fix setScale on matter bodies is resetting fixedRotation #6369 (thanks @sushovande)RandomDataGenerator.weightedPick
method to avoid sampling past the last element. Fix weightedPick sometimes returns undefined #6701 (thanks @jameskirkwood)Physics.Matter.Factory
methodpointerConstraint
no longer returns an error when it can't find the camera. Fix Mousespring causes an error when clicking off scene #6684 (thanks @spritus)Physics.Arcade.StaticBody
methodreset
now re-appliesoffset
values. Fix Resetting a static body should reapply the offset #6729 (thanks @samme)Video
Game Object now has a starting texture, which stops errors with accessingframe
before the video loads the first frame. Fix Video game object can't setDisplaySize #6475 (thanks @rexrainbow @JoeSiu)Device.Browser.safari
regular expression has been strenghtened so it now captures versions with double or triple periods in. Previously it would fail forVersion/17.2.1
due to the minor value. (thanks watcher)Browser
Device class will no longer think that Chrome is Mobile Safari on iOS devices. Fix iOS Chrome traces sys.game.device.browser.mobileSafari: true #6739 (thanks @michalfialadev)GameObjectCreator
methodcontainer
now includes all children in the config, accessed viaScene.make.container
. Fix Container created with the GameObjectCreator does not show all children. #6743 (thanks @Fake)addSpriteSheetFromAtlas
andTilemap.addTilesetImage
) will now render correctly. Fix tilemapaddTilesetImage
from spritesheet created viaaddSpriteSheetFromAtlas
renders wrong #6691 (thanks @Antriel)TilemapWebGLRenderer
function has been fixed so it now uses the TileSet width and height for the tile draw command. This fixes an issue where the Tilemap would render incorrectly if the base tile size was different to the tile size. Fix Tilemap WEBGL rendering looks wrong when base size differs from tileset size #5988 (thanks @samme)ArcadePhysics.World.collideSpriteVsTilemapLayer
method has been modified so that the body bounds are now expanded by the size of the scaled base tile in the Tilemap Layer. This fixes an issue where the check would skip over-sized tiles that were outside the bounds of the body. Mostly noticeable on layers that had a different base tile size to the map itself. Fix Broken Example (player doesnt get physics collider) #4479 (thanks @KingCosmic)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:
@actionmoon
@AlvaroEstradaDev
@Byvire
@Creepypoke
@Flashfyre
@orcomarcio
@paxperscientiam
@michalfialadev
@rafael-lua
@samme
@Stan-Stani
@stevenwithaph
@yaustar
@rexrainbow
This discussion was created from the release Phaser v3.80.0.
Beta Was this translation helpful? Give feedback.
All reactions