Jump to content

Phaser Particle Editor


saqsun
 Share

Recommended Posts

  • 2 weeks later...
  • 2 weeks later...

Hi! This might sound like a silly question perhaps, I'm new to Phaser and I would like to use this particle editor in a game.

I created a json with the editor, but unfortunately I cannot make the particles start emitting.

The code is here:

var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaserG', { preload: preload, create: create, update: update });

var ParticleEditorPlugin = require('@koreez/phaser-particle-editor-plugin');


function preload() {

    game.load.image('sky', 'assets/sky.png');
    
    game.load.json('magic', 'partyMagic.json');
    
}

function create() {
    
    game.add.sprite(0, 0, 'sky');
    
    game.physics.startSystem(Phaser.Physics.ARCADE);
    
    game.plugins.add(ParticleEditorPlugin);

    var phaserJSON = game.cache.getJSON('magic');
    game.make.particleEffect(10, 10, phaserJSON);
    
}

function update() {


}

Thanks in advance!

 

Link to comment
Share on other sites

function create() {
    //...
    game.make.particleEffect(10, 10, phaserJSON);
}

As you can see from snippet above you are using 'make' factory which is ok but then you need to add particle effect to world or you can use 'add' instead :)

function create() {
    //...
    game.add.particleEffect(10, 10, phaserJSON);
}

 

Link to comment
Share on other sites

  • 4 weeks later...
On 09/11/2017 at 5:47 AM, saqsun said:

function create() {
    //...
    game.make.particleEffect(10, 10, phaserJSON);
}

As you can see from snippet above you are using 'make' factory which is ok but then you need to add particle effect to world or you can use 'add' instead :)


function create() {
    //...
    game.add.particleEffect(10, 10, phaserJSON);
}

 

Sorry for not responding for a long time, I've been very busy x.x
So, I think the problem is actually I'm using Node.js instead of Common.js, in your github page you list two ways of importing the plugin: CommonJS and ES2015.
There is a way of importing with Node.js?

This line that I showed before was using Node.JS:

var ParticleEditorPlugin = require('@koreez/phaser-particle-editor-plugin');

Thanks in advance!

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...
  • 4 months later...
 Share

  • Recently Browsing   0 members

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