Example #1
0
def falling(screen, WIDTH, HEIGHT, clock, difficulty, timer1, mode):
    FPS = 60
    # Initializing groups
    player1 = fallingplayer.player(WIDTH, HEIGHT)
    all_players = pygame.sprite.Group()
    all_players.add(player1)
    all_falling = pygame.sprite.Group()
    fallingobj1 = fallingobjects.Fallingobjects(WIDTH, 5,
                                                random.randint(0, WIDTH),
                                                random.randint(0, 1))
    all_falling.add(fallingobj1)

    # Loads the background
    background = pygame.image.load("backgrounds/fallingbackground.png")
    draw.info(screen, WIDTH, HEIGHT, 'Score 50 to Move on',
              100)  # Displays the game info

    # Main game loop
    runnning = True
    while runnning:
        clock.tick(FPS)
        # Detects if player closes the window
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
                pygame.quit()
        # Randomly spawn a falling object,
        # more objects spawn as player score increases
        if (random.randrange(0, 100) < difficulty + (player1.score / 10)):
            newfallingobj = fallingobjects.Fallingobjects(
                WIDTH, random.randint(2,
                                      round(difficulty + player1.score / 10)),
                random.randint(0, WIDTH), random.randint(0, 2))
            all_falling.add(newfallingobj)
        # Displays background
        screen.fill(colors.black)
        screen.blit(background, (0, 0))
        collisions(all_falling, all_players, player1, screen, WIDTH, HEIGHT)
        # Updates the objects and players
        all_falling.update(5, HEIGHT, all_falling, player1)
        all_players.update(WIDTH, HEIGHT)
        # Displays player score
        draw.displayscore(screen, WIDTH, HEIGHT, player1.score)
        # Draw sprites to the screen
        all_falling.draw(screen)
        all_players.draw(screen)
        # Shows the total elapsed time
        draw.drawtime(timer1, screen)
        pygame.display.flip()
        # Detects end game
        if player1.score >= 50:
            running = False
            if mode:
                timer1.pause()
                draw.drawEnd(screen, WIDTH, HEIGHT, timer1)
            else:
                draw.drawWin(screen, WIDTH, HEIGHT)
            break
Example #2
0
def gameMain():
    #initialize the randomly selected word to guess
    wordToGuessSTRING = wordGuessList[random.randint(0, len(wordGuessList))]
    wordToGuess = list(wordToGuessSTRING)
    wordToGuess2 = list(wordToGuessSTRING)
    print("A word has been chosen...\n")
    #initialize variables requireda
    errorCount = 0
    missedLetters = []
    correctLetters = ["_"] * (len(wordToGuess))
    #main game start
    print(correctLetters)
    while correctLetters != wordToGuess: #10 is maximum number of errors until hangman is drawn completely
        guess = input("Enter a guess!: ")
        # guess = guess.lower
        if guess in wordToGuess and guess not in correctLetters:
            for c in wordToGuess:
                if c == guess:
                    correctLetters[wordToGuess2.index(guess)] = guess
                    wordToGuess2[wordToGuess2.index(guess)] = "0"
        elif guess in correctLetters:
            print("You already guessed that!")
        else:
            errorCount += 1
            missedLetters.append(guess)
        
        if errorCount == 10 or correctLetters == wordToGuess:
            break
        drawScreen(errorCount, missedLetters, correctLetters)
    
    if errorCount != 10:
        print("\n"*30)
        print(wordToGuess)
        print("CONGRATS! YOU WON!")
    else:
        print("\n"*30)
        draw.drawEnd()
        print(wordToGuess)
        print("Damn, you lost! Better luck next time.")
Example #3
0
def main():
    # Variable that controls if the welcome screen in shown
    global showTitle
    won = False
    quit = True
    WIDTH = 800
    HEIGHT = 600

    PLAYER_SIZE = 40
    PLAYER_SPEED = 5
    FPS = 60
    score = 0
    pygame.init()
    os.environ['SDL_VIDEO_CENTERED'] = '1'  # Centers the game screen

    # Sets up the game window
    screen = pygame.display.set_mode((WIDTH, HEIGHT))
    pygame.display.set_caption("Minigame Race")
    background = pygame.image.load("Background.png")
    # Instantiates a clock
    clock = pygame.time.Clock()
    running = True
    # Starts the music
    music()

    # Displays the welcome screen upon first launch
    if showTitle:
        draw.welcomeScreen(WIDTH, HEIGHT, screen)
    InMenu = True
    # Controls the whole menu
    while InMenu:
        mode = menu.menu(screen, WIDTH, HEIGHT)
        if (mode):
            time.sleep(.2)
            test.scoredisp('0')
            ready = menu.checkPlayerReady(screen, WIDTH, HEIGHT)
            time.sleep(.2)
            if ready:
                draw.countdown(screen, WIDTH, HEIGHT)
                InMenu = False
            else:
                continue
        else:
            time.sleep(.2)
            singlemode = menu.SinglePlayerMode(screen, WIDTH, HEIGHT)
            if singlemode:
                time.sleep(.2)
                ready = menu.checkPlayerReady(screen, WIDTH, HEIGHT)
                time.sleep(.2)
                if ready:
                    draw.countdown(screen, WIDTH, HEIGHT)
                    InMenu = False
                else:
                    continue
            else:
                choice = menu.minigamechooser(screen, WIDTH, HEIGHT)
                print(choice)
                if choice == 7:
                    running = False
                    quit = True
                elif choice == 6:
                    continue
                else:
                    runMinigame(choice)
                    running = False
                    quit = False

    # Initiates the player
    all_players = pygame.sprite.Group()
    player1 = player.Player(WIDTH / 2, HEIGHT / 2, PLAYER_SIZE, PLAYER_SPEED)
    all_players.add(player1)

    # Draws the gamestations
    all_gamestations = drawGamestations()

    # Instatiates and starts a timer
    timer1 = timer.Timer()
    timer1.start()
    while running:
        # Set the speed of the game
        clock.tick(FPS)

        # Detects exit
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
                pygame.quit()
            if event.type == pygame.KEYDOWN:
                if event.key == K_ESCAPE:
                    running = False
                    quit = False
                    showTitle = False
                    main()

        screen.fill(colors.black)
        # Calls update function to do updates
        updates(screen, all_players, all_gamestations,
            WIDTH, HEIGHT, background, player1)
        # Detects collision and determines the numbers of games played
        gamesplayed = collision(player1, all_gamestations,
            screen, WIDTH, HEIGHT, clock, timer1)
        draw.drawtime(timer1, screen)
        # This part runs only if in Multiplayer mode
        if mode:
            if score != player1.score:
                # Displays score to arduino
                test.scoredisp(player1.score)
                score = player1.score
        # Detects end game
        if gamesplayed == 6:
            draw.drawEnd(screen, WIDTH, HEIGHT, timer1)
            showTitle = False
            quit = False
            running = False
            main()
        if won:
            draw.drawlosegame(screen, WIDTH, HEIGHT)
            main()

        pygame.display.flip()
    if quit:
        pygame.quit()
Example #4
0
def catch(screen, WIDTH, HEIGHT, clock, timer1, mode):
    FPS = 60

    # Initializes the player and falling objects
    # sprite groups
    player1 = fallingplayer.player(WIDTH, HEIGHT)
    all_players = pygame.sprite.Group()
    all_players.add(player1)
    all_falling = pygame.sprite.Group()
    fallingobj1 = catchobjects.Catchobjects(WIDTH, 10,
                                            random.randint(0, WIDTH),
                                            random.randint(0, 1))
    all_falling.add(fallingobj1)
    all_bombs = pygame.sprite.Group()
    bomb = catchobjects.Bomb(WIDTH, 10, random.randint(0, WIDTH))
    all_bombs.add(bomb)

    # Loads the background we are going to use
    background = pygame.image.load("backgrounds/catchbackground.png")
    # Calls the draw.info function which will display to the player information
    # on what to do to move on
    draw.info(screen, WIDTH, HEIGHT, 'Catch 10 to Move on',
              100)  # Displays the game info

    # Main loop that will run until the end
    runnning = True
    while runnning:
        # Sets the FPS
        clock.tick(FPS)
        # Detects if player hits X on the window
        # and then closes the game if they did
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
                pygame.quit()

        # Algorithm to randomly spawn an enemy
        if (random.randrange(0, 100) < 0.75):
            # If above is true, create a new object and add it to the group
            newfallingobj = catchobjects.Catchobjects(WIDTH,
                                                      random.randint(10, 15),
                                                      random.randint(0, WIDTH),
                                                      random.randint(0, 2))
            all_falling.add(newfallingobj)
        if (random.randrange(0, 100) < .10):
            newbomb = catchobjects.Bomb(WIDTH, random.randint(10, 20),
                                        random.randint(0, WIDTH))
            all_bombs.add(newbomb)
        # Calls the collision function to detects collision
        collisions(all_falling, all_bombs, all_players, player1, screen, WIDTH,
                   HEIGHT)
        # Updates the player and falling object
        all_falling.update(5, HEIGHT, all_falling, player1)
        all_bombs.update(5, HEIGHT, all_bombs, player1)
        all_players.update(WIDTH, HEIGHT)
        # Sets the background
        screen.fill(colors.black)
        screen.blit(background, (0, 0))
        # Displays the score in top righ corners
        draw.displayscore(screen, WIDTH, HEIGHT, player1.score)
        # Once updated, draws sprite groups to the screen
        all_falling.draw(screen)
        all_players.draw(screen)
        all_bombs.draw(screen)
        # Displays total run time
        draw.drawtime(timer1, screen)
        # Flips the displays
        pygame.display.flip()
        # Detects if player has reached the score limit
        if player1.score >= 10:
            running = False
            if mode:  # Detects the mode program was started in
                timer1.pause()
                # Will tell the player they finished and displays
                # their time
                draw.drawEnd(screen, WIDTH, HEIGHT, timer1)
            else:
                # Tells the player the beat the level
                draw.drawWin(screen, WIDTH, HEIGHT)
            break
Example #5
0
def side(screen, WIDTH, HEIGHT, clock, timer1, mode):
    FPS = 60

    # Initializes the groups of objects
    player1 = sideclass.player(WIDTH, HEIGHT)
    all_players = pygame.sprite.Group()
    all_players.add(player1)
    all_enemy = pygame.sprite.Group()
    enemy1 = sideclass.Enemy(WIDTH, HEIGHT, 5)
    all_enemy.add(enemy1)
    # Loads 2 instances of the same background for scrolling
    background1 = pygame.image.load("backgrounds/jumpback.jpg")
    background2 = pygame.image.load("backgrounds/jumpback.jpg")
    # Displays info to the user playing the game
    draw.info(screen, WIDTH, HEIGHT, 'Score 15 to Move on', 100)
    running = True
    move1 = 800
    move2 = 0

    while running:
        clock.tick(FPS)

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
                pygame.quit()
        # Draws the background
        screen.fill(colors.black)
        screen.blit(background1, (move1, 0))
        screen.blit(background2, (move2, 0))

        # Randomly spawns enemies
        if (random.randrange(0, 100) < 1
                and len(all_enemy) < 2) or len(all_enemy) == 0:
            enemy = sideclass.Enemy(WIDTH, HEIGHT, random.randint(5, 8))
            all_enemy.add(enemy)
        # Displays the timer and score
        draw.drawtime(timer1, screen)
        draw.displayscore(screen, WIDTH, HEIGHT, player1.score)
        # Updates player and enemies
        all_players.update(WIDTH, HEIGHT)
        all_enemy.update(all_enemy, player1)
        all_players.draw(screen)
        all_enemy.draw(screen)
        # Detects collision between enemies and players
        collision(all_players, all_enemy, player1, screen, WIDTH, HEIGHT)
        # Sees if the player has reached the limit
        if player1.score == 15:
            if mode:  # If in minigame mode
                timer1.pause()
                draw.drawEnd(screen, WIDTH, HEIGHT, timer1)
            else:
                draw.drawWin(screen, WIDTH, HEIGHT)
            break

        # Controls movement of the background to scroll
        move1 -= 1
        move2 -= 1
        if move2 == -800:
            move2 = 800
        if move1 == -800:
            move1 = 800
        pygame.display.flip()
Example #6
0
def Snake(screen, WIDTH, HEIGHT, clock, timer1, mode):
    FPS = 60

    # Initializes the sprites
    all_players = pygame.sprite.Group()
    all_food = pygame.sprite.Group()
    all_bad = pygame.sprite.Group()
    foodobject = snakeclasses.food(
        randint(1, (WIDTH / 40) - 1) * 40,
        randint(1, (HEIGHT / 40) - 1) * 40)
    player1 = snakeclasses.player(WIDTH, HEIGHT)
    badobject = snakeclasses.bad(
        randint(1, (WIDTH / 40) - 1) * 40,
        randint(1, (HEIGHT / 40) - 1) * 40)
    all_bad.add(badobject)
    all_food.add(foodobject)
    all_players.add(player1)
    # Displays info to the player
    draw.info(screen, WIDTH, HEIGHT, 'Score 5 to Move on', 100)
    running = True
    while running:
        clock.tick(FPS)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
                pygame.quit()
        # Detects if player collides with the food
        if collision(player1.rect.x, foodobject.rect.x, player1.rect.y,
                     foodobject.rect.y):
            generating = True
            # Ensures food doesn't spawn on the obstacle
            while generating:
                foodobject.rect.x = randint(1, WIDTH / 40 - 1) * 40
                foodobject.rect.y = randint(1, HEIGHT / 40 - 1) * 40
                for bad in all_bad:
                    if bad.rect.x != foodobject.rect.x and bad.rect.y != foodobject.rect.y:
                        generating = False
            badobject = snakeclasses.bad(
                randint(1, (WIDTH / 40) - 1) * 40,
                randint(1, (HEIGHT / 40) - 1) * 40)
            all_bad.add(badobject)
            player1.score += 1
        # Detects collision with the enemy
        if enemyCollision(all_players, all_bad):
            # Displays loose message then resets the game
            draw.drawlosegame(screen, WIDTH, HEIGHT)
            for i in all_bad:
                all_bad.remove(i)
            player1.score = 0
            badobject.rect.x = randint(1, (WIDTH / 40) - 1) * 40
            badobject.rect.y = randint(1, (HEIGHT / 40) - 1) * 40
            while badobject.rect.x == foodobject.rect.x and badobject.rect.y == foodobject.rect.y:
                badobject.rect.x = randint(1, (WIDTH / 40) - 1) * 40
                badobject.rect.y = randint(1, (HEIGHT / 40) - 1) * 40
            all_bad.add(badobject)
        # Detects if player reached score limit
        if player1.score == 5:
            if mode:  # If in minigame mode
                timer1.pause()
                draw.drawEnd(screen, WIDTH, HEIGHT, timer1)
            else:
                draw.drawWin(screen, WIDTH, HEIGHT)
            break
        # Updates on the screen
        all_players.update(WIDTH, HEIGHT)
        screen.fill(colors.black)
        draw.displayscore(screen, WIDTH, HEIGHT, player1.score)
        all_players.draw(screen)
        all_food.draw(screen)
        all_bad.draw(screen)
        draw.drawtime(timer1, screen)
        pygame.display.flip()
Example #7
0
pygame.display.set_caption("Minesweeper")

while True:
    event = pygame.event.wait()
    t = event.type
    if t == pygame.QUIT:
        sys.exit()
    elif t == pygame.MOUSEBUTTONDOWN:
        if not g.ended:
            y, x = event.pos
            button = event.button
            tile = g.findTile(x, y)
            if button == 3:
                tile.toggleFlag()
            elif button == 1:
                g.openTile(tile)
    elif t == pygame.KEYDOWN:
        if g.ended:
            if event.key == 13:
                g.reset()

    g.checkWin()

    for tile in g:
        draw.drawTile(screen, tile)

    if g.ended:
        draw.drawEnd(screen, g.win, width * 25, height * 25)

    pygame.display.flip()
Example #8
0
def falling(screen, WIDTH, HEIGHT, clock, difficulty, timer1, mode):
    FPS = 60

    # Loads the background
    background = pygame.image.load("backgrounds/popbackground.jpg")

    # Initializes player and balloon groups
    player1 = player.Player(WIDTH / 2, HEIGHT / 2, 0, 5)
    all_players = pygame.sprite.Group()
    all_players.add(player1)
    all_objects = pygame.sprite.Group()
    obj1 = popobjects.Popobject(
        0, random.randint(0, HEIGHT),
        random.randint(2, round(difficulty + player1.score / 10)),
        random.randint(2, round(difficulty + player1.score / 10)), 0, 1)
    all_objects.add(obj1)

    # Displays to the player what their objective is
    draw.info(screen, WIDTH, HEIGHT, 'Pop 5 Balloons in 10 Seconds', 75)
    # Variable to keep track of time limit
    start = 600
    runnning = True
    while runnning:
        clock.tick(FPS)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
                pygame.quit()
        # Randomly spawns a balloon, if there are no balloons on the screen it will spawn one also
        if (random.randrange(0, 100) < 1.5 - player1.score / 100
                or len(all_objects) == 0):
            comingfrom = random.randint(1, 8)
            if comingfrom == 1:
                newobj = popobjects.Popobject(
                    -1, random.randint(0, HEIGHT),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 0), 1)
            elif comingfrom == 2:
                newobj = popobjects.Popobject(
                    random.randint(0, WIDTH), -1,
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 0), 1)
            elif comingfrom == 3:
                newobj = popobjects.Popobject(
                    random.randint(0, WIDTH), 601,
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 0), 3)
            elif comingfrom == 4:
                newobj = popobjects.Popobject(
                    801, random.randint(0, HEIGHT),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 0), 3)
            elif comingfrom == 5:
                newobj = popobjects.Popobject(
                    -1, random.randint(0, HEIGHT),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 0), 2)
            elif comingfrom == 6:
                newobj = popobjects.Popobject(
                    random.randint(0, WIDTH), 601,
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 0), 2)
            elif comingfrom == 7:
                newobj = popobjects.Popobject(
                    801, random.randint(0, HEIGHT),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 0), 4)
            elif comingfrom == 8:
                newobj = popobjects.Popobject(
                    random.randint(0, WIDTH), -1,
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 0), 4)
            all_objects.add(newobj)
        # Draws the background
        screen.fill(colors.black)
        screen.blit(background, (0, 0))
        # Detects collisions
        collisions(all_objects, all_players, player1, screen, WIDTH, HEIGHT)
        # Updates objects, dislay score and time
        all_objects.update(HEIGHT, WIDTH, all_objects)
        all_players.update(WIDTH, HEIGHT)
        draw.displayscore(screen, WIDTH, HEIGHT, player1.score)
        all_objects.draw(screen)
        all_players.draw(screen)
        draw.drawtime(timer1, screen)
        draw.drawremainingtime(start, screen)
        pygame.display.flip()
        # Detects if time limit is reached and resets the game if it has been
        if start < 0:
            start = 600
            draw.drawlosepop(all_objects, screen, WIDTH, HEIGHT, timer1)
            player1.score = 0
        # Detects if the player reached the score within the time limit
        if player1.score >= 5 and start > 0:
            running = False
            if mode:
                timer1.pause()
                draw.drawEnd(screen, WIDTH, HEIGHT, timer1)
            else:
                draw.drawWin(screen, WIDTH, HEIGHT)
            break
        start -= 1
Example #9
0
def falling(screen, WIDTH, HEIGHT, clock, difficulty, timer1, mode):
    FPS = 60

    # Sets the player and enemy sprite groups
    player1 = player.Player(WIDTH / 2, HEIGHT / 2, 0, 7)
    all_players = pygame.sprite.Group()
    all_players.add(player1)
    all_objects = pygame.sprite.Group()
    obj1 = objectsfordodge.Object(
        0, random.randint(0, HEIGHT),
        random.randint(2, round(difficulty + player1.score / 10)),
        random.randint(2, round(difficulty + player1.score / 10)), 0, 1)
    all_objects.add(obj1)

    # Loads the background
    background = pygame.image.load("backgrounds/dodgebackground.jpg")
    # Displays the info on what to do to the player
    draw.info(screen, WIDTH, HEIGHT, 'Score 50 to Move on', 100)
    # Main loop
    runnning = True
    while runnning:
        clock.tick(FPS)
        # Detects if player has closed the window
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
                pygame.quit()
        # Randomly spawns objects around the screen
        if (random.randrange(0, 100) < difficulty + (player1.score / 10)):
            comingfrom = random.randint(1, 8)
            if comingfrom == 1:
                newobj = objectsfordodge.Object(
                    -1, random.randint(0, HEIGHT),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 5), 1)
            elif comingfrom == 2:
                newobj = objectsfordodge.Object(
                    random.randint(0, WIDTH), -1,
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 5), 1)
            elif comingfrom == 3:
                newobj = objectsfordodge.Object(
                    random.randint(0, WIDTH), 601,
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 5), 3)
            elif comingfrom == 4:
                newobj = objectsfordodge.Object(
                    801, random.randint(0, HEIGHT),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 5), 3)
            elif comingfrom == 5:
                newobj = objectsfordodge.Object(
                    -1, random.randint(0, HEIGHT),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 5), 2)
            elif comingfrom == 6:
                newobj = objectsfordodge.Object(
                    random.randint(0, WIDTH), 601,
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 5), 2)
            elif comingfrom == 7:
                newobj = objectsfordodge.Object(
                    801, random.randint(0, HEIGHT),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 5), 4)
            elif comingfrom == 8:
                newobj = objectsfordodge.Object(
                    random.randint(0, WIDTH), -1,
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(2, round(difficulty + player1.score / 10)),
                    random.randint(0, 5), 4)
            # Adds object to the group if it spawns
            all_objects.add(newobj)
        # Detects collision
        collisions(all_objects, all_players, player1, screen, WIDTH, HEIGHT)
        # Updates of opbjects
        all_objects.update(HEIGHT, WIDTH, all_objects, player1)
        all_players.update(WIDTH, HEIGHT)
        screen.fill(colors.black)
        screen.blit(background, (0, 0))
        draw.displayscore(screen, WIDTH, HEIGHT, player1.score)
        all_objects.draw(screen)
        all_players.draw(screen)
        draw.drawtime(timer1, screen)
        pygame.display.flip()
        # Checks for player win
        if player1.score == 50:
            running = False
            if mode:
                timer1.pause()
                draw.drawEnd(screen, WIDTH, HEIGHT, timer1)
            else:
                draw.drawWin(screen, WIDTH, HEIGHT)
            break