Jump to content

Problems with creating multiple animations on a spritesheet


Recommended Posts



This is my code snippet to create a number of animations from a sprite sheet:

disk = this.game.add.sprite(newDiskX, newDiskY, 'playdiskred');disk['myConnectAnim'] = disk.animations.add('connectAnim', [8,9,10,11,12,13,14], 21, false);disk['myConnectAnim'].onComplete.add(this.connectComplete, this);disk['myDisappearAnim'] = disk.animations.add('disappearAnim', [6,5,4,3,2,1,0], 21, false);disk['myDisappearAnim'].onComplete.add(this.disappearComplete, this);disk['myAppearAnim'] = disk.animations.add('appearAnim', [0,1,2,3,4,5,6], 21, false);disk['myAppearAnim'].onComplete.add(this.appearComplete, this);

The problem is when I call

 disk['myConnectAnim'].play(21, false); 

Phaser seems to stop working, only a couple of frames gets played and onComplete is never called.

When I removed the lines to create myDisappearAnim and myAppearAnim, the same call to myConnectAnim works fine. Anyone have an idea on what I'm doing wrong here ?





Link to comment
Share on other sites


  • Recently Browsing   0 members

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