Skip to content
Snippets Groups Projects
Forked from asghar / se3xa3
112 commits ahead of the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
classFood_1_1Food.tex 4.18 KiB
\hypertarget{classFood_1_1Food}{}\section{Food.\+Food Class Reference}
\label{classFood_1_1Food}\index{Food.\+Food@{Food.\+Food}}


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


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
def \hyperlink{classFood_1_1Food_ae4c3146df2eab1cffad7a10bab5b721f}{\+\_\+\+\_\+init\+\_\+\+\_\+} (self, block\+Size)
\begin{DoxyCompactList}\small\item\em \hyperlink{classFood_1_1Food}{Food} constructor. \end{DoxyCompactList}\item 
def \hyperlink{classFood_1_1Food_aad94875bc7f2f6c990b826c9dc40092f}{draw\+\_\+food} (self, location)
\begin{DoxyCompactList}\small\item\em Draw method uses pygame to draw the food object on the window. \end{DoxyCompactList}\item 
def \hyperlink{classFood_1_1Food_a4a84b471eb86eaab7414ce1f28915fd6}{redraw\+\_\+food} (self, x, y, location, screen\+Size)
\begin{DoxyCompactList}\small\item\em redraw\+\_\+food method redraws the food on the screen randomly \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
{\bfseries size}\hypertarget{classFood_1_1Food_a811a8754b4796d69534a0649520a5993}{}\label{classFood_1_1Food_a811a8754b4796d69534a0649520a5993}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
An Abstract Data type which represents a one-\/unit of food. 

\subsection{Constructor \& Destructor Documentation}
\index{Food\+::\+Food@{Food\+::\+Food}!\+\_\+\+\_\+init\+\_\+\+\_\+@{\+\_\+\+\_\+init\+\_\+\+\_\+}}
\index{\+\_\+\+\_\+init\+\_\+\+\_\+@{\+\_\+\+\_\+init\+\_\+\+\_\+}!Food\+::\+Food@{Food\+::\+Food}}
\subsubsection[{\texorpdfstring{\+\_\+\+\_\+init\+\_\+\+\_\+(self, block\+Size)}{__init__(self, blockSize)}}]{\setlength{\rightskip}{0pt plus 5cm}def Food.\+Food.\+\_\+\+\_\+init\+\_\+\+\_\+ (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{block\+Size}
\end{DoxyParamCaption}
)}\hypertarget{classFood_1_1Food_ae4c3146df2eab1cffad7a10bab5b721f}{}\label{classFood_1_1Food_ae4c3146df2eab1cffad7a10bab5b721f}


\hyperlink{classFood_1_1Food}{Food} constructor. 

Initializes the size of the food, this needs to be the same as snake\textquotesingle{}s block size 
\begin{DoxyParams}{Parameters}
{\em block\+Size} & the width and height of the square block representing the food \\
\hline
\end{DoxyParams}


\subsection{Member Function Documentation}
\index{Food\+::\+Food@{Food\+::\+Food}!draw\+\_\+food@{draw\+\_\+food}}
\index{draw\+\_\+food@{draw\+\_\+food}!Food\+::\+Food@{Food\+::\+Food}}
\subsubsection[{\texorpdfstring{draw\+\_\+food(self, location)}{draw_food(self, location)}}]{\setlength{\rightskip}{0pt plus 5cm}def Food.\+Food.\+draw\+\_\+food (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{location}
\end{DoxyParamCaption}
)}\hypertarget{classFood_1_1Food_aad94875bc7f2f6c990b826c9dc40092f}{}\label{classFood_1_1Food_aad94875bc7f2f6c990b826c9dc40092f}


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


\begin{DoxyParams}{Parameters}
{\em location} & A list which consists the x and y location of the food \\
\hline
\end{DoxyParams}
\index{Food\+::\+Food@{Food\+::\+Food}!redraw\+\_\+food@{redraw\+\_\+food}}
\index{redraw\+\_\+food@{redraw\+\_\+food}!Food\+::\+Food@{Food\+::\+Food}}
\subsubsection[{\texorpdfstring{redraw\+\_\+food(self, x, y, location, screen\+Size)}{redraw_food(self, x, y, location, screenSize)}}]{\setlength{\rightskip}{0pt plus 5cm}def Food.\+Food.\+redraw\+\_\+food (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{x, }
\item[{}]{y, }
\item[{}]{location, }
\item[{}]{screen\+Size}
\end{DoxyParamCaption}
)}\hypertarget{classFood_1_1Food_a4a84b471eb86eaab7414ce1f28915fd6}{}\label{classFood_1_1Food_a4a84b471eb86eaab7414ce1f28915fd6}


redraw\+\_\+food method redraws the food on the screen randomly 


\begin{DoxyParams}{Parameters}
{\em x} & is the location of snake\textquotesingle{}s x-\/axis head location \\
\hline
{\em y} & is the location of snake\textquotesingle{}s y-\/axis head location \\
\hline
{\em location} & is a list that gives the location of present food \\
\hline
{\em screen\+Size} & is the size of the screen \\
\hline
\end{DoxyParams}


The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
\hyperlink{Food_8py}{Food.\+py}\end{DoxyCompactItemize}