Coding the Snake class
Add the single import
statement and the member variables. Be sure to study the code it will give some insight and understanding to the rest of the Snake
class.
import java.util.ArrayList; class Snake { // The location in the grid of all the segments private ArrayList<Point> segmentLocations; // How big is each segment of the snake? private int mSegmentSize; // How big is the entire grid private Point mMoveRange; // Where is the center of the screen // horizontally in pixels? private int halfWayPoint; // For tracking movement Heading private enum Heading { UP, RIGHT, DOWN, LEFT } // Start by heading to the right private Heading heading = Heading.RIGHT; // A bitmap for each direction the head can face private Bitmap mBitmapHeadRight; private Bitmap mBitmapHeadLeft; private Bitmap mBitmapHeadUp; private Bitmap mBitmapHeadDown; // A bitmap for the body private Bitmap...