I have in my app some sprites.
When I touch a sprite (in TouchEvent.isActionDown() ) , I need to change its image
How can I made this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not familiar with AndEngine, but by the looks of it, the
Spriteclass does not provide the functionality to change its image – or better said: texture. However, you might be able to accomplish your goal by using theTiledSpriteorAnimatedSprite.The latter is an extension of the first, so you should be able to use a TiledSprite. It has
setCurrentTileIndex()andnextTilemethods that seem to allow you to swap out one texture region by another. You may need to modify your images into a format suitable for AndEngine though and obviously you will need a handle to the touched sprite.