Skip to content
Snippets Groups Projects
Commit 9d88a0f0 authored by Hameed Andy's avatar Hameed Andy
Browse files

changes in appearance

parent d105e63b
No related branches found
No related tags found
No related merge requests found
......@@ -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, blue , (location[0],location[1], self.size, self.size))
pygame.draw.rect(win, black1 , (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
......
......@@ -25,7 +25,8 @@ class Snake():
# @param y The y-coordinate where the block should be drawn
def draw(self,snake_loc):
for x,y in snake_loc:
pygame.draw.rect(win, red , [x,y, self.size, self.size])
pygame.draw.rect(win, lightB , [x,y, self.size, self.size])
## pygame.draw.circle(win, lightB , [x,y], int(self.size/2))
def die():
#---------------------INSERT CODE -----------------
......
......@@ -15,6 +15,9 @@ pygame.display.set_caption("Snake 2.o")
#Define color constants
white = (255,255,255)
red = (255,0,0)
lightB = (89,131,146)
black1 = (1,22,30)
white_green = (239,246,224)
blue = (0,0,255)
black = (0,0,0)
......
BlankProjectTemplate/src/snake_image.png

36.9 KiB

import pygame, sys
from random import randint
import Gameplay
import init
class Themes():
......@@ -34,34 +35,39 @@ class Themes():
surface.blit(text,coord)
def themes(speed):
lightBlue = (89,131,146)
black1 = (1,22,30)
white_green = (239,246,224)
white = (255,255,255)
pygame.init()
run = True
while run:
theme = pygame.display.set_mode((500, 500))
theme.fill([200, 150, 250])
theme.fill(white_green)
mousepos = pygame.mouse.get_pos() #checking mouse position
mouseclick = pygame.mouse.get_pressed()#checking mouse pressed
pygame.display.set_caption("Choose Theme")
Themes.text('Choose Your Theme',"times",45,[96,96,96],(70,50),theme)
Themes.text('Choose Your Theme',"maiandragd",45,[96,96,96],(70,50),theme)
Themes.button(theme,[200,200,200], [75,150,150,100], 0)
Themes.text('Regular',"comicsansms", 40,[200, 0, 0],(80,170),theme)
Themes.button(theme,lightBlue, [75,150,150,100], 0)
Themes.text('Regular',"maiandragd", 40,white_green,(80,170),theme)
if (75 <= mousepos[0] <= 75+150 and 150 <= mousepos[1] <= 150+100 ):
if mouseclick[0] == 1:
Gameplay.game(speed,[255,0,0],[255,255,255])
Themes.button(theme,[0,0,0], [280,150,150,100], 0)
Themes.text('Dark',"comicsansms", 40,[225,255,255],(305,170),theme)
Themes.button(theme,black1, [280,150,150,100], 0)
Themes.text('Dark',"maiandragd", 40,white,(305,170),theme)
if (280 <= mousepos[0] <= 280+150 and 150 <= mousepos[1] <= 150+100 ):
if mouseclick[0] == 1:
Gameplay.game(speed,[255,255,255],[10,10,10])
Gameplay.game(speed,white,[10,10,10])
Themes.button(theme,[0,0,0], [175,300,80,50], 0)
Themes.button(theme,lightBlue, [175,300,80,50], 0)
Themes.button(theme,[200,200,200], [175,350,80,50], 0)
Themes.button(theme,[200,200,200], [255,300,80,50], 0)
Themes.button(theme,[0,0,0], [255,350,80,50], 0)
Themes.text('Ramdom',"comicsansms", 40,[150,0,0],(180,315),theme)
Themes.text('Random',"maiandragd", 40,[150,0,0],(180,315),theme)
if (180 <= mousepos[0] <= 180+160 and 315 <= mousepos[1] <= 315+100 ):
if mouseclick[0] == 1:
x = randint(0, 1)
......
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