Cache.getImage now returns null if no image was found.

This commit is contained in:
photonstorm 2014-09-03 11:11:48 +01:00
parent 3b28d568e9
commit 1f84024a3e
2 changed files with 3 additions and 1 deletions

View file

@ -138,6 +138,7 @@ Version 2.1.0 - "Cairhien" - -in development-
* The World bounds can now be set to any size, including smaller than the game dimensions. Before it was locked to a minimum size of the game canvas, but it can now be anything.
* ScaleManager.orientationSprite has been removed because it never displayed correctly anyway (it would be distorted by the game scale), it will be bought back in a future version by way of a custom orientation state.
* ArcadePhysics.overlap has been updated so that the Body.overlapX/Y properties are set to the amount the two bodies overlapped by. Previously they were zero and only populated during the separation phase, but now the data is available for just overlap checks as well. You can then use these values in your ovrelap callback as required - note that they are changed for every check, so a Sprite overlap tested against 10 other sprites will have the overlapX/Y values updated 10 times in a single collision pass, so you can only safely use the values in the callback (#641)
* Cache.getImage now returns `null` if the requested image wasn't found.
### Bug Fixes

View file

@ -823,7 +823,7 @@ Phaser.Cache.prototype = {
*
* @method Phaser.Cache#getImage
* @param {string} key - Asset key of the image to retrieve from the Cache.
* @return {object} The image data.
* @return {object} The image data if found in the Cache, otherwise `null`.
*/
getImage: function (key) {
@ -834,6 +834,7 @@ Phaser.Cache.prototype = {
else
{
console.warn('Phaser.Cache.getImage: Invalid key: "' + key + '"');
return null;
}
},