Coding the Snake class
Add the import
statements and the member variables for the Snake
class. Be sure to study the code. It will give some insight and understanding to the rest of the Snake
class:
import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Point; import android.view.MotionEvent; 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? ...