/** * @see org.newdawn.slick.particles.ParticleEmitter#update(org.newdawn.slick.particles.ParticleSystem, int) */ public void update(ParticleSystem system, int delta) { timer -= delta; if (timer <= 0) { timer = interval; Particle p = system.getNewParticle(this, 1000); p.setColor(1, 1, 1, 0.5f); p.setPosition(x, y); p.setSize(size); float vx = (float) (-0.02f + (Math.random() * 0.04f)); float vy = (float) (-(Math.random() * 0.15f)); p.setVelocity(vx,vy,1.1f); } }
/** * @see org.newdawn.slick.particles.ParticleEmitter#updateParticle(org.newdawn.slick.particles.Particle, int) */ public void updateParticle(Particle particle, int delta) { if (particle.getLife() > 600) { particle.adjustSize(0.07f * delta); } else { particle.adjustSize(-0.04f * delta * (size / 40.0f)); } float c = 0.002f * delta; particle.adjustColor(0,-c/2,-c*2,-c/4); }
/** * Update the render setting */ private void updateRender() { if (inherit.isSelected()) { emitter.usePoints = Particle.INHERIT_POINTS; oriented.setEnabled( true ); } if (quads.isSelected()) { emitter.usePoints = Particle.USE_QUADS; oriented.setEnabled( true ); } if (points.isSelected()) { emitter.usePoints = Particle.USE_POINTS; oriented.setEnabled( false ); oriented.setSelected( false ); } // oriented if( oriented.isSelected()) emitter.useOriented= true; else emitter.useOriented= false; // additive blending if( additive.isSelected()) emitter.useAdditive= true; else emitter.useAdditive= false; }