Physics integration and a fix to Tween that stopped the repeat/yoyo from working.

This commit is contained in:
Richard Davey
2013-09-03 17:07:05 +01:00
parent bdc1c2ceb9
commit 2fe8a3a0a7
9 changed files with 330 additions and 90 deletions
+18 -2
View File
@@ -115,6 +115,7 @@ Phaser.Cache.prototype = {
addImage: function (key, url, data) {
this._images[key] = { url: url, data: data, spriteSheet: false };
this._images[key].frame = new Phaser.Animation.Frame(0, 0, data.width, data.height, '', '');
PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
@@ -129,8 +130,8 @@ Phaser.Cache.prototype = {
*/
addSound: function (key, url, data, webAudio, audioTag) {
if (typeof webAudio === "undefined") { webAudio = true; }
if (typeof audioTag === "undefined") { audioTag = false; }
webAudio = webAudio || true;
audioTag = audioTag || false;
var locked = this.game.sound.touchLocked;
var decoded = false;
@@ -246,6 +247,21 @@ Phaser.Cache.prototype = {
return null;
},
/**
* Get a single frame by key. You'd only do this to get the default Frame created for a non-atlas/spritesheet image.
* @param key Asset key of the frame data you want.
* @return {object} The frame data you want.
*/
getFrame: function (key) {
if (this._images[key] && this._images[key].spriteSheet == false)
{
return this._images[key].frame;
}
return null;
},
/**
* Get sound by key.
* @param key Asset key of the sound you want.