I am trying to clear out the drawn texture from the screen.
Lets take a classic game example - in many games when the character goes through the coins the coins clears out from the screen and displays a sweet animation like fade in and fade out the points collected from that coin(+10) and show the coin exploding animation on that position.
I want to do something similar to that.
I am using SpriteBatch to draw the texture region like below.
Setting texture Region:
(...) public Texture texture; public TextureRegion coin; texture = new Texture(Gdx.files.internal("data/texture.png")); texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest); coin = new TextureRegion(texture, 0, 336, 65, 73); (...)
Drawing the texture into screen :
public SpriteBatch batcher; batcher = new SpriteBatch(); batcher.setProjectionMatrix(cam.combined); batcher.begin(); batcher.enableBlending(); batcher.draw(coin, x, y, 65,73); (...) (...) batcher.end(); The game character is also drawn using the same logic shown above.
Now when the game character will collide with the coin that I have drawn,the coin must be cleared(vanished) and some animation or big font like +50 must fadein and fadeout in that position.I tried but didn't find anything that would do this.
So how to do that ?

Coininstance and create aScoreDisplayinstance where it was? Shouldn't that cause your view to stop drawing the coin sprite and start drawing a +10 score text? \$\endgroup\$batcher.draw(coin, x, y, 65,73);work it will start throwing error on that line . \$\endgroup\$ArrayList<GameObject> gameObjectsand between yourbatcher'sbeginandend, dofor (GameObject o : gameObjects) { batcher.draw(gameObject.sprite, gameObject.x, gameObject.y, ...); }. That way, you can just add or removeCoins fromgameObjectsto control whether they're drawn or not. ThengameObjectsis your model and yourbatcherthe view. Do you see what I mean? \$\endgroup\$