August 2015
Intermediate to advanced
280 pages
5h 31m
English
We have the snake eating the apple; however, there aren't any consequences to this. As a part of the game, we need to make the snake increase the length of his body for each apple he eats. Our requirements for this are as follows:
First, let's create a class that will contain the length of the snake's body. This can take the form of an inner class for now:
private class BodyPart { private int x, y; private Texture texture; public BodyPart(Texture texture) { this.texture = texture; } public void updateBodyPosition(int x, int y) { this.x = x; this.y = y; } public void draw(Batch batch) ...