Example usage for com.badlogic.gdx.graphics.g2d ParticleEmitter draw

List of usage examples for com.badlogic.gdx.graphics.g2d ParticleEmitter draw

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g2d ParticleEmitter draw.

Prototype

public void draw(Batch batch) 

Source Link

Usage

From source file:com.tnf.ptm.common.GameDrawer.java

License:Apache License

public void draw(ParticleEmitter emitter, TextureAtlas.AtlasRegion tex, boolean additive) {
    maybeChangeAdditive(additive);/*from  w  ww  . j  a  va 2 s .c  om*/
    emitter.draw(myDrawer.getSpriteBatch());
}

From source file:de.hochschuletrier.gdw.ss15.game.systems.GoalEffectRenderSystem.java

@Override
protected void processEntity(Entity entity, float deltaTime) {
    GoalEffectComponent component = ComponentMappers.goalEffect.get(entity);
    PositionComponent pos = ComponentMappers.position.get(entity);
    TeamComponent team = ComponentMappers.team.get(entity);

    if (team.team != this.teamScored)
        return; //emitter belongs to goal of team who scored

    if (!component.started && !this.goalScored)
        return; //no gool scored and nothing to update

    if (component.started && this.goalScored)
        this.goalScored = false; //all emitters have started

    for (ParticleEmitter emitter : component.effect.getEmitters()) {
        if (!emitter.getName().toLowerCase().equals(this.teamScored.name().toLowerCase())) {
            //gool scored but emitter not started
            if (!component.started) {
                emitter.setPosition(pos.x, pos.y);
                emitter.reset();//from  w  ww  . j a  v  a 2 s .  c o m
                emitter.start();
                component.started = true;
            }
            emitter.update(deltaTime);
            emitter.draw(DrawUtil.batch);
            //System.out.println(emitter.getPercentComplete());
            if (emitter.isComplete()) {
                component.started = false;
            }
        }
    }
}

From source file:de.hochschuletrier.gdw.ss15.game.systems.RenderBallAtPlayerSystem.java

@Override
protected void processEntity(Entity entity, float deltaTime) {
    PlayerComponent player = ComponentMappers.player.get(entity);
    if (!player.hasBall)
        return;//from ww w  . j  a  v a2  s .c o m

    PositionComponent pos = ComponentMappers.position.get(entity);
    TeamComponent team = ComponentMappers.team.get(entity);
    for (ParticleEmitter emitter : effect.getEmitters()) {
        if (emitter.getName().toLowerCase().equals(team.team.name().toLowerCase())) {
            emitter.setPosition(pos.x, pos.y);
            emitter.start();
            emitter.update(deltaTime);
            emitter.draw(DrawUtil.batch);
        }
    }
}

From source file:org.destinationsol.game.GameDrawer.java

License:Apache License

public void draw(ParticleEmitter emitter, TextureAtlas.AtlasRegion tex, boolean additive) {
    maybeChangeAdditive(additive);//  w ww.ja v  a  2  s.co m
    emitter.draw(myDrawer.getBatch(emitter.getSprite().getTexture(), tex));
}