ParticleSystem in Slick2d (with MarteEngine)
- by Bro Kevin D.
First of all, sorry if this sounds very newbie-ish. I'm stuck at making a ParticleSystem I made using Pedigree to work in my game. It's basically an explosion that I want to display whenever an enemy dies.
The ParticleSystem has two emitters, smoke and explosion
I tried putting it in my Enemy (extends Entity) class
Enemy extends Entity class
@Override
public void update(GameContainer gc, int delta) throws SlickException {
super.update(gc, delta);
/** bunch of codes */
explosionSystem.update(delta);
}
@Override
public void render(GameContainer gc, Graphics gfx) throws SlickException {
super.render(gc, gfx);
if(isDestroyed) {
explosionSystem.render(x,y);
if(explosionSystem.getEmitter(1).completed()) {
this.destroy();
}
}
}
And it does not render.
I'm not sure if this is the proper way of implementing it, as I've considered creating an Entity to serve as controller for all the Enemies. Right now, I'm just adding enemies every second.
So how do I render the ParticleSystem when the enemy dies? If anyone can point me to the right direction. Thank you for your time.