I want to create some game, but I have a problem. I want to draw two images. I used Texture and SpriteBatch to draw two images. But now I want to implement some actions. I want to create messege for user. If he click on first image he gets message: your choice is picture1. And for the other image algorithm is the same.
public void create() {
background = new Texture(Gdx.files.internal("backg.png"));
polishFlag = new Texture(Gdx.files.internal("german.png"));
englishFlag = new Texture(Gdx.files.internal("english.png"));
batch = new SpriteBatch();
}
public void render() {
batch.begin();
batch.draw(background, 0, 0, 480, 320);
batch.draw(germanFlag, 140,80, 90, 60);
batch.draw(englishFlag, 260,80, 90, 60);
batch.end();
}
How I can implement this functionality? I want to this solution work on android platform. Some ideas?
Take a look at the InputProcessor interface. (Alternatively, use an InputMultiplexer class).
Using an InputProcessor you could do something like: