libgdx 粒子效果旋转

libgdx particleEffect rotation(libgdx 粒子效果旋转)

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

问题描述

我用 libgdx 在我的 android 设备上引火:

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 粒子效果旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:libgdx 粒子效果旋转

基础教程推荐