import mouse#————————————————————————————————————- pygame.mouse.set_pos(playerRect.centerx, playerRect.centery)#Shift enemies down#————————————————————————————————————- for b in

import pygame, random, sysfrom pygame.locals import *from High_Score_Module import highscoreWINDOWWIDTH = 1366WINDOWHEIGHT = 768TEXTCOLOR = (255, 255, 255)BACKGROUNDCOLOR = (97, 238, 253)FPS = 60BADDIEMINSIZE = 40BADDIEMAXSIZE = 60BADDIEMINSPEED = 1BADDIEMAXSPEED = 8ADDNEWBADDIERATE = 5PLAYERMOVERATE = 5#Terminate program#————————————————————————————————————-def terminate():    pygame.quit()    sys.exit()def waitForPlayerToPressKey():    while True:        for event in pygame.event.get():            if event.type == QUIT:                terminate()            if event.type == KEYDOWN:                if event.key == K_ESCAPE:                     terminate()                return#Checks for impact#————————————————————————————————————-def playerHasHitBaddie(playerRect, baddies):    for b in baddies:        if playerRect.colliderect(b’rect’):            return True    return False#Draws text in pygame#————————————————————————————————————-def drawText(text, font, surface, x, y):    textobj = font.render(text, 1, TEXTCOLOR)    textrect = textobj.get_rect()    textrect.topleft = (x, y)    surface.blit(textobj, textrect)#Sets clock, and makes game fullscreen, and allows for mouse movement#————————————————————————————————————-pygame.init()mainClock = pygame.time.Clock()windowSurface = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT),pygame.FULLSCREEN)pygame.display.set_caption(‘Play Dodger’)pygame.mouse.set_visible(False)#Fonts#————————————————————————————————————-font = pygame.font.SysFont(None, 48)#Imports background music and loss music#————————————————————————————————————-gameOverSound = pygame.mixer.Sound(‘OOF.wav’)pygame.mixer.music.load(‘bg3.mp3’)#Imports Player image, and enemy images#————————————————————————————————————-PlayFile = pygame.image.load(‘Play.png’)playerImage = pygame.transform.scale(PlayFile,(50,50))playerRect = playerImage.get_rect()romulanImage = pygame.image.load(‘Stop.png’)klingonImage = pygame.image.load(‘Pause.png’)#Draws startscreen #————————————————————————————————————-drawText(‘Play Button Dodger’, font, windowSurface, (WINDOWWIDTH / 3), (WINDOWHEIGHT / 3))drawText(‘Use your mouse to move’, font, windowSurface, (WINDOWWIDTH / 5) – 35, (WINDOWHEIGHT / 3) + 50)drawText(‘Press any key to start.’, font, windowSurface, (WINDOWWIDTH / 3) – 30, (WINDOWHEIGHT / 3) + 150)pygame.display.update()waitForPlayerToPressKey()x = 0inPlay = Truewhile inPlay:    baddies =     score = 0    playerRect.topleft = (WINDOWWIDTH / 2, WINDOWHEIGHT – 50)    baddieAddCounter = 0    pygame.mixer.music.play(-1, 0.0)    while True:         score += 1         for event in pygame.event.get():            if event.type == QUIT:                terminate()        #Mouse Movement#————————————————————————————————————-            if event.type == MOUSEMOTION:                               playerRect.move_ip(event.pos0 – playerRect.centerx, event.pos1 – playerRect.centery)#Adds new enemies#————————————————————————————————————-                    baddieAddCounter += 1        if baddieAddCounter == ADDNEWBADDIERATE:            baddieAddCounter = 0            baddieSize = random.randint(BADDIEMINSIZE, BADDIEMAXSIZE)            newBaddie1 = {‘rect’: pygame.Rect(random.randint(0, WINDOWWIDTH-baddieSize), 0 – baddieSize, baddieSize, baddieSize),                        ‘speed’: random.randint(BADDIEMINSPEED, BADDIEMAXSPEED),                        ‘surface’:pygame.transform.scale(romulanImage, (baddieSize, baddieSize)),                        }            newBaddie2 = {‘rect’: pygame.Rect(random.randint(0, WINDOWWIDTH-baddieSize), 0 – baddieSize, baddieSize, baddieSize),                        ‘speed’: random.randint(BADDIEMINSPEED, BADDIEMAXSPEED),                        ‘surface’:pygame.transform.scale(klingonImage, (baddieSize, baddieSize)),                        }            baddies.append(newBaddie1)            baddies.append(newBaddie2)            #Uses player image as mouse#————————————————————————————————————-        pygame.mouse.set_pos(playerRect.centerx, playerRect.centery)#Shift enemies down#————————————————————————————————————-        for b in baddies:            b’rect’.move_ip(0, b’speed’)#Delete enemies when they go off the screen#————————————————————————————————————-        for b in baddies::            if b’rect’.top > WINDOWHEIGHT:                baddies.remove(b)#Draws background#————————————————————————————————————-        windowSurface.fill(BACKGROUNDCOLOR)#Draws score#————————————————————————————————————-        drawText(‘Score: %s’ % (score), font, windowSurface, 10, 0)                windowSurface.blit(playerImage, playerRect)#Draws enemies#————————————————————————————————————-        for b in baddies:            windowSurface.blit(b’surface’, b’rect’)        pygame.display.update()#Hit detection#————————————————————————————————————-        if playerHasHitBaddie(playerRect, baddies):            inPlay = False            if score > x:                x = score             break        mainClock.tick(FPS)    pygame.mixer.music.stop()    gameOverSound.play()    gameOverSound.stop()from High_Score_Module import highscorepygame.init()X = 480Y = 400WHITE = (97, 238, 253)BLACK = (0, 0, 0)font = pygame.font.SysFont(“Arial”, 16)screen = pygame.display.set_mode((X, Y))screen.fill(WHITE)my_score = scorehighscore(screen, ‘score_file.txt’, my_score)txt_surf = font.render(“Thank You For Playing!”, True, BLACK)txt_rect = txt_surf.get_rect(center=(X//2, Y//2))screen.blit(txt_surf, txt_rect)pygame.display.flip()gameIcon = pygame.image.load(‘ICON.png’)pygame.display.set_icon(gameIcon)