Request 5 (LibGDX) - Particle Effects

dermetfan · 35K views · 2013 · 22:42

Open on YouTube

Game programming & enginesIndie game developmentSoftware (other)tutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering why a LibGDX particle effect from the .p file does not appear, since it walks through the editor and the load/start/draw code.

Recommended by 5 people across 5 different months, 2014 to 2015.

What it is

A 22-minute LibGDX tutorial by dermetfan on using the Particle Editor that ships with LibGDX and loading the resulting effect in code. It builds a simple empty screen and shows the handful of lines needed to load, start, draw and position a ParticleEffect.

What people said

Recommends Paul · 2014-01 · Stack Overflow · on “particle effect does not appear in libgdx?”

EDIT OK I found this video that explains how to use it : [this video] it works with this code: //in create effect = new ParticleEffect(); FileHandle fileDir = Gdx.files.internal("data"); effect.load(Gdx.files.internal("data/myParticleTxtFile"), fileDir); effect.start(); //in render effect.draw(batch, Gdx.graphics.getDeltaTime()); batch.end(); Previous message: I created a particle effect with the particle editor, I added the text file to the data folder. The particle constructor needs an atlas, so I created a new atlas with TexturePacker but I could not make it work.

Recommends Paul · 2014-01 · Stack Overflow · on “particle effect does not appear in libgdx?”

OK I found this video that explains how to use it : [this video] it works with this code: //in create effect = new ParticleEffect(); FileHandle fileDir = Gdx.files.internal("data"); effect.load(Gdx.files.internal("data/myParticleTxtFile"), fileDir); effect.start(); //in render effect.draw(batch, Gdx.graphics.getDeltaTime()); batch.end();

Recommends Deepscorn · 2014-05 · Stack Overflow · on “Libgdx ParticleEffect: There are no errors, but nothing is drawn”

Run once: effect = new ParticleEffect(); effect.load(Gdx.files.internal("path/to/your/particle.p", "directory/with/your/particle/png")); effect.setPosition(200, 200); effect.start(); Run in render: spriteBatch.begin(); effect.draw(spriteBatch, delta); spriteBatch.end(); And in dispose: effect.dispose(); Particle.png can be copied from libgdx sources for example: [LINK] And watch again the video tutorial - you are messing and missing many things: [this video] The tutorial itself covers less things, than video, but pasting here for hope it will be updated: [LINK]

Recommends T B · 2014-07 · Stack Overflow · on “How to use the .p files created from Libgdx particle editor in my Android game”

I have created a .p file using Libgdx particle editor by downloading libgdx-nightly-latest.zip using this [this video] tutorial. Now in my Android project i have added gdx.jar and gdx-backend-android.jar as external jar from Libgdx. I found the following code which are used in libgdx project: ParticleEffect effect = new ParticleEffect(); FileHandle fileDir = Gdx.files.internal("data"); effect.load(Gdx.files.internal("data/myParticleTxtFile"), fileDir); effect.start(); effect.draw(batch, Gdx.graphics.getDeltaTime()); batch.end(); I modified the above code as follows in onDraw() method ParticleEffect effect = new ParticleEffect(); FileHandle fileDir = Gdx.files.internal("asset"); effect.load(Gdx.fi

Recommends Prasanjit Dey · 2015-06 · Stack Overflow · on “Cigarette simulator - How was the animation done? (Android)”

I think the guy is using a particle system in any game engine to achieve the desired and it can be done easily. [this video]

Recommends asherbret · 2015-07 · Stack Overflow · on “libgdx - trail effect with particle effect or animation”

The easiest way to do this is using particle effects. it's hard to give more information since every particle effect is rather specific to its' game's needs. I suggest you take a look at the wiki [LINK] . Also, take a look at this helpful video [this video] . It has a basic usage of the particle effect editor, as well as the usage of ParticleEffect objects in libgdx code.

Cites jdubbing · 2014-03 · Stack Overflow · on “Particle effect not rendering”

I'm trying to use a particle effect, but I encounter an error associated with this task before my application starts. This is how I've set it up: private ParticleEffect particle; @Override public void create(){... ParticleEffect particle = new ParticleEffect(); particle.load(Gdx.files.internal("data/effects/flame1"), Gdx.files.internal("data/effects")); particle.setPosition(Gdx.graphics.getWidth() /2, Gdx.graphics.getHeight() /2); particle.start(); .........} @Override public void render(){... spriteBatch.begin(); particle.draw(spriteBatch, Gdx.graphics.getDeltaTime()); spriteBatch.end(); Note that my particle effects file and corresponding source image file is located under data/effects fol