Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
    
btw i set the isDestroyed in the collissionResponse(Entity e) method to true once the enemy's health drops to <= 0 –  Bro Kevin D. Nov 30 '11 at 3:31
    
i made a temporary (and very bad) solution, i'll post it when SE allows me to (in 5 hours) –  Bro Kevin D. Nov 30 '11 at 6:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.