List of usage examples for com.badlogic.gdx.graphics.g2d ParticleEffect setDuration
public void setDuration(int duration)
From source file:at.therefactory.jewelthief.ui.Particles.java
License:Open Source License
/** * Resets the position, start color and duration of the given firework effects to random values. * * @param effect/* w w w . j a va2s . c om*/ */ private void resetFireworksEffect(ParticleEffect effect) { effect.reset(); effect.setDuration(Utils.randomWithin(180, 250)); effect.setPosition(Utils.randomWithin(0, WINDOW_WIDTH), Utils.randomWithin(0, WINDOW_HEIGHT)); float[] colors = effect.getEmitters().get(0).getTint().getColors(); int randomStartColor = Utils.randomWithin(0, startColors.length - 1); for (int i = 0; i < 6; i++) { colors[i] = startColors[randomStartColor][i % 3]; } for (ParticleEmitter emitter : effect.getEmitters()) { emitter.getTint().setColors(colors); } }
From source file:de.myreality.plox.graphics.ParticleRenderer.java
License:Open Source License
@Override public void onRemove(GameObject object) { ParticleEffect effect = effects.remove(object); particleCounts.remove(object);/*from w ww.j a v a 2 s. c om*/ if (effect != null) { particleManager.setEndless(effect, false); effect.setDuration(0); if (object.getType().equals(GameObjectType.POWERUP)) { particleManager.unload(effect); } else if (!object.getType().equals(GameObjectType.SHOT)) { ParticleEffect eff = Resources.get(Resources.PARTICLES_EXPLOSION, ParticleEffect.class); particleManager.unload(effect); effect = particleManager.create(eff, false); particleManager.setParticleCount(effect, 50); effect.setPosition(object.getCenterX(), object.getCenterY()); effect.start(); } else if (!ScreenUtils.isOutOfScreen(object)) { ParticleEffect eff = Resources.get(Resources.PARTICLES_EXPLOSION_SMALL, ParticleEffect.class); effect = particleManager.create(eff, false); effect.setPosition(object.getCenterX(), object.getCenterY()); particleManager.setEndless(effect, false); effect.start(); } } }
From source file:net.bplaced.therefactory.nomoore.utils.Particles.java
License:Open Source License
/** * Resets the position, start color and duration of the given firework effects to random values. * * @param effect/*from w w w .j av a 2 s .c om*/ */ private void resetFireworksEffect(ParticleEffect effect) { effect.reset(); effect.setDuration(Utils.randomWithin(180, 250)); // effect.setPosition(Utils.randomWithin(0, WINDOW_WIDTH), Utils.randomWithin(0, WINDOW_HEIGHT)); }