/** * @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.BasicGame#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { Image image = new Image("testdata/particle.tga", true); system = new ParticleSystem(image); system.addEmitter(new FireEmitter(400,300,45)); system.addEmitter(new FireEmitter(200,300,60)); system.addEmitter(new FireEmitter(600,300,30)); //system.setUsePoints(true); }
/** * @see org.newdawn.slick.BasicGame#keyPressed(int, char) */ public void keyPressed(int key, char c) { if (key == Input.KEY_ESCAPE) { System.exit(0); } if (key == Input.KEY_SPACE) { mode = ParticleSystem.BLEND_ADDITIVE == mode ? ParticleSystem.BLEND_COMBINE : ParticleSystem.BLEND_ADDITIVE; system.setBlendingMode(mode); } }
/** * Clear the particle system held in this canvas * * @param additive * True if the particle system should be set to additive */ public void clearSystem(boolean additive) { system = new ParticleSystem("org/newdawn/slick/data/particle.tga", 2000); if (additive) { system.setBlendingMode(ParticleSystem.BLEND_ADDITIVE); } system.setRemoveCompletedEmitters(false); }
/** * Set the particle system to be displayed * * @param system * The system to be displayed */ public void setSystem(ParticleSystem system) { this.system = system; emitters.clear(); system.setRemoveCompletedEmitters(false); for (int i = 0; i < system.getEmitterCount(); i++) { emitters.add(system.getEmitter(i)); } }
public void init(GameContainer container) throws SlickException { container.getInput().addListener(listener); container.setShowFPS(false); system = new ParticleSystem("org/newdawn/slick/data/particle.tga", 2000); system.setBlendingMode(ParticleSystem.BLEND_ADDITIVE); system.setRemoveCompletedEmitters(false); for (int i = 0; i < waiting.size(); i++) { system.addEmitter((ParticleEmitter) waiting.get(i)); } waiting.clear(); }
/** * Change the visual indicator for the current particle system * blend mode */ public void updateBlendMode() { if (additive.isSelected()) { game.getSystem().setBlendingMode(ParticleSystem.BLEND_ADDITIVE); } else { game.getSystem().setBlendingMode(ParticleSystem.BLEND_COMBINE); } }
public void init(GameContainer container, StateBasedGame game) throws SlickException { mGame = game; Image image = new Image("res/effects/particle.tga", true); mParticleSystem = new ParticleSystem(image); mBd1 = (Image)DatasManager.getInstance().getFile("Image.menubackground"); mBd2 = (Image)DatasManager.getInstance().getFile("Image.menuplanet"); mParticleSystem.addEmitter(new FireEmitter(500, 400, 580)); }
/** * @see org.newdawn.slick.particles.ParticleEmitter#usePoints(org.newdawn.slick.particles.ParticleSystem) */ public boolean usePoints(ParticleSystem system) { return false; }