Ejemplo n.º 1
0
    def setPlayerSelectionScreen(self):

        self.currentScreenInstance = self.playerScreen
        playerScreenBackButton = Button(50, 50, 50, 50, "<-", 40)
        playerScreenBackButton.setCallBack(self.setStartScreen)
        self.playerScreen.add(playerScreenBackButton)
        self.changeScreen(5)
Ejemplo n.º 2
0
    def setEndScreen(self):

        self.endScreen.gamePieceGroup = pygame.sprite.Group()
        score = self.gameScreen.timer
        self.currentScreenInstance = self.endScreen
        self.endScreen.add(TextDisplay(self.width // 2, self.height // 4 + 100, \
            100, 50, "You lasted: " + str(score / 100) + "s", 40))
        self.endScreen.add(
            TextDisplay(self.width // 2, self.height // 4, 100, 50,
                        "Game Over!!", 40))
        submitScoreButton = Button(self.width // 2, self.height // 4 + 50, 100,
                                   50, "Return to Main Screen!!", 40)
        submitScoreButton.setCallBack(self.setStartScreen)
        self.endScreen.add(submitScoreButton)
        self.changeScreen(2)
Ejemplo n.º 3
0
    def setPracticeScreen(self):

        self.currentScreenInstance = self.practiceScreen

        self.practiceScreen.gamePieceGroup = pygame.sprite.Group()
        color = random.choice([(255, 255, 255), (0, 0, 255)])

        self.practiceScreen.add(
            Player(self.width // 2 - 100, 0, 20, 50, (255, 255, 255), "first"))

        self.practiceScreen.add(Piece(self.width / 2, \
                                  -100 - self.scrollY, 40, 100, color))

        self.practiceScreen.add(Piece(self.width / 2, \
                                  -300 - self.scrollY, 40, 100, color))

        practiceScreenBackButton = Button(50, 50, 50, 50, "<-", 40)
        practiceScreenBackButton.setCallBack(self.setStartScreen)
        self.practiceScreen.add(practiceScreenBackButton)
        self.practiceScreen.timer = 0
        self.practiceScreen.isPaused = False
        self.changeScreen(6)
Ejemplo n.º 4
0
    def on_init(self):
        pygame.init()
        self._display_surf = pygame.display.set_mode(
            self.size, pygame.HWSURFACE | pygame.DOUBLEBUF)
        self._display_surf.fill((255, 0, 0))
        self._running = True
        self.background = pygame.Surface((self.width, self.height))
        self.background.fill((0, 0, 0))
        self.screens = [
            "Start", "Player Selection", "Play", "End", "ScoreBoard",
            "Credits", "Instructions", "Practice"
        ]
        self.currentScreen = 0
        self.currentScreenInstance = None

        # Start Screen initialization
        self.startScreen = Screen(self.width, self.height, (255, 255, 255))
        self.startScreen.add(
            TextDisplay(self.width // 2, self.height // 4, 100, 50,
                        "Jerry's Great Climb", 40))
        startButton = Button(self.width // 2, self.height // 2, 100, 50,
                             "Play!", 40)
        practiceButton = Button(self.width // 2, self.height // 2 + 50, 100,
                                50, "Practice", 40)
        instructionButton = Button(self.width // 2, self.height // 2 + 100,
                                   100, 50, "Instructions!", 40)
        creditsButton = Button(self.width // 2, self.height // 2 + 150, 200,
                               50, "Credits!", 40)

        startButton.setCallBack(self.setPlayerSelectionScreen)
        instructionButton.setCallBack(self.setInstructionScreen)
        practiceButton.setCallBack(self.setPracticeScreen)
        creditsButton.setCallBack(self.setCreditsScreen)
        self.startScreen.add(startButton, instructionButton, creditsButton,
                             practiceButton)
        self.currentScreenInstance = self.startScreen

        # Instruction Screen initialization
        self.instructionScreen = Screen(self.width, self.height,
                                        (255, 255, 255))
        self.instructionScreen.add(
            TextDisplay(self.width // 2, self.height // 4 - 100, 100, 50,
                        "Instructions", 40))
        self.instructionScreen.add(
            TextDisplay(self.width // 2, self.height // 4 - 75, 100, 50,
                        "W/UP.............................Jump", 20))
        self.instructionScreen.add(
            TextDisplay(self.width // 2, self.height // 4 - 50, 100, 50,
                        "A/Left.............................Left", 20))
        self.instructionScreen.add(
            TextDisplay(self.width // 2, self.height // 4 - 25, 100, 50,
                        "D/Right.............................Right", 20))
        self.instructionScreen.add(
            TextDisplay(self.width // 2, self.height // 4, 100, 50,
                        "F/M............Climb", 20))
        self.instructionScreen.add(
            TextDisplay(self.width // 2, self.height // 4 + 25, 100, 50,
                        "Objective", 30))
        self.instructionScreen.add(
            TextDisplay(
                self.width // 2, self.height // 4 + 50, 100, 50,
                "Spend the most time on screen while dodging falling blocks.",
                20))
        self.instructionScreen.add(
            TextDisplay(
                self.width // 2, self.height // 4 + 75, 100, 50,
                "Climb onto fallen pieces by pressing in the direction of the block",
                20))
        self.instructionScreen.add(
            TextDisplay(
                self.width // 2, self.height // 4 + 100, 100, 50,
                "holding down F/M if you are first or second player respectively.",
                20))
        self.instructionScreen.add(
            TextDisplay(
                self.width // 2, self.height // 4 + 125, 100, 50,
                "Enter the practice screen to practice climbing and using powerups.",
                18))
        self.instructionScreen.add(
            TextDisplay(self.width // 2, self.height // 4 + 150, 100, 50,
                        "Powerups", 30))
        self.instructionScreen.add(
            TextDisplay(
                self.width // 2, self.height // 4 + 175, 100, 50,
                "Each power up is one use only. The orange power up is High Jump,",
                18))
        self.instructionScreen.add(
            TextDisplay(self.width // 2, self.height // 4 + 200, 100, 50,
                        "and the green power up is double jump.", 18))
        self.instructionScreen.add(
            TextDisplay(
                self.width // 2, self.height // 4 + 250, 100, 50,
                "Press 1 or 2 to access the power ups in the practice screen.",
                18))
        backButton = Button(50, 50, 100, 50, "<-", 40)
        backButton.setCallBack(self.setStartScreen)
        self.instructionScreen.add(backButton)

        # Practice Screen Initializaiton

        self.practiceScreen = GameScreen(self.width, self.height,
                                         (0, 255, 255))

        # Credits Screen Initialization
        self.creditScreen = Screen(self.width, self.height, (255, 255, 255))
        self.creditScreen.add(
            TextDisplay(self.width // 2, self.height // 4, 100, 50, "Credits!",
                        40))
        self.creditScreen.add(
            TextDisplay(
                self.width // 2, self.height // 4 + 50, 100, 50,
                "Sole Developer.............................Odell Blackmon III",
                20))
        self.creditScreen.add(
            TextDisplay(
                self.width // 2, self.height // 4 + 100, 100, 50,
                "UI Designer.............................Odell Blackmon III",
                20))
        creditBackButton = Button(50, 50, 100, 50, "<-", 40)
        creditBackButton.setCallBack(self.setStartScreen)
        self.creditScreen.add(creditBackButton)

        # Player Screen initialization

        self.playerScreen = Screen(self.width, self.height, (255, 255, 255))
        onePlayerButton = Button(self.width // 2 - 50, self.height // 2, 100,
                                 50, "1P", 40)
        twoPlayerButton = Button(self.width // 2 + 50, self.height // 2, 100,
                                 50, "2P", 40)

        onePlayerButton.setCallBack(self.setPlayScreen)
        twoPlayerButton.setCallBack(self.setPlay2Screen)

        self.playerScreen.add(onePlayerButton, twoPlayerButton)

        # Game Screen initialization
        self.gameScreen = GameScreen(self.width, self.height, (0, 255, 255))
        self.newPieceGenerationEvent = pygame.USEREVENT + 1
        self.newPowerUpGenerationEvent = pygame.USEREVENT + 3
        # Player initialization methods

        # End Game Screen initialization

        self.endScreen = Screen(self.width, self.height, (255, 255, 255))