-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.py
More file actions
45 lines (38 loc) · 1.39 KB
/
start.py
File metadata and controls
45 lines (38 loc) · 1.39 KB
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
import sys
import pygame
import time
from botplay import botPlay
from constant import WIDTH, HEIGHT, RestartGameSingle, RestartGameDual
from dualplay import dualPlay
from singleplay import singlePlay
from menu import Menu
pygame.init()
speed = [2, 2]
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption('Snacke')
start = True
# Create Menu
menu = Menu(pygame, screen)
while True:
if RestartGameSingle:
RestartGameSingle = singlePlay(pygame, screen, menu, False)
if RestartGameDual:
RestartGameDual = dualPlay(pygame, screen, menu)
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_s:
RestartGameSingle = singlePlay(pygame, screen, menu, False)
if event.key == pygame.K_d: ##! Dual player Mode
RestartGameDual = dualPlay(pygame, screen, menu)
if event.key == pygame.K_l:
RestartGameSingle = singlePlay(pygame, screen, menu, True)
if event.key == pygame.K_r:
menu.displayRanking()
time.sleep(2)
if event.key == pygame.K_b:
RestartBot = botPlay(pygame, screen, menu)
if event.key == pygame.K_e or event.type == pygame.QUIT:
pygame.display.quit()
pygame.quit()
sys.exit()
menu.displayStartMenu()