Commit graph

275 commits

Author SHA1 Message Date
photonstorm
eda4961c06 Math.getNextPowerOfTwo will get the next power of two for the given value.
Math.isPowerOfTwo will return a boolean if the given width and height are a power of two.
2016-09-28 13:48:08 +01:00
photonstorm
bffdb8fbc5 Moved the Canvas tests into the Phaser.Device class. 2016-09-28 13:39:30 +01:00
Richard Davey
1c415a0d7e Cache.addBitmapFontFromAtlas allows you to add a Bitmap Font to the Cache, that is comprised of a frame from a Texture Atlas, and the font data (in JSON or XML format). Once added you can use the Bitmap Font in the same way as you would any Bitmap Font (#2614) 2016-09-27 02:00:31 +01:00
Richard Davey
811c347cc3 Camera.fade has a new argument alpha to control the alpha level of the effect (thanks @rgk #2493)
Camera.flash has a new argument `alpha` to control the alpha level of the effect (thanks @rgk #2493)
2016-09-27 01:07:40 +01:00
Richard Davey
f331697fee Text.splitRegExp is a new property that allows you to control the regular expression that is used to split the text into multiple lines (@dai-shi #1403) 2016-09-26 22:35:54 +01:00
Richard Davey
604da9ebc8 TS defs fix #2754 2016-09-26 21:28:43 +01:00
Richard Davey
de56e37400 Merge pull request #2760 from JTronLabs/dev
Phaser.Math.between fixes & added Phaser.Math.random
2016-09-26 20:55:05 +01:00
Richard Davey
53de7c20f0 Small code tidy + TS defs for #2763 2016-09-26 20:49:35 +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
f3c5b7a0bc TS defs update. 2016-09-20 02:03:00 +01:00
Richard Davey
6fd15ee0e5 Updated TS defs for multi-texture support. 2016-09-20 00:21:24 +01:00
James Lowrey
b41d2453a9 TS defs 2016-09-14 18:34:16 -07: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
Christiano Teixeira
5ef9e8a24b Fixing the return type in typings for BitmapData.getPixel 2016-08-27 15:28:40 -03:00
Richard Davey
dd39f9ab08 Updated TS defs. 2016-08-26 01:24:15 +01:00
James
e90619b40e changed return value of Plugin.Weapon's fire, fireAtXY, fireAtPointer, fireAtSprite to Phaser.Bullet 2016-08-17 18:24:24 -05:00
Richard Davey
63ce6ae6c4 Defs update #2689 2016-08-16 21:01:41 +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
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
Richard Davey
d14250304c Defs update. 2016-07-22 04:19:17 +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
c36babcc1c Code formatting and docs updates. 2016-07-21 10:45:23 +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
60b8d78ab8 Group.align updates. 2016-07-20 12:29:30 +01:00
Richard Davey
bd6c91f924 Merge pull request #2651 from calvindavis/dev
Fixed optional seeds parameter in RandomDataGenerator's constructor.
2016-07-20 12:11:17 +01:00
Calvin Davis
e12e34e56d Fixed optional seeds parameter in RandomDataGenerator's constructor. 2016-07-19 16:18:48 +01:00
Richard Davey
b2c0b3d014 Merge pull request #2641 from calvindavis/dev
Fixed optional alpha parameter in interpolateColor.
2016-07-18 18:22:15 +01:00
Richard Davey
e62257fbed Merge pull request #2640 from Amyantis/physicsGroup_definition_fix
Fix definition of GameObjectFactory.physicsGroup
2016-07-18 18:21:46 +01:00
Calvin Davis
c2d596997c Fixed optional alpha parameter in interpolateColor. 2016-07-18 17:21:02 +01:00
Richard Davey
8d914bece8 Fixed TS defs for weapon.fire. 2016-07-16 07:56:16 +01:00
Amyantis
8b386dbbb1 Fix definition of GameObjectFactory.physicsGroup
Making physicsBodyType optionnal according to http://phaser.io/docs/2.6.1/Phaser.GameObjectFactory.html#physicsGroup
2016-07-12 14:13:57 +02:00
photonstorm
ac2516f5aa 2.6.1 Release. 2016-07-11 10:07:56 +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
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
3642ff0489 Phaser.Color.toABGR converts RGBA components to a 32 bit integer in AABBGGRR format. 2016-07-04 18:50:42 +01:00
photonstorm
0036bf747f BitmapData has a new, optional, fifth argument: skipPool. By default BitmapData objects will ask for the first free canvas found in the CanvasPool, but this behavior can now be customized on a per object basis. 2016-07-04 12:57:08 +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
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
monagames
d5661264d4 Improved typescript definitions 2016-06-25 17:22:56 +02:00
Richard Davey
2bd4f68ea0 Small tweaks to #2577 and TS defs. 2016-06-21 22:18:09 +01:00
Richard Davey
f3ad741614 Merge pull request #2580 from monagames/ts-emitter-missing-prop
Added missing property (particleAnchor) to emitter typescript definitions
2016-06-21 22:04:02 +01:00