user5450074 user5450074 - 3 months ago 21
Java Question

flip horizontaly (X) a ParticleEffect [Libgdx]

i got a particle effect thats is inside a group

shellParticle = new ParticleEffect();
shellParticle.load(Gdx.files.internal("shell13"),Gdx.files.internal(""));
shellParticle.getEmitters().first().setPosition(0,0);
shellParticle.scaleEffect(0.3f);


i need it to flip horizontaly but it just jave the function
flipY
and
setFlip(bool X, bool Y)



setFlip(true,false) just do nothing.


flipY()
actualy flip it verticaly.
Also i cant substract its own width*2 beause it dosent have...
Any ideas??

Answer

This seems to be a lack of infrmation from part of libgx api. The setFlip method is flipping the particle sprites (for particles which have already been emitted and future particles). flipY() modify propieties of emmiter setting everithing to negative but setting to negative just some of properties i get the flipX() method. Acctualy every change you wanna do with particules you shoud do it with emmiters properties exeptiong for the x and y position.

   private void flipX(){


    emmiter.getAngle().setHigh(emmiter.getAngle().getHighMin(),emmiter.getAngle().getHighMax());
    emmiter.getAngle().setLow(emmiter.getAngle().getLowMin(),emmiter.getAngle().getLowMax());

    emmiter.getGravity().setHigh(emmiter.getGravity().getHighMin(),emmiter.getGravity().getHighMax());
    emmiter.getGravity().setLow(emmiter.getGravity().getLowMin(),emmiter.getGravity().getLowMax());

    emmiter.getWind().setHigh(-emmiter.getWind().getHighMin(),-emmiter.getWind().getHighMax());
    emmiter.getWind().setLow(-emmiter.getWind().getLowMin(),-emmiter.getWind().getLowMax());

    emmiter.getRotation().setHigh(-emmiter.getRotation().getHighMin(),-emmiter.getRotation().getHighMax());
    emmiter.getRotation().setLow(-emmiter.getRotation().getLowMin(),-emmiter.getRotation().getLowMax());

    emmiter.getYOffsetValue().setLow(emmiter.getYOffsetValue().getLowMin(),emmiter.getYOffsetValue().getLowMax());

    emmiter.getXOffsetValue().setLow(emmiter.getXOffsetValue().getLowMin(),emmiter.getXOffsetValue().getLowMax());

}

I hope it helps someone.