Main menu and loading somewhat finished.
This commit is contained in:
parent
b0062a5ba7
commit
5452dfdfe0
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue