Jump to content

Help with a death animation


Recommended Posts

I'm a newbie so Im still learning the API.


The sprite is changing to the first animation but it is not animating.


What I need is the sprite kill() to occur preferably before the animation occurs and then for it to play.


My code that has the problems is:

    // For each opponent.    groupOpponents2.forEachAlive(function(opponent) {        //  Check if Enemies Dead.        if (opponent.alpha <= 0.5) {            // Clean up memory and kill off.            allCars.splice(opponent.isIndex,1);            //opponent.kill();            opponent.loadTexture('carExplode');            var explosion = opponent.animations.add('explode',[1,2,3,4,5,6,7,8,9,10], 12, true, true);            opponent.animations.play('explode', 12, false, true);                        opponent.body.damping = 1;        }          }, this);

What an I doing wrong guys this is driving me insane loooool.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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