rendered paste body## Wulf ## import randomimport pygame import mathfrom pygame.locals import *pygame.init ()pygame.mixer.init ()Clock = pygame.time.Clock()#################################################################################################################################################################################################################################################def Distance((x1,y1),(x2,y2)) : return math.sqrt((x2-x1)**2 +(y2-y1)**2)def CircleCheck (Surface,Pos,Radius,Colour) : # Returns True of False (1 or 0)#Only Accurate if checking againt an object of 3 px or less x = Pos[0] - Radius y = Pos[1] flag = False while x <= Pos[0] + Radius : y = int((Radius**2 - (x - Pos[0])**2 )**0.5 + Pos[1]) try : #Surface.set_at((int(x),y),(Colour)) if Surface.get_at((int(x),y)) == Colour : flag = True except : False y = int(-1*((Radius**2 - (x - Pos[0])**2 )**0.5) + Pos[1]) try : #Surface.set_at((int(x),y),(Colour)) if Surface.get_at((int(x),y)) == Colour : flag = True except : False if x -(Pos[0] - Radius) < 1 or (Pos[0] - Radius) - x < 1: x+=0.3 else : x+= 0.5 return flag################################################################################################################################################################################################################################################# Variablesscreen = pygame.display.set_mode ( (800, 600) )running = True CX = 800CY = 600CX2 = 300CY2 = 300Easy = FalseMedium = False Hard = False Text = 1LEFT = TrueTPS = 0Score = 0RS1x = random.randint(100, 700)RS1y = random.randint(100, 500)##FontsFont1 = pygame.font.Font ("esp.ttf", 35) Font2 = pygame.font.Font ("esp.ttf", 44) Font3 = pygame.font.Font ("esp.ttf", 20) ##Musicpygame.mixer.music.load ("music.mp3")pygame.mixer.music.play ((1), (0.0))################################################################################# Menuwhile running: event = pygame.event.poll () if event.type == pygame.QUIT: running = False screen.fill ( ( 0, 0, 0 ) ) # Easy Text if Text == 1: pygame.draw.rect(screen,(50,50,50),((335,150),(120,60))) text = Font1.render (str(("Easy")), True, (255,255,255)) screen.blit (text, (340,167)) if event.type == pygame.MOUSEBUTTONDOWN and event.button == LEFT: xy = pygame.mouse.get_pos() x = xy[0] y = xy[1] # Menu Click Easy if x > 335 and y > 150 and x < 335 + 120 and y < 150 + 60: Easy = True running = False # Menu Click Hard if x > 335 and y > 250 and x < 335 + 175 and y < 250 + 60: Medium = True running = False # Menu Click Hard if x > 335 and y > 350 and x < 335 + 120 and y < 350 + 60: Hard = True running = False # Medium Text if Text == 1: pygame.draw.rect(screen,(50,50,50),((305,250),(175,60))) text = Font1.render (str(("Medium")), True, (255,255,255)) screen.blit (text, (314,265)) # Hard Text if Text == 1: pygame.draw.rect(screen,(50,50,50),((335,350),(120,60))) text = Font1.render (str(("Hard")), True, (255,255,255)) screen.blit (text, (340,365)) # Title Text if Text == 1: pygame.draw.rect(screen,(50,50,50),((255,25),(285,60))) text = Font2.render (str(("G H O S T")), True, (255,255,255)) screen.blit (text, (260,35)) pygame.display.flip () TPS = TPS+Clock.tick()/1000.0################################################################################ # Easywhile Easy: event = pygame.event.poll () if event.type == pygame.QUIT: Easy = False screen.fill ( ( 0, 0, 0 ) ) MousePos = pygame.mouse.get_pos() # Collect reds if TPS > 5: pygame.draw.rect(screen,(255,0,0),((RS1x, RS1y),(20, 20))) if CircleCheck (screen, MousePos, 13, (255, 0, 0)): Score = Score + 1 RS1x = random.randint(100, 700) RS1y = random.randint(100, 500) # Blit Score text = Font3.render (str(("Score: " + str((Score)))), True, (255,255,255)) screen.blit (text, (5, 10)) # Fast Small Circle pygame.draw.circle(screen, (254, 255, 255), (CX, CY), 25) if CX > MousePos[0]: CX -= 1.50 if CX < MousePos[0]: CX += 1.50 if CY > MousePos[1]: CY -= 1.50 if CY < MousePos[1]: CY += 1.50 # Your Circle pygame.draw.circle(screen, (255, 255, 255), (MousePos), 10) # Check for collisions if CircleCheck (screen, MousePos, 13, (254,255,255)): text = Font1.render (str(("Game Over")), True, (255,255,255)) screen.blit (text, (280,167)) pygame.display.flip () pygame.time.delay (2000) Easy = False pygame.display.flip () TPS = TPS+Clock.tick()/1000.0 ################################################################################ # Medium while Medium: event = pygame.event.poll () if event.type == pygame.QUIT: Medium = False screen.fill ( ( 0, 0, 0 ) ) MousePos = pygame.mouse.get_pos() # Collect reds if TPS > 5: pygame.draw.rect(screen,(255,0,0),((RS1x, RS1y),(20, 20))) if CircleCheck (screen, MousePos, 13, (255, 0, 0)): Score = Score + 1 RS1x = random.randint(100, 700) RS1y = random.randint(100, 500) # Blit Score text = Font3.render (str(("Score: " + str((Score)))), True, (255,255,255)) screen.blit (text, (5, 10)) # Fast Small Circle pygame.draw.circle(screen, (254, 255, 255), (CX, CY), 25) if CX > MousePos[0]: CX -= 2.00 if CX < MousePos[0]: CX += 2.00 if CY > MousePos[1]: CY -= 2.00 if CY < MousePos[1]: CY += 2.00 # Your Circle pygame.draw.circle(screen, (255, 255, 255), (MousePos), 10) # Check for collisions if CircleCheck (screen, MousePos, 13, (254,255,255)): text = Font1.render (str(("Game Over")), True, (255,255,255)) screen.blit (text, (280,167)) pygame.display.flip () pygame.time.delay (2000) Medium = False pygame.display.flip () TPS = TPS+Clock.tick()/1000.0 ################################################################################ #Hardwhile Hard: event = pygame.event.poll () if event.type == pygame.QUIT: Hard = False screen.fill ( ( 0, 0, 0 ) ) MousePos = pygame.mouse.get_pos() # Collect reds if TPS > 5: pygame.draw.rect(screen,(255,0,0),((RS1x, RS1y),(20, 20))) if CircleCheck (screen, MousePos, 13, (255, 0, 0)): Score = Score + 1 RS1x = random.randint(100, 700) RS1y = random.randint(100, 500) # Blit Score text = Font3.render (str(("Score: " + str((Score)))), True, (255,255,255)) screen.blit (text, (5, 10)) # Fast Small Circle pygame.draw.circle(screen, (254, 255, 255), (CX, CY), 25) if CX > MousePos[0]: CX -= 2.50 if CX < MousePos[0]: CX += 2.50 if CY > MousePos[1]: CY -= 2.50 if CY < MousePos[1]: CY += 2.50 # Your Circle pygame.draw.circle(screen, (255, 255, 255), (MousePos), 10) # Check for collision if CircleCheck (screen, MousePos, 13, (254,255,255)): text = Font1.render (str(("Game Over")), True, (255,255,255)) screen.blit (text, (280,167)) pygame.display.flip () pygame.time.delay (3000) Hard = False pygame.display.flip () TPS = TPS+Clock.tick()/1000.0pygame.mixer.quitpygame.quit ()