贪吃蛇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);

}

}

posted on 2017-12-06 21:11  JETIME庚  阅读(215)  评论(0编辑  收藏  举报

导航