Main menu and loading somewhat finished.

This commit is contained in:
Sakse Dalum 2012-08-07 15:46:40 +02:00
parent b0062a5ba7
commit 5452dfdfe0
2 changed files with 13 additions and 10 deletions

View File

@ -40,18 +40,10 @@ class Game(object):
self.clock = pygame.time.Clock()
self.jukebox = jukebox.Jukebox(
os.path.abspath(os.path.join("resources", "music")),
["basshit.ogg"])
# Add main menu object to list of objects.
self.objs.append(main_menu.MainMenu(self, os.path.abspath(os.path.join(
"resources", "graphics", "main_menu.png"))))
self.level = None
self.ticks = self.prev_ticks = pygame.time.get_ticks()
self.load()
def start(self):
self.running = True
self.run()
@ -59,6 +51,16 @@ class Game(object):
def stop(self):
self.running = False
def load(self):
self.objs.append(main_menu.MainMenu(self, os.path.abspath(os.path.join(
"resources", "graphics", "main_menu.png"))))
self.level = None
self.jukebox = jukebox.Jukebox(
os.path.abspath(os.path.join("resources", "music")),
["basshit.ogg"])
self.jukebox.stop()
self.jukebox.play()
def run(self):
t = pygame.time.get_ticks()
dt = 0

View File

@ -43,6 +43,7 @@ class MainMenu(object):
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
self.game.goto_level(level.Level("landing"))
self.game.objs.remove(self)
def draw(self, window):
window.blit(self.background_img, (0, 0))