Me下的贪吃蛇小游戏(3)
//headSanke.setPoint_x(headSanke.getPoint_x()+Snake_Direction.SNAKE_SIZE); 按键游戏
// System.out.println("x: "+headSanke.getPoint_x()+" / y:"+headSanke.getPoint_Y());
// System.out.println("width: "+Canvas_Width);
if(headSanke.getDirection()==Snake_Direction.RIGHT||headSanke.getDirection()==Snake_Direction.RIGHT_x){
if(headSanke.getPoint_x()+Snake_Direction.SNAKE_SIZE>Canvas_Width-30)
{
if(headSanke.getPoint_Y()+Snake_Direction.SNAKE_SIZE<Canvas_Height-20)
{
headSanke.setPoint_Y(headSanke.getPoint_Y()+Snake_Direction.SNAKE_SIZE);
headSanke.setDirection(Snake_Direction.DOWN);
}
else {
headSanke.setPoint_Y(headSanke.getPoint_Y()-Snake_Direction.SNAKE_SIZE);
headSanke.setDirection(Snake_Direction.UP);
}
}
else
headSanke.setPoint_x(headSanke.getPoint_x()+Snake_Direction.SNAKE_SIZE);
}
else if(headSanke.getDirection()==Snake_Direction.UP||headSanke.getDirection()==Snake_Direction.UP_y)
相关新闻>>
- 发表评论
-
- 最新评论 更多>>