Commit graph

3839 commits

Author SHA1 Message Date
Richard Davey
3590272c51 All Game Objects have a new boolean property called pendingDestroy. If you set this to true then the object will automatically destroy itself in the *next* logic update, rather than immediately. This is useful for cases when you wish to destroy an object from within one of its own callbacks, such as with buttons or other input events (thanks @alamboley #1748) 2015-07-08 18:52:01 +01:00
photonstorm
1b5da312d0 RandomDataGenerator.weightedPick has been tweaked slightly to allow for a more even distribution of weights. It still favors the earlier array elements, but will accurately include 'distance' elements as well (thanks @gingerbeardman #1751) 2015-07-08 17:20:36 +01:00
photonstorm
87ac0b8f50 jsdoc tweak. 2015-07-08 16:40:40 +01:00
photonstorm
64b1794d67 Rope.segments used the wrong vertices property, causing a runtime error.
Debug.ropeSegments didn't take the scale of the Rope object into consideration, causing incorrect debug rendering.
2015-07-08 16:40:26 +01:00
photonstorm
47e1d16a6d jshint fix. 2015-07-08 16:00:03 +01:00
photonstorm
b9dcf74726 If the device is detected as a Windows Phone the renderer is automatically set to use Canvas, even if WebGL or AUTO was requested (thanks @ramarro123 #1706) 2015-07-08 15:25:52 +01:00
photonstorm
0f31358724 Device.windowsPhone should now correctly identify Windows Phone 8.1 devices, which also think they are iOS and Androids. If you find a device that gets around this check please send us its ua string! (thanks @jounii #1496) 2015-07-08 15:22:32 +01:00
photonstorm
f48d038db3 Lots of jsdoc updates (#1644) 2015-07-08 15:10:41 +01:00
photonstorm
1281bc52d7 Setting the scaleMode property of a Game configuration object would cause a ScaleManager TypeError in the resize method. It now stores the scale mode locally and applies it after boot (thanks @Mickawesomesque #1534) 2015-07-08 14:52:20 +01:00
photonstorm
3012e49937 Text.addColor would incorrectly color the text stroke if set (thanks @llevkin #1893
Text.addStrokeColor works in the same way as `Text.addColor` but allows you to define a color stop for the stroke color instead of the fill color.
2015-07-08 12:52:39 +01:00
Richard Davey
86cac2085c BitmapData.move(x, y) allows you to shift the contents of the BitmapData horizontally and vertically by the given amounts. The image wraps-around the edges of the BitmapData.
BitmapData.moveH(distance) allows you to horizontally shift the BitmapData with wrap-around the edges.

BitmapData.moveV(distance) allows you to vertically shift the BitmapData with wrap-around the edges.
2015-07-08 04:26:28 +01:00
Richard Davey
a7e18137d1 Text has a new style property: tabs. This allows you to specify a pixel value (or values) that allows you to space out text that contains tab characters within it. Text.tabs can be either an integer, in which case all tabs share the same spacing, or an array of pixel values corresponding exactly to the number of tabs per line of text. This allows you to easily align columns of data in a single Text object. 2015-07-08 01:15:31 +01:00
Richard Davey
3066f60f11 parseList support added. 2015-07-08 00:03:03 +01:00
Richard Davey
2e447ec01d Tidied up tab handling a little. 2015-07-07 23:41:37 +01:00
Richard Davey
ae08b9ac02 Text tab support working. Now to add varying tab sizing. 2015-07-07 23:31:44 +01:00
Richard Davey
b8cc4d9d53 Updated Text resolution handling. 2015-07-07 20:48:00 +01:00
photonstorm
a19479d948 jsdocs update. 2015-07-07 16:58:41 +01:00
photonstorm
157df30696 Pointer button handling has been given an overhaul. It has the following new boolean properties: leftButton, rightButton, middleButton, backButton, forwardButton and eraserButton. So you can now easily check which buttons are active and build right or middle click support into your games. The Pointer object normalises these properties for you, regardless if they came from a MouseEvent or PointerEvent (thanks @youssefdetovernickr for the idea #1848) 2015-07-07 16:53:56 +01:00
photonstorm
9548fb9856 Final textBounds updates. 2015-07-07 15:16:23 +01:00
Richard Davey
3f7f9986b6 Merge pull request #1891 from clark-stevenson/dev
Handful of updates.  Fixes #1877 thanks @sanchopancho13
2015-07-07 11:25:01 +01:00
Clark Stevenson
86c8704cd4 Handful of updates. Fixes #1877 thanks @sanchopancho13 2015-07-07 08:48:20 +01:00
Richard Davey
92f2742a26 When reusing a Tween created with an array of properties the values would get exponentially added to the TweenData internal array each time the tween was re-run (thanks @SBCGames #1747) 2015-07-07 04:21:55 +01:00
Richard Davey
6a9fd4de8d Debug.currentAlpha wasn't being used to set the alpha of the Debug context at all (was always set to 1) but now updates the alpha of the Debug context before anything is rendered to it (thanks @wayfu #1888) 2015-07-07 03:32:11 +01:00
Richard Davey
06658fa1e0 TilemapLayer.resize allows you to resize a TilemapLayer. It will update the internal canvas object and corresponding texture dimensions (#1881) 2015-07-07 03:27:28 +01:00
Richard Davey
8aaa8de985 Fixed issue with tilesets not updating correctly. 2015-07-07 02:38:14 +01:00
Richard Davey
a1f618f54f Debugging tileset issue. 2015-07-07 02:18:53 +01:00
Richard Davey
f57d3c19e9 P2.Body.createGroupCallback incorrectly referenced the _groupCallbackContext when deleting it (thanks @Langerz82 #1886) 2015-07-07 01:24:26 +01:00
Richard Davey
9886232fff Merge pull request #1890 from standardgaussian/issue1885
Issue #1885:
2015-07-07 01:21:25 +01:00
Standard Gaussian
a556dfdc69 Issue #1885: P2.enableBody now checks if an anchor exists on target object before attempting to set its value 2015-07-05 22:39:15 +01:00
photonstorm
8919e4e128 Trying out resize method. 2015-07-02 17:19:57 +01:00
photonstorm
ab092c5c14 Keyboard.addKeys is a practical way to create an object containing user selected hotkeys. For example: addKeys( [Phaser.Keyboard.W, Phaser.Keyboard.S, Phaser.Keyboard.A, Phaser.Keyboard.D], [ 'up', 'down', 'left', 'right' ] ); would return an object containing the properties up, down, left and right that you could poll just like a Phaser.Key object. (thanks @Mourtz #1857) 2015-07-02 14:15:06 +01:00
Richard Davey
755a247e31 Merge pull request #1857 from Mourtz/master
Implemented Keyboard.AddKeys function.
2015-07-02 13:54:18 +01:00
photonstorm
698167a596 Tiled Image Collection support is now available and has been added to the TilemapParser and Tilemap classes (thanks @asyed94 #1879) 2015-07-02 13:53:02 +01:00
Richard Davey
1f76340563 Merge pull request #1879 from asyed94/dev
Implemented Tiled Image Collection support.
2015-07-02 13:43:06 +01:00
photonstorm
a89d48b9a6 Text.autoRound allows you to control if the text is allowed to render at sub-pixel coordinates or not. Set to true to round the coordinates, often eliminating anti-aliasing from certain font types (#1867) 2015-07-02 13:39:59 +01:00
photonstorm
ce405acb02 jsdoc update #1864 2015-07-02 13:31:26 +01:00
photonstorm
29f9eeabc6 RenderTexture now takes the display objects alpha into consideration when rendering it, before it would always reset worldAlpha to 1 before rendering, thus ignoring any alpha that may be set. 2015-07-02 13:28:44 +01:00
Richard Davey
76292cb87a Merge pull request #1869 from clark-stevenson/dev
Updated TypeScript Definitions
2015-07-02 13:28:40 +01:00
Richard Davey
2b7666e22d Added toString to the constructor parameter. 2015-07-01 23:37:48 +01:00
asyed94
6771c656e9 Removed trailing whitespace. 2015-06-29 16:32:16 -05:00
asyed94
8fefabcf59 Implemented Tiled Image Collection support.
Created class ImageCollection.js to internally handle Image Collection
data.

Added imagecollections member to Tilemap.js to access parsed Image
Collection data.

Added ability to parse Image Collections from Tiled json data to
TilemapParser.js
2015-06-27 15:30:26 -05:00
photonstorm
8356aacaa8 Trying out new Text pivot and mute handling. 2015-06-24 19:57:40 +01:00
photonstorm
1ed33cb06c Setting mute to false on Sound that was never muted caused its volume to be set to zero (thanks @brianbunch #1870) 2015-06-24 15:54:25 +01:00
Clark Stevenson
7ac7501a29 Updated TypeScript Definitions 2015-06-23 21:50:27 +01:00
Richard Davey
5f2b2df3d4 Yuma :) 2015-06-22 00:31:54 +01:00
photonstorm
a69c156526 The Text Bounds is a rectangular region that allows you to align your text within it, regardless of the number of lines of text or position within the world. For example in an 800x600 sized game if you set the textBounds to be 0,0,800,600 and text alignment to 'left' and vertical alignment to 'bottom' then the text will render in the bottom-right hand corner of the game, regardless of the size of font you're using or the number of lines in the text itself.
Set the Style properties `boundsAlignH` and `boundsAlignV` or adjust them via the Text setters to change the alignment.

It works by calculating the final position based on the Text.canvas size, which is modified as the text is updated. Some fonts have additional padding around them which you can mitigate by tweaking the Text.padding property.

Setting a textBounds _doesn't_ update the wordWrapWidth, so be aware of the relationship between the two.

Call this method with nothing defined for any of the parameters to reset an existing textBounds.

#1824
2015-06-17 17:18:04 +01:00
photonstorm
0258245f12 Phaser.Text no longer extends PIXI.Text but replaces it entirely. Phaser.Text now natively extends a Phaser Sprite, meaning it can be enabled for physics, damaged, etc. 2015-06-17 13:21:28 +01:00
photonstorm
102c74e121 Deprecated the following:
* Camera.screenView
* ScaleManager.maxIterations
* ScaleManager.enterPortrait (see onOrientationChange)
* ScaleManager.enterLandscape (see onOrientationChange)
* ScaleManager.enterFullScreen (see onFullScreenChange)
* ScaleManager.leaveFullScreen (see onFullScreenChange)
* ScaleManager.fullScreenFailed (see onFullScreenError)
* ScaleManager.checkResize
* ScaleManager.checkOrientation
* ScaleManager.setScreenSize (see updateLayout)
* ScaleManager.setSize (see reflowCanvas)
* ScaleManager.checkOrientationState (see reflowCanvas)
* ScaleManager.orientation (see screenOrientation)
* Gamepad.disabled (see enabled)
* Input.currentPointers (see totalActivePointers)
* Input.disabled (see enabled)
* Keyboard.disabled (see enabled)
* Mouse.disabled (see enabled)
* Mouse.mouseMoveCallback (see Input.addMoveCallback)
* MSPointer.disabled (see enabled)
* Touch.disabled (see enabled)
* Cache.getUrl (see getURL)
* Math.truncate (see Math.trunc)
* Math.snapToInArray (see Phaser.ArrayUtils.findClosest)
* Math.interpolateFloat (see Math.linear)
* Math.normalizeLatitude (use Phaser.Math.clamp(lat, -90, 90))
* Math.normalizeLongitude (use Phaser.Math.wrap(lng, -180, 180))
* Math.chanceRoll (use Phaser.Utils.chanceRoll)
* Math.numberArray (use Phaser.ArrayUtils.numberArray)
* Math.numberArrayStep (use Phaser.ArrayUtils.numberArrayStep)
* Math.limitValue (use Phaser.Math.clamp)
* Math.randomSign (use Phaser.Utils.randomChoice(-1, 1))
* Math.angleLimit (use Phaser.Math.clamp)
* Math.getRandom (use Phaser.ArrayUtils.getRandomItem)
* Math.removeRandom (use Phaser.ArrayUtils.removeRandomItem)
* Math.floor (use Math.trunc)
* Math.ceil (use Phaser.Math.roundAwayFromZero)
* Math.shift (use Phaser.ArrayUtils.rotate)
* Math.shuffleArray (use Phaser.ArrayUtils.shuffle)
* Math.distanceRounded (do the rounding locally)
* Canvas.getOffset (see Phaser.DOM.getOffset)
* Canvas.getAspectRatio (see Phaser.DOM.getAspectRatio)
* TilemapLayer.tileColor (use TilemapLayer.debugSettings.missingImageFill)
* Phaser.ArrayList alias removed, now use Phaser.ArraySet
* Utils.transposeArray (see Phaser.ArrayUtils.transposeMatrix)
* Utils.rotateArray (see Phaser.ArrayUtils.rotateMatrix)
* Utils.shuffle (see Phaser.ArrayUtils.shuffle)
2015-06-17 03:14:31 +01:00
photonstorm
8cf28fede7 maxHealth is a new property that Game Objects with the Health component receive and works in combination with the heal method to ensure a health limit cap. 2015-06-17 02:00:04 +01:00
photonstorm
b725c25702 Button game objects now have Input.useHandCursor set to true by default. 2015-06-17 01:55:36 +01:00