String s="Score: "+snakeModel.score;
labelScore.setText(s);
}
//----------------------------------------------------------------------
//begin():游戏开始,放置贪吃蛇
//----------------------------------------------------------------------
void begin()
{
if(snakeModel==null||!snakeModel.running)
{
snakeModel=new SnakeModel(this,canvasWidth/nodeWidth,
this.canvasHeight/nodeHeight);
(new Thread(snakeModel)).start();
}
}
//----------------------------------------------------------------------
//main():主函数
//----------------------------------------------------------------------
public static void main(String[] args)
{
GreedSnake gs=new GreedSnake();
}
}
/**************************************************************************
*文件名:SnakeModel.java
*作者:C.Jason
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/