The latest stable release of Phaser is out
After more testing and bug fixing we're happy to announce that Phaser 2.4.3 "Coramen" is out:
- Loader.images is a new method that allows you to pass an array of image keys, and optionally the URLs to the Loader and have them all added to the load queue in one go.
- TweenManager.frameBased allows you to control if all newly created Tweens update based on the physics step (i.e. frame based) or the system clock (time based). A frame based tween will use the physics elapsed timer when updating. This means it will retain the same consistent frame rate, regardless of the speed of the device. The duration value given should be given in frames. If the Tween uses a time based update (which is the default) then the duration is given in milliseconds. In this situation a 2000ms tween will last exactly 2 seconds, regardless of the device and how many visual updates the tween has actually been through.
- Tween.frameBased does the same as TweenManager.frameBased but allows you to set the value on a per-tween basis.
- BitmapText.smoothed is a new boolean property that allows you to set texture smoothing on a bitmap font or not. By default smoothing is always on, but you can turn it off which helps for bitmap fonts created from pixel art style character sets.
- Text.addFontStyle and Text.addFontWeight allow you to apply font weights and styles to specific characters in a Text object. For example you can now include bold or italics within single Text objects (thanks @jdnichollsc #1950)
- PIXI.CanvasPool is a new static global created to deal with the issue of resource leaks and continuous DOM node build-up when creating lots of Text or BitmapData objects, or when calling
generateTextureon any display object. The CanvasPool will do its best to re-use out dated canvas elements rather than filling up the DOM with new ones.
- Sprite.setTexture has a new
destroyBaseparameter - set this to
trueif you know the base used a generated texture that isn't being used by any other sprites. This will free-up the canvas for further re-use by other calls to
generateTextureor Text objects.
- Line.midPoint will return a Point object where the
yvalues correspond to the center (or midpoint) of the Line segment.
- Line.rotateAround allows you to rotate a Line around the given coordinates (in world space)
- Line.centerOn will position the Line so that its midpoint lays on the coordinates given.
- BitmapData.line draws a line to the BitmapData in the color and thickness specified.
- BitmapData.op is a handy short-code to get and set the canvas global composite operator.
- BitmapData.drawFull draws the given Game Object or Group to a BitmapData and then recursively iterates through all of its children, including children of Game Objects and Groups. It can draw Text, BitmapText, Sprites, Images, Emitters and Graphics objects. It's perfectly valid to pass in
game.worldas the parent object, and it will iterate through the entire display list.
- Phaser.TilemapParser.INSERT_NULL is a new boolean that controls what happens when the parser encounters an empty tile: When scanning the Tiled map data the TilemapParser can either insert a null value (true) or a
Phaser.Tileinstance with an index of -1 (false, the default). Depending on your game type depends how this should be configured. If you've a large sparsely populated map and the tile data doesn't need to change then setting this value to
truewill help with memory consumption. However if your map is small, or you need to update the tiles (perhaps the map dynamically changes during the game) then leave the default value set (thanks #1982)
- TypeScript definitions fixes and updates (thanks @clark-stevenson @vrecluse @yahiko00 @cloakedninjas @qdrj)
- JSDoc typo fixes (thanks @Cowa @yahiko00 @qdrj @STuFF)
- VideoStream.active = false is used if the browser supports it, otherwise it falls back to VideoStream.stop.
- Text can now accept
textargument in the constructor and will cast it as an empty string.
- Point.rotate uses a faster and simpler rotation function when no distance argument is specified.
- Setting a P2.Body from Static or Kinematic to Dynamic will now automatically adjust the Body.mass to be 1 (thanks @wayfu #2005)
- Pointer.withinGame is no longer automatically set to
Pointer.stopmethod. Instead it will check if the Pointer actually is within the stage bounds and only set
falseif it's outside the bounds.
- MSPointer now has an
onPointerUpGlobalhandler for when the pointer is released outside of the canvas, but still within the browser window. This means that in IE11 a Sprites
onInputUpevent will now trigger even when outside the canvas (thanks @bvargish #2000)
- MSPointer now has handlers for the pointer being over and outside of the canvas element, which sets the
Pointer.withinGamebooleans accordingly. It also triggers the
- The MSPointer event listeners have been renamed to all lower-case, i.e. 'pointerDown' is now 'pointerdown'.
- Pointer.isDown was reset before the
Input.onUpevent, meaning you couldn't get the Pointer duration from within the event.
- Pointer.isDown was reset before the Input tap calculations, meaning
onTapwouldn't dispatch (thanks @stovenator #1953)
- InputHandler.pointerOver would get stuck in an 'isOver' state if the Sprite changed its visibility during an
onUpcallback (thanks @Cristy94 #1955)
- If you override the P2 mpx functions, to define your own px to meters values, the P2 Debug Bodies would ignore it (thanks @vrecluse #1957)
- ArrayUtils.numberArrayStep would return an empty array if a single parameter was given, instead of a single step array (thanks @pooya72 #1958)
- Text with tints applied wouldn't update properly in Canvas mode.
- Removed use of the deprecated
leaveFullScreensignals from the Scale Manager (thanks @mmanlod #1972)
- BitmapText with tints applied wouldn't update properly in Canvas mode (thanks @Pajamaman #1969)
- Group.cacheAsBitmap would be incorrectly offset in Canvas mode (thanks @mkristo #1925)
- Text.setTextBounds didn't add the x and y values to the width and height offsets.
- Line.rotate used a calculation method which resulted in the line growing (or shrinking) in length over time the more it was rotated. The new method never changes the lines length.
- BitmapText.font failed to pull the new font from the Phaser Cache, stopping it from updating properly (thanks @AbrahamAlcaina #2001)
- Video.stop now removes the 'playing' event listener, which stop Videos set to loop from throwing errors after being destroyed.
- Tilemap.createFromObjects has been strengthened so that will only create Sprites for matching gids/ids/names. It also only sets the Sprite width and height values if they are present in the Tiled data (thanks @pparke #2012)
- TilingSprite._renderCanvas wasn't correctly allowing for pixel rounding (thanks @ximop #2022)
- Cache.addSpriteSheet didn't include default values for the
spacingarguments (thanks @vladkens #2017 #2018)
- Tilemap.shuffle was calling the deprecated Phaser.Utils.shuffle, which has now moved to Phaser.ArrayUtils.shuffle.
- Enabling a filter on a display object that had a multiply blend mode set would cause the object to become invisible. The two cannot be combined, so when you set a filter on a display object it now automatically resets the blend mode to
NORMAL. The same does not happen in reverse however, so if you've got a filter set and then change the blend mode to multiply it will still break. Be careful to capture this yourself (thanks @wayfu #1994)
Discuss the release in this forum thread.