Bug 667

Summary: The Snake picture is ugly and may reduce the flexibility of future extension.
Product: CS3343 2021/22 Group16 Greedy Snake Reporter: LI Ruoxin <ruoxinli3-c>
Component: System sectionAssignee: Baron Qu <zhiyanqu2-c>
Status: RESOLVED FIXED    
Severity: enhancement CC: ruoxinli3-c
Priority: ---    
Version: Ver 2.0   
Hardware: PC   
OS: Windows   

Description LI Ruoxin 2021-12-06 18:20:40 HKT
The picture used for the snake is not very beautiful. And using pictures to construct the snake body may increase the difficulty of developing the AI Mode.
Comment 1 LI Ruoxin 2021-12-06 18:25:07 HKT
The snake body is now replaced by directly painting on the JPanel. The redundant snake pictures are deleted.

Below are the code implementation of painting the snake:

//set its head DARK_GRAY and body Black
protected void drawSnake(Graphics snake) {
		
		for (int i = 0; i < length; i++) {
			if (i == 0) {
				snake.setColor(Color.DARK_GRAY);
			} else {
				snake.setColor(Color.BLACK);
			}
			snake.fillRect(coordinate.get(i).get(SConstant.SC_COORDINATE_XPOS_KEY),coordinate.get(i).get(SConstant.SC_COORDINATE_YPOS_KEY), SConstant.SC_DEFAULT_NODE_SIZE,SConstant.SC_DEFAULT_NODE_SIZE);
		}
		
		drawInformation(snake);
		
}