接著為蛇蛇和果實加上邊框並在右下角加上陰影 !
pygame.draw.rect(canvas, grey, (snake.head[0], snake.head[1], unit + 2, unit + 2))
for body in snake.body[1:]:
pygame.draw.rect(canvas, grey, (body[0] + 1, body[1] + 1, unit, unit))
pygame.draw.rect(canvas, snake.color1, (snake.head[0] - 1, snake.head[1] - 1, unit + 2, unit + 2))
pygame.draw.rect(canvas, snake.color2, (snake.head[0] - 1, snake.head[1] - 1, unit + 2, unit + 2), 2)
for body in snake.body[1:]:
pygame.draw.rect(canvas, snake.color1, (body[0], body[1], unit, unit))
pygame.draw.rect(canvas, snake.color2, (body[0], body[1], unit, unit), 2)
pygame.draw.rect(canvas, grey, (fruit.pos[0] + 3, fruit.pos[1] + 3, unit - 4, unit - 4), 0, 3)
pygame.draw.rect(canvas, red, (fruit.pos[0] + 2, fruit.pos[1] + 2, unit - 4, unit - 4), 0, 3)
pygame.draw.rect(canvas, darkRed, (fruit.pos[0] + 2, fruit.pos[1] + 2, unit - 4, unit - 4), 2, 3)