Smoke effects of android engine using particle system

Source: Internet
Author: User

@ Override
Protected Scene onCreateScene (){
Final Scene scene = new Scene ();

Sprite background = new Sprite (0, 0, backgroundTextureRegion, getVertexBufferObjectManager ());
Scene. attachChild (background );

Rectangleparticle emitter = new rectangleparticle emitter (CAMERA_WIDTH, CAMERA_HEIGHT/2, 1, CAMERA_HEIGHT );

Final SpriteParticleSystem particle system = new SpriteParticleSystem (emitter, 10, 90,360, mParticleTextureRegion, getVertexBufferObjectManager ());

Particle System. addparticipant leinitializer (new colorparticipant leinitializer <Sprite> (0.45f, 0.45f, 0.45f ));
Particle System. addparticipant leinitializer (new AlphaParticleInitializer <Sprite> (0 ));
Participant system. addparticipant leinitializer (new blendfunctionparticipant leinitializer <Sprite> (gles1_gl _ SRC_ALPHA, gles1_gl _ ONE ));
Participant system. addparticipant leinitializer (new velocityparticipant leinitializer <Sprite> (-50,-5,-5, 5 ));
Participant system. addparticipant leinitializer (new rotationparticipant leinitializer <Sprite> (0.0f, 360.0f ));
Participant system. addparticipant leinitializer (new expireparticipant leinitializer <Sprite> (9 ));

Particle System. addparticipant lemodifier (new ScaleParticleModifier <Sprite> (0, 1, 1.0f, 3.0f ));
Participant system. addparticipant lemodifier (new colorparticipant lemodifier <Sprite> (0, 2, 0, 0.45f, 0, 0.45f, 0, 0.45f ));
Participant system. addparticipant lemodifier (new colorparticipant lemodifier <Sprite> (3, 5, 0.45f, 0, 0.45f, 0, 0.45f, 0 ));
Participant system. addparticipant lemodifier (new colorparticipant lemodifier <Sprite> (6, 9, 0, 0.45f, 0, 0.45f, 0, 0.45f ));
Particle System. addparticipant lemodifier (new AlphaParticleModifier <Sprite> (0, 1, 0, 0.25f ));
Particle System. addparticipant lemodifier (new AlphaParticleModifier <Sprite> (2, 5, 0.25f, 0 ));
Particle System. addparticipant lemodifier (new AlphaParticleModifier <Sprite> (6, 7, 0.25f, 0 ));
Particle System. addparticipant lemodifier (new AlphaParticleModifier <Sprite> (8, 9, 0.25f, 0 ));

Scene. attachChild (participant system );

Scene. setOnSceneTouchListener (new IOnSceneTouchListener (){
Public boolean onSceneTouchEvent (Scene pScene, TouchEvent pSceneTouchEvent ){
If (pSceneTouchEvent. isActionUp ()){
Participant system. setparticipant lesspawnenabled (false );
}
Return false;
}
});

Return scene;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.