-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings.py
52 lines (43 loc) · 1.12 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import pygame
from pygame.locals import *
pygame.init()
pygame.mixer.init()
pygame.font.init()
FPS = 5
WINDOWWIDTH = 640
WINDOWHEIGHT = 480
CELLSIZE = 20
assert WINDOWHEIGHT % CELLSIZE == 0, "Window Height must be a multiple of Cell Size"
assert WINDOWWIDTH % CELLSIZE == 0, "Window Width must be a multiple of Cell Size"
CELLWIDTH = int(WINDOWWIDTH / CELLSIZE)
CELLHEIGHT = int(WINDOWHEIGHT / CELLSIZE)
#Colour Codes
# R G B
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
DARKGREEN= (0, 155, 0)
DARKGRAY = (40, 40, 40)
YELLOW = (255, 255, 0)
BGCOLOR = BLACK
#Control Keys
UP = 'up'
DOWN = 'down'
LEFT = 'left'
RIGHT = 'right'
HEAD = 0 #Index of the snake's head
#Game Sounds
APPLEEATSOUND = pygame.mixer.Sound(r"sounds/appleEatSound.wav")
BGMUSIC = pygame.mixer.music.load(r"sounds/bgmusic.mid")
#Game Images
SETTINGSIMAGE = pygame.image.load(r"images/chooseLevel.png")
SETTINGSBUTTON = pygame.image.load(r"images/settings.png")
def levelSelect():
global FPS
if level == "EASY":
FPS = 4
elif level == "MEDIUM":
FPS = 7
elif level == "HARD":
FPS = 10