This version is out of date

The version of Phaser downloaded from this page is not the current stable release.

Version: 3.5.0 - "Kirito"
Released: 16th April 2018
Next Version: 3.5.1
Previous Version: 3.4.0

Change Log

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.
  • 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.
  • 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