ParticleSystem in Slick2d (with MarteEngine)

Posted by Bro Kevin D. on Game Development See other posts from Game Development or by Bro Kevin D.
Published on 2011-11-30T03:16:09Z Indexed on 2011/11/30 10:37 UTC
Read the original article Hit count: 416

Filed under:
|
|
|

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.

© Game Development or respective owner

Related posts about 2d

Related posts about java