贪吃蛇Food Java实现(二)
1.antition包Food类
package cn.tcc.snake.antition;
import java.awt.Graphics;
import java.awt.Point;
public class Food extends Points{
public void newFood(Point p){
this.setLocaltion(p);
System.out.println("Food");
}
public void isSankeEatFood(Sanke sanke){
System.out.println("Sanke");
return this.equals(Sanke.getHead());
}
public void drawMe(Graphics g){
System.out.println("sanke drawme");
g.fill3DRect(x * Global.CELL_SIZE, y* Global.CELL_SIZE, Global.CELL_SIZE,Global.CELL_SIZE, true);
}
}
你来是缘分,你走也是