Skip to content

Releases: phaserjs/phaser

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.

Eianrod

11 Sep 09:42
Compare
Choose a tag to compare

Version 2.1.1. of Phaser is an emergency point release. It addresses a potential race condition that could happen in States that tried to change state from the create method but had an empty preloader or pre-cached assets.

The list of changes below are from 2.1.0 - 9th September 2014

New Features

  • Updated to p2.js 0.6.0 - this was an API breaking change, so please see the p2.js section of this change log specifically if you're using p2 in your game.
  • If you are using CocoonJS, please set your game render type to CANVAS and not WEBGL or AUTO. You should also disable any of the ScaleManager screen resizing or margin setting code. By default in this mode CocoonJS will now set 'screencanvas=true' which helps with performance significantly.
  • Ninja Physics is no longer included in the build files by default. Not enough people were using it, and not enough contributions were coming in to help polish it up, so we've saved the space and removed it. It's still available in the grunt build files if you require it, but we're deprecating it from the core library at this time. It will make a return in Phaser3 when we move to a modular class system.
  • ScaleManager has a new scaleMode called RESIZE which will tell Phaser to track the size of the parent container (either a dom element or the browser window if none given) and set the canvas size to match it. If the parent changes size the canvas will resize as well, keeping a 1:1 pixel ratio. There is also a new ScaleManager.setResizeCallback method which will let you define your own function to handle resize events from the game, such as re-positioning sprites for a fluid responsive layout (#642)
  • The width and height given to the Phaser.Game constructor can now be numbers or strings in which case the value is treated as a percentage. For example a value of "100%" for the width and height will tell Phaser to size the game to match the parent container dimensions exactly (or the browser window if no parent is given). Equally a size of "50%" would tell it to be half the size of the parent. The values are retained even through resize events, allowing it to maintain a percentage size based on the parent even as it updates.
  • Device will now detect for Kindle and PS Vita (thanks @lucbloom)
  • Device will now detect for Cordova (thanks @videlais #1102)
  • Arcade Physics Body.skipQuadTree is a new boolean that if set to true when you collide the Sprite against a Group it will tell Phaser to skip using a QuadTree for that collision. This is handy if this Body is especially large.
  • Arcade Physics World.skipQuadTree will disable the use of all QuadTrees in collision methods, which can help performance in tightly packed scenes.
  • Cordova 'deviceready' event check added (thanks @videlais #1120)
  • Loader.useXDomainRequest boolean added. If true (the default is false, unless the browser is detected as being IE9 specifically) it will use XDomainRequest when loading JSON files instead of xhr. In rare IE edge-cases this may be required. You'll know if you need it (#1131 #1116)
  • Added support for Tiled objects type field (thanks @rex64 #1111)
  • Tile properties are now copied from the Tiled JSON data to the Phaser.Tile objects when parsed (thanks @beeglebug #1126)
  • All Images now have a frameData value, even if it's only one frame. This removes lots of engine code needed to check if images are sprite sheets or not, and simplifies game code too (thanks @lucbloom #1059)
  • Added a new Phaser.Rope object. This allows for a series of 'chained' Sprites and extends the Rope support built into Pixi. Access it via game.add.rope (thanks @codevinsky #1030)
  • Phaser.Device.isAndroidStockBrowser will inform you if your game is running in a stock Android browser (rather than Chrome) where you may wish to scale down effects, disable WebGL, etc (thanks @lucbloom #989)
  • Phaser.Camera has a new property position which is a Point object that allows you to get or set the camera position without having to read both the x and y values (thanks @Zielak #1015)
  • TileSprite now has the alive property, which should help with some Group operations (thanks @jonkelling #1085)
  • Events.onDestroy is a new signal that is dispatched whenever the parent is being destroyed. It's dispatched at the start of the destroy process, allowing you to perform any additional house cleaning needed (thanks @jonkelling #1084)
  • Group.onDestroy is a new signal that is dispatched whenever the Group is being destroyed. It's dispatched at the start of the destroy process, allowing you to perform any additional house cleaning needed (thanks @jonkelling #1084)
  • ScaleManager.destroy now removes the window and document event listeners, which are no longer created anonymously (thanks @eguneys #1092)
  • Input.Gamepad.destroy now destroys all connected SinglePads and clears event listeners.
  • SinglePad.destroy now clears all associated GamepadButton objects and signals.
  • Device.node and Device.nodeWebKit are two new properties (thanks @videlais #1129)
  • P2.PointProxy.mx and my values are get and set in meters with no pixel conversion taking place.
  • P2.InversePointProxy.mx and my values are get and set in meters with no pixel conversion taking place.
  • Pointer.dirty is a new boolean that is set by the InputHandler. It tells the Pointer to re-check all interactive objects it may be over on the next update, regardless if it has moved position or not. This helps solve issues where you may have a Button that on click generates a pop-up window that now obscures the Button (thanks @jflowers45 #882)
  • SoundManager.destroy is a new method that will destroy all current sounds and reset any callbacks.
  • StateManager.clearCurrentState now handles the process of clearing down the current state and is now called if the Game is destroyed.
  • Game.destroy now clears the current state, activating its shutdown callback if it had one. It also now destroys the SoundManager, stopping any currently running sounds (#1092)
  • Animation.onUpdate is a new event that is dispatched each time the animation frame changes. Due to its intensive nature it is disabled by default. Enable it with Animation.enableUpdate = true (#902)
  • Device now has new features to support detection of running inside a CocoonJS.App (thanks @videlais #1150)
  • Support for CocoonJS.App's 'onSuspended' and 'onActivated' events, making it so that the timers and sounds are stopped/started and muted/unmuted when the user swaps an app from the background to the fore or the reverse (thanks @videlais #1152)
  • Canvas.removeFromDOM(canvas) will remove a canvas element from the DOM.
  • Game.destroy now removes the games canvas element from the DOM.
  • ScaleManager.setMinMax(minWidth, minHeight, maxWidth, maxHeight) is a handy function to allow you to set all the min/max dimensions in one call.
  • ArcadePhysics.collide and overlap can now accept 2 Arrays of objects to be used in the collision checks (thanks @ctmartinez1992 #1158)
  • RetroFont has a new property called frameData which contains the Frame objects for each of the letters in the font, which can be used by Sprites.
  • Phaser.Canvas.setImageRenderingCrisp now sets image-rendering: pixelated, perfect for pixel art, which is now supported in Chrome 38.
  • Phaser.Mouse will now add a listener to the window to detect mouseup events. This is used to detect if the player releases the mouse while outside of the game canvas. Previously Pointer objects incorrectly thought they were still pressed when you returned the mouse over the canvas (#1167)
  • Rectangle.centerOn(x,y) allows you to quickly center a Rectangle on the given coordinates.
  • Group.addMultiple allows you to pass an array of game objects and they'll all be added to the Group in turn.
  • The StateManager will now check if a State has a method called resize. If it does, and if the game is running in the RESIZE Scale Mode then this method will be called whenever the game resizes. It will be passed two parameters: width and height that will match the games new dimensions. Resizing can happen as a result of either the parent container changing shape, or the browser window resizing.
  • Rectangle.topRight returns a Point object that represents the top-right coordinate of the Rectangle.
  • The grunt script now builds a new version of Phaser without any physics (including Arcade Physics), Tilemaps or Particles. This build is called phaser-no-physics.js and works stand-alone. Please note that things like the GameObjectFactory aren't changed, so they will still try and create a Tilemap for example should you ask them to (thanks @eguneys #1172)
  • Camera.roundPx is a new boolean. If set to true it will call view.floor as part of its update loop, keeping its boundary to integer values. Set to false to disable this from happening (#1141)
  • Phaser.Easing.Default is a new property that is used when a specific type of ease isn't given. It defaults to Linear.None but can be overridden to anything (thanks @alvinsight)

Updates

  • TypeScript definition updates to help fix for the noimplicitany option (thanks @Waog #1088)
  • TypeScript definitions fixes and updates (thanks @clark-stevenson @englercj @saikobee and @rhmoller)
  • All of the Pixi geom classes have been removed from the build file as they aren't needed (the Phaser.Geom classes overwrite them), saving some space in the process.
  • Improved consistency of clone methods on geometry classes (thanks @beeglebug #1130)
  • Removed Cache.isSpriteSheet method as no longer required (see #1059)
  • Added Cache.getFrameCount to return the number of frames in a FrameData.
  • Input.setMoveCallback has been removed due to deprecation.
  • BitmapData.refreshBuffer has been removed and replaced with BitmapData.update.
  • BitmapData.drawSprite has been removed due to deprecation. Use BitmapData.draw instead.
  • Pointer.moveCallback has been removed due to deprecati...
Read more

Cairhien

09 Sep 15:30
Compare
Choose a tag to compare

Version 2.1.0 - "Cairhien" - 9th September 2014

New Features

  • Updated to p2.js 0.6.0 - this was an API breaking change, so please see the p2.js section of this change log specifically if you're using p2 in your game.
  • If you are using CocoonJS, please set your game render type to CANVAS and not WEBGL or AUTO. You should also disable any of the ScaleManager screen resizing or margin setting code. By default in this mode CocoonJS will now set 'screencanvas=true' which helps with performance significantly.
  • Ninja Physics is no longer included in the build files by default. Not enough people were using it, and not enough contributions were coming in to help polish it up, so we've saved the space and removed it. It's still available in the grunt build files if you require it, but we're deprecating it from the core library at this time. It will make a return in Phaser3 when we move to a modular class system.
  • ScaleManager has a new scaleMode called RESIZE which will tell Phaser to track the size of the parent container (either a dom element or the browser window if none given) and set the canvas size to match it. If the parent changes size the canvas will resize as well, keeping a 1:1 pixel ratio. There is also a new ScaleManager.setResizeCallback method which will let you define your own function to handle resize events from the game, such as re-positioning sprites for a fluid responsive layout (#642)
  • The width and height given to the Phaser.Game constructor can now be numbers or strings in which case the value is treated as a percentage. For example a value of "100%" for the width and height will tell Phaser to size the game to match the parent container dimensions exactly (or the browser window if no parent is given). Equally a size of "50%" would tell it to be half the size of the parent. The values are retained even through resize events, allowing it to maintain a percentage size based on the parent even as it updates.
  • Device will now detect for Kindle and PS Vita (thanks @lucbloom)
  • Device will now detect for Cordova (thanks @videlais #1102)
  • Arcade Physics Body.skipQuadTree is a new boolean that if set to true when you collide the Sprite against a Group it will tell Phaser to skip using a QuadTree for that collision. This is handy if this Body is especially large.
  • Arcade Physics World.skipQuadTree will disable the use of all QuadTrees in collision methods, which can help performance in tightly packed scenes.
  • Cordova 'deviceready' event check added (thanks @videlais #1120)
  • Loader.useXDomainRequest boolean added. If true (the default is false, unless the browser is detected as being IE9 specifically) it will use XDomainRequest when loading JSON files instead of xhr. In rare IE edge-cases this may be required. You'll know if you need it (#1131 #1116)
  • Added support for Tiled objects type field (thanks @rex64 #1111)
  • Tile properties are now copied from the Tiled JSON data to the Phaser.Tile objects when parsed (thanks @beeglebug #1126)
  • All Images now have a frameData value, even if it's only one frame. This removes lots of engine code needed to check if images are sprite sheets or not, and simplifies game code too (thanks @lucbloom #1059)
  • Added a new Phaser.Rope object. This allows for a series of 'chained' Sprites and extends the Rope support built into Pixi. Access it via game.add.rope (thanks @codevinsky #1030)
  • Phaser.Device.isAndroidStockBrowser will inform you if your game is running in a stock Android browser (rather than Chrome) where you may wish to scale down effects, disable WebGL, etc (thanks @lucbloom #989)
  • Phaser.Camera has a new property position which is a Point object that allows you to get or set the camera position without having to read both the x and y values (thanks @Zielak #1015)
  • TileSprite now has the alive property, which should help with some Group operations (thanks @jonkelling #1085)
  • Events.onDestroy is a new signal that is dispatched whenever the parent is being destroyed. It's dispatched at the start of the destroy process, allowing you to perform any additional house cleaning needed (thanks @jonkelling #1084)
  • Group.onDestroy is a new signal that is dispatched whenever the Group is being destroyed. It's dispatched at the start of the destroy process, allowing you to perform any additional house cleaning needed (thanks @jonkelling #1084)
  • ScaleManager.destroy now removes the window and document event listeners, which are no longer created anonymously (thanks @eguneys #1092)
  • Input.Gamepad.destroy now destroys all connected SinglePads and clears event listeners.
  • SinglePad.destroy now clears all associated GamepadButton objects and signals.
  • Device.node and Device.nodeWebKit are two new properties (thanks @videlais #1129)
  • P2.PointProxy.mx and my values are get and set in meters with no pixel conversion taking place.
  • P2.InversePointProxy.mx and my values are get and set in meters with no pixel conversion taking place.
  • Pointer.dirty is a new boolean that is set by the InputHandler. It tells the Pointer to re-check all interactive objects it may be over on the next update, regardless if it has moved position or not. This helps solve issues where you may have a Button that on click generates a pop-up window that now obscures the Button (thanks @jflowers45 #882)
  • SoundManager.destroy is a new method that will destroy all current sounds and reset any callbacks.
  • StateManager.clearCurrentState now handles the process of clearing down the current state and is now called if the Game is destroyed.
  • Game.destroy now clears the current state, activating its shutdown callback if it had one. It also now destroys the SoundManager, stopping any currently running sounds (#1092)
  • Animation.onUpdate is a new event that is dispatched each time the animation frame changes. Due to its intensive nature it is disabled by default. Enable it with Animation.enableUpdate = true (#902)
  • Device now has new features to support detection of running inside a CocoonJS.App (thanks @videlais #1150)
  • Support for CocoonJS.App's 'onSuspended' and 'onActivated' events, making it so that the timers and sounds are stopped/started and muted/unmuted when the user swaps an app from the background to the fore or the reverse (thanks @videlais #1152)
  • Canvas.removeFromDOM(canvas) will remove a canvas element from the DOM.
  • Game.destroy now removes the games canvas element from the DOM.
  • ScaleManager.setMinMax(minWidth, minHeight, maxWidth, maxHeight) is a handy function to allow you to set all the min/max dimensions in one call.
  • ArcadePhysics.collide and overlap can now accept 2 Arrays of objects to be used in the collision checks (thanks @ctmartinez1992 #1158)
  • RetroFont has a new property called frameData which contains the Frame objects for each of the letters in the font, which can be used by Sprites.
  • Phaser.Canvas.setImageRenderingCrisp now sets image-rendering: pixelated, perfect for pixel art, which is now supported in Chrome 38.
  • Phaser.Mouse will now add a listener to the window to detect mouseup events. This is used to detect if the player releases the mouse while outside of the game canvas. Previously Pointer objects incorrectly thought they were still pressed when you returned the mouse over the canvas (#1167)
  • Rectangle.centerOn(x,y) allows you to quickly center a Rectangle on the given coordinates.
  • Group.addMultiple allows you to pass an array of game objects and they'll all be added to the Group in turn.
  • The StateManager will now check if a State has a method called resize. If it does, and if the game is running in the RESIZE Scale Mode then this method will be called whenever the game resizes. It will be passed two parameters: width and height that will match the games new dimensions. Resizing can happen as a result of either the parent container changing shape, or the browser window resizing.
  • Rectangle.topRight returns a Point object that represents the top-right coordinate of the Rectangle.
  • The grunt script now builds a new version of Phaser without any physics (including Arcade Physics), Tilemaps or Particles. This build is called phaser-no-physics.js and works stand-alone. Please note that things like the GameObjectFactory aren't changed, so they will still try and create a Tilemap for example should you ask them to (thanks @eguneys #1172)
  • Camera.roundPx is a new boolean. If set to true it will call view.floor as part of its update loop, keeping its boundary to integer values. Set to false to disable this from happening (#1141)
  • Phaser.Easing.Default is a new property that is used when a specific type of ease isn't given. It defaults to Linear.None but can be overridden to anything (thanks @alvinsight)

Updates

  • TypeScript definition updates to help fix for the noimplicitany option (thanks @Waog #1088)
  • TypeScript definitions fixes and updates (thanks @clark-stevenson @englercj @saikobee and @rhmoller)
  • All of the Pixi geom classes have been removed from the build file as they aren't needed (the Phaser.Geom classes overwrite them), saving some space in the process.
  • Improved consistency of clone methods on geometry classes (thanks @beeglebug #1130)
  • Removed Cache.isSpriteSheet method as no longer required (see #1059)
  • Added Cache.getFrameCount to return the number of frames in a FrameData.
  • Input.setMoveCallback has been removed due to deprecation.
  • BitmapData.refreshBuffer has been removed and replaced with BitmapData.update.
  • BitmapData.drawSprite has been removed due to deprecation. Use BitmapData.draw instead.
  • Pointer.moveCallback has been removed due to deprecation.
  • SinglePad.addButton has been removed due to deprecation.
  • P2.Body.loadData has been removed due to deprecation.
  • P2.World.defaultFriction and defaultRestitution have been removed due to deprecation.
  • Canvas.create noCocoon param...
Read more

Amadicia

18 Jul 11:51
Compare
Choose a tag to compare

Updates

  • Updated to Pixi.js 1.6.1 which fixes various issues such as IE9 Float32 defs and RenderTexture resizing and rendering.
  • TypeScript definitions fixes and updates (thanks @clark-stevenson and @alvinsight)
  • GameObjectFactory.spriteBatch now lets you specify null as a parameter for the parent and automatically adds the batch to game.world as a result. Also fixed jsdocs issues (@petarov #1000)
  • Rebuilt the way items are polled for Pointer events (drag, click, move). Now faster and more efficient, especially when some items in the stack require pixel perfect checks.
  • InputHandler.checkPointerOver now has a new fastTest parameter that forces a skips a pixel perfect check even if enabled.
  • InputHandler.checkPointerDown now has a new fastTest parameter that forces a skips a pixel perfect check even if enabled.
  • The key is now reported when failing to parse a Sprite Sheet (thanks @lucbloom #1026)
  • An editorconfig has been added to the core repo. See http://editorconfig.org (thanks @codevinksy #1027)
  • Keyboard.processKeyPress now checks if the Keyboard Input handler is disabled or not before processing the key callbacks.
  • Physics.bounds now correctly matches World.bounds on system start (thanks @Dumtard #1028)
  • Game._codePaused is now set if the Game is manually paused. See discussion: http://www.html5gamedevs.com/topic/6719-codepaused-property/ (thanks @devinb83 #1017)

New Features

  • ArrayList.setAll - sets the property to the given value on all members of the list.
  • Sprite.loadTexture has a new optional stopAnimation boolean parameter which will halt the currently running animation (if any) after changing the texture (based on #1029).
  • Animation.updateFrameData allows you to load a new FrameData object into an existing animation, even if currently running (based on #1029)
  • AnimationManager.loadFrameData will now update all existing Animations to use the newly loaded FrameData (based on #1029)
  • Sprite.loadTexture will store the smoothed property of the Sprite and re-apply it once the new texture is loaded.
  • Group.checkAll allows you to check if the same property exists across all children of the Group and is set to the given value (thanks @codevinsky #1013)
  • Group.checkProperty allows you to check if the property exists on the given child of the Group and is set to the value specified (thanks @codevinsky #1013)
  • Phaser.Utils.setProperty will set an Objects property regardless of depth (thanks @codevinsky #1013)
  • Phaser.Utils.setProperty will set an Objects property regardless of depth (thanks @codevinsky #1013)
  • Phaser.Utils.getProperty will get an Objects property regardless of depth (thanks @codevinsky #1013)

Bug Fixes

  • Fixed pixel perfect dragging (thanks @jeroenverfallie #996)
  • Debug.preUpdate was still being called in the Game Loop even if enableDebug was set to false (thanks @qdrj #995)
  • Phaser.Physics.P2.Body.addPolygon didn't work with a flat array of numbers for the coordinates (thanks @petarov, fix #883)
  • Added missing Loader.onPackComplete Signal (thanks @mjeffery #1007)
  • QuadTree leveling - Rather than level++ which changes the current nodes level, the subnodes should get the current nodes level+1 (thanks @devinb83 #1018)
  • Prevented objects with pixel perfect checks from over-riding other higher priority ID items (#983)
  • Group.create was not creating with p2 debug flag (thanks @Dumtard #1014)
  • World.wrap when using the bounds of the object wouldn't adjust the bounds correctly, meaning wrapping outside the camera failed (thanks @jackrugile #1020)
  • Pixi updated worldTransform from an Array to an Object and Phaser Image, BitmapText, Text and Graphics were still using array access to populate the world property, giving it incorrect results (thanks @alvinsight)
  • If you add a Tween to the TweenManager and then immediately stop it, it will still exist in the TweenManager (thanks @gilangcp #1032)
  • AnimationManager does not update currentFrame on play until second frame (thanks @Dumtard #1041)
  • Animation now guards against _frameData being null (thanks @lucbloom #1033)
  • Tilemap.swap now accurately swaps from A to B and from B to A (thanks @noidexe #1034)
  • BitmapData.resize fixed to update the crop property too, resolves issues with images getting cut off with BitmapData.load.
  • OrientationSprite fix as it's not using PIXI.TextureCache anymore (thanks @DarkDev- #1036)

Jornhill

10 Jul 19:47
Compare
Choose a tag to compare

Significant Internal Changes

  • The PIXI.TextureCache global array is no longer used internally for storing Pixi Texture files. It's not actually a requirement of Pixi to use this and we were running into various issues with texture conflicts in DragonBones tests and issues with shared texture frames between Sprites. It meant we couldn't crop a sprite without cropping all instances unless we created a new texture frame at run-time, which as you can imagine is a huge overhead if you then want to crop an animated Sprite.

After talking with Mat at GoodBoyDigital about the issue it was his idea to just not use the TextureCache at all, and let each Sprite have its own frame. So this is the direction we've taken. We didn't save this for the 2.1 release as it doesn't actually alter the Phaser API at all, but it does change how things are working internally. So if you've got game code hooked directly into the TextureCache you need to be aware of this change before updating to 2.0.6.

  • The way in which Sprite.crop works has been changed. It will now adjust the dimensions of the sprite itself, remaining at the sprites previous x/y coordinates. Please be aware of this if you use cropped sprites in your game. The change was worth it though as it's significantly more powerful as a result.

Updates

  • Merged Pixi 1.6.0 with Phaser - all of the lovely new Pixi features are in, like complex Graphics objects and masking.
  • TypeScript definitions fixes and updates (thanks @clark-stevenson and @Phaiax)
  • Documentation fixes (thanks @kay-is #941)
  • BitmapData.draw can now also take a Phaser.Sprite, Phaser.Image or BitmapData object as a source type. As a result BitmapData.drawSprite is now depcreated.
  • BitmapData.alphaMask can now also take a Phaser.Sprite, Phaser.Image or BitmapData object as a source type.
  • BitmapData.alphaMask has 2 new optional parameters: sourceRect and maskRect to give more fine-grained control over where the source and mask are drawn and their size
  • BitmapData.alphaMask 'mask' parameter is now optional, if not given it will use itself as the mask.
  • BitmapData.alphaMask now calls BitmapData.update after running.
  • BitmapData.draw now has two optional parameters: width and height, to let you stretch the image being drawn if needed.
  • Group.destroy now removes any set filters (thanks @Jmaharman fix #844)
  • RetroFont charsPerRow paramters is now optional. If not given it will take the image width and divide it by the characterWidth value.
  • RetroFont now uses Phaser.scaleModes.NEAREST by default for its RenderTexture to preserve scaling.
  • Loader.tilemap has renamed the mapURL parameter to url and mapData to data to keep it consistent with the other Loader methods.
  • Loader.physics has renamed the dataURL parameter to url and jsonData to data to keep it consistent with the other Loader methods.
  • Stage no longer creates the Phaser.Canvas object, but Game itself does in the setupRenderer method.
  • Canvas.create has deprecated the noCocoon parameter as it's no longer required. The parameter is still in the signature, but no longer used in the method.
  • Time.add allows you to add an existing Phaser.Timer to the timer pool (request #864)
  • Emitter.start has a new parameter: forceQuantity which will force the quantity of a flow of particles to be the given value (request #853)
  • Sound.pause will no longer fire a Sound.onStop signal, and the pause values are set before the onPause signal is dispatched (thanks @AnderbergE, fix #868)
  • Swapped to using escaped Unicode characters for the console output.
  • Frame.setTrim no longer modifies the Frame width and height values.
  • AnimationParser doesn't populate the Pixi.TextureCache for every frame any longer. Each display object has its own texture property instead.
  • Removed the cacheKey parameters from the AnimationParser methods as they're no longer used.
  • Loader.isLoading is set to false if the filelist size is zero.
  • Sound.externalNode has had the input property dropped from it, bringing it back in line with the AudioNode spec (thanks @villetou, #840)
  • The StateManager has a preRenderCallback option, which checks for a preRender function existing on the State, but it was never called. Have decided to add this in, so the core Game loop now calls state.preRender right before the renderer runs (thanks @AnderbergE #869)
  • Game.onBlur and Game.onFocus events are now dispatched regardless if Stage.disableVisibilityChange is true or false, so you can respond to these events without your game automatically pausing or resuming (#911)
  • Image has been heavily refactored to make use of common code in Phaser.Sprite, cutting the file size down significantly.
  • When using the non-minified version of Phaser it will throw a console.warn if you give an invalid texture key to a Sprite, Image or TileSprite (thanks @lucbloom, #990)

CocoonJS Specific Updates

  • Wrapped all touch, keyboard, mouse and fullscreen events that CocoonJS doesn't support in conditional checks to avoid Warnings.
  • The SoundManager no longer requires a touch to unlock it, defaults to unlocked.
  • Resolved issue where Cocoon won't render a scene in Canvas mode if there is only one Sprite/Image on it.

New Features

  • BitmapData.extract has a new parameter that lets you control if the destination BitmapData is resized before the pixels are copied.
  • BitmapData.extract has 4 new parameters: r2, g2, b2, a2 which let you re-color the extract pixels as they are drawn to the new BitmapData.
  • BitmapData.load will take a game object or string and resize the BitmapData to match it and then draw the pixels in.
  • Keyboard.addCallbacks now has a new parameter for keypress event capture.
  • Keyboard.pressEvent stores the most recent DOM keypress event.
  • Keyboard.processKeyDown now runs the callback after all the objects have been created and/or updated.
  • Keyboard.processKeyUp now runs the callback after all the objects have been created and/or updated.
  • Phaser.Keyboard.lastChar will return the string value of the last key pressed.
  • Phaser.Keyboard.lastKey will return the most recently pressed Key object.
  • RetroFont.updateOffset allows you to modify the offsetX/Y values used by the font during rendering.
  • ArcadePhysics.Body has a new boolean property enable. If false the body won't be checked for any collision or overlaps, or have its pre or post update methods called. Use this for easy toggling of physics bodies without having to destroy or re-create the Body object itself.
  • BitmapData.addToWorld will create a new Phaser.Image object, assign the BitmapData to be its texture, add it to the world then return it.
  • BitmapData.copyPixels now accepts a Sprite, Image, BitmapData, HTMLImage or string as its source.
  • Loader.pack will allow you to load in a new Phaser Asset Pack JSON file. An Asset Pack is a specially structured file that allows you to define all assets for your game in an external file. The file can be split into sections, allowing you to control loading a specific set of files from it. An example JSON file can be found in the resources\Asset Pack JSON Format folder and examples of use in the Phaser Examples repository.
  • Loader.totalQueuedPacks returns the number of Asset Packs in the queue.
  • Loader.totalLoadedPacks returns the number of Asset Packs already loaded.
  • Emitter.explode is a new short-cut for exploding a fixed quantity of particles at once.
  • Emitter.flow is a new short-cut for creating a flow of particles based on the given frequency.
  • Sprite.crop (and Image.crop) has been completely overhauled. You can now crop animated sprites (sprite sheet and texture atlas), you can define the x/y crop offset and the crop rectangle is exposed in the Sprite.cropRect property.
  • Sprite.updateCrop is available if you wish to update an externally referenced crop rectangle.
  • Sprites and Images now have their own textures objects, they are no longer references to those stored in the global Pixi.TextureCache. This allows you to redefine the texture frame dynamically without messing up any other Sprites in your game, such as via cropping. They still share global Base Textures, so image references are kept to a minimum.
  • Sprite.resetFrame will revert the Sprites texture frame back to its defaults dimensions. This is called when you call Sprite.crop with no rectangle, to reset the crop effect, but can be userful in other situations so we've left it as a public method.
  • TilemapLayers can now be used with an unbounded camera (a camera that can move beyond the world boundaries). Currently, when an unbounded camera moves outside of the world, tilemaps start acting weird because they only render themselves strictly within the world limits. With this change, the tilemap will continue scrolling and show empty space beyond its edge (thanks @jotson #851)
  • TilemapLayer.wrap property - if true the map is rendered as if it is on the surface of a toroid (donut) instead of a plane. This allows for games that seamlessly scroll from one edge to the opposite edge of the world without noticing the transition. Note that the World size must match the Map size (thanks @jotson #851)
  • Added PlayStation 3 controller button mappings to Phaser.Gamepad (thanks @wayfu)
  • GamepadButton.destroy method added. Called automatically by SinglePad when a controller is disconnected.
  • Added Math.factorial (thanks @alvinsight, #940)
  • Full Mouse Wheel support added, with new constants and callbacks for mouse wheel movement (thanks @woutercommandeur, #959)
  • A Phaser version of the Pixi PixelateFilter was added by @paperkettle #939)
  • TileMap.setPreventRecalculate allows you to turn on / off the recalculation of tile faces for tile collision, which is handy when modifying large portions of a map to avoid slow-down (thanks @sivael, #951)
  • Group.add has a new optional boolean parameter: silent. If set to true the child will not dispatch its onAddedToGroup event.
  • Group.addAt has a new optional bo...
Read more

Tanchico

20 May 09:40
Compare
Choose a tag to compare

Change Log

Version 2.0.5 - "Tanchico" - 20th May 2014

Updates

  • TypeScript definitions fixes and updates (thanks @luispedrofonseca @clark-stevenson @Anahkiasen @adamholdenyall @luispedrofonseca @WillHuxtable)
  • Input.getPointerFromIdentifier docs update to reflect where the identifier comes from. Pointer properties now set to give it fixed defaults (thanks @JirkaDellOro, #793)
  • Pointer.pointerId added which is set by the DOM event (if present in the browser). Note that browsers can and do recycle pointer IDs.
  • Pointer.type and Pointer.exists properties added.
  • QuadTree.retrieve can now accept either a Sprite with a physics body or a Phaser.Rectangle as its parameter.
  • PluginManager.add now accepts additional parameters and if given a function it will pass them all to the Plugin constructor.
  • Tilemap.getTile has a new nonNull parameter. If true it won't return null for empty tiles, but will return the actual Tile in that location.
  • Math.interpolateAngles and Math.nearestAngleBetween have been removed for the time being. They threw run-time errors previously.
  • PIXI.InteractionManager is no longer over-written if the object already exists (thanks @georgiee, #818)
  • Key.justPressed and justReleased incorrectly set the delay value to 2500ms. Now defaults to 50ms (thanks @draklaw, fix #797)
  • Stage.backgroundColor can now accept short-code hex values: #222, #334, etc.
  • Pointer.withinGame is now accurate based on game scale and updated as the Pointer moves.
  • Stage.bounds is now updated if the game canvas offset changes position. Note that it contains the un-scaled game dimensions.

New Features

  • New force parameter added to Group.set, setAll, setAllChildren, setProperty which controls if a property is created even if it doesn't exist.
  • Group.hasProperty will check a child for the given property and return true if it exists, otherwise false.
  • Phaser.Tween.from allows you to set tween properties that will end up where the current object is (thanks @codevinsky, #792)
  • Input.getPointerFromId will return a pointer with a matching pointerId value, if any. pointerId is a value set by the browser in the DOM event.
  • ArcadePhysics.getObjectsUnderPointer will return all children from a Group that overlap with the given Pointer.
  • InputManager.minPriorityID lets you set the minimum priority level an object needs to be to be checked by a Pointer. Useful for UI layer stacking.
  • New consts: Phaser.Tilemap.NORTH, SOUTH, EAST and WEST to use with plugins and generally just handy to have.
  • BitmapData.processPixelRGB added undefined check (thanks @muclemente, fix #808)
  • Phaser.Utils.transposeArray will transpose the given array and return it.
  • Phaser.Utils.rotateArray will rotate the given array by 90 or 180 degrees in either direction and return it.
  • BitmapData.rect provides a quick way to draw a Rectangle to a BitmapData.
  • Button.onOverMouseOnly is a boolean that causes onOver events to fire only if the pointer was a mouse (i.e. stops onOver sounds triggering on touch)
  • Tilemap.setCollision has a new boolean parameter 'recalculate' which lets you control recalculation of collision faces (thanks @max-m, #819)
  • Tilemap.setCollisionBetween has a new boolean parameter 'recalculate' which lets you control recalculation of collision faces (thanks @max-m, #819)
  • Tilemap.setCollisionByExclusion has a new boolean parameter 'recalculate' which lets you control recalculation of collision faces (thanks @max-m, #819)
  • Tilemap.setCollisionByIndex has a new boolean parameter 'recalculate' which lets you control recalculation of collision faces (thanks @max-m, #819)
  • Graphics.drawTriangles will draw an array of vertices to the Graphics object (thanks @codevinsky, #795)
  • Polygon.area will calculate the area of the Polygon (thanks @codevinsky, #795)
  • The Tiled JSON parser will now include Tiled polygons, ellipse and rectangle geometry objects in the resulting map data (thanks @tigermonkey, #791)
  • Input.addMoveCallback allows you to bind as many callbacks as you like to the DOM move events (Input.setMoveCallback is now flagged as deprecated)
  • Input.deleteMoveCallback will remove a previously set movement event callback.
  • Mouse will now check if it's over the game canvas or not and set Pointer.withinGame accordingly.
  • Mouse.mouseOutCallback callback added for when the mouse is no longer over the game canvas.
  • Mouse.stopOnGameOut boolean controls if Pointer.stop will be called if the mouse leaves the game canvas (defaults to false)
  • Tilemap.searchTileIndex allows you to search for the first tile matching the given index, with optional skip and reverse parameters.
  • Tilemap.layer is a getter/setter to the current layer object (which can be changed with Tilemap.setLayer)
  • Cache.checkKey added - allows you to pass in a Cache type and a key and return a boolean.
  • Cache.checkCanvasKey(key) - Check if a Canvas key exists in the cache (thanks to @delta11 for the proposal)
  • Cache.checkTextureKey(key) - Check if a Texture key exists in the cache (thanks to @delta11 for the proposal)
  • Cache.checkSoundKey(key) - Check if a Sound key exists in the cache (thanks to @delta11 for the proposal)
  • Cache.checkTextKey(key) - Check if a Text key exists in the cache (thanks to @delta11 for the proposal)
  • Cache.checkPhysicsKey(key) - Check if a Physics key exists in the cache (thanks to @delta11 for the proposal)
  • Cache.checkTilemapKey(key) - Check if a Tilemap key exists in the cache (thanks to @delta11 for the proposal)
  • Cache.checkBinaryKey(key) - Check if a Binary key exists in the cache (thanks to @delta11 for the proposal)
  • Cache.checkBitmapDataKey(key) - Check if a BitmapData key exists in the cache (thanks to @delta11 for the proposal)
  • Cache.checkBitmapFontKey(key) - Check if a BitmapFont key exists in the cache (thanks to @delta11 for the proposal)
  • Cache.checkJSONKey(key) - Check if a JSON key exists in the cache (thanks to @delta11 for the proposal)
  • New movement data added for a Pointer Locked mouse (Pointer.movementX/Y) (thanks @woutercommandeur, #831)
  • ScaleManager.bounds is a Rectangle object that holds the exact size of the game canvas, taking DOM offset and game scale into account.

Plugins

The Plugins have now all moved to their own repository

Bug Fixes

  • Line.pointOnLine corrected algorithm (thanks @woutercommandeur, fix #784)
  • Line segment collision fails under certain cicumstances (thanks @woutercommandeur, fix #760)
  • The P2 DistanceConstraint method signature has changed. Updated Phaser so maxForce is now passed as object (fix #788)
  • Moved the this._reversed flag outside of the property loop in Tween (as per tween.js issue 115)
  • Emitter.makeParticles updated to use Array.isArray() check on the key/frame values, so non-string objects can be passed in (thanks @AnderbergE, fix #786)
  • Tilemap.createFromObjects will now force the creation of the property again even if it doesn't exist (regression fix from 2.0.4)
  • Phaser.Line.intersectsPoints fixed by properly checking the boundaries (thanks @woutercommandeur, fix #790)
  • Group.set and setAll were changed in 2.0.4 to not create the property unless it existed. This broke backwards compatibility, so has been fixed.
  • Sound.play now returns the Sound object (thanks @AnderbergE, fix #802)
  • Device Silk UA test updated to avoid Safari conflict (thanks @jflowers45, fix #810)
  • Sound.stop on Samsung S4 would randomly throw a DOM error. Wrapped the audio stop in a try/catch (thanks FSDaniel)
  • RandomDataGenerator.integerInRange would return a non-integer value if you passed in a float.
  • Timer class updated so that code-resumed pauses don't mess up the internal _pausedTotal value (thanks @joelrobichaud, fix #814)
  • Timer class when paused by code after a game-level pause wouldn't set the codepaused flag (thanks @joelrobichaud, fix #814)
  • Stage.backgroundColor now properly accepts hex #RRGGBB and color values 0xRRGGBB again (fix #785)
  • Color.getRGB would return incorrect color components if a color value without alpha was given, now works with both 0xRRGGBB and 0xAARRGGBB.
  • Color.getWebRGB now works regardless if you give an 0xRRGGBB or 0xAARRGGBB color value.
  • If an object was drag enabled with bringToTop, the onDragStop event wouldn't fire until the mouse was next moved (thanks @alpera, fix #813)
  • RetroFont.text would throw WebGL errors due to an issue with Pixi.RenderTexture. Fixed in Phaser and submitted code to Pixi.
  • RenderTexture.resize would throw WebGL errors due to an issue with Pixi.RenderTexture. Fixed in Phaser and submitted code to Pixi.
  • Group.hasProperty fixed to not use hasOwnProperty, but a series of in checks (thanks @mgiuffrida for the idea, #829)
  • Tilemap.removeTile sets tiles to null but should set to index of -1 (thanks @draklaw, fix #835)

Mos Shirare

29 Apr 14:43
Compare
Choose a tag to compare

Version 2.0.4 - "Mos Shirare" - 29th April 2014

Updates

  • Updated to Pixi.js 1.5.3
  • Updated to latest p2.js - all commits from 0.5.0 to Apr 27th 2014.
  • TypeScript definitions fixes and updates (thanks @clark-stevenson @metrofun @killalau)
  • Timer has removed all use of local temporary vars in the core update loop.
  • The Input.reset hard reset parameter is now passed down to the Keyboard and Key reset methods.
  • AnimationManager.destroy now iterates through child animations calling destroy on all of them, avoiding a memory leak (thanks stauzs)
  • AnimationManager.play will now call Animation.stop on the current animation before switching to the new one (thanks @nihakue, #713)
  • ArcadePhysics.Body.phase is checked in postUpdate to prevent it from being called multiple times in a single frame.
  • Group.setProperty will now check if the property exists before setting it, this applies to Group.setAll and anything else using setProperty internally.
  • QuadTree.retrieve now checks to see if the given Sprite has a body before carrying on.
  • ArcadePhysics.collideSpriteVsGroup checks if Sprite has a body before carrying on, now safely skips sub-groups or other non-Sprite group children.
  • Group.remove now checks the child to see if it's a member of the root Group before removing it, otherwise Pixi throws an Error.
  • The Emitter no longer checks if minParticleScale = maxParticleScale for the scale check, allowing for fixed scale particles again.
  • The PIXI.AbstractFilter is now included in the Phaser Pixi build by default, allowing for easier use of external Pixi Filters.
  • All Game Objects have a new property: destroyPhase (boolean) which is true if the object is in the process of being destroyed, otherwise false.
  • If Tween.yoyo was true but repeat was 0 then it wouldn't yoyo. Now if yoyo is set, but not repeat, the repeat count gets set to 1 (thanks @hilts-vaughan, fix #744)
  • RandomDataGenerator.integerInRange uses a new method of rounding the value to an integer to avoid distribution probability issues (thanks PhaserFan)
  • Updated the Device little / big endianess check.
  • Time has been updated so that physicsElapsed can never be zero (falls back to 1/60), also fixes p2 elapsed time bug (thanks @georgiee, fix #758)
  • Input and Pointer now use the new ArrayList instead of a LinkedList, which resolve list item removable during callback issues.
  • Input.reset no longer resets every interactive item it knows of, because they are removed during the destroy phase and can now persist between States if needed.
  • Blank Tilemaps no longer create null tiles, but instead create Tile objects with an index of -1 which can be replaced and updated like any other tile.
  • Tilemap.addTilesetImage will now raise a console.warn if you specify an invalid tileset key and not create the tileset rather than pick the default set.
  • Math.smoothstep and Math.smootherstep have been updated to work regardless if a is > or < b (thanks @gre, fix #772)
  • Text.updateText now sets the lineCap to round to avoid occassional font glitching issues in Chrome.
  • Loader now uses XDomainRequest in IE9 to load JSON data to help with CORS issues.

New Features

  • New Phaser Project Template specifically for requireJS in the resources/Project Templates folder (many thanks @ashatch)
  • Loader now has an onFileStart event you can listen for (thanks @codevinsky, #705)
  • Group.classType allows you to change the type of object that Group.create or createMultiple makes from Phaser.Sprite to your own custom class.
  • Timer.clearPendingEvents will purge any events marked for deletion, this is run automatically at the start of the update loop.
  • Device.crosswalk detects if your game is running under Intels Crosswalk XDK.
  • Keyboard.reset has a new hard parameter which controls the severity of the reset. A soft reset doesn't remove any callbacks or event listeners.
  • Key.reset has a new hard parameter which controls the severity of the reset. A soft reset doesn't remove any callbacks or event listeners.
  • InputManager.resetLocked - If the Input Manager has been reset locked then all calls made to InputManager.reset, such as from a State change, are ignored.
  • Group.resetCursor will reset the Group cursor back to the start of the group, or to the given index value.
  • World.wrap will take a game object and if its x/y coordinates fall outside of the world bounds it will be repositioned on the opposite side, for a wrap-around effect.
  • Device.support32bit is a new boolean that sets if the context supports 32bit pixel manipulation using array buffer views or not.
  • P2.World now has its own pause and resume methods, so you can pause the physics simulation independent of your game (thanks @georgiee)
  • Phaser.ArrayList is a new iterative object, similar in principal to a set data structure, but operating on a single array without modifying the object structure.
  • Add scaleMode params to FilterTexture and RenderTexture (pixi.js update by @giraluna)
  • Your State can now have a pauseUpdate method, which is called constantly when the game is paused.
  • Timer.timeCap is a new setting allowing your Timers to protect against unexpectedly large delta timers (such as raf de-vis or CPU grind).
  • Camera.unfollow allows you to easily unfollow a tracked object (thanks @alvinsight, #755)
  • Animation.setFrame allows you to set the animation to a specific frame (thanks @adamholdenyall, #706)
  • Point.dot - get the dot product of two Point objects.
  • Point.cross - get the cross product of two Point objects.
  • Point.cross - get the cross product of two Point objects.
  • Point.perp - make the Point perpendicular (90 degrees rotation)
  • Point.rperp - make the Point perpendicular (-90 degrees rotation)
  • Point.normalRightHand - Right-hand normalize (make unit length) a Point.
  • Point.angle - Returns the angle between this Point object and another object with public x and y properties.
  • Point.angleSq - Returns the angle squared between this Point object and another object with public x and y properties.
  • Point.getMagnitudeSq - Calculates the length squared of the Point object.
  • Point.project - Project two Points onto another Point.
  • Point.projectUnit - Project two Points onto a Point of unit length.
  • Point.multiplyAdd - Adds two 2D Points together and multiplies the result by the given scalar.
  • Point.negative - Creates a negative Point.
  • Point.interpolate - Interpolates the two given Points, based on the f value (between 0 and 1) and returns a new Point.
  • Color.packPixel packs an rgb component into a single integer.
  • Color.unpackPixel unpacks an integer into a color object.
  • Color.fromRGBA converts an integer in 0xRRGGBBAA format to a color object.
  • Color.toRGBA converts rgba components into a 32-bit integer.
  • Color.RGBtoHSL converts an rgb color into hsl (hue, saturation, lightness)
  • Color.HSLtoRGB converts hsl values into an rgb color object.
  • Color.RGBtoHSV converts an rgb color into hsv (hue, saturation, value)
  • Color.HSVtoRGB converts an hsv value into an rgb color object.
  • Color.createColor - creates the new light-weight color object used by most Color conversion methods.
  • Color.updateColor - updates an existing color object to update the rgba property.
  • Color.RGBtoString converts an rgba color into a # or 0x color string.
  • Color.HSVColorWheel will return an array with 360 color objects for each segment of an HSV color wheel, you can optionally set the saturation and value amounts.
  • Color.HSLColorWheel will return an array with 360 color objects for each segment of an HSL color wheel, you can optionally set the saturation and lightness amounts.
  • BitmapData.cls clears the current context.
  • BitmapData.fill fills the context with the given color.
  • BitmapData.processPixelRGB lets you perform a custom callback on every pixel in the BitmapData by passing the pixels color object to your callback.
  • BitmapData.processPixel lets you perform a custom callback on every pixel in the BitmapData by passing the pixels color value to your callback.
  • BitmapData.replaceRGB will scan the bitmap for a specific color and replace it with the new given one.
  • BitmapData.setHSL sets the hue, saturation and lightness values on every pixel in the given region, or the whole BitmapData if no region was specified.
  • BitmapData.shiftHSL shifts the hue, saturation and lightness values on every pixel in the given region, or the whole BitmapData if no region was specified.
  • BitmapData.extract scans this BitmapData for all pixels matching the given r,g,b values and then draws them into the given destination BitmapData.
  • BitmapData.circle draws a filled Circle to the BitmapData at the given x, y coordinates and radius in size.

Bug Fixes

  • The main Timer loop could incorrectly remove a TimerEvent if a new one was added specifically during an event callback (thanks @garyyeap, fix #710)
  • Fixed the use of the destroy parameter in Group.removeAll and related functions (thanks @AnderbergE, fix #717)
  • P2.World.convertTilemap now correctly checks the collides parameter of the tiles as it converts them.
  • Animation.destroy didn't correctly clear the onStart, onLoop and onComplete signals.
  • StateManager.restart incorrectly skipped the first additional parameter after clearCache (thanks @mariusbrn, fix #722)
  • Line.angle and Math.angleBetween used Math.atan2 arguments in the wrong order (thanks @jotson, fix #724)
  • Group.destroy checks parent before removing (thanks @clark-stevenson, fix #733)
  • Fixed typo in P2.World.setMaterial (thanks @OpherV, fix #739)
  • InputHandler._setHandCursor private var wasn't properly set, meaning the hand cursor could sometimes remain (during destroy sequence for example)
  • Destroying an object with an input handler during its onDown event would throw Signals dispatch errors (thanks @jflowers45, fix #746)
  • Circle.distance used an incorrect M...
Read more