Phaser v3.5.0 Release Notes

Release Date: 2018-04-16 // about 6 years ago
  • ๐Ÿ”„ Changes to Cameras

    • ๐Ÿ“„ The Camera class and all Camera effects are now fully covered by 100% complete JS Docs.
    • All Camera effects have been recoded from scratch. They now follow a unified effects structure and each effect is encapsulated in its own class found in the 'effects' folder. Currently there are Fade, Flash and Shake effects.
    • The new effects classes are accessed via the Camera properties fadeEffect, flashEffect and shakeEffect. You can still use the friendly Camera level methods: shake, fade and flash.
    • 0๏ธโƒฃ The new structure means you can replace the default effects with your own by simply overwriting the properties with your own class.
    • The effects now work properly under any combination. For example, you can fade out then in, or in then out, and still flash or shake while a fade is happening. The renderers now properly stack the effects in order to allow this.
    • โšก๏ธ All of the effect related Camera properties (like _fadeAlpha) have been removed. If you need access to these values you can get it much more cleanly via the camera effects classes themselves. They were always private anyway, but we know some of you needed to modify them, so have been doing so from your code. This code will now need updating.
    • โœ‚ Removed Camera.clearBeforeRender property as it was never used internally. This setting can be enabled on a Game-wide basis.
    • Camera now extends the Event Emitter, allowing it to emit events.
    • ๐Ÿšš Camera.cullHitTest has been removed. It was never used internally and duplicates the code in Camera.cull.
    • โšก๏ธ The callback property of the Camera effects methods has changed purpose. It is no longer an onComplete callback, but is now an onUpdate callback. It is invoked every frame for the duration of the effect. See the docs for argument details.
    • ๐Ÿ‘€ Camera effects now dispatch events. They dispatch 'start' and 'complete' events, which can be used to handle any actions you may previously have been doing in the callback. See the effects docs and examples for the event names and arguments.
    • The Camera Shake effect now lets you specify a different intensities for the x and y dimensions.
    • ๐Ÿ”€ You can track the progress of all events via the progress property on the effect instance, allowing you to sync effect duration with other in-game events.

    ๐Ÿ†• New Feature: Scene Transitions

    โšก๏ธ There is a new method available in the ScenePlugin, available via: this.scene.transition which allows you to transition from one Scene to another over the duration specified. The method takes a configuration object which lets you control various aspects of the transition, from moving the Scenes around the display list, to specifying an onUpdate callback.

    โšก๏ธ The calling Scene can be sent to sleep, stopped or removed entirely from the Scene Manager at the end of the transition, and you can even lock down input events in both Scenes while the transition is happening, if required. There are various events dispatched from both the calling and target Scene, which combined with the onUpdate callback give you the flexibility to create some truly impressive transition effects both into and out of Scenes.

    ๐Ÿ‘€ Please see the complete JSDocs for the ScenePlugin for more details, as well as the new examples in the Phaser 3 Labs.

    More New Features

    • ๐Ÿ‘€ GameObject.ignoreDestroy allows you to control if a Game Object is destroyed or not. Setting the flag will tell it to ignore destroy requests from Groups, Containers and even the Scene itself. See the docs for more details.
    • ๐Ÿ”Œ The Scene Input Plugin has a new property enabled which allows you to enable or disable input processing on per Scene basis.

    ๐Ÿ› Bug Fixes

    • MatterEvents.off() would cause a TypeError if you destroyed the Matter world. Fix #3562 (thanks @pixelscripter)
    • DynamicBitmapText was missing the letterSpacing property, causing it to only render the first character in WebGL (thanks @Antriel)
    • โšก๏ธ The Animation component didn't properly check for the animation state in its update, causing pause / resume to fail. Fix #3556 (thanks @Antriel @siolfyr)
    • The Scene Manager would never reach an isBooted state if you didn't add any Scenes into the Game Config. Fix #3553 (thanks @rgk)
    • ๐Ÿ›  Fixed issue in HTMLAudioSound where mute would get into a recursive loop.
    • Every RenderTexture would draw the same content due to a mis-use of the CanvasPool (this also impacted TileSprites). Fix #3555 (thanks @kuoruan)
    • Group.add and Group.addMultiple now respect the Group.maxSize property, stopping you from over-populating a Group (thanks @samme)
    • When using HTML5 Audio, sound manager now tries to unlock audio after every scene loads, instead of only after first one. Fix #3309 (thanks @pavle-goloskokovic)
    • Group.createMultiple would insert null entries if the Group became full during the operation, causing errors later. Now it stops creating objects if the Group becomes full (thanks @samme)
    • ๐Ÿšš Group.remove didn't check if the passed Game Object was already a member of the group and would call removeCallback and (if specified) destroy in any case. Now it does nothing if the Game Object isn't a member of the group (thanks @samme)
    • If a Group size exceeded maxSize (which can happen if you reduce maxSize beneath the current size), isFull would return false and the group could continue to grow. Now isFull returns true in that case (thanks @samme)
    • ๐Ÿ›  Camera.fadeIn following a fadeOut wouldn't work, but is now fixed as a result of the Camera effects rewrite. Fix #3527 (thanks @Jerenaux)
    • Particle Emitters with large volumes of particles would throw the error GL_INVALID_OPERATION: Vertex buffer is not big enough for the draw call in WebGL.
    • ๐Ÿ›  Fixed issue with Game.destroy not working correctly under WebGL since 3.4. Fix #3569 (thanks @Huararanga)

    โšก๏ธ Updates

    • โœ‚ Removed the following properties from BaseSound as they are no longer required. Each class that extends BaseSound implements them directly as getters: mute, loop, seek and volume.
    • ๐Ÿ‘€ The Device.OS test to see if Phaser is running under node.js has been strengthened to support node-like environments like Vue (thanks @Chumper)
    • โšก๏ธ Every Plugin has been updated to correctly follow the same flow through the Scene lifecycle. Instead of listening for the Scene 'boot' event, which is only dispatched once (when the Scene is first created), they will now listen for the Scene 'start' event, which occurs every time the Scene is started. All plugins now consistently follow the same Shutdown and Destroy patterns too, meaning they tidy-up after themselves on a shutdown, not just a destroy. Overall, this change means that there should be less issues when returning to previously closed Scenes, as the plugins will restart themselves properly.
    • โšก๏ธ When shutting down a Scene all Game Objects that belong to the scene will now automatically destroy themselves. They would previously be removed from the display and update lists, but the objects themselves didn't self-destruct. You can control this on a per-object basis with the ignoreDestroy property.
    • 0๏ธโƒฃ A Matter Mouse Spring will disable debug draw of its constraint by default (you can override it by passing in your own config)
    • The RandomDataGenerator class is now exposed under Phaser.Math should you wish to instantiate it yourself. Fix #3576 (thanks @wtravO)
    • Refined the Game.destroy sequence, so it will now only destroy the game at the start of the next frame, not during processing.

    ๐Ÿ“š 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:

    @samme @Antriel