Commit graph

1011 commits

Author SHA1 Message Date
photonstorm
62b2fb51d6 Link changed (fix #1672) 2015-03-18 19:25:12 +00:00
photonstorm
f2b03c8826 Readme updated. 2015-03-18 19:14:58 +00:00
photonstorm
2483cd5df4 Various readonly Body properties flagged as 'readonly' in the jsdocs (#1643) 2015-02-26 23:32:14 +00:00
photonstorm
f99f182a6f Arcade Physics is now using a spacial pre-sort for all Sprite vs. Group and Group vs. Group collisions. You can define the direction the sort will prioritise via the new sortDirection property. By default it is set to Phaser.Physics.Arcade.LEFT_RIGHT. For example if you are making a horizontally scrolling game, where the player starts on the left and moves to the right, then this sort order will allow the physics system to quickly eliminate any object to the right of the players bounds. This cuts down on the sheer volume of actual collision checks needing to be made. In a densely populated level it can improve fps rate dramatically.
There are 3 other directions available (`RIGHT_LEFT`, `TOP_BOTTOM` and `BOTTOM_TOP`) and which one you need will depend on your game type. If you were making a vertically scrolling shoot-em-up then you'd pick `BOTTOM_TOP` so it sorts all objects above and can bail out quickly.

More importantly you can switch the `sortDirection` at run-time with no loss of performance. Just make sure you do it *before* running any collision checks. So if you had a large 8-way scrolling world you could set the `sortDirection` to match the direction the player was moving in and adjust it in real-time, getting the benefits as you go. My thanks to Aaron Lahman for inspiring this update.
2015-02-26 21:24:07 +00:00
photonstorm
74eeddf956 You can now set a resolution property in your Game Configuration object. This will be read when the Pixi renderer instance is created and used to set the resolution within that (#1621) 2015-02-26 10:52:30 +00:00
photonstorm
41396d5ad2 Merged all of the relevant Pixi 2.2.7 fixes in (#1621) 2015-02-25 17:04:48 +00:00
photonstorm
321e11d0a5 A State swap now sets the Loader.reset hard parameter to true by default. This will null any Loader.preloadSprite that may have been set (#1636) 2015-02-25 05:18:49 +00:00
photonstorm
466a4d11bb Loader.preloadSprite had an extra guard added to ensure it didn't try to updateCrop a non-existent sprite (thanks @noidexe #1636) 2015-02-25 03:08:37 +00:00
photonstorm
5635bed54f Docs update. 2015-02-23 13:58:57 +00:00
photonstorm
5fd066c610 ArraySet.getByKey gets an item from the set based on the property strictly equaling the value given. 2015-02-22 19:30:23 +00:00
photonstorm
8d71e8a32c Animation.update skips ahead frames when the system is lagging, however it failed to set the animation to the final frame in the sequence if the animation skipped ahead too far (thanks @richpixel #1628) 2015-02-22 19:26:56 +00:00
photonstorm
02ef1555c5 A TweenData wouldn't take into account the repeatDelay property when repeating the tween, but now does. A TweenData also has a new property yoyoDelay which controls the delay before the yoyo will start, allowing you to set both independently (thanks @DreadKnight #1469)
Tween.updateTweenData allows you to set a property to the given value across one or all of the current tweens. All of the Tween methods like Tween.delay and Tween.repeat have been updated to use this.

Tween.repeat has a new parameter `repeatDelay` which allows you to set the delay (in ms) before a tween will repeat itself.

Tween.yoyo has a new parameter `yoyoDelay` which allows you to set the delay (in ms) before a tween will start a yoyo.

Tween.interpolation has a new parameter `context` which allows you to define the context in which the interpolation function will run.
2015-02-19 00:51:32 +00:00
photonstorm
35b4926eb8 Undoing previous change - doesn't actually work at all! #1620 2015-02-18 23:32:12 +00:00
photonstorm
9effb4a946 Stage.visibilityChange now has a second parameter fromPhaser. This is set to true by the Stage._onChange callback. This should mean that when Phaser is listening for window.onblur and window.onfocus events it will only trigger the visibilityChange if that event was generated by Phaser itself. If it was generated by something else on the page or iframe it should now be ignored (thanks @austinhallock #1620) 2015-02-18 23:12:08 +00:00
photonstorm
b0261e4a5f Group.cursorIndex is the index of the item the Group cursor points to. This replaces Group._cache[8]. 2015-02-18 22:54:19 +00:00
photonstorm
88ab104da4 BitmapText has a new maxWidth property that will attempt to wrap the text if it exceeds the width specified. 2015-02-18 22:36:12 +00:00
photonstorm
ba727555c8 Emitter.flow now works in a slightly different (and more useful!) way. You can now specify a quantity and a total. The quantity controls how many particles are emitted every time the flow frequency is met. The total controls how many particles will be emitted in total. You can set total to be -1 and it will carry on emitting at the given frequency forever (also fixes #1598 thanks @brianbunch) 2015-02-18 22:35:05 +00:00
photonstorm
9879fc6387 If you load an image and provide a key that was already in-use in the Cache, then the old image is now destroyed (via Cache.removeImage) and the new image takes its place. 2015-02-18 16:58:08 +00:00
photonstorm
ef3cb1f31d Sound in Web Audio now uses AudioContext.onended to trigger when it will stop playing instead of using a time based value. This is only used if the sound doesn't loop and isn't an audio sprite, but will give a much more accurate Sound.onStop event. It also prevents short audio files from being cut off during playback (#1471) and accounts for time spent decoding. 2015-02-18 11:25:17 +00:00
photonstorm
0dbcf88767 Readme update. 2015-02-17 16:41:04 +00:00
photonstorm
1b83674f6d Docs update. 2015-02-17 06:01:51 +00:00
photonstorm
9670c8aa86 InputHandler.enableDrag with a boundsRect set now takes into account the Sprites anchor when limiting the drag (thanks @unindented #1593)
InputHandler.enableDrag with a boundsSprite set now takes into account both the Sprites anchor and the boundsSprite anchor when limiting the drag.
2015-02-16 15:49:46 +00:00
photonstorm
8c23bca62d Sprite.left, Sprite.right, Sprite.top, Sprite.bottom are new properties that contain the totals of the Sprite position and dimensions, adjusted for the anchor.
Sprite.offsetX and Sprite.offsetY contain the offsets from the Sprite.x/y coordinates to the top-left of the Sprite, taking anchor into consideration.
2015-02-16 15:47:55 +00:00
photonstorm
01a23b7d91 Tween.to now correctly accepts arrays are destination values, which makes the Tween interpolate through each value specified in the array using the defined Tween.interpolation method (see new example, thanks @FridayMarch26th #1619)
Tween.interpolationFunction was using the incorrect context to invoke the function. This is now defined in `TweenData.interpolationFunctionContext` and defaults to `Phaser.Math`. If you provide your own interpolation function then please adjust the context accordingly (thanks @FridayMarch26th #1618)
2015-02-16 12:23:54 +00:00
photonstorm
ae198e9364 InputHandler was using the wrong property in checkBoundsSprite when fixedToCamera (thanks @yig #1613) 2015-02-14 19:10:06 +00:00
photonstorm
f60b2b7635 World.setBounds if called after you had already started P2 Physics would incorrectly create a new collision group for the wall objects. P2.World now remembers the settings you provide for each wall and the collision group, and re-applies these settings should the world dimensions ever change (thanks @nextht #1455) 2015-02-11 22:33:29 +00:00
photonstorm
b692d3b456 PIXI.TextureSilentFail is a boolean that defaults to false. If true then PIXI.Texture.setFrame will no longer throw an error if the texture dimensions are incorrect. Instead Texture.valid will be set to false (#1556) 2015-02-11 22:10:53 +00:00
photonstorm
daf8440247 Tile.properties is now unique to that specific Tile, and not a reference to the Tileset index bound properties object. Tile.properties can now be modified freely without impacting other tiles sharing the same id (#1254) 2015-02-11 21:40:37 +00:00
photonstorm
8892f46a83 PIXI.WebGLRenderer.destroy has been fixed to decrement the glContextId and remove it from the PIXI.instances global. Game.destroy now hooks into this. This now means that you can now delete and create your Phaser game over and over without it crashing WebGL after the 4th attempt (#1260) 2015-02-11 21:02:15 +00:00
photonstorm
b68c3071a6 Phaser.Ellipse.contains is now working again (thanks @spayton) 2015-02-11 18:51:35 +00:00
photonstorm
0e7820bde5 Group.forEach (and many other Group methods) now uses the children.length value directly instead of caching it, which both helps performance and stops the loop from breaking should you remove a Group child in the invoked callback. 2015-02-11 17:19:56 +00:00
photonstorm
599bcf5f97 Loader.audiosprite has a new jsonData parameter. It allows you to pass a pre-existing JSON object (or a string which will be parsed as JSON) to use as the audiosprite data, instead of specifying a URL to a JSON file on the server (thanks @jounii #1447)
Loader.audiosprite has a new `autoDecode` parameter. If `true` the audio file will be decoded immediately upon load.
2015-02-11 16:16:58 +00:00
photonstorm
aa2df803b7 Pointer.stop would call event.preventDefault if Pointer._stateReset was true, which is always true after a State has changed and before Pointer.start has been called. However this broken interacting with DOM elements in the case where the State changes and you immediately try to use the DOM element without first having clicked on the Phaser game. An additional guard was added so preventDefault will now only be called if both _stateReste and Pointer.withinGame are true (thanks @satan6 #1509) 2015-02-11 16:03:24 +00:00
photonstorm
afd4108f04 Readme update. 2015-02-11 15:11:33 +00:00
photonstorm
6b8622a336 Timer.update was calling the TimerEvent callback even if TimerEvent.pendingDelete was already set to true, causing timer events to stack-up in cases where a new TimerEvent was generated in the callback (thanks @clowerweb #838) 2015-02-11 14:43:23 +00:00
photonstorm
74bee324a5 Sound.fadeIn now supports fading from a marker, as well as the entire audio clip, so now works with audio sprites (thanks @vorrin #1413) 2015-02-11 13:52:16 +00:00
photonstorm
dfee82834d Sound.loop even when set for WebAudio wouldn't use the AudioContext loop property because Sound.start was being invoked with an offset and duration. Now if loop is true and no marker is being used it will use the native Web Audio loop support (#1431)
SoundManager.setDecodedCallback lets you specify a list of Sound files, or keys, and a callback. Once all of the Sound files have finished decoding the callback will be invoked. The amount of time spent decoding depends on the codec used and file size. If all of the files given have already decoded the callback is triggered immediately.

Sound.loopFull is a new method that will start playback of the Sound and set it to loop in its entirety.
2015-02-11 05:17:53 +00:00
photonstorm
18ff04810f ArcadePhysics.distanceToPointer now calculates the distance in world space values.
ArcadePhysics.moveToPointer no longer goes crazy if the maxTime parameter is given and the Sprite is positioned in a larger game world (thanks @AnderbergE #1472)
2015-02-10 22:16:35 +00:00
photonstorm
7a066a3a8c World.setBounds will now adjust the World.x/y values to match those given (#1555) 2015-02-10 21:40:53 +00:00
photonstorm
cc7096b045 jsdoc fix #1543 2015-02-10 21:22:36 +00:00
photonstorm
0054dc996b The Loader now directly calls StateManager.loadComplete rather than the StateManager listening for the loadComplete event, because Loader.reset unbinds this event (and it's easy to accidentally remove it too)
Loader.onLoadComplete is dispatched *before* the Loader is reset. If you have a `create` method in your State please note that the Loader will have been reset before this method is called. This allows you to immediately re-use the Loader without having to first reset it manually.
2015-02-10 17:04:04 +00:00
photonstorm
dfc8ff32d2 You can now tint animated Sprites in Canvas mode. Or change the texture atlas frame of a tinted Sprite or Image. Please note that this is pretty expensive (depending in the browser), as the tint is re-applied every time the *frame changes*. The Pixi tint cache has also been removed to allow for subtle tint color shifts and to avoid blowing up memory. So use this feature sparingly! But at least it does now work (#1070) 2015-02-10 14:53:55 +00:00
photonstorm
823997744b Docs update. 2015-02-10 14:53:55 +00:00
photonstorm
816a80f39a If Body.customSeparateX or customSeparateY is true then the Body will no longer be automatically separated from a **Tilemap** collision or exchange any velocity. The amount of pixels that the Body has intersected the tile is available in Body.overlapX and overlapY, so you can use these values to perform your own separation in your collision callback (#992) 2015-02-10 12:58:12 +00:00
photonstorm
4489a12fd8 Sprite.loadTexture and Image.loadTexture now no longer call updateTexture if the texture given is a RenderTexture. This fixes issues with RetroFonts in IE11 WebGL as well as other RenderTexture related IE11 problems (#1310 #1381 #1523) 2015-02-10 12:27:55 +00:00
photonstorm
c154b8c785 Loader.resetLocked is a boolean that allows you to control what happens when the loader is reset, *which happens automatically on a State change*. If you set resetLocked to true it allows you to populate the loader queue in one State, then swap to another State without having the queue erased, and start the load going from there. After the load has completed you could then disable the lock again as needed.
Loader.reset has a new optional 2nd parameter `clearEvents` which if set to `true` (the default is false) will reset all event listeners bound to the Loader.
2015-02-10 11:58:17 +00:00
photonstorm
ec732e497f Docs update. 2015-02-09 22:19:05 +00:00
photonstorm
3fc8fbadca Docs update. 2015-02-09 20:10:51 +00:00
photonstorm
2b2ee27912 If for whatever reason you wish to hide the Phaser banner in the console.log you can set window.PhaserGlobal.hideBanner to true and it will skip the output. Honestly I'd rather if you didn't, but the option is now there. 2015-02-09 20:10:51 +00:00
photonstorm
35a04b2f1e TilemapParser now supports Tiled 0.11 version maps which includes the rotation property on all Object types.
Tilemap.createFromObjects now checks for a `rotation` property on the Object and if present will set it as the Sprite.angle (#1433)
2015-02-08 23:25:41 +00:00