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

changes to theme

parent 72145072
No related branches found
No related tags found
No related merge requests found
......@@ -115,14 +115,12 @@ def game(speed, colour,food_colour, backgroundColour):
win.fill(backgroundColour)
font = pygame.font.SysFont("times",30)
text = font.render("Score = " + str(score),True,[50,250,50])
sc_color = [0,0,0] if backgroundColour == [255,255,255] else [255,255,255]
font = pygame.font.Font("Roboto-Light.ttf",30)
text = font.render(" " + str(score),True,sc_color)
win.blit(text,(0,0))
if ([x,y] in snake_loc) and snake_length > 1:
## pygame.time.delay(1000)
# pygame.quit() #quit for now, but should return to main menu
ScoreDisplay.display(score,speed, colour,food_colour, backgroundColour)
snake_head = []
......
......@@ -3,6 +3,8 @@ from random import randint
import Gameplay
import init
theme = 0
class Themes():
## @brief A function for running other files
......@@ -34,9 +36,14 @@ class Themes():
text = font.render(text,True,color)
surface.blit(text,coord)
def custom_text(text,fontName,fontSize,color,coord,surface):
font = pygame.font.Font(fontName,fontSize)
text = font.render(text,True,color)
surface.blit(text,coord)
def themes(speed):
lightBlue = (89,131,146)
black1 = (1,22,30)
black1 = (48,47,47)
white_green = (239,246,224)
white = (255,255,255)
......@@ -49,31 +56,27 @@ class Themes():
mouseclick = pygame.mouse.get_pressed()#checking mouse pressed
pygame.display.set_caption("Choose Theme")
Themes.text('Choose Your Theme',"maiandragd",45,[96,96,96],(70,50),theme)
Themes.custom_text('Choose Your Theme',"Roboto-Light.ttf",45,[96,96,96],(70,50),theme)
Themes.button(theme,lightBlue, [75,150,150,100], 0)
Themes.text('Regular',"maiandragd", 40,white_green,(80,170),theme)
Themes.custom_text('Regular',"Roboto-Light.ttf", 30,white_green,(95,180),theme)
if (75 <= mousepos[0] <= 75+150 and 150 <= mousepos[1] <= 150+100 ):
if mouseclick[0] == 1:
Gameplay.game(speed,[255,0,0],[0,255,0],[255,255,255])
Gameplay.game(speed,[255,0,0],[0,255,0], white)
Themes.button(theme,black1, [280,150,150,100], 0)
Themes.text('Dark',"maiandragd", 40,white,(305,170),theme)
Themes.custom_text('Dark',"Roboto-Light.ttf", 30,white,(325,180),theme)
if (280 <= mousepos[0] <= 280+150 and 150 <= mousepos[1] <= 150+100 ):
if mouseclick[0] == 1:
Gameplay.game(speed,white,[255,255,0],[10,10,10])
Gameplay.game(speed,white,[255,255,0],black1)
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('Random',"maiandragd", 40,[150,0,0],(180,315),theme)
Themes.button(theme,[255,255,255], [175,300,160,100], 0)
Themes.custom_text('Random',"Roboto-Light.ttf", 30,[0, 0, 0],(200,330),theme)
if (180 <= mousepos[0] <= 180+160 and 315 <= mousepos[1] <= 315+100 ):
if mouseclick[0] == 1:
x = randint(0, 1)
if(x == 1): Gameplay.game(speed,[255,0,0],[0,255,0],[255,255,255])
else: Gameplay.game(speed,white,[255,255,0],[10,10,10])
if(x == 1): Gameplay.game(speed,[255,0,0],[0,255,0],white)
else: Gameplay.game(speed,white,[255,255,0],black1)
pygame.display.update()
#Themes.themes()
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