Richard Davey
604da9ebc8
TS defs fix #2754
2016-09-26 21:28:43 +01:00
Richard Davey
9b78f3ae7f
Docs update.
2016-09-26 20:56:31 +01:00
Richard Davey
6f67744276
Docs update.
2016-09-26 20:45:46 +01:00
Richard Davey
6402554b68
Docs update.
2016-09-21 23:17:38 +01:00
Richard Davey
31592b98f1
The P2 Physics library has been updated to 0.7.1. This is still quite out of date, but as soon as they release their latest build (hopefully soon) we'll update to that.
2016-09-21 23:16:14 +01:00
Richard Davey
fb1ea7a01e
Updated documentation.
2016-09-21 22:59:20 +01:00
Richard Davey
6aff35b5fd
Frame.rotationDirection
has been removed. It isn't needed, as modern texture packers only rotate 90 degrees clockwise anyway, and Phaser only supports this rotation direction.
2016-09-21 22:53:30 +01:00
Richard Davey
ed13db65d3
Docs update.
2016-09-20 02:00:05 +01:00
Richard Davey
b0ce81bec0
Multiple Batched Texture support is now available. This is a WebGL feature that can seriously decrease the volume of draw calls made in complex, or asset heavy, games. To enable it you can either use the new renderer type Phaser.WEBGL_MULTI
, or you can pass the property multiTexture: true
in a Phaser.Game configuration object. Once enabled, it cannot be disabled.
...
`game.renderer.setTexturePriority` is the method that goes with the Multiple Texture support. It takes an array as its single argument. The array consists of Phaser.Cache image key strings. Phaser will then try to batch as many of the textures as it can, depending on the hardware limits. If for example the GPU can only batch 8 textures, and you provide an array of 16, then only the first 8 in the array will be batched.
2016-09-19 23:31:32 +01:00
Richard Davey
b1473c55b9
Defs update #2737
2016-09-08 01:46:54 +01:00
Richard Davey
17f8181338
Defs update #2747
2016-09-08 01:44:53 +01:00
Richard Davey
c42c447bfb
Weapon.multiFire is a new property that allows you to set a Weapon as being allowed to call fire
as many times as you like, per game loop. This allows a single Weapon instance to fire multiple bullets.
...
Weapon.fire has two new arguments: `offsetX` and `offsetY`. If the bullet is fired from a tracked Sprite or Pointer, or the `from` argument is set, this applies a horizontal and vertical offset from the launch position.
Weapon.fireOffset attempts to fire a single Bullet from a tracked Sprite or Pointer, but applies an offset to the position first. This is a shorter form of calling `Weapon.fire` and passing in the offset arguments.
Weapon.fireMany attempts to fire multiple bullets from the positions defined in the given array. If you provide a `from` argument, or if there is a tracked Sprite or Pointer, then the positions are treated as __offsets__ from the given objects position. If `from` is undefined, and there is no tracked object, then the bullets are fired from the given positions, as they exist in the world.
2016-09-08 01:42:19 +01:00
Richard Davey
ec29511f42
Docs update.
2016-09-07 23:23:47 +01:00
Richard Davey
fb524d351b
Docs update.
2016-09-07 23:23:47 +01:00
Richard Davey
7f7a355686
Preparing for Phaser 3.0.0 dev.
2016-08-26 02:20:05 +01:00
Richard Davey
dd39f9ab08
Updated TS defs.
2016-08-26 01:24:15 +01:00
photonstorm
94a0dbe547
Text.updateText now sets Text.dirty = false
, which stops Text objects from having updateText
called twice on them after creation.
2016-08-25 14:16:48 +01:00
photonstorm
19dbd8bba8
The Weapon.fireRateVariance property was never taken into account internally. It's now applied to the firing rate correctly (thanks @noseglid #2715 )
2016-08-25 13:31:43 +01:00
photonstorm
2409499b4d
Docs update.
2016-08-25 13:07:42 +01:00
Richard Davey
08809217cd
Docs update.
2016-08-23 09:42:19 +01:00
photonstorm
cbef6d6648
Formatting fix.
2016-08-22 18:38:40 +01:00
photonstorm
7b9c4114b2
Preparing for 2.6.2 release.
2016-08-22 12:31:02 +01:00
Richard Davey
19342fa3af
ArcadePhysics Body.rotation now reads its initial value from sprite.angle instead of sprite.rotation. The property was immediately replaced with the correct value in Body.preUpdate regardless, but it keeps it consistent (thanks @samme #2708 )
2016-08-21 10:27:58 +01:00
photonstorm
4382944a2e
A tinted Texture in Canvas mode wouldn't be updated properly if it was also cropped, beyond the initial crop. Now a cropped texture will re-tint itself every time the crop is updated, and has changed (thanks @phoenixyjll #2688 )
2016-08-18 15:55:13 +01:00
photonstorm
04e70e820c
Updated KeyCode docs placement #2653
2016-08-18 15:35:43 +01:00
Richard Davey
129a652f07
Docs update.
2016-08-17 00:38:52 +01:00
Richard Davey
8d69d0e2e8
Docs update.
2016-08-17 00:38:52 +01:00
Richard Davey
63ce6ae6c4
Defs update #2689
2016-08-16 21:01:41 +01:00
Richard Davey
a0c6ae6c51
Phaser.Image now has the ScaleMinMax component.
2016-08-03 05:00:09 +01:00
Richard Davey
e955cf4222
Sound.play would throw the error "Uncaught DOMException: Failed to execute 'disconnect' on 'AudioNode': the given destination is not connected." in Chrome, if you tried to play an audio marker that didn't exist, while a valid marker was already playing.
2016-08-03 04:04:22 +01:00
Richard Davey
688752c5de
Math.getShortestAngle will return the shortest angle between the two given angles. Angles are in the range -180 to 180, which is what Sprite.angle
uses. So you can happily feed this method two sprite angles, and get the shortest angle back between them ( #2494 )
2016-07-29 03:39:51 +01:00
photonstorm
f246c276cb
Multi-Texture support has now been built into our version of Pixi. This can offer dramatic performance increases in WebGL games on GPUs that support multiple texture bindings (which is most of them these days).
...
WebGLRenderer.setTexturePriority is the method used to set the priority of textures when the GPU supports multi-texture batching.
Rope has two new properties `textureIndices` and `textureIndex` to handle multi-texture support.
Strip has two new properties `textureIndices` and `textureIndex` to handle multi-texture support.
The following shaders have all been updated to support multi-textures: `ComplexPrimitiveShader`, `PixiFastShader`, `PixiShader`, `PrimitiveShader`, `StripShader`.
WebGLFastSpriteBatch.vertSize was increased from 10 to 11.
BaseTexture.textureIndex is a new property that controls the index of the texture within the GPU texture cache. Usually you don't change this yourself, and use `renderer.setTexturePriority` instead, but the property is public and available for more advanced use-cases.
CanvasRenderer.setTexturePriority is an empty function, but included to allow you to simply call `game.renderer.setTexturePriority` without first having to wrap that in a WebGL check.
2016-07-26 14:56:12 +01:00
photonstorm
dfaf0b99dd
Merge branch 'multitexture-gl' into dev
2016-07-26 14:47:26 +01:00
photonstorm
86affde81b
The file pixi/utils/Polyk.js has been removed, as it was no longer used with Pixi or Phaser (we replaced it with EarCut a while ago)
2016-07-26 14:30:06 +01:00
Richard Davey
19e609185a
Math.rotateToAngle takes two angles (in radians), and an interpolation value, and returns a new angle, based on the shortest rotational distance between the two.
2016-07-25 00:39:38 +01:00
Richard Davey
b69cae4206
The methods setStageReference
and removeStageReference
have been removed from all Pixi classes. Objects no longer have stage
properties, or references to the Stage object. This is because no reference to the Stage is required for any calculations, and Phaser can only have 1 Stage, so adding and removing references to it were superfluous actions.
2016-07-23 14:31:17 +01:00
Richard Davey
ce764e098d
As a result of changes in #2573 Graphics objects were calling updateLocalBounds
on any shape change, which could cause dramatic performances drops in Graphics heavy situations ( #2618 ). Graphics objects now have a new flag _boundsDirty
which is used to detect if the bounds have been invalidated, i.e. by a Graphics being cleared or drawn to. If this is set to true then updateLocalBounds
is called once in the postUpdate
method (thanks @pengchuan #2618 )
2016-07-23 12:52:35 +01:00
Richard Davey
3d2cb3f8b3
Docs update.
2016-07-23 12:28:16 +01:00
Richard Davey
75272974e9
The Emitter.makeParticles collide
argument didn't work, as a result of #2661 , but is now properly respected thanks to that change (thanks @samme #2662 )
2016-07-23 10:08:34 +01:00
Richard Davey
6947057427
The property checkCollision.none
in the ArcadePhysics.Body class was available, but never used internally. It is now used and checked by the separate
method. By setting checkCollision.none = true
you can disable all collision and overlap checks on a Body, but still retain its motion updates (thanks @samme #2661 )
2016-07-23 10:01:38 +01:00
Richard Davey
46c20ab00a
The property checkCollision.none
has been removed from the ArcadePhysics.Body class. It was never used internally, so lead to confusion about its use. To disable a body, use body.enable = false
(thanks @samme #2661 )
2016-07-23 09:43:01 +01:00
photonstorm
9fb27b6fe2
Moving all the getTiles calls back again, as it's just a bit TOO API breaking to move them, for the sake of a few KB.
2016-07-22 14:05:35 +01:00
Richard Davey
91b9513e7e
TilemapLayer.getTileX, getTileY and getTileXY all now required a Phaser.TilemapLayer (or Phaser.TilemapLayerGL) as the first argument.
...
Tilemap.getRayCastTiles now requires a Phaser.TilemapLayer (or Phaser.TilemapLayerGL) as the first argument.
Tilemap.getTiles now requires a Phaser.TilemapLayer (or Phaser.TilemapLayerGL) as the first argument.
2016-07-22 04:10:55 +01:00
Richard Davey
020cb01056
Canvas tilemap renderer fixes.
2016-07-22 03:55:21 +01:00
Richard Davey
be92e41366
The private methods TilemapLayer._fixX
, _unfixX
, _fixY
and _unfixY
have been moved to `Tilemap.
2016-07-22 03:20:56 +01:00
Richard Davey
ef9f53e350
TilemapLayer.getRayCastTiles has been moved to Tilemap.getRayCastTiles.
...
TilemapLayer.rayStepRate has been moved to Tilemap.rayStepRate.
TilemapLayer.getTiles has been moved to Tilemap.getTiles.
2016-07-22 03:03:50 +01:00
Richard Davey
9eff79f2c2
Phaser.Tileset has a new property lastgid
which is populated automatically by the TilemapParser when importing Tiled map data, or can be set manually if building your own tileset.
2016-07-22 02:35:33 +01:00
Richard Davey
79e135087f
ScaleManager.hasPhaserSetFullScreen is a new boolean that identifies if the browser is in full screen mode or not, and if Phaser was the one that requested it. As it's possible to enter full screen mode outside of Phaser, and it then gets confused about what bounding parent to use.
2016-07-21 02:11:16 +01:00
Richard Davey
cff28860fa
The Loader.headers object has a new property requestedWith
. By default this is set to false
, but it can be used to set the X-Requested-With
header to XMLHttpRequest
(or any other value you need). To enable this do this.load.headers.requestedWith = 'XMLHttpRequest'
before adding anything to the Loader #2398
2016-07-20 12:45:11 +01:00
Richard Davey
60b8d78ab8
Group.align updates.
2016-07-20 12:29:30 +01:00
Richard Davey
0e24b1b946
Docs update.
2016-07-20 12:21:16 +01:00
Richard Davey
b8429b683e
Docs update.
2016-07-20 12:21:16 +01:00
Richard Davey
418c87ea1a
Weapon.autofire wouldn't fire after the first bullet, or until fire
was called, neither of which are requirements. If you now set this boolean the Weapon will fire continuously until you toggle it back to false (thanks @alverLopez #2647 )
2016-07-20 11:52:48 +01:00
Richard Davey
1e181fa30d
Tidying up new Tilemap classes.
2016-07-18 23:24:49 +01:00
Richard Davey
d3e460567b
Updated config to handle WebGL Tilemap renderer for testing.
2016-07-18 23:05:03 +01:00
Richard Davey
b405570833
Docs fix #2624
2016-07-17 11:26:09 +01:00
Richard Davey
6f9bcae23e
Docs fixes #2629
2016-07-17 11:23:41 +01:00
Richard Davey
265501b4af
The src/system folder has been removed and all files relocated to the src/utils folder. This doesn't change anything from an API point of view, but did change the grunt build scripts slightly.
2016-07-11 22:38:09 +01:00
photonstorm
9b4bb1bdd8
Group.getRandomExists will return a random child from the Group that has exists set to true.
...
Group.getAll will return all children in the Group, or a section of the Group, with the optional ability to test if the child has a property matching the given value or not.
Group.iterate has a new `returnType`: `RETURN_ALL`. This allows you to return all children that pass the iteration test in an array.
2016-07-11 17:05:42 +01:00
photonstorm
1467eb48cf
A Group with inputEnableChildren
set would re-start the Input Handler on a Sprite, even if that handler had been disabled previously.
2016-07-11 14:17:51 +01:00
photonstorm
9aef9b741c
Preparing for 2.6.2 dev.
2016-07-11 10:30:09 +01:00
photonstorm
1572a5313a
README update.
2016-07-11 10:11:09 +01:00
photonstorm
ac2516f5aa
2.6.1 Release.
2016-07-11 10:07:56 +01:00
Richard Davey
cfb2b813ef
Fixed Uncaught TypeError: Cannot set property 'x' of undefined
in Body.js (thanks @ErwanErwan #2607 )
2016-07-08 18:54:00 +01:00
photonstorm
aaa9f0d61a
Preparing for 2.6.1 dev.
2016-07-08 16:18:59 +01:00
photonstorm
fced3f86ec
Phaser 2.6.0 Release.
2016-07-08 15:46:26 +01:00
photonstorm
8a8fa0297d
Preparing for release.
2016-07-08 14:26:31 +01:00
photonstorm
61ce14f332
P2.World.clear will now clear out the World.walls property, resetting all of the wall bounds to null
. This allows the walls to be re-created accurately when the P2 World is reset, which happens on a State change or restart (thanks @ewpolly1 @codermua #2574 )
2016-07-08 13:02:58 +01:00
photonstorm
521a6c9dbb
Sound.stop will check to see if gainNode
exists before trying to disconnect from it.
2016-07-08 12:27:12 +01:00
photonstorm
dfd9203e0a
onWorldBounds now sends the bounds it collided with.
2016-07-08 11:28:45 +01:00
Richard Davey
0014201917
Groups now have the following properties, which are getters and setters: centerX
, centerY
, left
, right
, top
and bottom
. These calculate the bounds of the Group, based on all visible children, and then allow you to apply positioning based on that. This means you can, for example, now get the horizontal center of a Group by called Group.centerX
. These properties are also setters, so you can position the Groups, and it will take scale and rotation into consideration.
...
Groups have a new method `alignIn`. It allows you to align the Group within another Game Object, or a Rectangle. You can specify one of 9 positions which are the new position constants such as: `Phaser.TOP_LEFT` or `Phaser.CENTER` (see docs for the complete list). The Groups are positioned based on their child bounds, which takes rotation and scaling into consideration. You can easily place Groups into the corners of the screen, or game world, or align them within other Sprites, using this method.
Groups have a new method `alignTo`. It allows you to align a Group to the side of another Game Object, or a Rectangle. You can specify one of 11 positions which are the new position constants such as: `Phaser.TOP_LEFT` or `Phaser.LEFT_BOTTOM` (see docs for the complete list). The Groups are positioned based on their child bounds, which takes rotation and scaling into consideration. You can easily align Groups next to other Sprites using this method.
2016-07-08 01:33:42 +01:00
Richard Davey
c0ba439e82
ArcadePhysics.Body.onCollide is a new Signal that is dispatched whenever the Body collides with another Body. Due to the potentially high volume of signals this could create it is disabled by default. To use this feature set this property to a Phaser.Signal: sprite.body.onCollide = new Phaser.Signal()
and it will be called when a collision happens, passing two arguments: the sprites which collided.
...
ArcadePhysics.Body.onOverlap is a new Signal that is dispatched whenever the Body overlaps with another Body. Due to the potentially high volume of signals this could create it is disabled by default. To use this feature set this property to a Phaser.Signal: `sprite.body.onOverlap = new Phaser.Signal()` and it will be called when an overlap happens, passing two arguments: the sprites which collided.
2016-07-07 23:16:18 +01:00
Richard Davey
6ba3c9401f
ArcadePhysics.Body.setCircle is a new method that allows you to define an Arcade Physics Body as being a circle instead of a rectangle. You can control the radius of the body and the offset from the parent sprite.
...
ArcadePhysics.World.separateCircle is a new method that handles all circular body collisions internally within Arcade Physics (thanks @VitaZheltyakov)
All of the Arcade Physics internal methods, such as `collideGroupVsSelf`, `collideSpriteVsSprite` and so on, have been updated to work with circular body shapes (thanks @VitaZheltyakov)
ArcadePhysics.Body.onWorldBounds is a new Signal that is dispatched whenever the Body collides with the world bounds, something that was previously difficult to detect. Due to the potentially high volume of signals this could create it is disabled by default. To use this feature set this property to a Phaser.Signal: `sprite.body.onWorldBounds = new Phaser.Signal()` and it will be called when a collision happens, passing one argument: the sprite on which it occurred.
2016-07-07 21:58:39 +01:00
Richard Davey
d93019e86b
Moved to 2.6.0
2016-07-06 22:40:00 +01:00
Richard Davey
63158a1dbf
Argument swapped for destroyBaseTexture
.
2016-07-06 22:31:26 +01:00
Richard Davey
1b4d0330bf
TypeScript updates.
2016-07-06 22:19:17 +01:00
Richard Davey
c4d7870a31
* PIXI.Texture.fromImage, PIXI.BaseTexture.fromImage and PIXI.Sprite.fromImage have all been removed. They should never have actually been used, as they bypass the Phaser Loader, and don't factor in CORs or any other advanced loader settings.
...
* The PIXI.BaseTexture.imageUrl property has been removed, as it was never actually populated.
* The PIXI.BaseTexture._UID property has been removed, as it was never actually used internally.
* All references to PIXI.BaseTextureCache have been removed (primarily from BaseTexture.destroy and Texture.destroy), as the BaseTextureCache was never used internally by Phaser, or by our custom version of Pixi.
* PIXI.TextureCache has been removed. It was only ever used by the __default and __missing images that Phaser generates on start-up. It wasn't used internally by Phaser anywhere else, and the only references Pixi has to it have all been removed. If you need it in your own game, please refactor it to avoid it, or re-create the object on the PIXI global object.
* Canvases created by `BaseTexture.fromCanvas` no longer have the `_pixiId` property attached to them, as this was never used internally by Phaser or Pixi.
* PIXI.BaseTexture.updateSourceImage is now deprecated. Please use `Sprite.loadTexture` instead.
* The property PIXI.BaseTextureCacheIdGenerator has been removed, as it is no longer used internally by Phaser or Pixi.
* PIXI.Texture.addTextureToCache has been removed. The PIXI Texture Cache was never actually used by Phaser, and was leading to complications internally.
* PIXI.Texture.removeTextureFromCache has been removed. The PIXI Texture Cache was never actually used by Phaser, and was leading to complications internally.
* PIXI.Texture.fromFrame and PIXI.Sprite.fromFrame have been removed. They relied on the PIXI Texture Cache, which was never actually used by Phaser, and was never used internally by Pixi either.
* The property PIXI.TextureCacheIdGenerator has been removed, as it was not used internally.
* The property PIXI.FrameCache has been removed, as it was not used internally.
2016-07-06 21:47:27 +01:00
Richard Davey
3642ff0489
Phaser.Color.toABGR converts RGBA components to a 32 bit integer in AABBGGRR format.
2016-07-04 18:50:42 +01:00
photonstorm
e08e0861d0
Phaser.ArrayUtils.rotate is now deprecated. Please use Phaser.ArrayUtils.rotateLeft instead.
2016-07-04 13:09:36 +01:00
photonstorm
cb0861d881
The canvas created by Phaser.Debug for use when displaying debug data is no longer stored in the CanvasPool, and is instead a stand-alone canvas, free from ever being re-used by another game object.
2016-07-04 12:56:52 +01:00
photonstorm
4066a8d8d8
All Pixi.Graphics methods that change the Graphics, i.e. drawShape
, lineTo
, arc
, etc will now all automatically call Graphics.updateLocalBounds
. This is so that the bounds of the Graphics object are kept updated, allowing you to scale and rotate the Graphics object and still obtain correct dimensions from it (thanks @kelu-smiley #2573 )
2016-06-29 16:18:54 +01:00
Richard Davey
fdcbb9229b
Phaser.ArrayUtils.shift is the opposite of ArrayUtils.rotate. It takes an array, removes the element from the end of the array, and inserts it at the start, shifting everything else 1 space in the process.
2016-06-29 02:08:42 +01:00
Richard Davey
1f570b49e8
Phaser.Utils.pad now calls toString
on the input given, which means you can pass in common data typs such as numbers and have them padded and returned as strings.
2016-06-29 00:04:22 +01:00
Richard Davey
fbd1ba05f7
Phaser.Utils.reverseString will take the given string, reverse it, and then return it.
2016-06-27 22:43:53 +01:00
Richard Davey
a0c771d47e
Text.setText has a new optional argument immediate
which will re-create the texture immediately upon call, rather than wait for the next render pass to do so (thanks @Scraft #2594 )
2016-06-27 22:42:01 +01:00
photonstorm
b24de1e561
Polygon.contains would only work with non-flattened Polygon objects. It now works with both flat and non-flat Polygons.
...
Graphics objects enabled for input would fail to do anything if a Phaser Polygon was given to the Graphics object (which it was in nearly all cases), as it wouldn't detect input correctly with flattened polygons (thanks @symbiane #2591 )
2016-06-27 14:51:25 +01:00
Richard Davey
5e38f83627
Docs update.
2016-06-21 22:21:40 +01:00
Richard Davey
2bd4f68ea0
Small tweaks to #2577 and TS defs.
2016-06-21 22:18:09 +01:00
Richard Davey
50434375a1
Tidy up formatting for #2585
2016-06-21 22:00:59 +01:00
photonstorm
e39cd584bf
The start of the PIXI re-documentation process. Time to remove the old YUIdoc syntax, and replace with JSDoc and more meaningful descriptions.
2016-06-20 15:50:51 +01:00
photonstorm
d119ffa539
Removed PIXI.DisplayObject.prototype._renderWebGL
and PIXI.DisplayObject.prototype._renderCanvas
as both were only there for ancient jshint tests.
2016-06-20 14:10:21 +01:00
photonstorm
2310e5dc6f
Sound.volume was accidentally repeated twice in the source (thanks @LoneStranger #2569 )
2016-06-20 12:18:39 +01:00
photonstorm
697a2ae94e
Fixed issue in Group.align where the cell wouldn't increase if rows
was great than -1
2016-06-17 15:28:39 +01:00
Richard Davey
effb975a25
Preparing for 2.5.1 development.
2016-06-17 13:11:48 +01:00
photonstorm
be0f50b23e
Preparing for 2.4.10 development.
2016-06-17 03:05:14 +01:00
photonstorm
47f0224a40
Phaser 2.4.9 release.
2016-06-17 01:11:24 +01:00
photonstorm
4da3b15ae2
Renamed alignTo to alignIn, and added the new method alignTo, to allow for Sprite to Sprite alignment. Updated all of the Bounds and TS defs.
2016-06-16 17:01:51 +01:00
photonstorm
5bcf84f5a4
Added offsetX and offsetY arguments to Bounds.alignTo.
2016-06-16 15:51:12 +01:00
photonstorm
966a9f8b47
Docs update.
2016-06-16 14:31:26 +01:00
photonstorm
3d626d22db
Docs update.
2016-06-16 14:13:37 +01:00
photonstorm
06ac2cf921
Docs.
2016-06-16 13:25:46 +01:00
photonstorm
963678b65b
Docs update.
2016-06-16 12:40:04 +01:00
photonstorm
964e2db7da
Docs update.
2016-06-16 12:33:09 +01:00
photonstorm
04237f88bd
Readme update.
2016-06-16 12:27:36 +01:00
photonstorm
5ca134d328
Readme update.
2016-06-16 12:22:42 +01:00
photonstorm
f64558c4ac
Readme update.
2016-06-16 12:14:27 +01:00
Richard Davey
853d770764
Group.align is a new method that allows you to layout all the children of the Group in a grid formation. You can specify the dimensions of the grid, including the width, height and cell size. You can also control where children are positioned within each grid cell. The grid width and height values can also be set to -1, making them fluid, so the grid expands until all children are aligned. Finally an optional child index argument can be set. This is a great way to quickly and comprehensively align Group children, and has lots of use cases.
2016-06-16 02:50:24 +01:00
Richard Davey
ed8fbd9a6c
All Game Objects with the Bounds component; which includes Sprites, Images, Text, BitmapText, TileSprites and anything that extend these, now have a new method alignTo
. It allows you to align the Game Object to another Game Object, or a Rectangle. You can specify one of 9 positions which are the new constants: Phaser.TOP_LEFT
, Phaser.TOP_CENTER
and so on (see above for the complete list). The Game Objects are positioned based on their Bounds, which takes rotation, scaling and anchor into consideration. You can easily place Sprites into the corners or the screen or game world, or align them against other Sprites, using this method.
2016-06-16 02:00:46 +01:00
Richard Davey
0efcf68b21
The Game Object Bounds component has been updated to include two new properties: centerX
and centerY
. This means you can, for example, now get the horizontal center of a Sprite by called Sprite.centerX
. These properties are also setters, so you can position the Game Objects, and it will take scale and anchor into consideration.
2016-06-16 01:00:11 +01:00
Richard Davey
123e61c018
The Game Object Bounds component has been updated so that it now provides setters for all of the properties, as well as getters. Previously Sprite.left
, Sprite.right
, Sprite.top
and Sprite.bottom
were read-only, but they are now available to be set as well, and take into consideration the anchor and scale of the Game Objects.
2016-06-16 00:33:48 +01:00
Richard Davey
d67e902760
Rectangle.getPoint is a new method that returns a point based on the given location constant, such as Phaser.BOTTOM_LEFT
. It returns the same result as calling Rectangle.bottomLeft
(etc) but unlike those getters you are able to provide your own Point object.
2016-06-15 23:39:15 +01:00
Richard Davey
64a44aab17
Added the following new constants: Phaser.TOP_LEFT
, Phaser.TOP_CENTER
, Phaser.TOP_RIGHT
, Phaser.MIDDLE_LEFT
, Phaser.MIDDLE_CENTER
, Phaser.MIDDLE_RIGHT
, Phaser.BOTTOM_LEFT
, Phaser.BOTTOM_CENTER
and Phaser.BOTTOM_RIGHT
.
2016-06-15 23:37:48 +01:00
Richard Davey
32cf1f1a9c
Group.createMultiple can now accept Arrays for both the key
and frame
arguments. This allows you to create multiple sprites using each key and/or frame in the arrays, which is a great and quick way to build diverse Groups. See the JSDocs for complete details and code examples.
2016-06-15 22:36:23 +01:00
photonstorm
bc00c900e9
BitmapData.smoothProperty is a new property that holds the string based prefix needed to set image scaling on the BitmapData context.
...
BitmapData.copyTransform allows you to draw a Game Object to the BitmapData, using its `worldTransform` property to control the location, scaling and rotation of the object. You can optionally provide
BitmapData.drawGroup now uses the new `copyTransform` method, to provide for far more accurate results. Previously nested Game Objects wouldn't render correctly, nor would Sprites added via `addChild` to another Sprite. BitmapText objects also rendered without rotation taken into account, and the Sprites smoothing property was ignored. All of these things are now covered by the new drawGroup method, which also handles full deep iteration down the display list.
2016-06-14 15:29:56 +01:00
photonstorm
ad3641830d
Phaser.Matrix if passed a 0 value would consider it falsy, and replace it with the default by mistake. It now checks if the arguments are undefined
or null
and only then sets the defaults (thanks mmcs)
2016-06-14 12:18:23 +01:00
photonstorm
1a3b06a9f4
The DisplayObject.worldRotation
value didn't sign the wt.c
value correctly, meaning the rotation would be wrong.
...
The `DisplayObject.worldScale` value didn't multiply the local objects scale into the calculation, meaning the value wasn't a true representation of the objects world scale.
2016-06-13 17:01:03 +01:00
photonstorm
0880380ea9
Phaser 2.4.9 RC4.
2016-06-10 16:22:54 +01:00
Richard Davey
cd8bb5a216
Removed keyCode modifier ( #2542 )
2016-06-09 22:03:09 +01:00
photonstorm
88f47e2497
Keyboard now uses a new internal method getKeyCode
to normalize the key code value based on browser support. It first checks for event.key
, then event.keyIdentifier
and finally event.keyCode
(thanks @SVasilev #2542 )
2016-06-09 16:37:32 +01:00
photonstorm
a65f9c7e4b
Group.onChildInputDown is a new Signal that you can listen to. It will be dispatched whenever any immediate child of the Group emits an onInputDown
signal itself. This allows you to listen for a Signal from the Group, rather than every Sprite within it.
...
Group.onChildInputUp is a new Signal that you can listen to. It will be dispatched whenever any immediate child of the Group emits an `onInputUp` signal itself. This allows you to listen for a Signal from the Group, rather than every Sprite within it.
Group.onChildInputOver is a new Signal that you can listen to. It will be dispatched whenever any immediate child of the Group emits an `onInputOver` signal itself. This allows you to listen for a Signal from the Group, rather than every Sprite within it.
Group.onChildInputOut is a new Signal that you can listen to. It will be dispatched whenever any immediate child of the Group emits an `onInputOut` signal itself. This allows you to listen for a Signal from the Group, rather than every Sprite within it.
2016-06-09 16:19:11 +01:00
photonstorm
99aeae5e4d
Docs update.
2016-06-09 14:58:41 +01:00
photonstorm
e8e7e27184
The DisplayObject.renderOrderID
used to run in reverse. I.e. in a display list with 10 sprites on it, the first sprite (at the bottom of the list, rendering behind all the others) would have a renderOrderID
of 9, where-as the top-most sprite, rendering above all others, would have a renderOrderID
of 0. While this didn't cause any side-effects internally, it's arguably illogical. So the process has been reversed, and renderOrderID
s are now accumulative, starting at zero each frame, and increasing as it iterates down the display list. So the higher the ID, the more "on-top" of the output the object is.
...
`InputHandler.validForInput` and `Pointer.processInteractiveObjects` have been updated to reflect the new `renderOrderID` sequence (see above).
2016-06-09 12:32:37 +01:00
photonstorm
e5c4f7729d
Docs update.
2016-06-09 11:37:01 +01:00
Richard Davey
1956d3584e
InputHandler.dragStopBlocksInputUp is a boolean that allows you to control what happens with the input events. If false
(the default) then both the onInputUp
and onDragStop
events will get dispatched when a Sprite stops being dragged. If true
then only the onDragStop
event is dispatched, and the onInputUp
is skipped.
2016-06-07 02:21:12 +01:00
Richard Davey
df92c45420
There are two new Phaser consts available, for help with orientation of games or Game Objects. They are Phaser.HORIZONTAL
, Phaser.VERTICAL
, Phaser.LANDSCAPE
and Phaser.PORTRAIT
.
2016-06-07 01:45:33 +01:00
Richard Davey
66b846cbdb
InputHandler.dragDistanceThreshold gives you more fine control over when a Sprite Drag event will start. It allows you to specify a distance, in pixels, that the pointer must have moved before the drag will begin.
...
InputHandler.dragTimeThreshold gives you more fine control over when a Sprite Drag event will start. It allows you to specify a time, in ms that the pointer must have been held down for, before the drag will begin.
InputHandler.downPoint is a new Point object that contains the coordinates of the Pointer when it was first pressed down on the Sprite.
2016-06-07 01:28:06 +01:00
photonstorm
5492ed0d64
Docs update.
2016-06-06 11:15:38 +01:00
Richard Davey
de3d749385
Farthest swapped for the more common Furthest.
2016-06-05 23:01:00 +01:00
Richard Davey
56759f46fd
Docs update.
2016-06-05 21:23:13 +01:00
photonstorm
61f064dfe9
Docs update.
2016-06-03 16:45:47 +01:00
photonstorm
93b1f3eba1
Math.between will return a value between the given min
and max
values.
2016-06-03 16:18:35 +01:00
photonstorm
ee6f277b31
PluginManager.remove has a new argument destroy
(defaults to true
) which will let you optionally called the destroy
method of the Plugin being removed.
2016-06-03 15:52:17 +01:00
photonstorm
0da7cf5ffd
There are a bunch of new Phaser consts available to help with setting the angle of a Game Object. They are Phaser.ANGLE_UP
, ANGLE_DOWN
, ANGLE_LEFT
, ANGLE_RIGHT
, ANGLE_NORTH_EAST
, ANGLE_NORTH_WEST
, ANGLE_SOUTH_EAST
and ANGLE_SOUTH_WEST
.
2016-06-03 15:19:18 +01:00
photonstorm
96711f4db9
Added the Weapon Plugin and worked lots on its docs.
2016-06-03 15:09:43 +01:00
photonstorm
9ae43757b9
Group.removeAll has a new argument destroyTexture
which allows you to optionally destroy the BaseTexture of each child, as it is removed from the Group (thanks @stoneman1 #2487 )
2016-06-03 13:11:03 +01:00
photonstorm
84c60d4e87
Within RequestAnimationFrame both updateRAF
and updateSetTimeout
now only call game.update
if isRunning
is true. This should avoid asynchronous Game destroy errors under environments like Angular (thanks @flogvit #2521 )
2016-06-03 13:00:45 +01:00
Richard Davey
097add1aa6
Game Objects including Sprite, Image, Particle, TilemapLayer, Text, BitmapText and TileSprite have a new property called data
. This is an empty Object that Phaser will never touch internally, but your own code, or Phaser Plugins, can store Game Object specific data within it. This allows you to associate data with a Game Object without having to pollute or change its class shape.
2016-06-03 01:08:32 +01:00
Richard Davey
1d5ff625b2
Docs update.
2016-06-02 22:45:35 +01:00
photonstorm
68c29470cf
The way the display list updates and Camera movements are handled has been completely revamped, which should result is significantly smoother motion when the Camera is following tweened or physics controlled sprites. The Stage.postUpdate
function is now vastly reduced in complexity. It takes control over updating the display list (calling updateTransform
on itself), rather than letting the Canvas or WebGL renderers do this. Because of this change, the Camera.updateTarget
function uses the Sprites worldPosition
property instead, which is now frame accurate (thanks @whig @Upperfoot @Whoisnt @hexus #2482 )
2016-06-02 16:38:21 +01:00
photonstorm
87529ee39e
Docs update.
2016-06-02 15:46:16 +01:00
photonstorm
63a1336bd5
Sound.addMarker now has a default value for the duration
argument (1 second) to avoid the DOM Exception 11 error if you accidentally miss it out (thanks @mari8i #2508 )
2016-06-02 15:29:51 +01:00
photonstorm
21b5492e98
Video.onComplete wouldn't fire on iOS if the user hit the 'Done' button before the video had finished playing. It now uses the webkitendfullscreen
event to detect this, and dispatches the onComplete
signal should that event fire (thanks @kelu-smiley #2498 )
2016-06-02 15:26:11 +01:00
photonstorm
97905e0021
Docs update.
2016-06-02 15:02:44 +01:00
photonstorm
07ef075e92
Phaser.Line.intersectsRectangle checks for intersection between a Line and a Rectangle, or any Rectangle-like object such as a Sprite or Body.
2016-05-24 02:30:00 +01:00
photonstorm
9b9e398c73
InputHandler.checkPointerDown had an incorrect single pipe character |, instead of an OR check ||, and an isDown
check, causing Button Over events to fail (thanks @pengchuan #2486 )
2016-05-23 13:03:11 +01:00
photonstorm
09dd84565e
Arcade Physics Body incorrectly positioned if the Sprite had a negative scale (see http://www.html5gamedevs.com/topic/22695-247-248-body-anchoring-any-migration-tips/ ) (thanks @SBCGames @icameron @Nuuf @EvolViper #2488 #2490 )
2016-05-23 12:46:01 +01:00
photonstorm
7844ad927c
Preparing for 2.4.9 dev.
2016-05-23 12:32:37 +01:00
photonstorm
d1234d1685
Preparing for 2.5.0 dev.
2016-05-19 13:45:51 +01:00
photonstorm
9f28d0659d
Phaser 2.4.8 release.
2016-05-19 12:36:51 +01:00
photonstorm
a6a2c61240
Sprites that had a tint on them, that then had their frame changed via either Sprite.frame
or Sprite.frameName
wouldn't re-tint the new frame, and would become stuck on the old frame in Canvas mode (thaks @spayton #2453 )
2016-05-17 21:04:40 +01:00
photonstorm
d161a7f6bc
Sounds played using the Audio tag, set to loop, would get caught in an endless pause-play loop cycle (thanks @rroylance #2473 )
2016-05-17 16:43:11 +01:00
photonstorm
54683b7fb2
Sounds played using the Audio tag, that were paused and then resumed again (either directly in code, or via a game pause event) would not resume from the point at which they paused (thanks @rroylance #2473 )
2016-05-16 15:16:19 +01:00
photonstorm
02e8b1ae0a
If you set Game.renderType to Phaser.HEADLESS
it will no longer render the output to the canvas. The canvas is still created (although not added to the DOM), as it's required internally, but no rendering now takes place on it (thanks @ForgeableSum #2464 )
2016-05-16 14:53:11 +01:00
photonstorm
ac89d1aec7
Arcade Physics Body has a new property worldBounce
. This controls the elasticity of the Body specifically when colliding with the World bounds. By default this property is null
, in which case Body.bounce is used instead. Set this property to a Phaser.Point object in order to enable a World bounds specific bounce value (thanks @VitaZheltyakov #2465 )
2016-05-16 13:53:12 +01:00
photonstorm
f9994fac75
Fixed a bug in Arcade Physics Body.preUpdate which would incorrectly apply the position of an offset Body (one which has had Body.setSize used on it) when combined with a Sprite with a non-zero anchor (thanks @SBCGames #2470 )
2016-05-16 13:39:46 +01:00
photonstorm
19dce62734
Arcade Physics has had a new world
argument added to the following functions: distanceBetween
, distanceToXY
, distanceToPointer
, angleBetween
, angleToXY
and angleToPointer
. The argument (which is false by default), when enabled will calculate the angles or distances based on the Game Objects world
property, instead of its x
and y
properties. This allows it to work for objects that are placed in offset Groups, or are children of other display objects (thanks @Skeptron for the thread #2463 )
2016-05-16 13:31:57 +01:00
photonstorm
a26bd55811
TS defs fix #2475
2016-05-16 13:03:48 +01:00
photonstorm
4fd2524c61
Text.setStyle has a new argument update
which will optionally automatically call updateText
after setting the new style (thanks @staff0rd #2478 )
2016-05-16 12:55:27 +01:00
photonstorm
f34b567295
BitmapData.copy, and by extension any method that uses it, including BitmapData.draw, drawGroup and drawFull, now all support drawing RenderTexture objects. These can either be passed directly, or be the textures of Sprites, such as from a call to generateTexture.
2016-05-12 03:48:14 +01:00
photonstorm
94832677b9
Docs update.
2016-05-11 16:39:39 +01:00
photonstorm
9649f714bb
InputHandler.checkPointerDown and checkPointerOver will now test the worldTransform scale property of a Sprite. If zero it will fast return, where-as before it would incorrectly report an up event (thanks @jaapaurelio #2466 )
2016-05-11 12:25:35 +01:00
photonstorm
a2ba13e33f
Docs update.
2016-05-11 11:27:36 +01:00
photonstorm
16203a378a
PIXI.defaultRenderer is now set to null
in Game.destroy, allowing it to be reset if a new Game instance is created on the same page (thanks @xtforgame ##2474)
2016-05-11 11:27:36 +01:00
Morton Fox
e125696ccd
Update link to CONTRIBUTING.md
2016-05-07 00:43:13 -04:00
photonstorm
b008fc7216
Readme update.
2016-04-28 00:18:08 +01:00
photonstorm
16378713b4
JSDocs update ( #249 )
2016-04-27 12:57:41 +01:00
photonstorm
f494c867c7
Fixed an issue in the Arcade Physics overlap method where it would only detect overlaps up to the max bias threshold and no further (thanks @rgk #2441 )
...
The Arcade Physics overlap method would return false if two bodies were overlapping but neither had any velocity (i.e. they were embedded into each other)
2016-04-25 11:38:51 +01:00
photonstorm
620b95e510
Updated docs and TS defs re: #2443
2016-04-23 04:36:47 +01:00
photonstorm
6bc93de7a5
Preparing for 2.4.8 dev.
2016-04-23 04:32:47 +01:00
photonstorm
a29cc64932
Phaser 2.4.7 Final.
2016-04-22 15:15:28 +01:00
photonstorm
b441ee315f
Docs update.
2016-04-22 11:56:06 +01:00
photonstorm
7d9c817373
Dragging a Sprite while the camera was moving would slowly cause the Sprite position to become out of sync the further the camera moved. A Sprite being dragged now tracks the camera position during the drag update and adjusts accordingly (thanks @jeroenverfallie #1044 )
2016-04-19 01:54:24 +01:00
photonstorm
628dd1c420
P2.Body.offset is now used and applied to the Sprite position during rendering. The values given are normal pixel values, and offset the P2 Body from the center of the Sprite (thanks @Mourtz #2430 )
2016-04-18 20:57:41 +01:00
photonstorm
a2d145a43d
When the Loader loads audio via the Audio tag, instead of Web Audio, it used to use Phaser.GAMES[_this.game.id].load
as the callback handler, which would stop it from working if you had multiple Loaders set-up within Phaser. It now uses a local reference to _this
instead (thanks @SBCGames #2435 )
2016-04-18 16:44:28 +01:00
photonstorm
257a22b170
When loading Video with the asBlob
argument set it now uses a 'blob' type for the XHR loader, and doesn't cast the resulting file as a Blob upon load. This fixes loading videos as blobs on Chrome for Android (thanks @JuCarr #2433 )
2016-04-18 16:17:27 +01:00
photonstorm
41add1b4bf
Phaser 2.4.7 RC1.
2016-04-14 13:23:44 +01:00
photonstorm
aad499b025
Tidying up the code base for 2.4.7.
2016-04-14 12:43:10 +01:00
photonstorm
5221bfd5da
You can now pass in your own Canvas element to Phaser and it will use that instead of creating one itself. To do so you must pass a Game Configuration object to Phaser when you instantiate it, and set the canvas
property of the config object to be the DOM element you wish to use, i.e.: { canvas: document.getElementById('yourCanvas') }
(thanks @Friksel #2311 )
2016-04-14 11:57:10 +01:00
photonstorm
48ff74b718
Text update.
2016-04-14 11:48:08 +01:00
photonstorm
150e443875
Docs update to include browserify info #2424
2016-04-13 16:05:03 +01:00
photonstorm
1f8e352b7c
Docs update.
2016-04-13 15:44:21 +01:00
photonstorm
a6528aa9fc
Docs fix.
2016-04-13 15:44:21 +01:00
photonstorm
d04a6ec402
Docs update.
2016-04-12 02:21:02 +01:00
photonstorm
f4277efc20
Alternative snooker-ball like collision test.
2016-04-11 16:43:17 +01:00
photonstorm
7102a34706
Camera.flash is a new function that makes the camera 'flash' over the top of your game. It works by filling the game with the solid fill color specified, and then fading it away to alpha 0 over the duration given. This is great for things like hit effects. You can listen for the Camera.onflashComplete Signal.
...
Camera.fade is a new function that makes the camera fade to the color given, over the course of the duration specified. This is great for things like transitioning from one State to another. You can listen for the Camera.onFadeComplete Signal.
Camera.resetFX resets any active FX, such as a fade or flash and immediately clears it. Useful to calling after a fade in order to remove the fade from the Stage.
Phaser.Camera.ENABLE_FX is a const that controls if the Camera FX are available or not. It's `true` by default, but if you set it to `false` before boot then it won't create the Graphics object required to process the effects.
2016-04-09 04:05:07 +01:00
photonstorm
2ea94c83e6
Camera.shake is a new function that creates a camera shake effect. You can specify the intensity, duration and direction of the effect. You can also set if it should shake the camera out of bounds or not.
2016-04-09 02:57:16 +01:00
photonstorm
dba84d5931
Camera has a new property: lerp
. This is a Point object, that allows you to control the amount of horizontal and vertical smoothing to be applied to the camera when it tracks a Sprite. It works both with and without deadzones, and is turned off by default. Set it to low values such as 0.1 for really smooth motion tracking (thanks to @WombatTurkey for the idea of adding this)
2016-04-09 01:07:19 +01:00
photonstorm
cc5361dd6d
World.separate has been optimized to cut down on the number of calls to intersect
from 3 calls per Game Object collision check, to 2. So if you were colliding 50 sprites it will reduce the call count from 150 to 100 per frame. It also reduces the calls made to seperateX
and seperateY
by the same factor.
...
Two immovable bodies would never set their overlap data, even if an overlap only check was being made. As this is useful data to have this has been changed. Two immovable bodies will still never separate from each other, but they _will_ have their `overlapX` and `overlapY` properties calculated now.
2016-04-07 18:04:45 +01:00
photonstorm
50e126f59e
* Body has two new properties: left
and top
. These are the same as Body.x
and Body.y
but allow you to pass the Body to geometry level functions such as Circle.contains.
...
* Body.setCircle allows you to define a Body as using a circle to collide with instead of a rectangle. You can set the radius of the collision circle and an offset.
* Body.render now renders both circle and rectangle body shapes to the Debug canvas.
* World.intersects has been updated to support both circle and rectangle body shapes, and supports quick-paths for circle vs. circle and rect vs. rect checks.
* World.circleBodyIntersects is a new method that checks for intersection between a Body that has been defined as a circle, and a normal rectangle based Body. This is used internally by World.intersects, but exposed for direct calls as well.
2016-04-07 17:01:16 +01:00
photonstorm
b9f62e77e6
You can now pass a TilemapLayer as a Texture to a TileSprite. A limitation of this is that if you pass it to a TileSprite it will make a fill pattern from the TilemapLayer at that instant it's passed, and it won't keep track of the layer in future should it update (thanks @jdnichollsc #1989 )
2016-04-07 03:45:21 +01:00
photonstorm
e5ceb7e9bc
P2.World.setBounds has been re-written completely. If the World is resized it no longer removes the P2 body instances and re-creates them. Instead it checks to see which walls are required and then just moves the position of the shapes instead, or updates them, or creates or destroys them as required. This is far more efficnent, especially in a game which see's a lot of world bounds changes (i.e. resizes responsively in browser)
2016-04-07 01:56:42 +01:00
photonstorm
5c261821fe
P2.World.updateBoundsCollisionGroup didn't set the _boundsOwnGroup
private var, meaning the World.setBounds
method wasn't able to restore previously set collision masks automatically (thanks @jmp909 #2183 )
2016-04-07 01:25:52 +01:00
photonstorm
4d5a037ae5
P2.World.updateBoundsCollisionGroup wouldn't use the boundsCollisionGroup
mask if you passed true
as the argument, only if it was left undefined.
2016-04-07 01:18:19 +01:00
photonstorm
787111c12c
A Game Object with fixedToCamera = true
that was then set for Input, and enabled for dragging from its center (input.enableDrag(true)
) would throw an error upon being dragged (thanks @solusipse #2367 )
2016-04-07 00:44:53 +01:00
photonstorm
fc7b5c79e3
Graphics objects can now have a Physics Body directly attached to them, where-as before it would throw an error due to a lack of anchor property (thanks @NLilley #2400 )
2016-04-07 00:14:41 +01:00
photonstorm
896b32a28c
SoundManager.muteOnPause is a new boolean that allows you to control if the Sound system gets muted automatically when a Phaser game pauses, such as when it loses focus. You may need to set this to false
if you wish to control the audio system from outside of your Phaser game, i.e. from DOM buttons or similar ( #2382 )
2016-04-06 02:09:22 +01:00
photonstorm
61bc4a8dca
Sound.play when using an AudioTag would ignore the muted state of the SoundManager and play regardless. It now checks the SoundManager.mute state on play, and sets the volume accorindingly (thanks @brianbunch #2139 )
2016-04-06 01:41:54 +01:00
photonstorm
03ea59940c
Docs update.
2016-04-06 01:29:16 +01:00
photonstorm
988290631f
When setting a global volume for the SoundManager it would previously incorrectly calculate the volumes of AudioTag based Sound objects that were not played at volume 1. The new approach uses Sound.updateGlobalVolume which adjusts the Sound volume to be a percentage of the global volume. So if the global volume is 0.5 and the Sound volume is 0.5, the Sound will play with an actual volume of 0.25 (thanks @VitaZheltyakov #2325 )
2016-04-06 01:19:32 +01:00
photonstorm
4d69b13977
Passing a BitmapData to a TileSprite as a texture would fail if the BitmapData had not been previously added to the cache. It now uses the new frameData property (thanks @mzamateo @lucap86 #2380 )
2016-04-06 00:44:55 +01:00