/* 贪吃蛇可能移动的方向 */
public final static byte DOWN = 2;
public final static byte LEFT = 4;
public final static byte RIGHT = 6;
public final static byte UP = 8;
// 贪吃蛇的当前方向
private byte currentDirection;
// 保存贪吃蛇每一段的列表
private Vector worm = new Vector(5, 2);
// 是否需要更新状态
private boolean needUpdate;
// 是否在运动中
private boolean moveOnNextUpdate;
// 是否吃到食物
private boolean hasEaten;
// 贪吃蛇的初始位置、长度和方向
private final static int INIT_X = 3;
private final static int INIT_Y = 8;
private final static int INIT_LEN = 8;
private final static byte INIT_DIR = RIGHT; |