As we all know that the particle editor give us a explosive particle line . However , what I need is a particle move from around point to the point I clicked . How can I realize this?
1 Answers
0
votes
Just take a "Point particle" and change the position over time to the clicked point while the ParticleEffectis running. Thats all you need todo. A simple approach would be to create a class which holds the component ParticleEffect, an target position and extends Actor. Inside of the act(float delta) you update the position of the Actor into the direction of the target by an speedvalue multiplied with the delta time. Don't forget to update the postion of the ParticleEffect. Something like this:
@Override
public void act2(float delta) {
direction = this.pos - this.target; //both are vector2
direction.nor();
this.setPosition(direction.x*delta*velocity, direction.y*delta*velocity);
}
@Override
public void draw2(Batch batch, float alpha) {
emitter.setPosition(getX(), getY());
emitter.draw(batch);
}