An Abstract Data type which represents a one-unit of food.
More...
|
def | __init__ (self, blockSize) |
| Food constructor. More...
|
|
def | draw_food (self, location) |
| Draw method uses pygame to draw the food object on the window. More...
|
|
def | redraw_food (self, x, y, location, screenSize) |
| redraw_food method redraws the food on the screen randomly More...
|
|
An Abstract Data type which represents a one-unit of food.
def Food.Food.__init__ |
( |
|
self, |
|
|
|
blockSize |
|
) |
| |
Food constructor.
Initializes the size of the food, this needs to be the same as snake's block size
- Parameters
-
blockSize | the width and height of the square block representing the food |
def Food.Food.draw_food |
( |
|
self, |
|
|
|
location |
|
) |
| |
Draw method uses pygame to draw the food object on the window.
- Parameters
-
location | A list which consists the x and y location of the food |
def Food.Food.redraw_food |
( |
|
self, |
|
|
|
x, |
|
|
|
y, |
|
|
|
location, |
|
|
|
screenSize |
|
) |
| |
redraw_food method redraws the food on the screen randomly
- Parameters
-
x | is the location of snake's x-axis head location |
y | is the location of snake's y-axis head location |
location | is a list that gives the location of present food |
screenSize | is the size of the screen |
The documentation for this class was generated from the following file: