Jump to content

Recommended Posts



I'm trying to get an explosion working with animated particles in Phaser. So far I've got the emitted working fine and seem to be able to add animations to the particles, but running these animations does nothing.


Since the docs say that "Particles are extended Sprites" I would assume that you can add and run animations in the same way that you do an a normal sprite?


Any help would be greatly appreciated!!

var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });var emitter;function preload() {    game.load.spritesheet('partAnim', 'assets/partAnim.png', 134, 141);}function create() {    game.physics.startSystem(Phaser.Physics.ARCADE);    game.stage.backgroundColor = 0x337799;    emitter = game.add.emitter(0, 0, 100);    emitter.makeParticles('partAnim');    emitter.gravity = 200;    game.input.onDown.add(particleBurst, this);}function particleBurst(pointer) {    emitter.x = pointer.x;    emitter.y = pointer.y;    emitter.start(true, 2000, null, 1);    var part = emitter.getTop();    part.animations.add('run');    part.animations.play('run', 15, true);    console.log(part);}
Link to comment
Share on other sites


  • Recently Browsing   0 members

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