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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.