Jump to content

Animating multiple of the same sprite


Ryth
 Share

Recommended Posts

Hey,

I'm trying to make all my sprites follow the same spritesheet, although when I render them they are static and I cannot seem to instruct them to follow the animation set.

I have managed to get what I wanted working for a single sprite in another script but I cannot seem to apply this to multiple sprites.

Any help would be greatly appreciated.

Cheers,

Ryth

//Below is the separate script

function preload() {
    console.log("Pre Start");
    game.load.spritesheet('WaterSheet', 'assets/WaterSheet.png', 103, 53, 10);
    console.log("Pre Done");
}

function update() {

}

function create() {
    WaterSprite = this.game.add.sprite(15, 30, 'WaterSheet');
    WaterSprite.animations.add('active', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
    WaterSprite.animations.play('active', 5, true);
}

// Below is from my current script, it's the line I use to render the spritesheet. I have used the same animation as above. This is ran in a loop to render all the blocks.

gameScene.renderXY(WaterSprite, isoPt.x+borderOffset.x, isoPt.y+borderOffset.y, false);

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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