-
Notifications
You must be signed in to change notification settings - Fork 0
/
menu.py
69 lines (62 loc) · 2.05 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
68
69
from retrogamelib.util import *
from retrogamelib import clock
from retrogamelib import button
from retrogamelib.constants import *
from game import *
from retrogamelib import dialog
from retrogamelib import font
from retrogamelib import display
from levels import *
def run_menu():
timer = 0
play_music("data/title.ogg")
game = Game()
set_global_sound_volume(0.75)
while True:
clock.tick()
button.handle_input()
# If we pressed start, begin the game
if button.is_pressed(START):
play_music("data/algar-orka.xm", -1)
# Creates text box
whitefont = font.Font(GAMEBOY_FONT, GB_SCREEN_COLOR)
box = dialog.DialogBox((152, 46), (50, 50, 50),
GB_SCREEN_COLOR, whitefont)
box.set_dialog([
"Spin to \
win.",
"- Garen 2008"
])
# Updates box when Z is pressed
box.set_scrolldelay(2)
while not box.over():
clock.tick()
button.handle_input()
if button.is_pressed(A_BUTTON):
box.progress()
screen = display.get_surface()
screen.fill(GB_SCREEN_COLOR)
screen.blit(game.background, (0, 0))
box.draw(screen, (4, 4))
display.update()
game.won = True
#game.level = 1
game.lives = 3
game.score = 0
#Play each level
for lvl in LEVELS:
game.startLevel(lvl)
#game.level += 1
game.loop()
#if not game.player.alive():
# break
screen = display.get_surface()
screen.fill(GB_SCREEN_COLOR)
screen.blit(load_image("data/bg.png"), (0, 0))
ren = game.font.render("Press Start")
timer += 1
timer = timer % 30
if timer < 15:
screen.blit(ren, (80-ren.get_width()/2,
104-ren.get_height()/2))
display.update()