Commit graph

4997 commits

Author SHA1 Message Date
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
c7225cb3b7 Added Rectangle.getPoint. 2016-06-15 23:40:15 +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
gotenxds
91987eff56 Added some data to image object types. 2016-06-15 13:09:47 +03:00
Richard Davey
2aa2c67e7b Merge pull request #2563 from aaronklaassen/reign-rein
Fix reign/rein in getting started guide
2016-06-15 10:52:20 +01:00
Richard Davey
70be74cb36 Lots of work on Body.moveTo and Body.moveFrom. Now working nicely. 2016-06-15 04:12:47 +01:00
Aaron Klaassen
aacb3436a4 Fix reign/rein typo. 2016-06-14 21:00:06 -05:00
Richard Davey
b5cc01132c Body.move tests. 2016-06-14 23:45:00 +01:00
photonstorm
834a8df99d Fixed concat grunt task so that the Weapon plugin is included. 2016-06-14 15:45:20 +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
189cbf4132 Added exists property. 2016-06-14 15:29:45 +01:00
photonstorm
6383f6b1fb Updated docs. 2016-06-14 15:29:38 +01:00
photonstorm
7817d47a25 Updated Cache docs. 2016-06-14 12:18:32 +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
Richard Davey
7108bc3de3 Merge pull request #2552 from drhayes/dev
Distinguish between Arrays and Objects when cloning in Cache.getJSON.
2016-06-14 11:49:02 +01:00
Richard Davey
c484da3e16 Merge pull request #2561 from danzel/dev
Add Pointer.pointerMode
2016-06-14 11:45:27 +01:00
Dave Leaver
4dde32d746 Add Pointer.pointerMode 2016-06-14 18:02:11 +12:00
photonstorm
fb3f7721cb Working through updating BitmapData.copy to use the source matrix instead, so it retains the correct draw sequence order. 2016-06-13 17:01:33 +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
Pete Baron
6848c90257 Added remaining task summary. 2016-06-14 01:20:43 +12:00
Pete Baron
04980c8096 Remove hack to force WEBGL mode for testing. 2016-06-14 01:02:02 +12:00
Pete Baron
11c5300591 Remove dubious use of tile.index to reference the tilesets list (it seems unlikely that there would ever be a tilesets value for every tile, and a huge waste of memory if it was ever done that way).
TODO: look into putting the tileset index (or a tileset reference) into each Tile structure when building them to avoid resolveTilesets entirely too.
2016-06-14 00:43:46 +12:00
Pete Baron
7533005a62 Fix buffer size bug. 2016-06-14 00:00:18 +12:00
Pete Baron
b406d10d94 Comments, and removed reinitialisation of the glBatch list. 2016-06-13 18:40:51 +12:00
Pete Baron
310b151924 Removed pixiTest flag, using renderType instead. 2016-06-13 18:39:52 +12:00
Pete Baron
a648026fa4 Progress update. 2016-06-13 18:39:16 +12:00
Pete Baron
c7476a6583 Fixed bug where scroll was effectively applied twice. 2016-06-13 18:38:55 +12:00
Pete Baron
446eab60af Progress update. 2016-06-13 17:47:25 +12:00
Pete Baron
05efcfe36e Modified my PIXI.Tilemap class to accept the glBatch list of tile source and destination coordinates, convert them into a GL TRIANGLE_STRIP data buffer, then draw them as a single batch WebGL draw. 2016-06-13 17:28:35 +12:00
Pete Baron
a8405bd066 add comment 2016-06-13 17:26:33 +12:00
Pete Baron
57a6245f25 Made a copy of Phaser.TilemapLayer which instead extends PIXI.Tilemap, then added functions to build a batch list of tile source and destination coordinates (instead of drawing them directly onto a Canvas). This maintains all the existing Phaser functionality in regards to tile map decoding and interpretation, and also provides maximum performance from the PIXI component by using a TRIANGLE_STRIP to render everything as a single batch job. 2016-06-13 17:25:50 +12:00
Pete Baron
94d49f1196 Add GL variant of the Tileset.draw function for new approach to WebGL tile drawing (utilising most of the existing Phaser code unchanged) 2016-06-13 17:13:13 +12:00
David Hayes
346aed2866 Distinguish between Arrays and Objects when cloning in Cache.getJSON.
Fixes #2551.
2016-06-10 10:33:33 -05:00
photonstorm
0880380ea9 Phaser 2.4.9 RC4. 2016-06-10 16:22:54 +01:00
Richard Davey
1daf897b23 Small styling fixes. 2016-06-09 23:27:19 +01:00
Richard Davey
5415d9b603 Stage and Group postUpdate methods iterate the same way now. 2016-06-09 23:14:24 +01:00
Richard Davey
cd8bb5a216 Removed keyCode modifier (#2542) 2016-06-09 22:03:09 +01:00
Richard Davey
57642afc24 Fixed keyboard issue. 2016-06-09 20:55:21 +01:00
photonstorm
28c1a26780 Phaser 2.4.9 RC3. 2016-06-09 17:13:31 +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
2ac594ca03 TypeScript defs update. 2016-06-09 16:29:09 +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
28331c4f7f Comment fix. 2016-06-09 15:37:03 +01:00
photonstorm
458a67251d Fixed input property check. 2016-06-09 15:09:20 +01:00
photonstorm
90e1460320 Added new Debug.displayList function. 2016-06-09 14:58:58 +01:00
photonstorm
99aeae5e4d Docs update. 2016-06-09 14:58:41 +01:00