Kadir
Kadir

Reputation: 411

How to make particle effect in Andengine?

I'm developing a game by andengine.I need some particle effect for my game. Game: There are balls in scene and they are moving by MoveModifier randomly.And when i touch them,they are getting lost. I want: When they are getting lost,a particle effect occurs like glass broken, ball explosion or sth like that.. How can do that?

Upvotes: 1

Views: 4394

Answers (2)

dg_no_9
dg_no_9

Reputation: 1013

Initialize particle emitter with center as (0,0).

IParticleEmitter emitter = new PointParticleEmitter(0,0);

Initialize particle system with your own parameters as follows.

ParticleSystem particleSystem = new ParticleSystem(emitter,5,10,50,textureRegion);

You may set blend function if you like.

particleSystem.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE);

Then you can add particleInitializers and ParticleModifiers according to your wish.

    particleSystem.addParticleInitializer(new VelocityInitializer(-20, 20, -40, -60));
    particleSystem.addParticleInitializer(new ColorInitializer(1f, 0.5f, 0.8f));
    particleSystem.addParticleModifier(new ExpireModifier(2f));
    particleSystem.addParticleModifier(new ColorModifier(1f, 0.88f, 1f, 0.6f, 0.8f, 0.3f, 0f, 0.4f));

Then you may attach this particleSystem object into your scene or any nodes.

Upvotes: 1

K_Anas
K_Anas

Reputation: 31466

you can view this Project hope you will find some helpful resources

Upvotes: 3

Related Questions