forked from namankr1/SimPhy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
theory_game1.py
57 lines (54 loc) · 1.72 KB
/
theory_game1.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
55
56
57
import pygame
import sys
import inputbox
from Button import Button
import errorScreen
from pygame.locals import *
def theory_game1(DISPLAYSURF,path):
if pygame.mixer.music.get_busy():
pygame.mixer.music.stop()
btn_back = pygame.image.load('Images/buttons/back.png')
btn_next = pygame.image.load('Images/buttons/next.png')
btn_home = pygame.image.load('Images/buttons/home.png')
clock = pygame.time.Clock()
image_no = 1
image_name = path+str(image_no)+".png"
background1=pygame.image.load(image_name)
run = True
while run:
mouse = pygame.mouse.get_pos()
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
pygame.quit()
sys.exit()
elif event.type == pygame.MOUSEBUTTONDOWN:
if rect_back.collidepoint(mouse):
if image_no <= 1:
image_no=1
else :
image_no-=1
image_name = path+str(image_no)+".png"
background1=pygame.image.load(image_name)
DISPLAYSURF.blit(background1,(0,0))
pygame.display.update()
elif rect_next.collidepoint(mouse):
if image_no >=5:
image_no=5
else :
image_no+=1
image_name = path+str(image_no)+".png"
background1=pygame.image.load(image_name)
DISPLAYSURF.blit(background1,(0,0))
pygame.display.update()
elif rect_home.collidepoint(mouse):
run = False
DISPLAYSURF.blit(background1,(0,0))
rect_back = DISPLAYSURF.blit(btn_back ,(10,10))
rect_next = DISPLAYSURF.blit(btn_next,(50,10))
rect_home= DISPLAYSURF.blit(btn_home,(550,10))
pygame.display.update()
clock.tick(60)
background_end=pygame.image.load('Images/simphy.jpg')
DISPLAYSURF.blit(background_end,(0,0))
pygame.display.update()