Hello I am a newbie with libgdx, my question is: how could I add a Particleeffect to a Body that is moving? I searched about the matter and I didnt find anything related to it.
I have the following code to add my ball:
public Body createThrowedBall(float x, float y) {
Gdx.app.log("createThrowedBall", "("+x+","+y+")");
BodyDef ballDef = new BodyDef();
ballDef.type = BodyType.DynamicBody;
ballDef.position.set(x,y);
CircleShape shape = new CircleShape();
shape.setRadius(5.5f);
FixtureDef fixtureDef= new FixtureDef();
fixtureDef.shape = shape;
fixtureDef.density = 1f;
fixtureDef.friction = 0f;
fixtureDef.restitution = 0f;
fixtureDef.filter.groupIndex = -1;
Body body = world.createBody(ballDef);
body.createFixture(fixtureDef);
shape.dispose();
// note the massive impulse vector
body.applyLinearImpulse(new Vector2(0, 5500), new Vector2(x,camera.viewportHeight), false);
return body;
}
That draws a simple circle shape that is throwed up. I want to add like a fire effect burning during the throw ( I did it with the Particle Editor) but I dont know how to attach it.