Search in sources :

Example 1 with EmitterActor

use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.

the class MoonActor method initEmitters.

private void initEmitters() {
    emitter = new EmitterActor(StrPathBuilder.build(PathFinder.getSfxPath(), "moons", moon.name()));
    addActor(emitter);
    float offsetX = getOffset();
    float offsetY = getOffset();
    emitter.start();
    emitter.setSpeed(0.12f);
    float size = getEmitterScale();
    emitter.getEffect().getEmitters().get(0).scaleSize(size, size);
    emitter.setPosition((FULL_SIZE / 2 + offsetX), (FULL_SIZE / 2 + offsetY));
    circleEmitter = new EmitterActor(StrPathBuilder.build(PathFinder.getSfxPath(), "moons", "circle " + moon.name()));
    addActor(circleEmitter);
    offsetX = getOffset();
    offsetY = getOffset();
    circleEmitter.start();
    circleEmitter.setSpeed(0.12f);
    size = 1.4f;
    // size =1/(size+2)/3;
    circleEmitter.getEffect().getEmitters().get(0).scaleSize(size, size);
    circleEmitter.setPosition((FULL_SIZE / 2 + offsetX), (FULL_SIZE / 2 + offsetY));
}
Also used : EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Example 2 with EmitterActor

use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.

the class AnimMultiplicator method applyTemplateAngles.

private void applyTemplateAngles(Set<Coordinates> coordinates) {
    int max = template.getNumberOfEmitters(getActive());
    // 1 for ray, but we know coordinates precisely
    List<EmitterActor> list = new ArrayList<>();
    for (EmitterActor e : emitterList) {
        int angle = 0;
        for (Coordinates coordinate : coordinates) {
            if (e.isGenerated()) {
                continue;
            }
            EmitterActor actor = multiplicateEmitter(angle, coordinate, e);
            angle += 360 / max;
            list.add(actor);
        }
    }
    list.forEach(a -> emitterList.add(a));
}
Also used : Coordinates(main.game.bf.Coordinates) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Example 3 with EmitterActor

use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.

the class EmitterController method setForActive.

public void setForActive() {
    String presetPath = new FileChooser(PathFinder.getSfxPath()).launch("", "");
    // ImageChooser ic = new ImageChooser();
    // ic.setDefaultFileLocation(PathFinder.getSfxPath()+"images//");
    // String imagePath = ic.
    ActiveObj active = DC_Game.game.getManager().getActiveObj().getRef().getActive();
    CompositeAnim anim = AnimMaster.getInstance().getConstructor().getOrCreate(active);
    // ANIM_PART part = ANIM_PART.IMPACT;
    anim.getMap().keySet().forEach(part -> {
        // anim.getMap().get(part).getData().setValue();
        List<EmitterActor> list = EmitterPools.getEmitters(presetPath);
        anim.getMap().get(part).setEmitterList(list);
    });
// impact?
}
Also used : ActiveObj(main.entity.obj.ActiveObj) FileChooser(main.swing.generic.components.editors.FileChooser) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor) CompositeAnim(eidolons.libgdx.anims.CompositeAnim)

Example 4 with EmitterActor

use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.

the class EditorParticleMaster method clicked.

public void clicked(int x, int y) {
    String path = EditorMapView.getInstance().getGuiStage().getEmitterPalette().getSelectedEmitterPath();
    EmitterActor last = particles.create(path, x, y);
    last.start();
    stack.push(last);
    final DAY_TIME time = this.time;
    last.addListener(new ClickListener() {

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            if (button == 1) {
                removeEmitter(last, time);
            }
            return super.touchDown(event, x, y, pointer, button);
        }
    });
    MapMaster.addToListMap(map, time, last);
    // layer
    // centering? emitters probably self-center...
    last.setPosition(x, y);
    layers.get(time).addActor(last);
    GuiEventManager.trigger(MapEvent.EMITTER_CREATED, last);
}
Also used : DAY_TIME(main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Example 5 with EmitterActor

use of eidolons.libgdx.anims.particles.EmitterActor in project Eidolons by IDemiurge.

the class MapMoveLayers method spawn.

private void spawn(MapMoveLayer container, int x, int y, int w, int h) {
    x = RandomWizard.getRandomIntBetween(x, // can overlap!}
    x + w);
    y = RandomWizard.getRandomIntBetween(y, y + h);
    addActor(container);
    if (container.type.emitterPaths != null)
        if (RandomWizard.random()) {
            for (String sub : container.type.emitterPaths) {
                EmitterActor emitter = new EmitterActor(sub);
                container.addActor(emitter);
                emitter.setPosition(container.getWidth() / 2, container.getHeight() / 2);
                emitter.start();
                emitter.getEffect().getEmitters().get(0).scaleSize(container.getScaleX() + 0.25f);
            }
            container.getContent().setZIndex(0);
        }
    container.setOriginalX(x);
    container.setOriginalY(y);
    container.getContent().setPosition(x, y);
    container.setFluctuatingAlpha(0);
    MapMaster.addToListMap(map, time, container);
    if (isTinted(container)) {
        tint(container.getColor());
    }
// alpha to 0
}
Also used : EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

Aggregations

EmitterActor (eidolons.libgdx.anims.particles.EmitterActor)17 Vector2 (com.badlogic.gdx.math.Vector2)3 Actor (com.badlogic.gdx.scenes.scene2d.Actor)2 DAY_TIME (main.content.enums.macro.MACRO_CONTENT_CONSTS.DAY_TIME)2 Coordinates (main.game.bf.Coordinates)2 Batch (com.badlogic.gdx.graphics.g2d.Batch)1 ParticleEmitter (com.badlogic.gdx.graphics.g2d.ParticleEmitter)1 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)1 CompositeAnim (eidolons.libgdx.anims.CompositeAnim)1 EMITTER_VALUE_GROUP (eidolons.libgdx.anims.particles.EmitterPresetMaster.EMITTER_VALUE_GROUP)1 MAP_POINTS (eidolons.libgdx.screens.map.layers.MapMoveLayers.MAP_POINTS)1 ActiveObj (main.entity.obj.ActiveObj)1 FileChooser (main.swing.generic.components.editors.FileChooser)1 DequeImpl (main.system.datatypes.DequeImpl)1