com.badlogic.gdx.graphics.g2d.ParticleEffectPool Java Examples

The following examples show how to use com.badlogic.gdx.graphics.g2d.ParticleEffectPool. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RangedDamageVisualizer.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
@Override public IFuture<Void> visualize(RangedDamageResult result) {
    final Future<Void> future = new Future<Void>();
    SoundManager.instance.playSound("ability-firestorm");
    if (Config.particles.exists("ability-" + result.ability.name + "-hit")) {
        ParticleEffectPool effectPool = Config.particles.get("ability-" + result.ability.name + "-hit");
        ParticleActor actor = new ParticleActor(effectPool.obtain());
        visualizer.viewController.effectLayer.addActor(actor);
        actor.freeOnComplete();
        actor.setPosition(
            result.target.getX() * ViewController.CELL_SIZE + ViewController.CELL_SIZE / 2,
            result.target.getY() * ViewController.CELL_SIZE + ViewController.CELL_SIZE / 2
        );
    }
    if (result.success) {
        visualizer.viewController.visualize(new Death(result.creature, result.target)).addListener(future);
    } else {
        visualizer.viewController.visualize(new Defence(result.target, AttackType.weapon)).addListener(future);
    }
    return future;
}
 
Example #2
Source File: UdacityScreen.java    From ud405 with MIT License 5 votes vote down vote up
@Override
public void show() {
    batch = new SpriteBatch();
    logo = new Texture("udacity_logo_white.png");
    logoHeight = logo.getHeight() * LOGO_WIDTH / logo.getWidth();

    ParticleEffect touchEffect = new ParticleEffect();
    touchEffect.load(Gdx.files.internal("UdacityEmitter.p"), Gdx.files.internal(""));
    touchEffect.setEmittersCleanUpBlendFunction(false);
    touchEffectPool = new ParticleEffectPool(touchEffect, 1, 2);
    Gdx.input.setInputProcessor(this);
}
 
Example #3
Source File: UdacityScreen.java    From ud406 with MIT License 5 votes vote down vote up
@Override
public void show() {
    batch = new SpriteBatch();
    // TODO: Scavenger hunt! Where does this logo live?
    logo = new Texture("udacity_logo_white.png");
    logoHeight = logo.getHeight() * LOGO_WIDTH / logo.getWidth();

    ParticleEffect touchEffect = new ParticleEffect();
    // TODO: Same question. Where does UdacityEmitter.p live? How are we loading it?
    touchEffect.load(Gdx.files.internal("UdacityEmitter.p"), Gdx.files.internal(""));
    touchEffect.setEmittersCleanUpBlendFunction(false);
    touchEffectPool = new ParticleEffectPool(touchEffect, 1, 2);
    Gdx.input.setInputProcessor(this);
}
 
Example #4
Source File: ParticlePool.java    From Norii with Apache License 2.0 4 votes vote down vote up
public ParticlePool(ParticleType particletype) {
	Utility.loadParticleAsset(particletype.getParticleFileLocation());
	particleEffectPool = new ParticleEffectPool(Utility.getParticleAsset(particletype.getParticleFileLocation()),INITIAL_CAPACITY,MAX_PARTICLES_IN_POOL);
}
 
Example #5
Source File: Particles.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
public Particles(ObjectMap<String, ParticleEffectPool> data) {
    this.data = data;
}
 
Example #6
Source File: Particles.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
public ParticleEffectPool get(String name) {
    if (!data.containsKey(name))
        throw new IllegalArgumentException("there is no such particle: " + name);
    return data.get(name);
}
 
Example #7
Source File: ParticleActor.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
public ParticleActor(ParticleEffectPool.PooledEffect effect) {
    this.effect = effect;
}