Hello everyone,
it’s been a while since i’ve been trying to figure out how to animate a sprite inside a group.
I’ve looked over the internet and all the solutions dont seem to work for me: the sprite do not change the frame and sticks to just the first one as the animation does not start. I do not get any kind of error so i cannot figure out how to fix this.
I’ll paste my code and what i’m trying to do, if you could help me it would be great.
//create
bullets=game.add.group();
bullets.enableBody = true;
bullets.physicsBodyType = Phaser.Physics.ARCADE;
weapon = game.add.weapon(20, ‘bullet’)
weapon.bullets.setAll(‘scale.x’, 1.5);
weapon.bulletSpeed=400;
bullets.callAll(‘animations.add’, ‘animations’, ‘uku’, [0,1,2,3,4], 24, true);
//update
if ( fireButton.isDown)
{
player.animations.play(‘fire’);
bullets.callAll(‘play’, ‘animations’, ‘uku’);
game.time.events.add(400, function (){weapon.fire ();});
}