set TouchEvent to every particle in SpriteParticleSystem in andEngine livewallpaper

Posted by Girish Bhutiya on Game Development See other posts from Game Development or by Girish Bhutiya
Published on 2013-02-07T06:13:19Z Indexed on 2014/08/21 10:31 UTC
Read the original article Hit count: 663

Filed under:
|
|
|
|

All
I have working on andEngine Live wallpaper and I have use SpriteParticleSystem. I want to add touch event to every Sprite of SpriteParticleSystem and remove that sprite from scene.

I have use below code for create particle system.

final SpriteParticleSystem particleSystem = new SpriteParticleSystem(new PointParticleEmitter(mParticleX, mParticleY),mParticleMinRate, mParticleMaxRate, mParticleMax,this.mFlowerTextureRegion, this.getVertexBufferObjectManager());


        //particleSystem.addParticleInitializer(new BlendFunctionParticleInitializer<Sprite>(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE));
        particleSystem.addParticleInitializer(new VelocityParticleInitializer<Sprite>(-90, 0, 0, 0));
        particleSystem.addParticleInitializer(new AccelerationParticleInitializer<Sprite>(8, -11));
        particleSystem.addParticleInitializer(new RotationParticleInitializer<Sprite>(0.0f, 360.0f));
        //particleSystem.addParticleInitializer(new ColorParticleInitializer<Sprite>(1.0f, 1.0f, 0.0f));
        particleSystem.addParticleInitializer(new ExpireParticleInitializer<Sprite>(15.5f));

        particleSystem.addParticleModifier(new ScaleParticleModifier<Sprite>(0, 5, 0.5f, 2.0f));
        background = new Sprite(0, 0, backgroundTextureRegion, mEngine.getVertexBufferObjectManager());
        background.setPosition((CAMERA_WIDTH - background.getWidth()) * 0.5f, (CAMERA_HEIGHT - background.getHeight()) * 0.5f);
        //background.setScale(1.5f);
        //SpriteBackground bg = new SpriteBackground(background);
        //mScene.setBackground(bg);
        this.mScene.attachChild(background);
        this.mScene.attachChild(particleSystem);  <br>

Thanks in advance.

© Game Development or respective owner

Related posts about android

Related posts about sprites