-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.py
67 lines (47 loc) · 2.07 KB
/
menu.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
62
63
64
65
66
67
import pygame, sys
from button import Button
import coins as cn
import demo
pygame.init()
SCREEN=pygame.display.set_mode((800,400))
pygame.display.set_caption("Menu")
SCREEN.fill((94,129,162))
def get_font(size):
return pygame.font.Font('Graphics/font/Pixeltype.ttf',size)
def play():
if(cn.coin_decrease(100)):
demo.game_main()
def Tasks():
import doing as dn
dn.doing_main()
pygame.display.update()
def main_menu():
while True:
SCREEN.fill((94,129,162))
MENU_MOUSE_POS=pygame.mouse.get_pos()
MENU_TEXT=get_font(80).render("PRODUCTIVE JUMP!",True,"#b68f40")
MENU_RECT=MENU_TEXT.get_rect(center=(400, 80))
PLAY_BUTTON = Button(image=None, pos=(400, 180),
text_input="PLAY", font=get_font(55), base_colour="#d7fcd4", hovering_colour="White")
TASKS_BUTTON = Button(image=None, pos=(400, 250),
text_input="TASKS", font=get_font(55), base_colour="#d7fcd4", hovering_colour="White")
QUIT_BUTTON = Button(image=None, pos=(400, 320),
text_input="QUIT", font=get_font(55), base_colour="#d7fcd4", hovering_colour="White")
SCREEN.blit(MENU_TEXT,MENU_RECT)
for button in [PLAY_BUTTON,TASKS_BUTTON,QUIT_BUTTON]:
button.changeColour(MENU_MOUSE_POS)
button.update(SCREEN)
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.MOUSEBUTTONDOWN:
if PLAY_BUTTON.checkForInput(MENU_MOUSE_POS):
play()
if TASKS_BUTTON.checkForInput(MENU_MOUSE_POS):
Tasks()
if QUIT_BUTTON.checkForInput(MENU_MOUSE_POS):
pygame.quit()
sys.exit()
pygame.display.update()
main_menu()