Jump to content

A bug with switching from sprite sheet to single frame images


lucbloom
 Share

Recommended Posts

I have fixed a bug. This is how to repro it:

 

At startup:

this.sprite.loadTexture("walk.png"); // Sprite sheet 3x4 frames

 

Some time later:

this.sprite.loadTexture("dead.png"); // Single frame

 

My game sets this.sprite.frame each update. If the object is 'dead', the frame number is 0.

 

The BUG is: the old frameData in this.sprite.animations resets the texure to walk.png's first frame.

I SOLVED this by executing

    this.animations.loadFrameData(null);

in the "cache.isSpritesheet == false" part of Phaser.Sprite.prototype.loadTexture

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...