Skip to content

Commit e6812cf

Browse files
committed
Added BMD frame checks.
1 parent 5dbe6b6 commit e6812cf

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/gameobjects/Image.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,13 @@ Phaser.Image.prototype.loadTexture = function (key, frame) {
261261
}
262262
else if (key instanceof Phaser.BitmapData)
263263
{
264+
// This works from a reference, which probably isn't what we need here
264265
this.setTexture(key.texture);
266+
267+
if (this.game.cache.getFrameData(key.key, Phaser.Cache.BITMAPDATA))
268+
{
269+
setFrame = !this.animations.loadFrameData(this.game.cache.getFrameData(key.key, Phaser.Cache.BITMAPDATA), frame);
270+
}
265271
}
266272
else if (key instanceof PIXI.Texture)
267273
{

src/gameobjects/Sprite.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,11 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame, stopAnimation) {
379379
{
380380
// This works from a reference, which probably isn't what we need here
381381
this.setTexture(key.texture);
382-
setFrame = !this.animations.loadFrameData(this.game.cache.getFrameData(key.key, Phaser.Cache.BITMAPDATA), frame);
382+
383+
if (this.game.cache.getFrameData(key.key, Phaser.Cache.BITMAPDATA))
384+
{
385+
setFrame = !this.animations.loadFrameData(this.game.cache.getFrameData(key.key, Phaser.Cache.BITMAPDATA), frame);
386+
}
383387
}
384388
else if (key instanceof PIXI.Texture)
385389
{

0 commit comments

Comments
 (0)