So basically till know I have a DynamicBody where I’m adding 36 sprites when user touch the screen. The thing that I want to know if it’s possible with AndEngine to add a text label on the screen. Let’s say for example I have different flags and the text label is saying England. If user press English flag I want to remove the selected flag when it’s correct and to change the text to USA for example. So I need somehow to make a connection between the selected sprite and the text which is on the screen and to remove the sprite if it’s correct.
SO far I can add/remove sprites, I need a help only adding the text and a way to know which is the right sprite depending on that sprite.
Another second question is : which is the best way I can load 36 sprites on the screen everyone in different position without having any lags and things like that.
For a sample code you can take a look at this post : AndEngine Sprites
AndEngine has support for text labels;
Textis a label with unchangeable text (You only set in once in the constructor) andChangeableTextis a label whose text can be changed.About your second question,
Entityclass has 2 methods calledgetUserData()andsetUserData(Object pData). You can use these to find out which sprite was clicked.For example:
And then, when it is clicked, you can find out which sprite is it:
Loading 36 sprites shouldn’t make a game laggy… Loading 36 large textures might, but if at least some of the sprites are created from the same texture, it’s fine.