saqsun

Phaser Particle Editor

Recommended Posts

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!

 

Share this post


Link to post
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);
}

 

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.