Ejemplo n.º 1
0
    def __init__(self, name, handler, img):
        super().__init__(name)
        self.handler = handler
        self.img = img
        self.player1 = None
        self.player2 = None
        self.player1Rect = Rect(0, 0, 0, 0)
        self.player2Rect = Rect(0, 0, 0, 0)
        self.hoverOver = Sound("Beep2")
        self.hoverPlay = 0
        self.settings = Settings()

        # TODO Fix bug with duplicated players or made it so same player cannot be selected twice

        # Rectangle Dict
        self.rects = {
            Rect(23, 89, 60, 60): Collin(150, 100, handler),
            Rect(23, 214, 60, 60): Smo(150, 100, handler),
            Rect(23, 336, 60, 60): Kemul(150, 100, handler),
            Rect(23, 465, 60, 60): Jarod(150, 100, handler)
        }

        self.color_rects = {
            colors.get("RED"): Rect(0, 0, 200, 1000),
            colors.get("ORANGE"): Rect(200, 0, 200, 800),
            colors.get("YELLOW"): Rect(400, 0, 200, 800),
            colors.get("GREEN"): Rect(600, 0, 200, 800),
            colors.get("BLUE"): Rect(800, 0, 200, 800),
            colors.get("PURPLE"): Rect(1000, 0, 200, 800),
            colors.get("PINK"): Rect(1200, 0, 200, 800),
        }
Ejemplo n.º 2
0
 def update(self, screen):
     for event in pygame.event.get():
         if event.type == pygame.QUIT:
             self.handler.setDone(True)
         elif event.type == pygame.KEYDOWN:
             if event.key == pygame.K_ESCAPE:
                 self.handler.getStateManager().setCurrentState(
                     "MinigameMenu")
     screen.fill(colors.get("BLACK"))
Ejemplo n.º 3
0
    def update(self, screen):
        pressed = False

        for key in self.color_rects:
            pygame.draw.rect(screen, key, self.color_rects[key])
            self.color_rects[key].x += 100
            if self.color_rects[key].x > 1200:
                self.color_rects[key].x = -200

        # Event look
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                self.handler.setDone(True)
            elif event.type == pygame.MOUSEBUTTONDOWN:
                if event.button == 1:
                    pressed = True

        # Drawing background image
        screen.blit(self.img, [0, 0])

        # Button to return to the main menu
        if (715 < pygame.mouse.get_pos()[0] < 1055
                and pressed) and (600 < pygame.mouse.get_pos()[1] < 750
                                  and pressed):
            self.handler.getStateManager().setCurrentState("MainMenuState")

        if (39 < pygame.mouse.get_pos()[0] < 91
                and pressed) and (66 < pygame.mouse.get_pos()[1] < 118
                                  and pressed):
            self.settings.setSFX()
            self.settings.write()

        if (39 < pygame.mouse.get_pos()[0] < 91
                and pressed) and (176 < pygame.mouse.get_pos()[1] < 228
                                  and pressed):
            self.settings.setMusic()
            self.settings.write()

        # Colors selected player black
        if self.settings.useSFX():
            pygame.draw.rect(screen, colors.get("BLUE"), Rect(39, 66, 52, 52))

        if self.settings.useMusic():
            pygame.draw.rect(screen, colors.get("BLUE"), Rect(39, 176, 52, 52))
Ejemplo n.º 4
0
 def update(self, currenthp):
     pygame.draw.rect(self.screen, self.BLACK, self.borderrect)
     if currenthp < 0:
         currenthp = 0
     pct = currenthp / self.health
     if self.position == "topleft":
         self.rect.width = self.width * pct
         if pct >= .7:
             pygame.draw.rect(self.screen, self.GREEN, self.rect)
             text = self.font.render(
                 str(int(currenthp)) + " | " + str(self.health), False,
                 colors.get("WHITE"))
         if .3 <= pct < .7:
             pygame.draw.rect(self.screen, self.YELLOW, self.rect)
             text = self.font.render(
                 str(int(currenthp)) + " | " + str(self.health), False,
                 colors.get("BLACK"))
         if pct < .3:
             pygame.draw.rect(self.screen, self.RED, self.rect)
             text = self.font.render(
                 str(int(currenthp)) + " | " + str(self.health), False,
                 colors.get("WHITE"))
         self.screen.blit(text, (20, 50))
         text = self.font.render(self.handler.getPlayer1().name, False,
                                 colors.get("BLACK"))
         self.screen.blit(text, (5, 5))
     if self.position == "topright":
         self.rect.width = self.width * pct
         self.rect.x = (self.screensize[0] - 10) - self.rect.width
         if pct >= .7:
             pygame.draw.rect(self.screen, self.GREEN, self.rect)
             text = self.font.render(
                 str(int(currenthp)) + " | " + str(self.health), False,
                 colors.get("WHITE"))
         if .3 <= pct < .7:
             pygame.draw.rect(self.screen, self.YELLOW, self.rect)
             text = self.font.render(
                 str(int(currenthp)) + " | " + str(self.health), False,
                 colors.get("BLACK"))
         if pct < .3:
             pygame.draw.rect(self.screen, self.RED, self.rect)
             text = self.font.render(
                 str(int(currenthp)) + " | " + str(self.health), False,
                 colors.get("WHITE"))
         self.screen.blit(text, (self.screensize[0] - 125, 50))
         text = self.font.render(self.handler.getPlayer2().name, False,
                                 colors.get("BLACK"))
         self.screen.blit(text,
                          (self.screensize[0] -
                           (len(self.handler.getPlayer2().name) * 14), 5))
Ejemplo n.º 5
0
    def __init__(self, name, handler):
        super().__init__(name)
        self.handler = handler
        self.left_paddle_speed = 10
        self.left_paddle_height = 100
        self.left_paddle_width = 20
        self.left_paddle_x = 30
        self.left_paddle_y = 350
        self.left_paddle_rect = pygame.Rect(self.left_paddle_x,
                                            self.left_paddle_y,
                                            self.left_paddle_width,
                                            self.left_paddle_height)
        self.left_paddle_color = colors.get("WHITE")
        self.left_score = 0

        self.right_paddle_speed = 10
        self.right_paddle_height = 100
        self.right_paddle_width = 20
        self.right_paddle_x = 1040
        self.right_paddle_y = 350
        self.right_paddle_rect = pygame.Rect(self.right_paddle_x,
                                             self.right_paddle_y,
                                             self.right_paddle_width,
                                             self.right_paddle_height)
        self.right_paddle_color = colors.get("WHITE")
        self.right_score = 0

        self.ball_speed_x = 5
        self.ball_speed_y = 5
        self.ball_width = 20
        self.ball_height = 20
        self.ball_x = 540
        self.ball_y = 390
        self.ball_rect = pygame.Rect(self.ball_x, self.ball_y, self.ball_width,
                                     self.ball_height)
        self.ball_color = colors.get("WHITE")

        self.font = pygame.font.SysFont("Boogaloo", 48)
Ejemplo n.º 6
0
    def __init__(self, name, handler, base_img, hidden_img):
        super().__init__(name)
        self.handler = handler
        self.base_img = base_img
        self.hidden_img = hidden_img
        self.player1 = None
        self.player2 = None
        self.player1Rect = Rect(0, 0, 0, 0)
        self.player2Rect = Rect(0, 0, 0, 0)
        self.hoverOver = Sound("Beep2")
        self.hoverPlay = 0
        self.background_color = [0, 0, 0]
        self.background_rect = pygame.Rect(0, 0, 1100, 800)
        self.red_change = 1
        self.green_change = 1
        self.blue_change = 1
        self.red_done = False
        self.green_done = False
        self.blue_done = False
        self.state = 1

        # Rectangle Dict
        self.rects = {
            Rect(30, 51, 47, 47): David(150, 100, handler),
            Rect(30, 141, 47, 47): Greg(150, 100, handler),
            Rect(30, 225, 47, 47): JaccobBonkley(150, 100, handler),
            Rect(30, 311, 47, 47): Jakob(150, 100, handler),
            Rect(30, 395, 47, 47): Kyle(150, 100, handler),
            Rect(30, 482, 47, 47): Will(150, 100, handler),
            Rect(228, 323, 26, 34): Shed(150, 100, handler)
        }

        self.hidden_rects = {
            Rect(23, 89, 60, 60): Collin(150, 100, handler),
            Rect(23, 214, 60, 60): Smo(150, 100, handler),
            Rect(23, 336, 60, 60): Kemul(150, 100, handler),
            Rect(23, 465, 60, 60): Jarod(150, 100, handler),
            Rect(818, 45, 35, 35): Reynaldo(150, 100, handler)
        }

        self.color_rects = {
            colors.get("RED"): Rect(0, 0, 200, 800),
            colors.get("ORANGE"): Rect(200, 0, 200, 800),
            colors.get("YELLOW"): Rect(400, 0, 200, 800),
            colors.get("GREEN"): Rect(600, 0, 200, 800),
            colors.get("BLUE"): Rect(800, 0, 200, 800),
            colors.get("PURPLE"): Rect(1000, 0, 200, 800),
            colors.get("PINK"): Rect(1200, 0, 200, 800),
        }
    def update(self, rangedcd, specialcd, currenthp):
        if self.lasttickhp != currenthp:
            if len(self.damagearray) > 3:
                del (self.damagearray[0])
            self.damagearray.reverse()
            self.damagearray.append(
                [self.lasttickhp - currenthp,
                 self.handler.getTick()])
            self.damagearray.reverse()

        for obj in self.damagearray:
            text = self.font.render(str(int(obj[0])), False, colors.get("RED"))
            self.screen.blit(
                text, (self.player.rect.x + 20, self.player.rect.y - 35 -
                       (self.handler.getTick() - obj[1])))
            if self.handler.getTick() - obj[1] > 80:
                self.damagearray.remove(obj)

        if self.player.special_cooldown.getTotalCooldown() > 0:
            self.specialrect.x = self.player.rect.x
            self.specialrect.y = self.player.rect.y - 10
            specialpct = specialcd / self.player.special_cooldown.getTotalCooldown(
            )
            if specialpct > 1:
                specialpct = 1
            self.specialrect.width = self.width * specialpct
            if specialpct > 0:
                pygame.draw.rect(self.screen, self.LIGHT_GRAY,
                                 self.specialrect)

        if self.player.ranged_cooldown.getTotalCooldown() > 0:
            self.rangedrect.x = self.player.rect.x
            self.rangedrect.y = self.player.rect.y - 15
            rangedpct = rangedcd / self.player.ranged_cooldown.getTotalCooldown(
            )
            if rangedpct > 1:
                rangedpct = 1
                self.rangedrect.x = self.player.rect.x
            self.rangedrect.width = self.width * rangedpct
            if rangedpct > 0:
                pygame.draw.rect(self.screen, self.DARK_GRAY, self.rangedrect)

        self.lasttickhp = currenthp
Ejemplo n.º 8
0
    def update(self, screen):
        super().update(screen)

        if not self.special_cooldown.isDone():
            self.special_cooldown.update()

        if self.special_active and not self.sleeping:
            self.special_duration.update()
            screen.blit(font.render(self.pun, False, colors.get("BLACK")), (self.rect.x, self.rect.y - 100))
            if self.handler.getPlayer1().name == "Smo":
                if abs(self.rect.x - self.handler.getPlayer2().rect.x) <= self.special_range and abs(self.rect.y - self.handler.getPlayer2().rect.y) <= self. special_range:
                    if (self.target_health - 10) <= self.handler.getPlayer2().health:
                        self.handler.player2.takeDamage(50)
            if self.handler.getPlayer2().name == "Smo":
                if abs(self.rect.x - self.handler.getPlayer1().rect.x) <= self.special_range and abs(self.rect.y - self.handler.getPlayer1().rect.y) <= self.special_range:
                    if (self.target_health - 10) <= self.handler.getPlayer1().health:
                        self.handler.player1.takeDamage(50)
            if self.special_duration.isDone():
                self.GeneratePun()
                self.special_cooldown.update()
                self.target_health_update()
                self.special_active = False
Ejemplo n.º 9
0
    "SettingsState":
    SettingsState("SettingsState", handler, settingsState),
    "MinigameMenu":
    MinigameMenu("MinigameMenu", handler, minigameMenu),
    "Pong":
    Pong("Pong", handler),
    "Tetris":
    Tetris("Tetris", handler)
}
stateManager.setStateDict(stateDict)
# End State Declaration

# Vars
done = False
game_won = False
stateManager.setCurrentState("MainMenuState")

font = pygame.font.SysFont("Comic Sans MS", 16)

# Game loop
while not handler.getDone():
    handler.updateTick()
    stateManager.update(screen)
    text = font.render(str(int(clock.get_fps())), False, colors.get("BLACK"))
    screen.blit(text, (0, 780))

    clock.tick(60)
    pygame.display.flip()

pygame.quit()
Ejemplo n.º 10
0
 def drawPlat(self, screen):
     pygame.draw.rect(screen, colors.get("PINK"), self.rect)
Ejemplo n.º 11
0
    def update(self, screen):
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                self.handler.setDone(True)
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE:
                    self.handler.getStateManager().setCurrentState(
                        "MainMenuState")
                    self.clear_score()
                    self.resetState()

        keys = pygame.key.get_pressed()
        if keys[pygame.K_w] and not self.left_paddle_rect.y <= 0:
            self.left_paddle_rect.y -= self.left_paddle_speed
        if keys[pygame.K_s] and not self.left_paddle_rect.y >= 700:
            self.left_paddle_rect.y += self.left_paddle_speed
        if keys[pygame.K_UP] and not self.right_paddle_rect.y <= 0:
            self.right_paddle_rect.y -= self.right_paddle_speed
        if keys[pygame.K_DOWN] and not self.right_paddle_rect.y >= 700:
            self.right_paddle_rect.y += self.right_paddle_speed
        self.ball_rect.x += self.ball_speed_x
        self.ball_rect.y += self.ball_speed_y

        screen.fill(colors.get("BLACK"))
        pygame.draw.rect(screen, self.left_paddle_color, self.left_paddle_rect)
        pygame.draw.rect(screen, self.right_paddle_color,
                         self.right_paddle_rect)
        pygame.draw.rect(screen, self.ball_color, self.ball_rect)

        left_score = self.font.render(str(self.left_score), False,
                                      colors.get("WHITE"))
        right_score = self.font.render(str(self.right_score), False,
                                       colors.get("WHITE"))
        screen.blit(left_score, (100, 20))
        screen.blit(right_score, (950, 20))

        if pygame.Rect.colliderect(
                self.ball_rect,
                self.left_paddle_rect) or pygame.Rect.colliderect(
                    self.ball_rect, self.right_paddle_rect):
            self.ball_speed_x *= -1
            if self.ball_speed_x > 0:
                self.ball_speed_x += 1
            else:
                self.ball_speed_x -= 1
            if self.ball_speed_y > 0:
                self.ball_speed_y += .5
            else:
                self.ball_speed_y -= .5
        if self.ball_rect.y <= 0 or self.ball_rect.y >= 780:
            self.ball_speed_y *= -1
        if self.ball_rect.x <= 0:
            self.right_score += 1
            self.resetState()
        if self.ball_rect.x >= 1100:
            self.left_score += 1
            self.resetState()
        if self.left_paddle_rect.y < 0:
            self.left_paddle_rect.y = 0
        if self.left_paddle_rect.y > 700:
            self.left_paddle_rect.y = 700
        if self.right_paddle_rect.y < 0:
            self.right_paddle_rect.y = 0
        if self.right_paddle_rect.y > 700:
            self.right_paddle_rect.y = 700
Ejemplo n.º 12
0
    def update(self, screen):
        screen.blit(self.background_image, [0, 0])  # Jakob's mistake
        keys = pygame.key.get_pressed()

        self.handler.level.update(screen)

        if keys[pygame.K_a] and not (self.player1.sleeping
                                     or self.player1.stunned):
            self.player1.moveLeft()
        if keys[pygame.K_d] and not (self.player1.sleeping
                                     or self.player1.stunned):
            self.player1.moveRight()
        if keys[pygame.K_LEFT] and not (self.player2.sleeping
                                        or self.player2.stunned):
            self.player2.moveLeft()
        if keys[pygame.K_RIGHT] and not (self.player2.sleeping
                                         or self.player2.stunned):
            self.player2.moveRight()

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                self.handler.setDone(True)
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_g and not (self.player1.sleeping
                                                    or self.player1.stunned):
                    self.player1.attack(screen)
                    self.player1.rangedstarttime = pygame.time.get_ticks()
                    self.player1.released = False
                elif event.key == pygame.K_f and not (self.player1.sleeping
                                                      or self.player1.stunned):
                    self.player1.special()
                elif event.key == pygame.K_r and not (self.player1.sleeping
                                                      or self.player1.stunned):
                    self.player1.meleeAttack(screen)
                elif event.key == pygame.K_w and not (self.player1.sleeping
                                                      or self.player1.stunned):
                    self.player1.jump()
                elif event.key == pygame.K_s and not (self.player1.sleeping
                                                      or self.player1.stunned):
                    self.player1.duck()
                elif event.key == pygame.K_RSHIFT and not (
                        self.player2.sleeping or self.player2.stunned):
                    self.player2.attack(screen)
                    self.player2.rangedstarttime = pygame.time.get_ticks()
                    self.player2.released = False
                elif event.key == pygame.K_RETURN and not (
                        self.player2.sleeping or self.player2.stunned):
                    self.player2.special()
                elif event.key == pygame.K_RCTRL and not (
                        self.player2.sleeping or self.player2.stunned):
                    self.player2.meleeAttack(screen)
                elif event.key == pygame.K_UP and not (self.player2.sleeping or
                                                       self.player2.stunned):
                    self.player2.jump()
                elif event.key == pygame.K_DOWN and not (
                        self.player2.sleeping or self.player2.stunned):
                    self.player2.duck()
                elif event.key == pygame.K_ESCAPE:
                    self.handler.getStateManager().setCurrentState(
                        "PausedState")
            elif event.type == pygame.KEYUP:
                if event.key == pygame.K_w:
                    self.player1.unjump()
                elif event.key == pygame.K_UP:
                    self.player2.unjump()
                if event.key == pygame.K_s:
                    self.player1.unduck()
                elif event.key == pygame.K_DOWN:
                    self.player2.unduck()
                elif event.key == pygame.K_g:
                    self.player1.rangedendtime = pygame.time.get_ticks()
                    self.player1.released = True
                elif event.key == pygame.K_RSHIFT:
                    self.player2.rangedendtime = pygame.time.get_ticks()
                    self.player2.released = True
            if self.useJoysticksP1 and event.type == pygame.JOYBUTTONDOWN:
                if event.button == CONTROLLER_RANGED and not (
                        self.player1.sleeping
                        or self.player1.stunned) and event.joy == 0:
                    self.player1.attack(screen)
                    self.player1.rangedstarttime = pygame.time.get_ticks()
                    self.player1.released = False
                if event.button == CONTROLLER_SPECIAL and not (
                        self.player1.sleeping
                        or self.player1.stunned) and event.joy == 0:
                    self.player1.special()
                if event.button == CONTROLLER_MELEE and not (
                        self.player1.sleeping
                        or self.player1.stunned) and event.joy == 0:
                    self.player1.meleeAttack(screen)
                if event.button == CONTROLLER_JUMP and not (
                        self.player1.sleeping or self.player1.stunned
                ) and event.joy == 0 and self.player1.name != "Lil' Shed":
                    self.player1.jump()
                if event.button == CONTROLLER_CROUCH and not (
                        self.player1.sleeping or self.player1.stunned
                ) and event.joy == 0 and self.player1.name != "Lil' Shed":
                    self.player1.duck()
            if self.useJoysticksP2 and event.type == pygame.JOYBUTTONDOWN:
                if event.button == CONTROLLER_JUMP and not (
                        self.player2.sleeping or self.player2.stunned
                ) and event.joy == 1 and self.player2.name != "Lil' Shed":
                    self.player2.jump()
                if event.button == CONTROLLER_MELEE and not (
                        self.player2.sleeping
                        or self.player2.stunned) and event.joy == 1:
                    self.player2.meleeAttack(screen)
                if event.button == CONTROLLER_CROUCH and not (
                        self.player2.sleeping or self.player2.stunned
                ) and event.joy == 1 and self.player2.name != "Lil' Shed":
                    self.player2.duck()
                if event.button == CONTROLLER_RANGED and not (
                        self.player2.sleeping
                        or self.player2.stunned) and event.joy == 1:
                    self.player2.attack(screen)
                    self.player2.rangedstarttime = pygame.time.get_ticks()
                    self.player2.released = False
                if event.button == CONTROLLER_SPECIAL and not (
                        self.player2.sleeping
                        or self.player2.stunned) and event.joy == 1:
                    self.player2.special()
                if event.button == CONTROLLER_PAUSE:
                    self.handler.getStateManager().setCurrentState(
                        "PausedState")
            if self.useJoysticksP1 and event.type == pygame.JOYBUTTONUP:
                if event.button == CONTROLLER_JUMP and not (
                        self.player1.sleeping or self.player1.stunned
                ) and event.joy == 0 and self.player1.name != "Lil' Shed":
                    self.player1.unjump()
                if event.button == CONTROLLER_RANGED and event.joy == 0:
                    self.player1.rangedendtime = pygame.time.get_ticks()
                    self.player1.released = True
                if event.button == CONTROLLER_CROUCH and event.joy == 0 and self.player1.name != "Lil' Shed":
                    self.player1.unduck()
            if self.useJoysticksP2 and event.type == pygame.JOYBUTTONUP:
                if event.button == CONTROLLER_JUMP and not (
                        self.player2.sleeping or self.player2.stunned
                ) and event.joy == 1 and self.player2.name != "Lil' Shed":
                    self.player2.unjump()
                if event.button == CONTROLLER_RANGED and event.joy == 1:
                    self.player2.rangedendtime = pygame.time.get_ticks()
                    self.player2.released = True
                if event.button == CONTROLLER_CROUCH and event.joy == 1 and self.player2.name != "Lil' Shed":
                    self.player2.unduck()

        if self.player1.rect.y > screen.get_size()[1]:
            self.player1.health = 0
        if self.player2.rect.y > screen.get_size()[1]:
            self.player2.health = 0

        if self.player2.health <= 0:
            self.player2.goToSleepForAnExtendedPeriodOfTime()
            screen.blit(self.kosprite,
                        [self.player2.rect.x - 15, self.player2.rect.y - 80])
        if self.player1.health <= 0:
            self.player1.goToSleepForAnExtendedPeriodOfTime()
            screen.blit(self.kosprite,
                        [self.player1.rect.x - 15, self.player1.rect.y - 80])

        if self.timer.current_time < 1:
            self.platformArray.remove(self.platformArray)

        self.player1.update(screen)
        self.player2.update(screen)
        self.player1.attackUpdate(screen)

        self.timer.update(screen)

        self.p1infobar.update(
            self.player1.ranged_cooldown.getCurrentCooldown(),
            self.player1.special_cooldown.getCurrentCooldown(),
            self.player1.health)
        self.p2infobar.update(
            self.player2.ranged_cooldown.getCurrentCooldown(),
            self.player2.special_cooldown.getCurrentCooldown(),
            self.player2.health)

        self.p1hpbar.update(self.player1.health)
        self.p2hpbar.update(self.player2.health)

        self.platformArray.update()

        for p in self.platformArray:
            if p.platform_cooldown.isDone() and p.duration != -1:
                self.platformArray.remove(p)

        self.handler.setPlayer1(self.player1)
        self.handler.setPlayer2(self.player2)

        if self.player1.name != "Lil' Shed":
            self.player1.xchange = 0
        if self.player2.name != "Lil' Shed":
            self.player2.xchange = 0

        if self.useJoysticksP1:
            if (self.joystick1.get_axis(0) > 0.01
                ) and not (self.player1.sleeping or self.player1.stunned):
                self.player1.moveRight()

            if (self.joystick1.get_axis(0) < -0.01
                ) and not (self.player1.sleeping or self.player1.stunned):
                self.player1.moveLeft()

            if (self.joystick1.get_axis(1) > 0.01) and not (
                    self.player1.sleeping or
                    self.player1.stunned) and self.player1.name == "Lil' Shed":
                self.player1.duck()
            elif self.player1.name == "Lil' Shed":
                self.player1.unduck()

            if (self.joystick1.get_axis(1) < -0.01) and not (
                    self.player1.sleeping or
                    self.player1.stunned) and self.player1.name == "Lil' Shed":
                self.player1.jump()
            elif self.player1.name == "Lil' Shed":
                self.player1.unjump()

        if self.useJoysticksP2:
            if (self.joystick2.get_axis(0) > 0.01
                ) and not (self.player2.sleeping or self.player2.stunned):
                self.player2.moveRight()

            if (self.joystick2.get_axis(0) < -0.01
                ) and not (self.player2.sleeping or self.player2.stunned):
                self.player2.moveLeft()

            if (self.joystick2.get_axis(1) > 0.01) and not (
                    self.player2.sleeping or
                    self.player2.stunned) and self.player2.name == "Lil' Shed":
                self.player2.duck()
            elif self.player2.name == "Lil' Shed":
                self.player2.unduck()

            if (self.joystick2.get_axis(1) < -0.01) and not (
                    self.player2.sleeping or
                    self.player2.stunned) and self.player2.name == "Lil' Shed":
                self.player2.jump()
            elif self.player2.name == "Lil' Shed":
                self.player2.unjump()

        if self.player1.sleeping:
            text = font.render("Player 2 Wins!", False, colors.get("BLACK"))
            screen.blit(text, ((screen.get_size()[0] / 2 - 125),
                               (screen.get_size()[1] / 2 - 200)))
            text = font.render(self.handler.getPlayer1().loseQuote, False,
                               colors.get("BLACK"))
            screen.blit(text, (self.handler.getPlayer1().rect.x,
                               self.handler.getPlayer1().rect.y - 100))
            text = font.render(self.handler.getPlayer2().winQuote, False,
                               colors.get("BLACK"))
            screen.blit(text, (self.handler.getPlayer2().rect.x,
                               self.handler.getPlayer2().rect.y - 100))
            if self.count == 0:
                self.end_time = self.timer.current_time
                self.count += 1
            if self.timer.current_time <= self.end_time - 5:
                self.handler.setDone(True)
                self.handler.getStateManager().setCurrentState("EndGameState")
            self.victor = 2
        elif self.player2.sleeping:
            text = font.render("Player 1 Wins!", False, colors.get("BLACK"))
            screen.blit(text, ((screen.get_size()[0] / 2 - 125),
                               (screen.get_size()[1] / 2 - 200)))
            text = font.render(self.handler.getPlayer2().loseQuote, False,
                               colors.get("BLACK"))
            screen.blit(text, (self.handler.getPlayer2().rect.x,
                               self.handler.getPlayer2().rect.y - 100))
            text = font.render(self.handler.getPlayer1().winQuote, False,
                               colors.get("BLACK"))
            screen.blit(text, (self.handler.getPlayer1().rect.x,
                               self.handler.getPlayer1().rect.y - 100))
            if self.count == 0:
                self.end_time = self.timer.current_time
                self.count += 1
            if self.timer.current_time <= self.end_time - 5:
                self.handler.setDone(True)
                self.handler.getStateManager().setCurrentState("EndGameState")
            self.victor = 1