-
Notifications
You must be signed in to change notification settings - Fork 21
/
settingsSnakeFun.py
executable file
·48 lines (40 loc) · 1.04 KB
/
settingsSnakeFun.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
import pygame
from pygame.locals import *
pygame.init()
pygame.mixer.init()
pygame.font.init()
FPS = 3
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")
def levelSelect():
global FPS
if level == "EASY":
FPS = 4
elif level == "MEDIUM":
FPS = 7
elif level == "HARD":
FPS = 10