Introduction - If you have any usage issues, please Google them yourself
Design ideas
Firstly, the main knowledge point of this program is the graphical user interface. The basic structure design of the interface is as follows
To build a framework as a basic interface for visual programming interfaces, considering that you want to add a variety of components to your program, it is reasonable to use the panel, so you will inherit the JPanel class.
The next step is to add a variety of elements to the program, including the snake body, the food (both the snake body and the food are made of small squares, using different color differences); Additionally, the divider (that is, the length of the snake times 10). The meter.
Another is the process design of the program: the movement of the snake should include the movement of the snake.
Finally, the state of the snake: it should include whether the snake has eaten the food, whether it has hit a wall, or whether it has bitten itself.
In addition, when running the program, you should consider the problem of delay. Therefore, the content of the thread should be used. The design is to implement the interface Runnabled.
Packet : 71477207snake(java).rar filelist
calculator\.project
calculator\.classpath
calculator\bin\packagecalculator\CalculatorPanel.class
calculator\bin\packagecalculator\Calculator.class
calculator\src\packagecalculator\Calculator.java
calculator\src\packagecalculator\CalculatorPanel.java
snake\.project
snake\.classpath
snake\bin\Snake$MySnake.class
snake\bin\Snake.class
snake\bin\Direction.class
snake\bin\Snake$1.class
snake\bin\Snake$2.class
snake\src\Snake.java
Calculator.jar
java程序设计.ppt
Snake.jar
calculator\bin\packagecalculator
calculator\src\packagecalculator
calculator\bin
calculator\src
snake\bin
snake\src
calculator
snake