Hi i am using Andengine to make an Game application
in that i want to change the background image of an sprite when i click on that sprite. can any body help me how to do that.
this.mFaceTextureRegionBackOn = TextureRegionFactory.extractFromTexture(this.mTextureBackOn);
this.mFaceTextureRegionBackOff = TextureRegionFactory.extractFromTexture(this.mTextureBackOff);
final ButtonSprite back = new ButtonSprite(centerXBack, centerYBack, this.mFaceTextureRegionBackOn, this.getVertexBufferObjectManager());
scene.attachChild(back);
back.setOnClickListener(new OnClickListener() {
@Override
public void onClick(ButtonSprite arg0, float arg1, float arg2) {
MainActivity.this.mFaceTextureRegionBackOn = TextureRegionFactory.extractFromTexture(MainActivity.this.mTextureBackOff);
}
});
there is a sprite button when i click on that button it’s texture region i am changing but it could not help me to change image of that sprite
There is a similar usage in AndEngineExamples, see https://github.com/nicolasgramlich/AndEngineExamples/blob/GLES2/src/org/andengine/examples/UpdateTextureExample.java