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.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.ticks = self.prev_ticks = pygame.time.get_ticks()
|
||||||
|
|
||||||
|
self.load()
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.running = True
|
self.running = True
|
||||||
self.run()
|
self.run()
|
||||||
|
@ -59,6 +51,16 @@ class Game(object):
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.running = False
|
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):
|
def run(self):
|
||||||
t = pygame.time.get_ticks()
|
t = pygame.time.get_ticks()
|
||||||
dt = 0
|
dt = 0
|
||||||
|
|
|
@ -43,6 +43,7 @@ class MainMenu(object):
|
||||||
if event.type == pygame.KEYDOWN:
|
if event.type == pygame.KEYDOWN:
|
||||||
if event.key == pygame.K_SPACE:
|
if event.key == pygame.K_SPACE:
|
||||||
self.game.goto_level(level.Level("landing"))
|
self.game.goto_level(level.Level("landing"))
|
||||||
|
self.game.objs.remove(self)
|
||||||
|
|
||||||
def draw(self, window):
|
def draw(self, window):
|
||||||
window.blit(self.background_img, (0, 0))
|
window.blit(self.background_img, (0, 0))
|
||||||
|
|
Loading…
Reference in New Issue