forked from namankr1/SimPhy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame1_ending.py
54 lines (51 loc) · 1.74 KB
/
game1_ending.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
53
54
import pygame, pygame.font, pygame.event, pygame.draw, string
from pygame.locals import *
from Button import Button
import sys
import game1
import inputbox
import teststart
import theory_game1
class game1_ending:
def __init__(self, screen,text,path):
print ("hi game1_ending")
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')
btn_learnmore = pygame.image.load('Images/buttons/learnbutton.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")
game1.startGame1(screen)
elif rect_exit.collidepoint(mouse):
if pygame.mixer.music.get_busy():
pygame.mixer.music.stop()
print ("exit")
run1 = False
pygame.quit()
sys.exit()
elif rect_learnmore.collidepoint (mouse):
theory_game1.theory_game1(screen,path)
rect_replay = screen.blit(btn_replay ,(10,260))
rect_exit = screen.blit(btn_exit,(210,260))
rect_learnmore= screen.blit(btn_learnmore,(410,260))
pygame.display.update()
clock.tick(60)