Jump to content

Custom particles.


Mono2692
 Share

Recommended Posts

Hi, Im following the example (https://labs.phaser.io/view.html?src=src\game objects\particle emitter\custom particles.js) so i can create a custom particle that plays an animation during it's lifetime. In the example they create the custom particle class inside the same file of the scene, and also a variable called anim outside the scene scope so it can be called from the scene and inside the custom particle class. My question is the following, what if i create the custom particle class in a separate .js file? How can I pass the animation to the particle when is created in the createEmitter call? How can I pass the particleClass with some variables? Any recomendation would be appreciated.

    let emitter = particles.createEmitter({
        x: 100,
        y: 100,
        frame: 0,
        quantity: 1,
        frequency: 200,
        angle: { min: 0, max: 30 },
        speed: 200,
        gravityY: 100,
        lifespan: { min: 2000, max: 4000 },
        particleClass: AnimatedParticle
    });

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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