-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathteststart.py
61 lines (52 loc) · 2.05 KB
/
teststart.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
58
59
60
61
import pygame
import os
import sys
import inputbox
import demo
import manual
import pyganim
import credits
from Button import Button
from pygame.locals import *
from constants import *
from const_colors import *
def start(DISPLAY_SURF):
background = pygame.image.load('Images/simphy.jpg')
btn_start = pygame.image.load('Images/buttons/playbutton.png')
btn_credits = pygame.image.load('Images/buttons/creditsbutton.png')
btn_manual = pygame.image.load('Images/buttons/manualbutton.png')
clock = pygame.time.Clock()
# background=pygame.image.load('Images/simphy.jpg')
run = True
DISPLAY_SURF = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT), 0, 32)
# create the animation objects ('filename of image', duration_in_seconds)
boltAnim = pyganim.PygAnimation([('Images/simphyimages/s.jpg', 0.2),('Images/simphyimages/m.jpg', 0.2),('Images/simphyimages/p.jpg', 0.2),('Images/simphyimages/h.jpg', 0.2),('Images/simphyimages/y.jpg', 0.2),('Images/simphyimages/notzoom.jpg',0.2),('Images/simphyimages/allzoom.jpg', 0.2),])
boltAnim.play();
while run:
DISPLAY_SURF.blit(background,SCREEN_TOPLEFT)
mouse = pygame.mouse.get_pos()
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
pygame.quit()
sys.exit(0)
elif event.type == pygame.MOUSEBUTTONDOWN:
if rect_start.collidepoint(mouse):
demo.startGame(DISPLAY_SURF)
elif rect_credits.collidepoint(mouse):
credits.credits(DISPLAY_SURF)
elif rect_manual.collidepoint(mouse):
manual.manual(DISPLAY_SURF)
#elif btn.obj.collidepoint(mouse):
# manual.manual(DISPLAY_SURF)
boltAnim.blit(DISPLAY_SURF, (0, 0))
rect_start = DISPLAY_SURF.blit(btn_start,(210,185))
rect_credits = DISPLAY_SURF.blit(btn_credits,(210,250))
rect_manual = DISPLAY_SURF.blit(btn_manual,(210,315))
pygame.display.update()
clock.tick(60)
#main starts
if __name__ == "__main__":
DISPLAY_SURF = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT), 0, 32)
pygame.init()
start(DISPLAY_SURF)