Skip to content
Snippets Groups Projects
Commit abdc6f5e authored by 's avatar
Browse files

update

parent 9f9ff76b
No related branches found
No related tags found
No related merge requests found
Showing
with 6 additions and 6 deletions
......@@ -19,7 +19,7 @@ class Food():
## @brief Draw method uses pygame to draw the food object on the window
# @param location A list which consists the x and y location of the food
def draw_food(self, location):
pygame.draw.rect(win, black1 , (location[0],location[1], self.size, self.size))
pygame.draw.rect(win, [245,250,170] , (location[0],location[1], self.size, self.size))
## @brief redraw_food method redraws the food on the screen randomly
# @param x is the location of snake's x-axis head location
......
......@@ -151,7 +151,7 @@ def game(speed, colour, backgroundColour):
'''
#Draw snake
snake.draw(snake_loc)
snake.draw(colour,snake_loc)
#update display
pygame.display.update()
......
......@@ -50,7 +50,7 @@ def main():
pygame.display.set_caption("Lets Play")
#Adding the play game button
if (400 <= mousepos[0] <= 400+170 and 250 <= mousepos[1] <= 300+50 ):
if (400 <= mousepos[0] <= 400+170 and 250 <= mousepos[1] <= 250+50 ):
#checks if the mouse is hovering over the button
GUI.button(game,darkgray, [400,250,170,50], 0)
#checking if the button is clicked
......
......@@ -23,9 +23,9 @@ class Snake():
## @brief Draw method uses pygame to draw the snake object
# @param x The x-coordinate where the block should be drawn
# @param y The y-coordinate where the block should be drawn
def draw(self,snake_loc):
def draw(self,colour, snake_loc):
for x,y in snake_loc:
pygame.draw.rect(win, lightB , [x,y, self.size, self.size])
pygame.draw.rect(win, colour , [x,y, self.size, self.size])
## pygame.draw.circle(win, lightB , [x,y], int(self.size/2))
def die():
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -10,7 +10,7 @@ from random import randint
pygame.init()
screenSize = 500
win = pygame.display.set_mode((screenSize,screenSize))
pygame.display.set_caption("Snake 2.o")
pygame.display.set_caption("Snake")
#Define color constants
white = (255,255,255)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment