Esempio n. 1
0
def Menu(user_text):
    print(user_text)
    while True:
        screen.blit(fondo, [0, 0])
        screen.blit(menuTitle, (300, 150))

        for e in pygame.event.get():
            if e.type == pygame.QUIT:
                pygame.quit()
                sys.exit()
            if e.type == MOUSEBUTTONDOWN and e.button == 1:
                if startButton.collidepoint(mouse.get_pos()):
                    # print("Hola start")
                    niveles.Niveles(user_text)
                elif rankingButton.collidepoint(mouse.get_pos()):
                    # print("Hola ranking")
                    ranking.Ranking(user_text)
                elif creditsButton.collidepoint(mouse.get_pos()):
                    # print("Hola credits")
                    credits.Credits(user_text)
                elif whatAbout.collidepoint(mouse.get_pos()):
                    explanation.Explanation(user_text)

        if whatAbout.collidepoint(mouse.get_pos()):
            draw.rect(screen, (140, 176, 134), whatAbout, 0)
        else:
            draw.rect(screen, (0, 0, 0), whatAbout, 0)

        pygame.draw.rect(screen, (0, 0, 0), startButton, 0)
        screen.blit(
            textoStart,
            (startButton.x +
             (startButton.width - textoStart.get_width()) / 2, startButton.y +
             (startButton.height - textoStart.get_height()) / 2))

        pygame.draw.rect(screen, (0, 0, 0), rankingButton, 0)
        screen.blit(textoRanking,
                    (rankingButton.x +
                     (rankingButton.width - textoRanking.get_width()) / 2,
                     rankingButton.y +
                     (rankingButton.height - textoRanking.get_height()) / 2))

        pygame.draw.rect(screen, (0, 0, 0), creditsButton, 0)
        screen.blit(textoCredits,
                    (creditsButton.x +
                     (creditsButton.width - textoCredits.get_width()) / 2,
                     creditsButton.y +
                     (creditsButton.height - textoCredits.get_height()) / 2))

        texto2 = italic_font30.render("What is the game about?", True, 'white')
        screen.blit(texto2,
                    (whatAbout.x +
                     (whatAbout.width - texto2.get_width()) / 2, whatAbout.y +
                     (whatAbout.height - texto2.get_height()) / 2))

        pygame.display.flip()
        clock.tick(60)
Esempio n. 2
0
 def start_game(self):
     g = game.Game(self.pos + 1)
     if self.pos == self.w_levels - 1:
         g.boss_fight = True
     g.first_time = self.first_time
     g.loop()
     rgl.button.handle_input()
     if g.won:
         self.pos += 1
         if g.boss_fight:
             credits.Credits().loop()
         if self.pos >= self.unlocked and self.pos < self.num_levels:
             self.unlocked += 1
             open("prog.sav", "wb").write(str(self.unlocked))
             self.first_time = False
         else:
             self.pos -= 1
     rgl.util.play_music("data/od-special_s.mod", -1, 0.7)
Esempio n. 3
0
 def Credits(self):
     #Opens a window using code from credits.py
     self.slideWindow = credits.Credits()
     self.slideWindow.show()
Esempio n. 4
0
 def __credits_screen(self):
     credits = c.Credits()
     self.__progress(credits, s.CREDITS_FPS)