Snake
Public Member Functions | Public Attributes | List of all members
Food.Food Class Reference

An Abstract Data type which represents a one-unit of food. More...

Public Member Functions

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...
 

Public Attributes

 size
 

Detailed Description

An Abstract Data type which represents a one-unit of food.

Constructor & Destructor Documentation

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
blockSizethe width and height of the square block representing the food

Member Function Documentation

def Food.Food.draw_food (   self,
  location 
)

Draw method uses pygame to draw the food object on the window.

Parameters
locationA 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
xis the location of snake's x-axis head location
yis the location of snake's y-axis head location
locationis a list that gives the location of present food
screenSizeis the size of the screen

The documentation for this class was generated from the following file: