粒子系统libGDX粒子、系统、libGDX

由网友(像艳遇一样忧伤)分享简介:谁能给我从哪里开始制作一个粒子系统libGDX一个很好的例子?我已经看过了libGDX源测试的例子,但我仍然有麻烦我的头周围。也许它只是一个很好的解释会有所帮助。我想我要让某种爆炸了很多五颜六色的颗粒。任何帮助是极大AP preciated!Can anyone give me a good example of w...

谁能给我从哪里开始制作一个粒子系统libGDX一个很好的例子?我已经看过了libGDX源测试的例子,但我仍然有麻烦我的头周围。也许它只是一个很好的解释会有所帮助。我想我要让某种爆炸了很多五颜六色的颗粒。任何帮助是极大AP preciated!

Can anyone give me a good example of where to start with making a particle system in libGDX? I have looked at the test example in the libGDX source but I am still having trouble getting my head around it. Maybe just a good explanation of it will help. I'm thinking I want to make some sort of explosion with a lot of colorful particles. Any help is greatly appreciated!

推荐答案

定义你的游戏类粒子特效:

Define a particle effect in your game class:

public ParticleEffect particleEffect;

初​​始化:

Initialize it:

    particleEffect = new ParticleEffect();
    particleEffect.load(Gdx.files.internal("data/particleEffect.p"), 
            Gdx.files.internal("data"));

在你的渲染()方法,你想粒子发射的地点位置(爆炸地点):

In your render() method, position it at the place you want particles to be emitted (explosion location):

    particleEffect.setPosition(world.effectX, world.effectY);

最后画出来(也内渲染()):

    particleEffect.draw(spriteBatch, delta);

就这样,pretty的简单明了。

That's it, pretty simple and straightforward.

另一件事,效果本身,看看被内特,http://libgdx.google$c$c.com/svn/jws/particle-editor.jnlp.使用编辑器,你应该能够创造出不错的效果。否则,复制从实施例的粒子文件并进行修改。

Another thing, the effect itself, have a look at the Particle Editor by Nate, http://libgdx.googlecode.com/svn/jws/particle-editor.jnlp. Using the editor you should be able to create nice effects. Otherwise, copy the particle file from the examples and modify it.

阅读全文

相关推荐

最新文章