koreezgames / phaser3-particle-editor

A flexible editor for building phaser particles.
https://koreezgames.github.io/phaser3-particle-editor/
MIT License
171 stars 13 forks source link

Providing emitZone is producing invalid JSON config file. #24

Closed Waclaw-I closed 6 years ago

Waclaw-I commented 6 years ago

Hi!

I was testing your particle editor and tried to import its output into my Phaser 3 game. Everything was fine untill I added an emitZone with shape defined.

Expected Behavior

Editor should produce a valid JSON to use.

Current Behavior

zrzut ekranu 2018-09-12 o 12 13 19

Steps to Reproduce (for bugs)

TestProject.zip I also included .ppe file inside.

Context

Your Environment

Thanks for this awesome editor! I am really enjoying it. Cheers!

saqsun commented 6 years ago

Hi @Waclaw-I ! Thanks for your report.

Actually this is an issue of readme and we should fix it ASAP ;)

Please try to do this:

function preload() {
  this.load.atlas('shapes', 'assets/shapes.png', 'assets/shapes.json');
  this.load.text('particle-effect', 'assets/particle-effect.json');
}

function create() {
  this.add.particles('shapes',  new Function('return ' + this.cache.text.get('particle-effect'))());
}

Cheers!

Waclaw-I commented 6 years ago

Thanks for providing the solution @saqsun , working like charm!