I’m developing a game for Android using andEngine. I have to change sprite images dynamically. In J2ME, i used
sprite.setImage("img.png");
But in andengine, i not able to find method
//sprite.setImage(?); -In andengine
Any solutions ?
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 think use TextureRegion is a better way to change sprite’s image.
Add the following code in org.anddev.andengine.entity.sprite
Then you can change image by this method. You can check the andengine samples to see how to create a texture region from an image.
PS, if
mTextureRegionis final, just remove thefinalsyntax.