August 2015
Intermediate to advanced
280 pages
5h 31m
English
Next up, we need to get our snake eating something. Let's get our apple implemented.
We will need to get our apple to do the following things:
Right! Let's add the texture:
private Texture apple;
Then, let's amend our show() method and add the code to instantiate the apple texture:
apple = new Texture(Gdx.files.internal("apple.png"));Let's add a flag to determine if the apple is available:
private boolean appleAvailable = false;
private int appleX, appleY;This will control whether or not we want to place one. In the Snake game, the next apple appears after the current apple ...