ParticleEmitter.js v0.1.2
Tsukimi
Last updated: 2018/07/29: add demo sample project
Introduction
PIXI has particles inside but hard to use in RMMV interface.
This plugin provide a simple interface to make particle systems.
Features
- Simple Creating and setting parameters of PIXI.particles.Emitter.
Screenshots
https://www.youtube.com/embed/DRbnXTH8LU8
Demo
download my demo project from here!
How to Use
Preparation:
https://www.youtube.com/embed/MABQ4IDZgws
(below are the steps in the video)
1. first,
make your desire particle emitter in the under website, and download the config file(.json).
https://pixijs.io/pixi-particles-editor/
** First scroll down and
set Rederer to Canvas2D to see correct visual effects !!
This site use wrong method in WebGL mode. It will auto turn to WebGL mode if your game uses WebGL.
2. create a folder named "
particles" inside
data/ and
put config file inside it
3. create a folder named "
particles" inside
img/ and
put particle image file inside it
4. open plugin manager, turn plugin on and
write names of config file (in data/particles/) into it.
The preparation is done.
With only one command
(createPEmitter), you can make the emitter show up in the game!
■■■ Create/Adjust emitter by plugin command:
Spoiler: plugin command
*** You can brief all "PEmitter" to "PE" for short ***
createPEmitter {id} {config} {eventId} {imageNames ...}
create a particle emitter.
id: id of this controller. choose a name you like!
config: config name download from the website (.json no need)
eventId: the event which this emitter chase
-1:player、0:this event、1~:event#
x:no event, on screen;screen:on screen (only on current map)
imageNames: image name inside img/particles/.
ex: createPEmitter star#1 starEmitter x star1 star2
Create an emitter named star#1, config is starEmitter.json,
position based on screen. Images are star1.png & star2.png.
pausePEmitter {id}
pause emitting.
resumePEmitter {id}
resume emitting.
stopPEmitter {id}
stop emitter and delete after all particle i dead.
deletePEmitter {id}
delete emitter and all particles immediately.
setPEmitterPos {id} {x} {y}
set emitter (relative) position to (x,y).
Besides numbers, you can also set these to x & y:
Spoiler x: Don't change from current parameter value ex:x
v<Number>: value of Game Variable<Number> ex:v15
r<#1>~<#2>: Random value between #1 and #2. ex:r30~45
#1 and #2 can also be variables.
ex: setPEmitterPos star#1 10 x
set emitter star#1's x coordinate to 10. (y doesn't change)
movePEmitterPos {id} {x} {y} {duration} (easingFunction)
move emitter (relative) position to (x,y) by {duration} frame.
input→x: don't move
easingFunction: move easing functions at
https://easings.net/
will be 'linear' if not specified
ex: movePEmitterPos star#1 -10 20 60 easeOutBounce
move emitter star#1 to (-10,20) in 60 frames, with
bouncing animation.
setPEmitterZ {id} {z}
set emitter Z layer.
z layer:
0 : lower tile
1 : lower character
3 : character
4 : upper tile
5 : upper character
6 : shadow of airship
7 : Balloon
8 : animation
9 : map destination (white rectangle)
ex: setPEmitterZ star#1 5
set emitter star#1 z-layer to upper character.
setPEmitterAsLocal {id} {true/false}
create particle to event relative position
instead of to the map.
(if true, event move right -> all particle move right)
setPEmitterStaticToPlayer {id} {true/false}
should emitter set to player(-1) remain exist
after map transition.(true -> exist)
*Only effect on emitter set to player.
Advanced moving:
Spoiler: advanced moving
(Q:Queue、R:Routine)
movePEmitterPosQ {id} {x} {y} {duration} (easingFunction)
Add move command to move queue. Will start next move
after last move is finish.
ex: movePEmitterPosQ star#1 0 20 60 easeOutBounce
movePEmitterPosQ star#1 20 x 30 easeInBounce
Move to (0,20) in 60f then move to (20,20) in 30f.
movePEmitterPosQR {id} {x} {y} {duration} (easingFunction)
Add move command to routine move queue.
will repeat moving command in routine move queue.
ex: movePEmitterPosQR star#1 -20 20 30
movePEmitterPosQR star#1 20 20 30
movePEmitterPosQR star#1 20 -20 30
movePEmitterPosQR star#1 -20 -20 30
(-20,20)→(20,20)→(20,-20)→(-20,-20)→(-20,20)→…
clearPEmitterPosQ {id}
clear move queue.
clearPEmitterPosQR {id}
clear routine move queue.
■■■ Create/Adjust emitter by Map/Event tags(notes):
Spoiler: tags
Map:
<PEmitter:id,config,imageNames,...>
Same as createPEmitter.
However, eventId will be set to screen.
ex:<PEmitter:star#1,starEmitter,star1,star2>
<SetPEmitterPos:id,x,y>
Same as setPEmitterPos.
<SetPEmitterZ:id,z>
Same as setPEmitterZ.
<MovePEmitterPosQR:id,x,y,duration,easingFunc>
Same as movePEmitterPosQR.
event:
<PEmitter:id,config,imageNames,...>
Same as createPEmitter.
However, eventId will be set to this event.
ex:<PEmitter:star#1,starEmitter,star1,star2>
<SetPEmitterPos:id,x,y>
Same as setPEmitterPos.
<SetPEmitterZ:id,z>
Same as setPEmitterZ.
<SetPEmitterAsLocal:id>
Same as setPEmitterPosAsLocal.
<MovePEmitterPosQR:id,x,y,duration,easingFunc>
Same as movePEmitterPosQR.
Script Download
You can download(press ctrl+s) the script from
here, or from
my Github.
FAQ
Q: Error "
Cannot set property x of null" show up.
A: please check all names of config-files you use is filled into the plugin parameter "configName".
Q:
A:
Terms of use
Free to use in non-commercial/commercial games. Credits no need. (but I will be happy if you would write in your game!)
Credit and Thanks
- Author: Tsukimi (in this forum: cji3bp62000)
Author's Notes
Library/source used:
- PIXI-particles from:
https://github.com/pixijs/pixi-particles
- Easing function from:
http://gsgd.co.uk/sandbox/jquery/easing/
本贴来自国际rpgmaker官方论坛作者:Tsukimi-neko处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/particle-emitter-easy-making-particle-effects-in-mv.97729/