forked from namankr1/SimPhy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
endScreen.py
47 lines (45 loc) · 1.48 KB
/
endScreen.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
import pygame, pygame.font, pygame.event, pygame.draw, string
from pygame.locals import *
from Button import Button
import sys
import inputbox
import teststart
class endScreen:
def __init__(self, DISPLAY_SURF,text):
pygame.font.init()
fontobject = pygame.font.Font(None,18)
if pygame.mixer.music.get_busy():
pygame.mixer.music.stop()
pygame.mixer.music.load('Sound/bomb.ogg')
pygame.mixer.music.play(-1, 0.0)
if len(text) != 0:
btn_replay = pygame.image.load('Images/buttons/playagain.png')
btn_exit = pygame.image.load('Images/buttons/exitbutton.png')
clock = pygame.time.Clock()
run1= True;
while run1:
mouse = pygame.mouse.get_pos()
for event in pygame.event.get():
if event.type == pygame.QUIT:
if pygame.mixer.music.get_busy():
pygame.mixer.music.stop()
run1 = False
pygame.quit()
sys.exit()
elif event.type == pygame.MOUSEBUTTONDOWN:
if rect_replay.collidepoint(mouse):
if pygame.mixer.music.get_busy():
pygame.mixer.music.stop()
print ("restart")
teststart.start(DISPLAY_SURF)
elif rect_exit.collidepoint(mouse):
if pygame.mixer.music.get_busy():
pygame.mixer.music.stop()
print ("exit")
run1 = False
pygame.quit()
sys.exit()
rect_replay = DISPLAY_SURF.blit(btn_replay ,(130,(DISPLAY_SURF.get_height()-100)))
rect_exit = DISPLAY_SURF.blit(btn_exit,(320,(DISPLAY_SURF.get_height()-100)))
pygame.display.update()
clock.tick(60)