Skip to content

Releases: phaserjs/phaser

Coramen

24 Aug 14:51
Compare
Choose a tag to compare

New Features

  • 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 generateTexture on 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 destroyBase parameter - set this to true if 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 generateTexture or Text objects.
  • Line.midPoint will return a Point object where the x and y values 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.world as 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.Tile instance 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 true will 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)

Updates

  • 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 undefined or null as the text argument 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 false in the Pointer.stop method. Instead it will check if the Pointer actually is within the stage bounds and only set withinGame to false if it's outside the bounds.
  • MSPointer now has an onPointerUpGlobal handler for when the pointer is released outside of the canvas, but still within the browser window. This means that in IE11 a Sprites onInputUp event 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.withinGame booleans accordingly. It also triggers the Mouse.mouseOutCallback and Mouse.mouseOverCallback callbacks respectively.
  • The MSPointer event listeners have been renamed to all lower-case, i.e. 'pointerDown' is now 'pointerdown'.

Bug Fixes

  • Pointer.isDown was reset before the Input.onUp event, meaning you couldn't get the Pointer duration from within the event.
  • Pointer.isDown was reset before the Input tap calculations, meaning onTap wouldn't dispatch (thanks @stovenator #1953)
  • InputHandler.pointerOver would get stuck in an 'isOver' state if the Sprite changed its visibility during an onUp callback (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 enterFullScreen and leaveFullScreen signals 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 frameMax, margin and spacing arguments (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)

Altara

29 Jul 14:06
Compare
Choose a tag to compare

Updates

  • TypeScript definitions fixes and updates (thanks @clark-stevenson @shivinsky)
  • JSDoc typo fixes (thanks @DrkSephy)
  • TilemapLayer - Fixed unmatched context.save and context.restore calls (thanks @MortimerGoro #1934)
  • Cache.getFrame has a new cache parameter (that defaults to the Image cache, but can be changed to any other)
  • Cache.getFrameCount has a new cache parameter (that defaults to the Image cache, but can be changed to any other)
  • Cache.getFrameData has a new cache parameter (that defaults to the Image cache, but can be changed to any other)
  • Cache.hasFrameData has a new cache parameter (that defaults to the Image cache, but can be changed to any other)
  • Cache.getFrameByIndex has a new cache parameter (that defaults to the Image cache, but can be changed to any other)
  • Cache.getFrameByName has a new cache parameter (that defaults to the Image cache, but can be changed to any other)
  • Device.canPlayVideo now checks for ogv as a valid file extension for OGG video files (thanks @JB-Tellez #1928)
  • Phaser.Sound will now automatically check the Cache to see if the audio file it is using is still there or not. If not then it will automatically called Sound.destroy on itself. If you do not desire this result then you should ensure that you undertake all house-keeping yourself, and properly destroy Sound objects before calling Cache.removeSound (#1946)

Bug Fixes

  • DeviceButton would try to set altKey, shiftKey and ctrlKey even for Joypads (thanks @zatch #1939)
  • Pointer.move would accidentally reset the isDown status of the Pointer on touch devices, which broke things like Sprite input events when built to native apps or run locally (#1932 #1943)
  • Pointer.onDown (and input enabled items like Buttons) would fail on FireFox / Linux and CocoonJS (#1944 #1945)

Ionin Spring

24 Jul 12:54
Compare
Choose a tag to compare

This is a small point release that updates the Creature runtimes and fixes a couple of small cache issues.

It also modifies the Grunt build scripts so that all third party libs (such as Creature, P2, gl-matrix and PIXI) are now kept well and truly outside of Phaser. They are defined and placed first in the build files. So no more PIXI hiding within the Phaser namespace or UMD patching for Phaser required.

Updates

  • The Creature Runtimes have been updated to the latest versions and the Phaser.Creature class updated to use them.
  • GameObjectFactory.creature is a new method to help with quick Creature animation object creation.
  • Cache.getPixiTexture will now search the image cache if it couldn't find a texture in the PIXI.TextureCache global array, if it finds a matching image in the image cache then it returns a new PIXI.Texture based on it.
  • Cache.getPixiBaseTexture will now search the image cache if it couldn't find a BaseTexture in the PIXI.BaseTextureCache global array.

Bug Fixes

  • Fixed Cache.getKeys to use the _cacheMap (thanks @jamesgroat #1929)
  • Safari on OSX wouldn't recognise button presses on trackpads (thanks JakeCake)
  • Cache.removeImage now calls destroy on the image BaseTexture, removing it from the PIXI global caches without throwing a warning.

Katar

22 Jul 14:36
Compare
Choose a tag to compare

Note: Revision a of Phaser 2.4.0 includes a fix to the build files that stopped some PIXI classes being undefined (such as TilingSprite). Nothing in the framework itself changed.

API Changes

  • RenderTexture.render now takes a Matrix as its second parameter, not a Point object. This brings it in line with Pixi and allows you to perform much more complex transformations on the object being rendered. If you need to replicate the old behavior please use RenderTexture.renderXY(sprite, point.x, point.y) instead.
  • PIXI.DisplayObject.updateTransform has a new optional parameter parent. If the DisplayObject doesn't have a parent (i.e. it isn't on the display list yet) then in the past updateTransform would fail. This meant you couldn't do things like scale or rotate a Sprite and then draw it to a RenderTexture or BitmapData, as calls to updateTransform would be ignored. The new checks now look to see if the parent parameter is set. If so this takes priority over the actual parent and is used to modify the transform (note that it doesn't reparent the DisplayObject, it merely uses it for the transform.) If there is no parent (explicitly or via the parameter) then it falls back to use Phaser.World as the parent. If it can't reach that then no transform takes place.
  • If Phaser.Sound.noAudio has been set then Phaser.Loader will not load any audio files. No errors are thrown, but all calls to Loader.audio and Loader.audiosprite are silently ignored. noAudio can be set either via the PhaserGlobal global var or is set if the device your game is running on has no audio playback support.
  • Files can now be added to the Loader with an absolute URL even if you have a Loader.baseURL set. In previous versions the baseURL would still be prepended to the file URL, but the Loader now checks if the a file URL begins with http or // and skips prepending the baseURL to it.
  • Phaser.StateManager would incorrectly call loadUpdate and loadRender while the game was paused or if the State didn't have an update or render method defined, even after the loader was completed. Although this is a bug fix it's still an API change should you have been using the loadUpdate/Render calls in the old way. Also the StateManager no longer calls preRender unless the State create method has finished. If the State doesn't have a create method then preRender runs immediately.
  • Frame.uuid has been removed (was flagged as deprecated for several releases). This has a two-fold effect: First it means that the property no longer exists and secondly it means that the AnimationParser (the class responsible for loading sprite sheets and texture atlases) no longer has to call either RandomDataGenerator.uuid OR populates the PIXI.TextureCache. The first saves some CPU time and the second saves memory by not creating references to textures it doesn't ever use. The PIXI.TextureCache is now ignored by Phaser other than for the __missing and __default textures.
  • Phaser.AnimationParser methods JSONData, JSONDataHash and XMLData have all had their cacheKey parameter removed as it's no longer used.
  • Input.deleteMoveCallback no longer takes an integer as its parameter. Now you have to give it the original callback and context in order to remove it. This is to protect against index invalidation (see the fixed Bugs list)
  • Group.add and Group.addAt will only create a Physics Body on the child if it doesn't already have one. This is a change from 2.3 where it would replace the physics body property with the new body, but this could lead to garbage build-up over time, so you should now properly destroy the body before changing it.
  • Button game objects now have Input.useHandCursor set to true by default.
  • Phaser.BitmapText no longer extends PIXI.BitmapText but replaces it entirely.
  • Phaser.Text no longer extends PIXI.Text but replaces it entirely. Phaser.Text now natively extends a Phaser Sprite, meaning it can be enabled for physics, damaged, etc.
  • Mouse.button and MSPointer.button have been deprecated and are no longer set (they remain at -1). They never supported complex button events such as holding down 2 buttons and releasing just one, or any buttons other than left and right. They have been replaced with the far more robust and accurate Pointer DeviceButton properties such as Pointer.leftButton, Pointer.rightButton and so on.
  • Phaser.DeviceButton is a new class that handles a specific button on an input device, for example the middle button of a mouse, the eraser button of a stylus or a shoulder button on a Gamepad.
  • Phaser.DeviceButton.shiftKey is a boolean that holds if the shift key was held down or not during the last button event.
  • Phaser.DeviceButton.altKey is a boolean that holds if the alt key was held down or not during the last button event.
  • Phaser.DeviceButton.ctrlKey is a boolean that holds if the control key was held down or not during the last button event.
  • Phaser.GamepadButton has been removed and now uses DeviceButton instead. Three internal API changes took place: processButtonDown is renamed to start, processButtonUp is renamed to stop and processButtonFloat is renamed to padFloat. If you extended GamepadButton in your own code you need to replace it with DeviceButton.
  • MSPointer now checks the pointerType property of the DOM event and if it matches 'mouse' it will update Input.mousePointer, rather than Input.pointer1 (or whatever the next free Pointer was).
  • Time.suggestedFps is now only populated if Time.advancedTiming is enabled.

p2.js Upgraded to version 0.7.0

Phaser has been upgraded internally to use the new release of p2 physics. All Phaser based API call signatures remain unchanged unless listed below.

For the full list of p2 additions please read their change log.

  • The P2.Body.onBeginContact arguments have changed. It now sends 5 arguments: The Phaser.P2.Body, the p2.Body, the p2 Shape from Body A, the p2 Shape from Body B and the contact equations array. Note that the Phaser.P2.Body may be null if you collide with a 'native' p2 body (such as the world bounds). However the p2.Body argument will always be populated.
  • The P2.Body.onEndContact arguments have changed. It now sends 4 arguments: The Phaser.P2.Body, the p2.Body, the p2 Shape from Body A and the p2 Shape from Body B. Note that the Phaser.P2.Body may be null if this is the end of a contact with a 'native' p2 body (such as the world bounds). However the p2.Body argument will always be populated.
  • P2.Body.applyImpulse allows you to apply an impulse to a Body. An impulse is a force added to a body during a short period of time.
  • P2.Body.applyImpulseLocal allows you to apply an impulse to a point local to the Body. An impulse is a force added to a body during a short period of time.
  • P2.Body.getVelocityAtPoint gets the velocity of a point in the body.

Build Updates

  • The Grunt build script now lets you exclude four new modules: rope, tilesprite, creature and video.
  • Rope removes the ability to create Rope sprites and also removes the PIXI.Rope and PIXI.Strip classes.
  • TileSprite removes the ability to create Tile Sprites and also removes the PIXI.TilingSprite class.
  • Creature is not enabled by default, but allows you to control support for Creature bone based animations.
  • Video removes the ability to render Videos and video streams to textures.
  • Pixi is no longer an optional module. Phaser no longer uses any main stream branch of Pixi and has multiple fixes and tweaks internally through-out it. Therefore it's now no longer possible to replace the version of Pixi that Phaser uses with any other version, so we removed the option from the custom list. Over time we will do away with the Pixi globals and merge it fully into Phaser to avoid conflicts with any other version of Pixi present.

New Features

  • All calls to Loader methods that add files to the queue, such as Loader.image or Loader.atlas, now have the URL as an optional parameter. If not set Loader will assume the URL to be based on the key given. For example the following: game.load.image("boom", "boom.png") can now be expressed as just game.load.image("boom"), or game.load.atlas("player", "player.png", "player.json") can now be shortened to game.load.atlas("player"). Please see the freshly updated jsdocs for full details.
  • Loader.atlas and Cache.addTextureAtlas will now automatically determine the format of the JSON data (array or hash) when added to the Cache. You no longer need to specify it explicitly if JSON, only if XML.
  • Added support for the Creature Automated Animation Tool. You can now create a Phaser.Creature object which uses json data and a texture atlas for the animations. Creature is a powerful animation tool, similar to Spriter or Spine. It is currently limited to WebGL games only, but the new libs should prove a solid starting point for anyone wanting to incorporate Creature animations into their games.
  • Tilemap.getTileWorldXY has a new optional parameter: nonNull which if set makes it behave in the same way as getTile does (thanks @GGAlanSmithee #1722)
  • Group.hash is an array (previously available as Group._hash, but protected) into which you can add any of its children via Group.addToHash and Group.removeFromHash. Only children of the Group can be added to and removed from the hash. The hash is used automatically by Arcade Physics in order to perform non z-index based destructive sorting. However if you don't use Arcade Physics, or it isn't a physics enabled Group, then you can use the hash to perform your own sorting and filtering of Group children without touching their z-index (and therefore display draw order).
  • Group.physicsSortDirection is a new property allowing you to set a custom sort direction for Arcade Physics Sprites within the Group hash. Previously Arcade ...
Read more

Tarabon

26 Mar 03:30
Compare
Choose a tag to compare

Significant Updates

Game Objects and Components

All of the core Game Objects have received an important internal restructuring. We have moved all of the common functions to a new set of Component classes. They cover functionality such as 'Crop', 'Physics Body', 'InCamera' and more. You can find the source code to each component in the src/gameobjects/components folder of the repo.

All of the Game Object classes have been restructured to use the new component approach. This puts an end to the "God classes" structure we had before and removes literally hundreds of lines of duplicate code. It also allowed us to add features to Game Objects; for example Bitmap Text objects are now full-class citizens with regard to physics capabilities.

Although this was a big internal shift from an API point of view not much changed - you still access the same methods and properties in the same way as before. Phaser is just a lot leaner under the hood now.

It's worth mentioning that from a JavaScript perspective components are mixins applied to the core game objects when Phaser is instantiated. They are not added at run-time or are dynamic (they never get removed from an object once added for example). Please understand that this is by design.

You can create your own custom Phaser classes, with your own set of active components by copying any of the pre-existing Game Objects and modifying them.

Custom Builds

As a result of the shift to components we went through the entire source base and optimised everything we could. Redundant paths were removed, debug flags removed and new stub classes and hooks were created. What this means is that it's now easier than ever to "disable" parts of Phaser and build your own custom version.

We have always included a couple of extra custom builds with Phaser. For example a build without P2 Physics included. But now you can strip out lots of additional features you may not require, saving hundreds of KB from your build file in the process. Don't use any Sound in your game? Then you can now exclude the entire sound system. Don't need Keyboard support? That can be stripped out too.

As a result of this work the minimum build size of Phaser is now just 83KB (minified and gzipped).

Please see the README instructions on how to create custom builds.

Arcade Physics

We've updated the core of Arcade Physics in a number of significant ways.

First we've dropped lots of internal private vars and moved to using non-cached local vars. Array lengths are no longer cached and we've implemented physicsType properties on Game Objects to speed-up the core World collideHandler. All of these small changes have lead to a nice improvement in speed as a result, and also allows us to now offer things like physics enabled BitmapText objects.

More importantly we're now using a spacial pre-sort for all Sprite vs. Group and Group vs. Group collisions. You can define the direction the sort will prioritize via the new sortDirection property. By default it is set to Phaser.Physics.Arcade.LEFT_RIGHT. For example if you are making a horizontally scrolling game, where the player starts on the left of the world and moves to the right, then this sort order will allow the physics system to quickly eliminate any objects to the right of the player bounds. This cuts down on the sheer volume of actual collision checks needing to be made. In a densely populated level it can improve the fps rate dramatically.

There are 3 other directions available (RIGHT_LEFT, TOP_BOTTOM and BOTTOM_TOP) and which one you need will depend on your game type. If you were making a vertically scrolling shoot-em-up then you'd pick BOTTOM_TOP so it sorts all objects above and can bail out quickly. There is also SORT_NONE if you would like to pre-sort the Groups yourself or disable this feature.

Another handy feature is that you can switch the sortDirection at run-time with no loss of performance. Just make sure you do it before running any collision checks. So if you had a large 8-way scrolling world you could set the sortDirection to match the direction the player was moving in and adjust it in real-time, getting the benefits as you go. My thanks to Aaron Lahman for inspiring this update.

Phaser.Loader

The Phaser.Loader has been updated to support parallel downloads which is now enabled by default (you can toggle it via the Loader.enableParallel flag) as well as adding future extensibility points with a pack/file unified filelist and an inflight queue.

There are no known incompatibilities with the previous Loader. Be aware that with parallel downloading enabled the order of the Loader events may vary (as can be seen in the "Load Events" example).

The parallel file concurrency limit is available in Loader.maxParallelDownloads and is set to 4 by default. Under simulated slower network connections parallel loading was a good bit faster than sequential loading. Even under a direct localhost connection parallel loading was never slower, but benefited most when loading many small assets (large assets are more limited by bandwidth); both results are fairly expected.

The Loader now supports synchronization points. An asset marked as a synchronization point must be loaded (or fail to load) before any subsequent assets can be loaded. This is enabled by using the withSyncPoint and addSyncPoint methods. Packs ('packfile' files) and Scripts ('script' files) are treated as synchronization points by default. This allows parallel downloads in general while allowing synchronization of select resources if required (packs, and potentially other assets in the future, can load-around synchronization points if they are written to delay final 'loading').

Additional error handling / guards have been added, and the reported error message has been made more consistent. Invalid XML (when loading) no longer throws an exception but fails the particular file/asset that was being loaded.

Some public methods/properties have been marked as protected, but no (except in case of a should-have-been-private-method) public-facing interfaces have been removed. Some private methods have been renamed and/or removed.

A new XHR object is created for each relevant asset (as there must be a different XHR for each asset loaded in parallel). Online searches indicated that there was no relevant benefit of XHR (as a particular use-case) re-use; and time will be dominated with the resource fetch. With the new flight queue an XHR cache could be re-added, at the cost of some complexity.

The URL is always transformed through transformUrl, which can make adding some one-off special cases like #1355 easier to deal with.

This also incorporates the fast-cache path for Images tags that can greatly speed up the responsiveness of image loading.

Loader.resetLocked is a boolean that allows you to control what happens when the loader is reset, which happens automatically on a State change. If you set resetLocked to true it allows you to populate the loader queue in one State, then swap to another State without having the queue erased, and start the load going from there. After the load has completed you could then disable the lock again as needed.

Thanks to @pnstickne for vast majority of this update.

Pixi v2

We are now using our own custom build of Pixi v2. The Pixi project has moved all development resources over to Pixi v3, but it wasn't ready in time for the release of Phaser 2.3 so we've started applying our own fixes to the version of Pixi that Phaser uses.

As a result we have removed all files from the src/pixi folder that Phaser doesn't use, in order to make this distinction clearer. This includes EventTarget, so if you were relying on that in your game you'll need to add it back in to your local build.

We've also removed functions and properties from Pixi classes that Phaser doesn't require: such as the Interaction Manager, Stage.dirty, etc. This has helped us cut down the source code size and make the docs less confusing, as they no longer show properties for things that weren't even enabled.

We've rolled our own fixes into our version of Pixi, ensuring we keep it as bug-free as possible.

New Features

  • Physics.Arcade.isPaused allows you to toggle Arcade Physics processing on and off. If true the Body.preUpdate method will be skipped, halting all motion for all bodies. Note that other methods such as collide will still work, so be careful not to call them on paused bodies.
  • Arcade.Body.friction allows you to have more fine-grained control over the amount of velocity passed between bodies on collision.
  • BitmapData.text will render the given string to the BitmapData, with optional font, color and shadow settings.
  • MSPointer.capture allows you to optionally event.preventDefault the pointer events (was previously always on)
  • MSPointer.event now stores the most recent pointer event.
  • MSPointer.pointerDownCallback, pointerMoveCallback and pointerUpCallback all allow you to set your own event based callbacks.
  • MSPointer.button now records which button was pressed down (if any)
  • Phaser now supports rotated and flipped tiles in tilemaps, as exported from the Tiled map editor (thanks @nkholski #1608)
  • TilemapParser now supports Tiled 0.11 version maps which includes the rotation property on all Object types.
  • Tilemap.createFromObjects now checks for a rotation property on the Object and if present will set it as the Sprite.angle (#1433)
  • If for whatever reason you wish to hide the Phaser banner in the console.log you can set window.PhaserGlobal.hideBanner to true and it will skip the output. Honestly I'd rather if you didn't, but the option is now there.
  • TilemapLayer.setScale will allow you to apply scaling to a specific Tilemap layer, i.e. layer.setScale(2) would double the size of the layer. The way the Camera responds to the layer is adjusted accordingly based on the scale,...
Read more

Alkindar

06 Jan 07:11
Compare
Choose a tag to compare

Version 2.2.2 - "Alkindar" - 6th January 2015

New Features

  • Phaser.Loader now supports BLOB urls for audio files (thanks @aressler38 #1462)
  • Line.reflect will calculate the reflected, or outgoing angle of two lines. This can be used for Body vs. Line collision responses and rebounds.
  • Line.normalAngle gets the angle of the line normal in radians.
  • Line.normalX and Line.normalY contain the x and y components of the left-hand normal of the line.
  • Line.fromAngle will sets this line to start at the given x and y coordinates and for the segment to extend at angle for the given length.
  • BitmapData.drawGroup draws the immediate children of a Phaser.Group to a BitmapData. Children are only drawn if they have their exists property set to true. The children will be drawn at their x and y world space coordinates. When drawing it will take into account the child's rotation, scale and alpha values. No iteration takes place. Groups nested inside other Groups will not be iterated through.

Updates

  • TypeScript definitions fixes and updates (thanks @clark-stevenson @Schmavery)
  • DOM.visualBounds now includes scroll bars (#1429)
  • The new fixed time-step code has been more carefully linked to Pixi transform updates. This should finally put a stop to the tunneling issues that were being reported.
  • Tween.stop fired a different set of onComplete parameters to Tween.update. Both now dispatch `onComplete(target, tween)`` as the parameters in that order (thanks @P0rnflake #1450)
  • Removed redundant tolerance parameter from Rectangle.intersects (thanks @toolness #1463)
  • Phaser.Graphics.drawCircle now overrides PIXI.drawCircle which means the docs are now correct re: diameter not radius (thanks @ethankaminski #1454)
  • Device.webAudio check inversed to avoid throwing a warning in Chrome.
  • Mouse.mouseMoveCallback is flagged as deprecated.
  • Remove tw and th init from TilemapLayer (thanks @nextht #1474)
  • Particles.Arcade.Emitter.makeParticles now checks the given quantity value against Emitter.maxParticles. If quantity is more than maxParticles then the maxParticles value is reset to the new quantity given (as this is how most devs seem to use it).
  • Particles.Arcade.Emitter.emitParticle now returns a boolean depending if a particle was emitted or not.
  • Particles.Arcade.Emitter.update only updates _counter if a particle was successfully emitted.
  • Phaser.Point.angleSq removed. It didn't work so any code relying on it would be broken, and it's unclear what it was meant for (thanks @nextht #1396)
  • BitmapData.copy tx parameter if null and source is a Display Object, it will default to source.x.
  • BitmapData.copy ty parameter if null and source is a Display Object, it will default to source.y.

Bug Fixes

  • Fix / double-copy for Safari tilemap bug when rendering with delta scrolling. This fixes tilemaps not appearing to update on Safari OS X and iOS specifically (thanks @pnstickne @neurofuzzy @lastnightsparty #1439 #1498)
  • Simplified call to updateTransform. This is the unified and verified fix for #1424 #1479 #1490 #1502 and solves issues with physics tunneling and visual glitches under the new time step code.
  • Tween.delay, Tween.repeat and Tween.yoyo will no longer throw an error if called before a TweenData object has been created (via Tween.to or Tween.from) (thanks @SomMeri #1419)
  • The click trampoline added for IE prevented Chrome for Android from being
    able to launch Full Screen mode with the default parameters for
    ScaleManger#startFullScreen (the desktop version of Chrome was not
    affected.). This is now fixed and additional compatibility settings (clickTrampoline) that can be used to configure when such is used. By default the 'when-not-mouse' mode is only enabled for Desktop browsers, where the
    primary input is ubiquitously a mouse. There are no known breaking compatibility changes - the Full Screen should be initiatable in Chrome for Android as it was in 2.1.x. The default Android browser does not support Full Screen (thanks @pnstickne)
  • TilemapParser now checks for image collections, avoiding crashes. These would arise with maps exported from the new release of Tiled (thanks @paul-reilly #1440)
  • Group.replace could still access newChild.parent after it was set to undefined. This unifies the approach (thanks @pnstickne #1410 #1417)
  • P2.postBroadphaserHandler updated to avoid skipping final 2 pairs.
  • The P2 World constructor wouldn't let you use your own config unless you specified both the gravity and broadphase. Now allows one or both (thanks @englercj #1412)
  • The RandomDataGenerator could be seeded with an array of values. However if the array contained a zero it would stop seeding from that point (thanks @jpcloud @pnstickne #1456)
  • Added extra checks to Sound.play to stop it throwing DOM Exception Error 11 if the sound.readyState wasn't set or the sound was invalid. Also wrapped stop()``call in atry catch`.
  • Time.reset would incorrectly reset the _started property, now maps it to Time.time (thanks @XekeDeath #1467)
  • Fix floating point inaccuracy in Tween easing edge cases (thanks @jounii #1492)
  • Phaser.Signal was causing a CSP script-src violations in Cordova and Google Chrome Apps (thanks @elennaro #1494)
  • Added Events.onEnterBounds to the destroy method (thanks @legendary-mich #1497)
  • AnimationManager.destroy is now more careful about clearing up deep references (thanks @Arturszott #1449)
  • Ellipse.right and Ellipse.bottom setters fixed (thanks @nextht #1397)
  • Fixed double Ellipse.getBounds definition (thanks @nextht #1397)
  • TileSprite.loadTexture crashed when textures were updated in WebGL (thanks @pandavigoureux29 #1495)

Pixi.js 2.2.0 Updates

  • The strip class has now three extra properties, canvasPadding, paddingX, and paddingY : @darionco
  • Added mipmap option to to textures.
  • Added the ability to use GL_TRIANGLES when rendering Strips @darionco
  • Added the ability to tint the Graphics.
  • Fixed Y-flipped mask issue on render texture.
  • Fixed the issue where you could an alpha that is more than one and it would.
  • Fixed text issues when using accents.
  • Fixed sprite caching not clearing the previous cached texture : @kambing86
  • Fixed arcTo issues.
  • Vertex buffer and and vertex shader optimisation and reduced memory footprint on the tint and alpha : @bchevalier
  • Applied the new generic updateTransform to spritebatch : @kambing86

Danabar

04 Dec 11:43
Compare
Choose a tag to compare

Version 2.2.1 - "Danabar" - 4th December 2014

Bug Fixes

  • Fixed Pixi.js issue with alpha not working on any display object.
  • Fixed TweenManager.isTweening() and .removeFrom() (thanks @jotson #1408)
  • Added Game.debug reset method for when the debug manager is disabled (thanks @DanielSitarz #1407)
  • Custom Particle classes that used a BitmapData wouldn't work (thanks @hardalias #1402)

Version 2.2.0 - "Bethal" - 3rd December 2014

New Features

  • Updated to Pixi v2.2.0 - see separate change log entry below.
  • Cache.getRenderTexture will retrieve a RenderTexture that is stored in the Phaser Cache. This method replaces Cache.getTexture which is now deprecated.
  • Cache.autoResolveURL is a new boolean (default false) that automatically builds a cached map of all loaded assets vs. their absolute URLs, for use with Cache.getURL and Cache.checkURL. Note that in 2.1.3 and earlier this was enabled by default, but has since been moved behind this property which needs to be set to true before you load any assets to enable.
  • You can now call Tween.to again on a Tween that has already completed. This will re-use the same tween, on the original object, without having to recreate the Tween again. This allows a single tween instance to be re-used multiple times, providing they are linked to the same object (thanks InsaneHero)
  • Phaser.Color.valueToColor converts a value: a "hex" string, a "CSS 'web' string", or a number - into red, green, blue, and alpha components (thanks @pnstickne #1264)
  • Stage.backgroundColor now supports CSS 'rgba' values, as well as hex strings and hex numbers (thanks @pnstickne #1234)
  • Pointer.addClickTrampoline now adds in support for click trampolines. These raise pointer events into click events, which are required internally for a few edge cases like IE11 full screen mode support, but are also useful if you know you specifically need a DOM click event from a pointer (thanks @pnstickne #1282)
  • Point.floor will Math.floor both the x and y values of the Point.
  • Point.ceil will Math.ceil both the x and y values of the Point.
  • ScaleManager.scaleSprite takes a Sprite or Image object and scales it to fit the given dimensions. Scaling happens proportionally without distortion to the sprites texture. The letterBox parameter controls if scaling will produce a letter-box effect or zoom the sprite until it fills the given values.
  • Phaser.DOM.getBounds is a cross-browser element.getBoundingClientRect method with optional cushion.
  • Phaser.DOM.calibrate is a private method that calibrates element coordinates for viewport checks.
  • Phaser.DOM.aspect gets the viewport aspect ratio (or the aspect ratio of an object or element)
  • Phaser.DOM.inViewport tests if the given DOM element is within the viewport, with an optional cushion parameter that allows you to specify a distance.
  • Phaser.DOM.viewportWidth returns the viewport width in pixels.
  • Phaser.DOM.viewportHeight returns the viewport height in pixels.
  • Phaser.DOM.documentWidth returns the document width in pixels.
  • Phaser.DOM.documentHeight returns the document height in pixels.
  • TilemapLayers have been given a decent performance boost on canvas with map shifting edge-redraw (thanks @pnstickne #1250)
  • A large refactor to how the internal game timers and physics calculations has been made. We've now swapped to using a fixed time step internally across Phaser, instead of the variable one we had before that caused glitchse on low-fps systems. Thanks to pjbaron for his help with all of these related changes.
  • We have separated the logic and render updates to permit slow motion and time slicing effects. We've fixed time calling to fix physics problems caused by variable time updates (i.e. collisions sometimes missing, objects tunneling, etc)
  • Once per frame calling for rendering and tweening to keep things as smooth as possible
  • Calculates a suggestedFps value (in multiples of 5 fps) based on a 2 second average of actual elapsed time values in the Time.update method. This is recalculated every 2 seconds so it could be used on a level-by-level basis if a game varies dramatically. I.e. if the fps rate consistently drops, you can adjust your game effects accordingly.
  • Game loop now tries to "catch up" frames if it is falling behind by iterating the logic update. This will help if the logic is occasionally causing things to run too slow, or if the renderer occasionally pushes the combined frame time over the FPS time. It's not a band-aid for a game that floods a low powered device however, so you still need to code accordingly. But it should help capture issues such as gc spikes or temporarily overloaded CPUs.
  • It now detects 'spiraling' which happens if a lot of frames are pushed out in succession meaning the CPU can never "catch up". It skips frames instead of trying to catch them up in this case. Note: the time value passed to the logic update functions is always constant regardless of these shenanigans.
  • Signals to the game program if there is a problem which might be fixed by lowering the desiredFps
  • Time.desiredFps is the new desired frame rate for your game.
  • Time.suggestedFps is the suggested frame rate for the game based on system load.
  • Time.slowMotion allows you to push the game into a slow motion mode. The default value is 1.0. 2.0 would be half speed, and so on.
  • Time.timeCap is no longer used and now deprecated. All timing is now handled by the fixed time-step code we've introduced.
  • Time.now can no longer be relied upon to contain a timestamp value. If the browser supports requestAnimationFrame then Time.now will contain the high resolution timer value that rAf generates. Otherwise it will contain the value of Date.now. If you require the actual time value (in milliseconds) then please use Time.time instead. Note that all Phaser sub-systems that used to rely on Time.now have been updated, so if you have any code that extends these please be sure to check it.
  • Game.forceSingleUpdate will force just a single logic update, regardless of the delta timer values. You can use this in extremely heavy CPU situations where you know you're about to flood the CPU but don't want Phaser to get stuck in a spiral.
  • Tilemap.createFromTiles will convert all tiles matching the given tile index (or an array of indexes) into Sprites. You can optionally then replace these tiles if you wish. This is perfect for games when you want to turn specific tiles into Sprites for extra control. The Sprites have an optional properties object which they can be populated with.
  • Added support for the Wheel Event, which is the DOM3 spec (thanks @pnstickne #1318)
  • Wheel Scroll Event (old non-FF) and DOM Mouse Wheel (old FF) are
    supported via a non-exported reused wrapper object; WheelEventProxy.
    The proxy methods are generated one-time dynamically but only when needed.
  • Key.justDown allows you to test if a Key has just been pressed down or not. You can only call justDown once per key press. It will only return true once, until the Key is released and pressed down again. This allows you to use it in situations where you want to check if this key is down without using a Signal, such as in a core game loop (thanks @pjbaron #1321)
  • Key.justUp allows you to test if a Key has just been released or not. You can only call justUp once per key press. It will only return true once, until the Key is pressed down and released again. This allows you to use it in situations where you want to check if this key is up without using a Signal, such as in a core game loop (thanks @pjbaron #1321)
  • Device.whenReady is a new signal that you can use to tell when the device is initialized.
  • Device.onInitialized is dispatched after device initialization occurs but before any of the ready callbacks have been invoked. Local "patching" for a particular device can/should be done in this event.
  • TweenManager.removeFrom method allows you to remove a tween from a game object such as a Sprite (thanks @lewster32 #1279)
  • Tweens have been completely rewritten. They're now much more flexible and efficient than before:
  • When specifying the ease in Tween.to or Tween.from you can now use a string instead of the Function. This makes your code less verbose. For example instead of Phaser.Easing.Sinusoidal.Out and you can now just use the string "Sine".The string names match those used by TweenMax and includes: "Linear", "Quad", "Cubic", "Quart", "Quint", "Sine", "Expo", "Circ", "Elastic", "Back", "Bounce", "Power0", "Power1", "Power2", "Power3" and "Power4". You can append ".easeIn", ".easeOut" and "easeInOut" variants. All are supported for each ease types.
  • Tweens now create a TweenData object. The Tween object itself acts like more of a timeline, managing multiple TweenData objects. You can now call Tween.to and each call will create a new child tween that is added to the timeline, which are played through in sequence.
  • Tweens are now bound to the new Time.desiredFps value and update based on the new Game core loop, rather than being bound to time calculations. This means that tweens are now running with the same update logic as physics and the core loop.
  • Tween.timeScale allows you to scale the duration of a tween (and any child tweens it may have). A value of 1.0 means it should play at the desiredFps rate. A value of 0.5 will run at half the frame rate, 2 at double and so on. You can even tween the timeScale value for interesting effects!
  • Tween.reverse allows you to instantly reverse an active tween. If the Tween has children then it will smoothly reverse through all child tweens as well.
  • Tween.repeatAll allows you to control how many times all child tweens will repeat before firing the Tween.onComplete event. You can set the value to -1 to repeat forever.
  • Tween.loop now controls the looping of all child tweens.
  • Tween.onRepeat is a new signal that is dispatched whenever a Tween repeats. If a Tween has many child tweens its di...
Read more

Bethal

03 Dec 10:43
Compare
Choose a tag to compare

Version 2.2.0 - "Bethal" - 3rd December 2014

New Features

  • Updated to Pixi v2.2.0 - see separate change log entry below.
  • Cache.getRenderTexture will retrieve a RenderTexture that is stored in the Phaser Cache. This method replaces Cache.getTexture which is now deprecated.
  • Cache.autoResolveURL is a new boolean (default false) that automatically builds a cached map of all loaded assets vs. their absolute URLs, for use with Cache.getURL and Cache.checkURL. Note that in 2.1.3 and earlier this was enabled by default, but has since been moved behind this property which needs to be set to true before you load any assets to enable.
  • You can now call Tween.to again on a Tween that has already completed. This will re-use the same tween, on the original object, without having to recreate the Tween again. This allows a single tween instance to be re-used multiple times, providing they are linked to the same object (thanks InsaneHero)
  • Phaser.Color.valueToColor converts a value: a "hex" string, a "CSS 'web' string", or a number - into red, green, blue, and alpha components (thanks @pnstickne #1264)
  • Stage.backgroundColor now supports CSS 'rgba' values, as well as hex strings and hex numbers (thanks @pnstickne #1234)
  • Pointer.addClickTrampoline now adds in support for click trampolines. These raise pointer events into click events, which are required internally for a few edge cases like IE11 full screen mode support, but are also useful if you know you specifically need a DOM click event from a pointer (thanks @pnstickne #1282)
  • Point.floor will Math.floor both the x and y values of the Point.
  • Point.ceil will Math.ceil both the x and y values of the Point.
  • ScaleManager.scaleSprite takes a Sprite or Image object and scales it to fit the given dimensions. Scaling happens proportionally without distortion to the sprites texture. The letterBox parameter controls if scaling will produce a letter-box effect or zoom the sprite until it fills the given values.
  • Phaser.DOM.getBounds is a cross-browser element.getBoundingClientRect method with optional cushion.
  • Phaser.DOM.calibrate is a private method that calibrates element coordinates for viewport checks.
  • Phaser.DOM.aspect gets the viewport aspect ratio (or the aspect ratio of an object or element)
  • Phaser.DOM.inViewport tests if the given DOM element is within the viewport, with an optional cushion parameter that allows you to specify a distance.
  • Phaser.DOM.viewportWidth returns the viewport width in pixels.
  • Phaser.DOM.viewportHeight returns the viewport height in pixels.
  • Phaser.DOM.documentWidth returns the document width in pixels.
  • Phaser.DOM.documentHeight returns the document height in pixels.
  • TilemapLayers have been given a decent performance boost on canvas with map shifting edge-redraw (thanks @pnstickne #1250)
  • A large refactor to how the internal game timers and physics calculations has been made. We've now swapped to using a fixed time step internally across Phaser, instead of the variable one we had before that caused glitchse on low-fps systems. Thanks to pjbaron for his help with all of these related changes.
  • We have separated the logic and render updates to permit slow motion and time slicing effects. We've fixed time calling to fix physics problems caused by variable time updates (i.e. collisions sometimes missing, objects tunneling, etc)
  • Once per frame calling for rendering and tweening to keep things as smooth as possible
  • Calculates a suggestedFps value (in multiples of 5 fps) based on a 2 second average of actual elapsed time values in the Time.update method. This is recalculated every 2 seconds so it could be used on a level-by-level basis if a game varies dramatically. I.e. if the fps rate consistently drops, you can adjust your game effects accordingly.
  • Game loop now tries to "catch up" frames if it is falling behind by iterating the logic update. This will help if the logic is occasionally causing things to run too slow, or if the renderer occasionally pushes the combined frame time over the FPS time. It's not a band-aid for a game that floods a low powered device however, so you still need to code accordingly. But it should help capture issues such as gc spikes or temporarily overloaded CPUs.
  • It now detects 'spiraling' which happens if a lot of frames are pushed out in succession meaning the CPU can never "catch up". It skips frames instead of trying to catch them up in this case. Note: the time value passed to the logic update functions is always constant regardless of these shenanigans.
  • Signals to the game program if there is a problem which might be fixed by lowering the desiredFps
  • Time.desiredFps is the new desired frame rate for your game.
  • Time.suggestedFps is the suggested frame rate for the game based on system load.
  • Time.slowMotion allows you to push the game into a slow motion mode. The default value is 1.0. 2.0 would be half speed, and so on.
  • Time.timeCap is no longer used and now deprecated. All timing is now handled by the fixed time-step code we've introduced.
  • Time.now can no longer be relied upon to contain a timestamp value. If the browser supports requestAnimationFrame then Time.now will contain the high resolution timer value that rAf generates. Otherwise it will contain the value of Date.now. If you require the actual time value (in milliseconds) then please use Time.time instead. Note that all Phaser sub-systems that used to rely on Time.now have been updated, so if you have any code that extends these please be sure to check it.
  • Game.forceSingleUpdate will force just a single logic update, regardless of the delta timer values. You can use this in extremely heavy CPU situations where you know you're about to flood the CPU but don't want Phaser to get stuck in a spiral.
  • Tilemap.createFromTiles will convert all tiles matching the given tile index (or an array of indexes) into Sprites. You can optionally then replace these tiles if you wish. This is perfect for games when you want to turn specific tiles into Sprites for extra control. The Sprites have an optional properties object which they can be populated with.
  • Added support for the Wheel Event, which is the DOM3 spec (thanks @pnstickne #1318)
  • Wheel Scroll Event (old non-FF) and DOM Mouse Wheel (old FF) are
    supported via a non-exported reused wrapper object; WheelEventProxy.
    The proxy methods are generated one-time dynamically but only when needed.
  • Key.justDown allows you to test if a Key has just been pressed down or not. You can only call justDown once per key press. It will only return true once, until the Key is released and pressed down again. This allows you to use it in situations where you want to check if this key is down without using a Signal, such as in a core game loop (thanks @pjbaron #1321)
  • Key.justUp allows you to test if a Key has just been released or not. You can only call justUp once per key press. It will only return true once, until the Key is pressed down and released again. This allows you to use it in situations where you want to check if this key is up without using a Signal, such as in a core game loop (thanks @pjbaron #1321)
  • Device.whenReady is a new signal that you can use to tell when the device is initialized.
  • Device.onInitialized is dispatched after device initialization occurs but before any of the ready callbacks have been invoked. Local "patching" for a particular device can/should be done in this event.
  • TweenManager.removeFrom method allows you to remove a tween from a game object such as a Sprite (thanks @lewster32 #1279)
  • Tweens have been completely rewritten. They're now much more flexible and efficient than before:
  • When specifying the ease in Tween.to or Tween.from you can now use a string instead of the Function. This makes your code less verbose. For example instead of Phaser.Easing.Sinusoidal.Out and you can now just use the string "Sine".The string names match those used by TweenMax and includes: "Linear", "Quad", "Cubic", "Quart", "Quint", "Sine", "Expo", "Circ", "Elastic", "Back", "Bounce", "Power0", "Power1", "Power2", "Power3" and "Power4". You can append ".easeIn", ".easeOut" and "easeInOut" variants. All are supported for each ease types.
  • Tweens now create a TweenData object. The Tween object itself acts like more of a timeline, managing multiple TweenData objects. You can now call Tween.to and each call will create a new child tween that is added to the timeline, which are played through in sequence.
  • Tweens are now bound to the new Time.desiredFps value and update based on the new Game core loop, rather than being bound to time calculations. This means that tweens are now running with the same update logic as physics and the core loop.
  • Tween.timeScale allows you to scale the duration of a tween (and any child tweens it may have). A value of 1.0 means it should play at the desiredFps rate. A value of 0.5 will run at half the frame rate, 2 at double and so on. You can even tween the timeScale value for interesting effects!
  • Tween.reverse allows you to instantly reverse an active tween. If the Tween has children then it will smoothly reverse through all child tweens as well.
  • Tween.repeatAll allows you to control how many times all child tweens will repeat before firing the Tween.onComplete event. You can set the value to -1 to repeat forever.
  • Tween.loop now controls the looping of all child tweens.
  • Tween.onRepeat is a new signal that is dispatched whenever a Tween repeats. If a Tween has many child tweens its dispatched once the sequence has repeated.
  • Tween.onChildComplete is a new signal that is dispatched whenever any child tweens have completed. If a Tween consists of 4 sections you will get 3 onChildComplete events followed by 1 onComplete event as the final tween finishes.
  • Chained tweens are now more intelligently handled. Because you can easily create child tweens (by simply calling Tween.to m...
Read more

Ravinda

23 Oct 11:38
Compare
Choose a tag to compare

Version 2.1.3 - "Ravinda" - 23rd October 2014

New Features

  • Updated to Pixi v2.0.0 (see change list below)
  • Happily removed the IE11 WebGL lock as Pixi now fully supports it :)
  • Time.prevTime is a new property that contains the raw value of the game timer from the previous update.
  • Sound.fadeTo allows you to fade the Sound to the given volume over the duration specified (thanks @nickryall #1225)
  • BitmapData.getFirstPixel will scan the BitmapData and return the color and location of the first non-transparent pixel encountered. You can specify one of 4 scan directions: top to bottom, bottom to top, left to right and right to left.
  • BitmapData.getBounds will return a Rectangle object that encompasses the full extent of the non-transparent pixels in the BitmapData. This can be useful if you wish to trim away transparent pixels from the sides of a BitmapData down to size before saving.
  • Rectangle.scale allows you to scale the width and height of a Rectangle.
  • RenderTexture has a new optional parameter: resolution

Updates

  • TypeScript definitions fixes and updates (thanks @clark-stevenson)
  • Changed the Animation constructor parameter delay to frameRate as it's a more accurate term of what it should be. Internally nothing changed.
  • Circle.getBounds added.
  • Ellipse.getBounds added.
  • Device.canPlayAudio now supports opus files directly, as well as opus encoded audio stored in ogg containers (#1232)
  • PIXI.AbstractFilter is now bundled by default to support the new sprite.shader feature in Pixi v2.
  • Changed all typeof comparisons from == to === (thanks @bobbywilson0 #1230)
  • JSDoc fixes in the Rope class (thanks @Rovanion)
  • Filter.update now caches the previous pointer position to avoid flooding the uniform. Also the mouse uniform is now a value between 0 and 1 depending on the position within the game view.

Bug Fixes

  • Fixed a reference error to the Loader.baseURL in Cache._resolveUrl method. This stops the error where Safari would show lots of file load errors but then still load the files (thanks @neurofuzzy #1235)
  • Fixed the Filter mouse uniform value population.
  • Fixed an issue where audio files with query strings after them would fail the canPlayAudio checks (thanks Vithar)
  • Input.hitTest now accurately detects hits on the extreme edges of a display object (thanks InsaneHero)
  • Button.setSounds now works if given an AudioSprite as the sound source.

Pixi v2 Specific New Features

  • Sprites can now have a custom shader applied to them. Much better performance than filters.
  • Renderers now have a resolution. Ideal for working with different pixel density.
  • Big refactor of the webGLRenderer and WebGLSpriteBatch renderer.
  • Refactor of CanvasRenderer.
  • DisplayObject.updateTransform function rewritten with for better performance.
  • New Events Class.
  • New Constructor for all renderers (including autoDetect)
  • Massive Refactor of Graphics (WebGL and Canvas)
  • Graphics objects can now be interactive.
  • Made removeChild no longer returns error.
  • Lots of new functions added to the Matrix class.
  • RenderTexture refactored. Now accepts Matrix in the render function.
  • AsciiFilter, NoiseFilter and TiltShiftFilter.
  • added getChildIndex and setChildIndex methods to DisplayObjectContainer.
  • Bug Fixes.

Pixi v2 Specific Bug Fixes

  • iOS8 alpha bug fixed.
  • set default padding to 0 for graphics objects.
  • PIXI.Graphics initial width and height is 0.
  • Fixed Graphics getBounds.
  • fix cacheAsBitmap alpha issue for canvas.
  • Fixed minY calculation in updateBounds.
  • Fixed Bezier issue on Graphics.
  • Added 0 width check to DisplayObjectContainer.

Whitebridge

09 Oct 15:19
Compare
Choose a tag to compare

New Features

  • StateManager.unlink will null all State-level Phaser properties, such as game, add, etc. Useful if you never need to return to the State again.
  • Cache.removeImage has a new parameter: removeFromPixi which is true by default. It will remove the image from the Pixi BaseTextureCache as well as from the Phaser Cache. Set to false if you don't want the Pixi cache touched.
  • Group.ignoreDestroy boolean will bail out early from any call to Group.destroy. Handy if you need to create a global Group that persists across States.
  • Loader can now natively load XML files via load.xml. Once the XML file has loaded it is parsed via either DOMParser or ActiveXObject and then added to the Cache, where it can be retrieved via cache.getXML(key).
  • Cache now has support for XML files stored in their own container. You can add them with cache.addXML (typically this is done from the Loader automatically for you) and get them with cache.getXML(key). There is also cache.checkXMLKey(key), cache.checkKeys and cache.removeXML(key).
  • Rectangle.aabb is a new method that will take an array of Points and return a Rectangle that matches the AABB (bounding area) of the Points (thanks @codevinsky #1199)
  • AudioSprite support is now built into the Loader and SoundManager. AudioSprites are like sprite sheets, only they consist of a selection of audio files and markers in a json configuration. You can find more details at https://github.com/tonistiigi/audiosprite (thanks @codevinsky #1205)
  • Point.parse will return a new Point object based on the x and y properties of the object given to Point.parse (thanks @codevinsky #1198)
  • Sound.fadeOut(duration) will fade the Sound to a volume of zero over the duration given. At the end of the fade the Sound will be stopped and Sound.onFadeComplete dispatched.
  • Sound.fadeIn(duration, loop) will start the Sound playing, or restart it if already playing, set its volume to zero and then increase the volume over the duration given until it reaches 1. At the end of the fade the Sound.onFadeComplete event is dispatched.
  • Text.addColor allows you to set specific colors within the Text. It works by taking a color value, which is a typical HTML string such as #ff0000 or rgb(255,0,0) and a position. The position value is the index of the character in the Text string to start applying this color to. Once set the color remains in use until either another color or the end of the string is encountered. For example if the Text was Photon Storm and you did Text.addColor('#ffff00', 6) it would color in the word Storm in yellow.
  • Text.clearColors resets any previously set colors from Text.addColor.
  • If you pass a tinted Sprite to BitmapData.draw or BitmapData.copy it will now draw the tinted version of the Sprite to the BitmapData and not the original texture.
  • BitmapData.shadow(color, blur, x, y) provides a quick way to set all the relevant shadow settings, which are then be used in future draw calls.
  • Cache.addBitmapData has a new parameter: frameData allowing you to pass a Phaser.FrameData object along with the BitmapData.
  • Cache.getFrameData has a new parameter: map which allows you to specify which cache to get the FrameData from, i.e. Phaser.Cache.IMAGE or Phaser.Cache.BITMAPDATA.
  • Sprite.loadTexture if given a BitmapData as the texture will now query the cache to see if it has any associated FrameData, and if so it will load that into the AnimationManager.
  • BitmapData.textureLine takes a Phaser.Line object and an image in the image cache. It then accurately draws the image as a repeating texture for the full length of the line.
  • AnimationManager.name will now return the name property of the currently playing animation, if any.
  • Group.filter takes a predicate function and passes child, index, and the entire child array to it. It then returns an ArrayList containing all children that the predicate returns true for (thanks @codevinsky #1187)
  • Cache.checkUrl allows you to check if a resource is in the cache based on an absolute URL (thanks @englercj #1221)
  • Cache.getUrl gets a resource from the cache based on the absolute URL it was loaded from (thanks @englercj #1221)
  • Sound.allowMultiple allows you to have multiple instances of a single Sound playing at once. This is only useful when running under Web Audio, and we recommend you implement a local pooling system to not flood the sound channels. But it allows for one Sound object to play overlapping times, useful for gun effects and similar (#1220)

Updates

  • TypeScript definitions fixes and updates (thanks @clark-stevenson @englercj @benjamindulau)
  • Added the sourceRect and maskRect parameters back into BitmapData.alphaMask as they were accidentally removed in 2.1 (thanks seejay92)
  • jsdoc fixes (thanks @danxexe #1209)
  • AnimationParser is now using value instead of nodeValue when parsing atlas XML files, avoiding Chrome deprecation warnings (thanks @valtterip #1189)
  • Color.webToColor restored. Converts a CSS rgba color into a native color value.
  • Color.createColor now populates the color property of the returned object with the results of Phaser.Color.getColor.
  • Color.createColor now has a color32 property with the results of Phaser.Color.getColor32.
  • Color.hexToColor has been optimised to inline the regex and has moved the createColor call so it now populates the color object fully, not just setting the r,g,b properties.
  • Keyboard.PLUS and Keyboard.MINUS have been added to the list of key codes (thanks @victorbjelkholm #1281)

Bug Fixes

  • If Game Objects change their frame, such as with an animated Sprite, and the change goes from a previously trimmed frame to a non-trimmed (full size) one, then the previous trim values were still left active, causing it to glitch (thanks stupot)
  • If you called StateManager.start from within a states init method which also had a preload method it would fail to start the next State.
  • StateManager.boot would call start on a State twice if it was added to the game and started before the DOM load had completed. This didn't cause an error but was duplicating function calls needlessly.
  • Changing any of the Text properties such as font, lineSpacing and fontSize on a Text object that wasn't already on the display list would cause an updateTransform error. Parent is now checked first in all setters.
  • A Timer with a delay value that was a float and not an integer would not loop correctly. Timer delay values are now passed through Math.round to avoid this (thanks @osmanzeki #1196)
  • The Loader would incorrectly call fileComplete for legacy audio files instead of setting it as a callback, throwing up errors if the audio file failed to load (thanks @spayton #1212)
  • The Uint32Array check used in Utils was incorrectly replacing Uint32Array on Safari, causing errors like BitmapData.getPixel32 to fail and other related issues (fixes #1043 and #1197)
  • Camera.follow would break if the parent of the Sprite being followed was scaled in any way (thanks @englercj #1222)
  • Fixed the 4fv uniform in the Pixelate filter.