本文介绍了libgdx particleEffect旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我画我的火的Andr​​oid设备上使用libgdx:

I draw fire on my android device with libgdx:

ParticleEffect effect;
ParticleEffectPool fireEffectPool;
Array<PooledEffect> effects = new Array<PooledEffect>();

@Override
public void create()
{
    ...
    effect = new ParticleEffect();
    effect.load(Gdx.files.internal("particles/fire01.p"), Gdx.files.internal("image"));
    effect.setFlip(true, false);
    fireEffectPool = new ParticleEffectPool(effect, 1000, 3000);

    PooledEffect myEffect = fireEffectPool.obtain();
    myEffect.setPosition(200, 400);
    effects.add(myEffect);
    ...
}

我可以旋转,设置速度或编程扩展我的影响?

Can I rotate, set speed or scale my effect programmatically?

推荐答案

是的。退房ParticleEmitterTest:https://github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/ParticleEmitterTest.java

Yes. Check out the ParticleEmitterTest: https://github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/ParticleEmitterTest.java

您只需要获得一个ParticleEmitter:

You just need to obtain a ParticleEmitter:

emitter = effect.getEmitters().first();
emitter.getScale().setHigh(5, 20);

这篇关于libgdx particleEffect旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 18:04