Commit graph

4558 commits

Author SHA1 Message Date
photonstorm
6cc0a48347 Phaser 2.4.7 RC2. 2016-04-22 14:45:11 +01:00
photonstorm
b441ee315f Docs update. 2016-04-22 11:56:06 +01:00
photonstorm
002d6250a8 Docs update. 2016-04-21 00:48:54 +01:00
Richard Davey
37d7a1161a Merge pull request #2439 from kiswa/dev
Allow debug.line to be used without error TS2346
2016-04-20 14:23:55 +01:00
Matthew Ross
55214fe2df Allow debug.line to be used without error TS2346
When calling debug.line('Any string'); the TypeScript compiler give error TS2346 because there are no parameters in the method definition. This creates a dummy parameter which allows the same functionality without the compiler error.
2016-04-20 09:19:11 -04:00
photonstorm
3d6b1a3b7e Stopped the Camera Shake effect from changing the World position, as it screws up Arcade Physics, Sprite deltas and some input handling. Instead moved the effect to be render applied only. On Canvas it updates the context.setTransform call, and on WebGL the renderSession offset property. 2016-04-19 04:12:58 +01:00
photonstorm
62d135cf1f Small tidy-up. 2016-04-19 03:39:04 +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
41f81d39b7 jsdocs update (and removed isCircle switch) 2016-04-18 16:17:47 +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
ac4acfb912 Removed Arcade Physics Circle support (now in its own branch) ready for 2.4.7 release. 2016-04-14 13:23:28 +01:00
photonstorm
4d8753e9ce Tidying up for 2.4.7. 2016-04-14 12:57:05 +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
Richard Davey
9c972d241e Merge pull request #2429 from lewispollard/dev
Alter BitmapText to use toString on text parameter in constructor
2016-04-13 15:40:15 +01:00
Lewis Pollard
719b4bb7f6 Alter BitmapText to use toString on text parameter in constructor
The BitmapText property accessor for the text property uses toString on the value passed in, meaning Numbers can be passed in as the text value with no problem. However, passing a Number into the constructor results in the following exception as it isn't implicitly converted to a string in a similar manner.

phaser.js:71890 TypeError: text.substr is not a function
    at Phaser.BitmapText.updateText (http://localhost/phaser/build/phaser.js:56283:21)
    at new Phaser.BitmapText (http://localhost/phaser/build/phaser.js:56034:10)
    at Phaser.GameObjectFactory.bitmapText (http://localhost/phaser/build/phaser.js:46318:26)
    at Object.Boot.create (http://localhost/phaser/:46:34)
    at Phaser.StateManager.loadComplete (http://localhost/phaser/build/phaser.js:29240:35)
    at Phaser.Loader.finishedLoading (http://localhost/phaser/build/phaser.js:71446:25)
    at Phaser.Loader.processLoadQueue (http://localhost/phaser/build/phaser.js:71403:18)
    at Phaser.Loader.asyncComplete (http://localhost/phaser/build/phaser.js:71476:14)
    at Phaser.Loader.xmlLoadComplete (http://localhost/phaser/build/phaser.js:72413:14)
    at .<anonymous> (http://localhost/phaser/build/phaser.js:72236:34)

This simply mimics the logic in the property accessor by running toString on the text value and using an empty string if null to allow Numbers to be passed into the constructor.
2016-04-13 15:24:29 +01:00
Richard Davey
358cc6b8d0 Merge pull request #2428 from EJanuszewski/radToDeg-typo
Fix typo in Math radToDeg description
2016-04-13 14:18:18 +01:00
photonstorm
d04a6ec402 Docs update. 2016-04-12 02:21:02 +01:00
Richard Davey
cd4b8c0d6a Merge pull request #2427 from jamesgroat/patch-1
Add resolution to interface IGameConfig
2016-04-11 23:03:54 +01:00
jamesgroat
51db815d3a Add resolution to interface IGameConfig 2016-04-11 14:03:26 -07:00
photonstorm
f4277efc20 Alternative snooker-ball like collision test. 2016-04-11 16:43:17 +01:00
photonstorm
a193ad557e Fixed jsdocs #2418 2016-04-11 08:55:24 +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
0b0a5d44cc Camera shake working and documented. 2016-04-09 02:49:18 +01:00
photonstorm
a916812db1 Camera shake support. 2016-04-09 02:01:45 +01:00
photonstorm
460c444acf Camera lerp TS defs update. 2016-04-09 01:35:58 +01:00
photonstorm
9e803fff7c Small fix. 2016-04-09 01:10:31 +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
b9fab96471 Improved docs. 2016-04-09 00:25:56 +01:00
photonstorm
3c4e63fda5 World.separateCircle is working with circle vs. circle bodies. 2016-04-08 03:37:49 +01:00
photonstorm
d009b8d769 Circle vs. Circle rebound code started. 2016-04-07 19:32:27 +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
b162ca4d51 Improved Math.clamp and docs. 2016-04-07 16:14:44 +01:00
photonstorm
952b5c04ea The start of Arcade Physics circle bodies. 2016-04-07 14:32:53 +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
e4a505d4b6 Lots of new Signals documentation. 2016-04-07 02:44:29 +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
58af40ca92 Added a bit more info to the SoundManager docs re: #2373 2016-04-07 01:07: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