Releases: phaserjs/phaser
Amadicia
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 togame.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
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 tourl
andmapData
todata
to keep it consistent with the other Loader methods. - Loader.physics has renamed the
dataURL
parameter tourl
andjsonData
todata
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
. Iffalse
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 totrue
the child will not dispatch itsonAddedToGroup
event. - Group.addAt has a new optional bo...
Tanchico
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
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...
"Allorallen"
Updates
- Updated to Pixi.js 1.5.2
- Updated to p2.js 0.5.0
- Return the result of P2.Body.setCircle for further chaining and manipulation (fix #659)
- Updated the PhysicsEditor plugin to maintain position, radius, mask bits, category bits and sensor flags (thanks @georgiee, #674)
- Further TypeScript defs tweaks (thanks @clark-stevenson)
- Lowered the default size of SpriteBatch from 10000 to 2000 as this yields faster results on mobile (pixi.js update)
- Fix for 'jagged' strokes on custom fonts (thanks @nickryall, #677)
- The State.update function (and thus the update of any sub-classed Sprites or other objects) is now called before Stage, Tweens, Sound, Input, etc (#662)
- The Phaser jshint process is now running on Travis (thanks @xtian, #656)
- The Phaser Gruntfile is now split up into option tasks (thanks @xtian, #638)
- Key.reset now clears any callbacks associated with the onDown and onUp events and nulls the onHoldCallback if set. Key.reset is called by Keyboard.reset when changing state.
- If you pass
null
to Tilemap.putTile as the tile parameter it will pass the call over to Tilemap.removeTile. - TypeScript definitions updated for latest changes (thanks @clark-stevenson)
- Keyboard.stop nulls the function references after removing the event listeners (thanks @bmceldowney, #691)
- Tilemap.hasTile allows for multi-layer type parameter (thanks @Raeven0, #680)
- Grunt update to dev dependencies (thanks @xtian, #695)
- Emitter now emits Phaser.Particle objects instead of Phaser.Sprites, which can be extended as required.
- Emitter has had various local properties removed that were already declared in Phaser.Group which it extends.
- PluginManager parent parameter removed as it's redundant. Also most core functions tidied up and jsdocs fixed.
- p2.World.defaultRestitution has been deprecated and is now p2.World.restitution.
- p2.World.defaultFriction has been deprecated and is now p2.World.friction.
- p2.World now uses 4 bodies for the world boundaries, rather than 1 body with 4 shapes. This stops the bounds triggering narrowphase with every single body in the world.
- p2.World bounds are now included in the callback events such as beginContact and impact events.
- Thanks to @stuff the Classes drop-down list in the API docs now indents the sub-classes.
New Features
- Added ability to retrieve a single p2 fixture from the cache (thanks @georgiee, #674)
- Timers can now have a start delay value (thanks @georgiee, #660)
- CacheAsBitmap added to Display Object, so works for Sprite, Image, Button. Allows you to cache complex display hierarchies for speed.
- CacheAsBitmap added to Graphics Object. Allows you to cache complex graphics structures hierarchies for speed.
- Added generateTexture function to display objects. Create a texture from the current object display hierarchy for use as a texture elsewhere.
- Added optional FilterArea to display object (for optimisation)
- Graphics chaining functions.
- Added Pointer.positionUp which records the last point at which the pointer left the screen (thanks @Cryszon, #676)
- Phaser.Point.centroid static function added to calculate the centroid or midpoint of an array of points (thanks @lewster32, #675)
- SoundManager.remove(sound) now lets you remove a sound from the SoundManager, destroying it in the process.
- Sound.destroy will remove a sound and all local references it holds, optionally removing itself from the SoundManager as well.
- SoundManager.removeByKey(key) will remove all sounds from the SoundManager that have a key matching the given value.
- ArcadePhysics.Body.hitTest(x, y) will return a boolean based on if the given world coordinate are within the Body or not.
- StateManager.restart allows you to quickly restart the current state, optionally clearing the world and cache.
- Tilemap.removeTile(x, y, layer) lets you remove the tile at the given coordinates and updates the collision data.
- Tilemap.removeTileWorldXY lets you remove the tile at the given pixel value coordinates and updates the collision data.
- Key.enabled boolean allows you to toggle if a Key processes its update method or dispatches any events without deleting and re-creating it.
- Emitter now has minParticleAlpha and maxParticleAlpha values for setting a random alpha on emitted particles.
- Emitter.particleAnchor allows you to control the anchor of emitted Particles. Defaults to 0.5 (same as before) but now under your control.
- Emitter.setAlpha allows you to quickly set the min and max alpha values.
- Emitter.setScale allows you to quickly set the min and max scale values.
- Emitter.blendMode lets you set the blendMode of any emitted Particle (needs a browser that supports canvas blend modes)
- Group.customSort allows you to sort the Group children based on your own sort function.
- Emitter.setScale has a new 'rate' parameter which allows particles to change in scale over time, using any Easing value or timescale.
- Emitter.setScale now allows you to scale the x and y axis of the particles independently.
- Emitter.setAlpha has a new 'rate' parameter which allows particles to change alpha over time, using any Easing value or timescale.
- Emitter.bringToTop and Emitter.sendToBack are booleans that let you optionally set the display order of the Particle when emitted.
- Emitter now calls the Phaser.Particle.onEmit function, which is left empty for you to override and add in custom behaviours.
- p2.World has a new contactMaterial property, which can be configured like a normal P2 Contact Material and is applied when two bodies hit that don't have defined materials.
- Group.remove has a new 'destroy' parameter (false by default), which will optionally call destroy on the item removed from the Group.
- Group.removeAll has a new 'destroy' parameter (false by default), which will optionally call destroy on the items removed from the Group.
- Group.removeBetween has a new 'destroy' parameter (false by default), which will optionally call destroy on the items removed from the Group.
- @georgiee created a new P2.FixtureList class to allow easy access the fixtures of a created P2 Body:
This is especially useful in combination with PhysicsEditor and P2.Body#addPhaserPolygon.
You can configure your whole collision grouping in PhysicsEditor and then you can later change the mask bits easily with this class. You can also access parts (groups) and named fixtures by a group index or a fixture key - both properties can be set in PhysicsEditor with the custom phaser exporter.
Use cases:
- Configure collision bits in PhysicsEditor and you want to change them later.
- Place a sensor in your fixture and access this single fixture later (to disable temporarily)
- Create a small body with threes fixtures (circle, circle + polygon/convex). Now you want that the polygon part to behave like rubber and assign a bouncing (restitution > 1) material. Assign a fixture key in PhysicsEditor and access the fixture like this. (see the image for the fixture I described)
Bug Fixes
- If you inputEnable = false a gameobject you couldn't re-enable it again using inputEnable = true, only directly via the handler (thanks @nickrall, fix #673)
- Fixed setTexture bug with TilingSprite (pixi.js 1.5.2 bug fix)
- Fixed anchor point bug in canvas with TilingSprite (pixi.js 1.5.2 bug fix)
- Fixed positionOffset not begin correct in TilingSprite (pixi.js 1.5.2 bug fix)
- Fixed issue where filters were not being applied to TilingSprite (pixi.js 1.5.2 bug fix)
- Fixed SpriteBatch canvas transform bug (pixi.js 1.5.2 bug fix)
- Fixed Cached textures issue when using base64 encoded images (@cacheflowe) (pixi.js 1.5.2 bug fix)
- Fixed issue where visibility was not being respected in sprite batch (pixi.js 1.5.2 bug fix)
- Fixed bug in gl.bindTexture which tried to use an undefined private var. (@photonstorm) (pixi.js 1.5.2 bug fix)
- Fixed the 'short cut' version of Math.floor in setTransform if roundPixels is true. (@photonstorm) (pixi.js 1.5.2 bug fix)
- SoundManager.boot will check to see if the AudioContext was created before carrying on (thanks @keyle, fix #669)
- Fixed bug where move up and move down method in groups did not work (thanks @jonthulu, fix #684)
- Fixed bug in Group.next when cursor is at the last child (thanks @jonthulu, fix #688)
- Emitter.minParticleScale and maxParticleScale wasn't resetting the Body size correctly.
- Group.removeBetween now properly iterates through the children.
- P2.World had a type in the restitution method title. Now fixed.
- Objects with an InputHandler now deactivate it when the object is removed from a Group but not destroyed (fix #672)
- Fixed the vectors used in the BlurX and BlurY filters (thanks @nickryall, fix #668)
p2.js v0.5.0
- Added property .enableIslandSleeping to World.
- Added property .useFrictionGravityOnZeroGravity to World.
- Renamed .useWorldGravityForFrictionApproximation in World to .useWorldGravityAsFrictionGravity to keep things more uniform.
- Sleep improvements.
- Added property .frictionIterations to GSSolver, and removed .skipFrictionIterations.
- Upgraded to gl-matrix 2.1.0.
- Removed QuadTree.
- Removed mat2.
- Added Utils.extend.
- Added methods .setStiffness and .setRelaxation methods to Constraint.
- Removed properties .stiffness, .relaxation and .useGlobalEquationParameters from GSSolver.
- Added methods .setGlobalStiffness, .setGlobalRelaxation, .setGlobalEquationParameters to World.
- Renamed property .eps to .epsilon for Equation.
- Removed property .useBoundingBoxes from NaiveBroadphase in favor of the new property .boundingVolumeType in Broadphase.
- Added methods .getMaxForce and .setMaxForce to LockConstraint.
- Changed property names .bi, .bj, .ni, .ri, .rj to .bodyA, .bodyB, .normalA, .contactPointA, .contactPointB in Equation, ContactEquation and FrictionEquation classes.
- Removed IslandSolver in favor of ...
"Ghealdan"
Bug Fixes
- Sprite would glitch if it had an ArcadePhysics Body that was re-positioned out of loop.
- Sprite would "fly off" if it had an ArcadePhysics Body that was re-positioned during an input handler.
- Tween.generateData would enter an eternal loop if the total resulted in a float. Now wrapped in Math.floor.
- ArcadePhysics.Body preUpdate has been modified to stop Sprites with non-1 scaling from gaining delta and moving off the screen (fix #644).
- ArcadePhysics.Body deltaMaxY wasn't being correctly applied.
- P2.World - Removing tilemap layer retrieval for object layers in convertCollisionObjects() (thanks bmceldowney, fix #653)
- Calling Keyboard.stop() wouldn't let you call Keyboard.start() later on in the same game
Updated
- The "Build your First Phaser Game" Tutorial has been updated for Phaser 2
- Line.fromSprite now sets "fromCenter" to false by default as Sprite.center is deprecated in 2.x. Documentation and Examples updated to reflect this.
- All the documentation has been re-published for 2.0.2.
- Lots of ArcadePhysics.World methods have been marked as private where they shouldn't be called directly (separateX, etc)
- xtian jshint fixed nearly every single file in the repository!
New Features
- Sprite.overlap lets you quickly check to see if the bounds of two display objects are intersecting or not, without having to use a physics system.
- Keyboard.destroy will now clear all event listeners and any custom set callbacks or Keys.
"Lyrelle"
The 2.0.1 release of Phaser is mostly a maintenance release. With 2.0 being such a significant upgrade there were bound to be some issues, and this release addresses them. One of the core things a lot of you kept telling us was that you need Arcade Physics to work pretty much exactly as it did in the past. So in 2.0.1 we've taken ArcadePhysics back another iteration, fixed a few of the most common complaints you had with it, and fixed every single physics example as well.
2.0.1 also brings the TypeScript definitions virtually bang up to date, covering P2 and Ninja physics, Arcade updates and more. Our thanks to Clarke for his continued support of these.
There are a few new features as well including a Phaser export script for PhysicsEditor (found in the resources
folder), updates to the Particle Emitter and device enhancements. As always if you find a bug that you can confirm with a test case, please report it to us via github. If you think you may have found a bug, but aren't quite sure, please post it to the forum first.
"Aes Sedai"
Phaser 2.0.0 is a major upgrade to the Phaser Game Framework. With significant improvements across the whole library it's our biggest and fastest release yet. Please see the README for full details, the Migration Guide for help porting a 1.x game across and our new Examples repository.
Shienar
New Examples:
- Added lovely new little mini golf game by jpcloud.
Updates:
- Loader can now load JSON files natively (thanks lucas)
- TilemapParser now errors if the tileset isn't the right size
Bug Fixes:
- Updated Physics.Body.applyDamping so that velocity is reduced down to zero properly (thanks caezs)
- ArcadePhysics.collideSpriteVsTilemapLayer wouldn't call the process or collide callbacks if only 1 tile was involved in the check (thanks mandarinx)
- Lots of documentation fixes (thanks nhowell)
- Fix for PixiPatch so it renders masks again (thanks georgios)
- Modified ArcadePhysics.intersects so it returns a value as well as asigns (thanks bunnyhero)
- Lots of TypeScript defs fixes (thanks clark)
Saldaea
This 1.1.5 release is released to address issues in 1.1.4 that we didn't want you to have to wait too long for.
- Explicitly paused Timer continues if you un-focus and focus the browser window (thanks georgiee)
- Added TimerEvent.pendingDelete and checks in Timer.update, so that removing an event in a callback no longer throws an exception (thanks georgiee)
- Fixed TypeScript defs on lines 1741-1748 (thanks wombatbuddy)
- Added SAT.js to TypeScript definition. Now compiles properly.
- Added missing Line.js to the Grunt file.
- Tilemap#paste diffX and diffY equations changed, fixed issue #393 (thanks brejep)
- Added missing return value in Body.hitLeft and hitRight, fixes issue #398 (thanks ram64).
- Fixed easing tween example case. Issue #379 (thanks wesleywerner)
- Removed SAT.js UMD wrapped, fixes issue #361 (thanks luizbills)
- Removed inContact check from Body.separate.
- Fixed Tilemap docs (wrongly pointed to Tileset methods)