habib257

Untitled

Mar 25th, 2021
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 117.41 KB | None | 0 0
  1. # sorry for how much code this game hass!
  2. def level3():
  3.  
  4.    # ---------------------------------------------------------- transition
  5.    white = (255, 255, 255)
  6.    black = (0, 0, 0)
  7.   # our window
  8.    WINDOW_SIZE = (800,700)
  9.  
  10.    pygame.display.set_caption("new world")
  11.    blacks = 0, 0, 0
  12.    window = pygame.display.set_mode((WINDOW_SIZE), pygame.NOFRAME)
  13.  
  14.  
  15.     class Circle:
  16.         def __init__( self, color, x, y, radius, width ):
  17.             self.color = color
  18.             self.x = x
  19.             self.y = y
  20.             self.radius = radius
  21.             self.width = width
  22.             self.raw_width = width
  23.  
  24.         def draw( self, window ):
  25.             pygame.draw.circle( window, self.color, ( self.x, self.y ), self.radius, self.width )
  26.  
  27.  
  28.         def circleInTransition( self ):
  29.             self.radius = max(WINDOW_SIZE)
  30.             self.width = 0
  31.             add = True
  32.             speed = 13
  33.             rnge = round(800 / speed)
  34.            
  35.             for i in range( rnge ):
  36.                 for event in pygame.event.get():
  37.                     if event.type == pygame.QUIT:
  38.                         pygame.quit()
  39.                         sys.exit()
  40.  
  41.                
  42.                 self.width += speed
  43.                
  44.                 if self.width > self.radius:
  45.                     self.width = self.radius
  46.  
  47.  
  48.                
  49.                 circle.draw( window )
  50.                 pygame.display.update()
  51.  
  52.  
  53.             self.width = self.radius - 50
  54.             for i in range( 300 ):
  55.                 time.sleep(0.0001)
  56.                 for event in pygame.event.get():
  57.                     if event.type == pygame.QUIT:
  58.                         pygame.quit()
  59.                         sys.exit()
  60.  
  61.                 self.radius -= 2
  62.                 self.width -= 2
  63.                
  64.                 if self.radius < 50:
  65.                     if self.width <= 0:
  66.                         self.radius = 50
  67.                     else:
  68.                         self.radius = 50
  69.  
  70.  
  71.                 if self.width < 1:
  72.                     self.width = 1
  73.                     break
  74.  
  75.                 else:
  76.                     level3()
  77.                    
  78.                 #if self.width == 50:
  79.                 #    self.width = 0
  80.                    
  81.  
  82.                
  83.                 circle.draw( window )
  84.                 pygame.display.update()
  85.                
  86.             pygame.display.update()
  87.  
  88.  
  89.  
  90.  
  91.         def circleInTransition( self ):
  92.             self.radius = max(WINDOW_SIZE)
  93.             self.width = 0
  94.             add = True
  95.             speed = 13
  96.             rnge = round(800 / speed)
  97.            
  98.             for i in range( rnge ):
  99.                 for event in pygame.event.get():
  100.                     if event.type == pygame.QUIT:
  101.                         pygame.quit()
  102.                         sys.exit()
  103.  
  104.                
  105.                 self.width += speed
  106.                
  107.                 if self.width > self.radius:
  108.                     self.width = self.radius
  109.  
  110.  
  111.                
  112.                 circle.draw( window )
  113.                 pygame.display.update()
  114.  
  115.  
  116.             self.width = self.radius - 50
  117.             for i in range( 300 ):
  118.                 time.sleep(0.0001)
  119.                 for event in pygame.event.get():
  120.                     if event.type == pygame.QUIT:
  121.                         pygame.quit()
  122.                         sys.exit()
  123.  
  124.                 self.radius -= 2
  125.                 self.width -= 2
  126.                
  127.                 if self.radius < 50:
  128.                     if self.width <= 0:
  129.                         self.radius = 50
  130.                     else:
  131.                         self.radius = 50
  132.  
  133.  
  134.                 if self.width < 1:
  135.                     self.width = 1
  136.                     break
  137.  
  138.                 else:
  139.                     level3()
  140.                    
  141.                 #if self.width == 50:
  142.                 #    self.width = 0
  143.                    
  144.  
  145.                
  146.                 circle.draw( window )
  147.                 pygame.display.update()
  148.                
  149.             pygame.display.update()
  150.            
  151.  
  152.         def circleOutInInOut( self ):
  153.             self.radius = max(WINDOW_SIZE)
  154.             self.width = 0
  155.             speed = 99
  156.             playerman = player(340,465,50,50,white)
  157.  
  158.             rnge = round(800 / speed)
  159.             for i in range( rnge ):
  160.                 for event in pygame.event.get():
  161.                     if event.type == pygame.QUIT:
  162.                         pygame.quit()
  163.                         sys.exit()
  164.                 if self.width > self.radius:
  165.                     self.width = self.radius
  166.  
  167.                 self.width += speed
  168.                 circle.draw( window )
  169.  
  170.            
  171.             for i in range( 90 ):
  172.                 time.sleep(0.0001)
  173.                 for event in pygame.event.get():
  174.                     if event.type == pygame.QUIT:
  175.                         pygame.quit()
  176.                         sys.exit()
  177.                        
  178.                
  179.                 if self.width < 0:
  180.                     self.width = 0
  181.  
  182.  
  183.  
  184.  
  185.                 self.width -= 8
  186.  
  187.            
  188.                 for bg in bgs:
  189.                     bg.draw()
  190.                 playerman.draw()
  191.                 chef1.draw()
  192.                 chef2.draw()
  193.                 chef3.draw()
  194.                 for cheese in cheeses:
  195.                     cheese.draw()
  196.  
  197.                 for obj in object_list:
  198.                     obj.draw()
  199.                 cheesemove()
  200.                 position()
  201.                 window.blit(healthba, (-1,0))
  202.                 # player health HHEHEHEHEHE
  203.                 hitbox = (5, 35 + 2, 31, 57)
  204.                 pygame.draw.rect(window, (167, 70, 47), (hitbox[0], hitbox[1] - 4, 170 - (5 * (10 - health)),  10)) # NEW
  205.                 pygame.draw.rect(window, (24, 10, 6), (hitbox[0], hitbox[1] - 25, 170 - (5 * (10 - health)),  10)) # NEW
  206.                 pygame.draw.rect(window, (54, 24, 16), (hitbox[0], hitbox[1] - 26, 170 - (5 * (10 - health)),  10)) # NEW
  207.                 pygame.draw.rect(window, (243, 130, 104), (hitbox[0], hitbox[1] - 25, 170 - (5 * (10 - health)),  10)) # NEW
  208.                 pygame.draw.rect(window, (221, 109, 83), (hitbox[0], hitbox[1] - 24, 170 - (5 * (10 - health)),  23)) # NEW
  209.                 pygame.draw.rect(window, (199, 84, 57), (hitbox[0], hitbox[1] - 20, 170 - (5 * (10 - health)), 20)) # NEWright = True
  210.  
  211.                 hitbox2 = (5, 89 + 2, 31, 57)
  212.                 pygame.draw.rect(window, (13, 16, 17), (hitbox2[0], hitbox2[1] - 21, 170 - (5 * (10 - health2)),  20)) # NEW
  213.                 pygame.draw.rect(window, (146,236,244), (hitbox2[0], hitbox2[1] - 20, 170 - (5 * (10 - health2)),  20)) # NEW
  214.                 pygame.draw.rect(window, (95, 212, 231), (hitbox2[0], hitbox2[1] - 18, 170 - (5 * (10 - health2)),  20)) # NEW
  215.                 pygame.draw.rect(window, (13, 16, 17), (hitbox2[0], hitbox2[1] - 8, 170 - (5 * (10 - health2)),  15)) # NEW
  216.                 pygame.draw.rect(window, (57, 182, 214), (hitbox2[0], hitbox2[1] - 10, 170 - (5 * (10 - health2)),  20)) # NEW
  217.                 pygame.draw.rect(window, (114, 203, 226), (hitbox2[0], hitbox2[1] - 16, 170 - (5 * (10 - health2)),  20)) # NEW
  218.  
  219.                 hitbox3 = (660, 50 + 2, 31, 57)
  220.                 pygame.draw.rect(window, (17,48,42,255), (hitbox3[0], hitbox3[1] - 21, 120 - (5 * (10 - health3)),  20)) # NEW
  221.                 pygame.draw.rect(window, (89,243,212,255), (hitbox3[0], hitbox3[1] - 20, 120 - (5 * (10 - health3)),  20)) # NEW
  222.                 pygame.draw.rect(window, (87,205,182,255), (hitbox3[0], hitbox3[1] - 18, 120 - (5 * (10 - health3)),  20)) # NEW
  223.                 pygame.draw.rect(window, (71,190,166,255), (hitbox3[0], hitbox3[1] - 8, 120 - (5 * (10 - health3)),  15)) # NEW
  224.                 pygame.draw.rect(window, (57,160,139,255), (hitbox3[0], hitbox3[1] - 10, 120 - (5 * (10 - health3)),  20)) # NEW
  225.                 pygame.draw.rect(window, (71,190,166,255), (hitbox3[0], hitbox3[1] - 16, 120 - (5 * (10 - health3)),  20)) # NEW
  226.  
  227.                
  228.  
  229.                 window.blit(stat1, (0,0))
  230.                 window.blit(settingsm,(655,-100))
  231.                
  232.                 circle.draw( window )
  233.                 pygame.display.update()
  234.  
  235.  
  236.             pygame.display.update()
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243. # --------------------------------------------------- Transition
  244.     global pause
  245.  
  246.  
  247.     pause = False
  248.  
  249.    
  250.     def quitgame():
  251.         pygame.quit()
  252.  
  253.     def unpause():
  254.         global pause
  255.         pause = False
  256.        
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.     jump = pygame.mixer.Sound('jump1.wav')
  266.     jump.set_volume(0.1)
  267.  
  268.  
  269.     hits = pygame.mixer.Sound('hit.flac')
  270.     hits.set_volume(0.1)
  271.  
  272.     land = [pygame.mixer.Sound('jumpland (4).wav'),pygame.mixer.Sound("land.wav")]
  273.     land[1].set_volume(0.1)
  274.     land[0].set_volume(0.1)
  275.  
  276.     walk = [pygame.mixer.Sound('jumpland (4).wav'),pygame.mixer.Sound("jumpland (4).wav"),pygame.mixer.Sound("jumpland (4).wav")]
  277.     walk[1].set_volume(0.05)
  278.  
  279.  
  280.     # our player class LEVEL 3
  281.     class player:
  282.         def __init__(self,x,y,height,width,color):
  283.             self.x = x
  284.             self.y = y
  285.             self.height = height
  286.             self.width = width
  287.             self.idle = [pygame.image.load("grey_mouse/idle (" + str(i) + ").png").convert_alpha() for i in range(1, 21)]
  288.             self.leftid = [pygame.image.load("grey_mouse/id (" + str(i) + ").png").convert_alpha() for i in range(1, 21)]
  289.             self.Right = [pygame.image.load("grey_mouse/walk (" + str(i) + ").png").convert_alpha() for i in range(1, 9)]
  290.             self.left = [pygame.image.load("grey_mouse/left (" + str(i) + ").png").convert_alpha() for i in range(1, 9)]
  291.             self.jump = [pygame.image.load("grey_mouse/jump (6).png")]
  292.  
  293.             self.jump2 = [pygame.image.load("grey_mouse/jump 06.png").convert_alpha()]
  294.             self.Push = [pygame.image.load("grey_mouse/ol" + str(i) + ".png").convert_alpha() for i in range(1, 9)]
  295.             self.Push2 = [pygame.image.load("grey_mouse/olo (" + str(i) + ").png").convert_alpha() for i in range(1, 9)]
  296.  
  297.             self.att = [pygame.image.load("grey_mouse/oj" + str(i) + ".png").convert_alpha() for i in range(1, 9)]
  298.             self.att2 = [pygame.image.load("grey_mouse/ojo (" + str(i) + ").png").convert_alpha() for i in range(1, 9)]
  299.             self.snif = [pygame.image.load("grey_mouse/sni (" + str(i) + ").png").convert_alpha() for i in range(1, 19)]
  300.             self.snife = [pygame.image.load("grey_mouse/snie (" + str(i) + ").png").convert_alpha() for i in range(1, 19)]
  301.  
  302.             self.death = [pygame.image.load("grey_mouse/dead (" + str(i) + ").png").convert_alpha() for i in range(1, 16)]
  303.             self.death2 = [pygame.image.load("grey_mouse/dead2 (" + str(i) + ").png").convert_alpha() for i in range(1, 16)]
  304.  
  305.             repeat = jumpCountStart // 9
  306.             self.jump = [self.jump[i // repeat] for i in range(len(self.jump) * repeat)]
  307.            
  308.             self.color = color
  309.             self.rect = pygame.Rect(x,y,height,width)
  310.             self.fps = 60
  311.             self.clock = pygame.time.Clock()
  312.             self.next_frame_time = 0
  313.             self.anim_index = 0
  314.             self.time = 0
  315.             self.isJump = False
  316.             self.JumpCount = 10
  317.  
  318.             self.JumpCount = jumpCountStart
  319.             self.direction = "att"
  320.             self.direction = "att2"
  321.  
  322.             self.direction = "jump"
  323.             self.direction = "jump2"
  324.             self.direction = "Push2"
  325.             self.direction = "snif"
  326.             self.direction = "snif2"
  327.  
  328.             self.direction = "DEath"
  329.             self.direction = "DEath2"
  330.  
  331.             self.direction = "Idle"
  332.             self.direction = "right"
  333.             self.direction = "left"
  334.             self.direction = "leftid"
  335.  
  336.             self.speed = 1.9
  337.             self.fall = 0
  338.  
  339.         def get_rect(self):
  340.             self.rect.topleft = (self.x,self.y)
  341.             return self.rect
  342.              
  343.  
  344.                
  345.         def draw(self):
  346.             self.rect.topleft = (self.x,self.y)
  347.             if self.direction == "Idle":
  348.                 self.clock.tick(self.fps)
  349.                 image_list = self.idle
  350.  
  351.             elif self.direction == "right":
  352.                 image_list = self.Right
  353.                    
  354.             elif self.direction == "left":
  355.                 image_list = self.left
  356.  
  357.             elif self.direction == "leftid":
  358.                 image_list = self.leftid
  359.  
  360.             elif self.direction == "jump":
  361.                 image_list = self.jump
  362.  
  363.             elif self.direction == "jump2":
  364.                 image_list = self.jump2
  365.  
  366.             elif self.direction == "Push":
  367.                 image_list = self.Push
  368.  
  369.  
  370.             elif self.direction == "Push2":
  371.                 image_list = self.Push2
  372.  
  373.  
  374.             elif self.direction == "att":
  375.                 image_list = self.att
  376.                
  377.             elif self.direction == "att2":
  378.                 image_list = self.att2
  379.  
  380.             elif self.direction == "snif":
  381.                 image_list = self.snif
  382.                
  383.             elif self.direction == "DEath":
  384.                 image_list = self.death
  385.                
  386.             elif self.direction == "DEath2":
  387.                 image_list = self.death2
  388.             elif self.direction == "snif2":
  389.                 image_list = self.snife
  390.  
  391.                
  392.             time_now = pygame.time.get_ticks()
  393.             if (time_now > self.next_frame_time):
  394.                 # Time until the next game
  395.                 inter_time_delay = 2000 // self.fps
  396.                 self.next_frame_time = time_now + inter_time_delay
  397.                 # Showing next frame
  398.                 self.anim_index += 1
  399.                 if self.anim_index >= len(image_list):
  400.                     self.anim_index = 0
  401.      
  402.             if self.anim_index >= len(image_list):
  403.                 self.anim_index = 0
  404.             player_image = image_list[self.anim_index]
  405.  
  406.  
  407.            
  408.  
  409.             self.hitbox = (self.x, self.y + 30, 46,60)
  410.  
  411.             player_rect = player_image.get_rect(midbottom = self.get_rect().midbottom)
  412.             window.blit(player_image, player_rect)
  413.  
  414.        
  415.  
  416.  
  417.  
  418.     # our player class LEVEL 2
  419.     class lavaa:
  420.         def __init__(self,x,y,height,width,color):
  421.             self.x = x
  422.             self.y = y
  423.             self.height = height
  424.             self.width = width
  425.             self.ws = [pygame.image.load("bob (" + str(i) + ").png").convert_alpha() for i in range(1, 13)]
  426.             self.color = color
  427.             self.rect = pygame.Rect(x,y,height,width)
  428.             self.fps = 60
  429.             self.clock = pygame.time.Clock()
  430.             self.next_frame_time = 0
  431.             self.anim_index = 0
  432.  
  433.             self.direction = "ws"
  434.  
  435.  
  436.         def get_rect(self):
  437.             self.rect.topleft = (self.x,self.y)
  438.             return self.rect
  439.              
  440.  
  441.                
  442.         def draw(self):
  443.             self.rect.topleft = (self.x,self.y)
  444.             if self.direction == "ws":
  445.                 self.clock.tick(self.fps)
  446.                 image_list = self.ws
  447.  
  448.  
  449.                
  450.             time_now = pygame.time.get_ticks()
  451.             if (time_now > self.next_frame_time):
  452.                 # Time until the next game
  453.                 inter_time_delay = 3000 // self.fps
  454.                 self.next_frame_time = time_now + inter_time_delay
  455.                 # Showing next frame
  456.                 self.anim_index += 1
  457.                 if self.anim_index >= len(image_list):
  458.                     self.anim_index = 0
  459.      
  460.             if self.anim_index >= len(image_list):
  461.                 self.anim_index = 0
  462.             player_image = image_list[self.anim_index]
  463.            
  464.             player_rect = player_image.get_rect(center = self.get_rect().center)
  465.             player_rect.centerx += 15
  466.             player_rect.centery += -60
  467.             window.blit(player_image, player_rect)
  468.             pygame.draw.rect(window,self.color,self.rect)
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.     # our player class
  476.     class lavaa2: # level 3
  477.         def __init__(self,x,y,height,width,color):
  478.             self.x = x
  479.             self.y = y
  480.             self.height = height
  481.             self.width = width
  482.             self.ws = [pygame.image.load("fliplava (" + str(i) + ").png").convert_alpha() for i in range(1, 13)]
  483.             self.ws2 = [pygame.image.load("updownbob (" + str(i) + ").png").convert_alpha() for i in range(1, 13)]
  484.  
  485.  
  486.             self.color = color
  487.             self.rect = pygame.Rect(x,y,height,width)
  488.             self.fps = 60
  489.             self.clock = pygame.time.Clock()
  490.             self.next_frame_time = 0
  491.             self.anim_index = 0
  492.  
  493.             self.direction = "ws"
  494.             self.direction = "updownlava"
  495.  
  496.  
  497.         def get_rect(self):
  498.             self.rect.topleft = (self.x,self.y)
  499.             return self.rect
  500.              
  501.  
  502.                
  503.         def draw(self):
  504.             self.rect.topleft = (self.x,self.y)
  505.             if self.direction == "ws":
  506.                 self.clock.tick(self.fps)
  507.                 image_list = self.ws
  508.  
  509.             if self.direction == "updownlava":
  510.                 self.clock.tick(self.fps)
  511.                 image_list = self.ws2
  512.  
  513.                
  514.             time_now = pygame.time.get_ticks()
  515.             if (time_now > self.next_frame_time):
  516.                 # Time until the next game
  517.                 inter_time_delay = 3000 // self.fps
  518.                 self.next_frame_time = time_now + inter_time_delay
  519.                 # Showing next frame
  520.                 self.anim_index += 1
  521.                 if self.anim_index >= len(image_list):
  522.                     self.anim_index = 0
  523.      
  524.             if self.anim_index >= len(image_list):
  525.                 self.anim_index = 0
  526.             player_image = image_list[self.anim_index]
  527.            
  528.             player_rect = player_image.get_rect(center = self.get_rect().center)
  529.             player_rect.centerx += 15
  530.             player_rect.centery += -60
  531.             window.blit(player_image, player_rect)
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.     # our player class
  539.     class puff:
  540.         def __init__(self,x,y,height,width,color):
  541.             self.x = x
  542.             self.y = y
  543.             self.height = height
  544.             self.width = width
  545.             self.ws = [pygame.image.load("dark (" + str(i) + ").png").convert_alpha() for i in range(1, 20)]
  546.             self.wss = [pygame.image.load("dark (" + str(i) + ").png").convert_alpha() for i in range(1,2)]
  547.             self.darkside2 = [pygame.image.load("darkside (" + str(i) + ").png").convert_alpha() for i in range(1,20)]
  548.  
  549.             self.color = color
  550.             self.rect = pygame.Rect(x,y,height,width)
  551.             self.fps = 60
  552.             self.clock = pygame.time.Clock()
  553.             self.next_frame_time = 0
  554.             self.anim_index = 0
  555.             self.direction = "ws"
  556.             self.direction = "wss"
  557.             self.direction = "darkside"
  558.  
  559.             self.show = False
  560.         def get_rect(self):
  561.             self.rect.topleft = (self.x,self.y)
  562.             return self.rect
  563.              
  564.  
  565.                
  566.         def draw(self):
  567.             self.rect.topleft = (self.x,self.y)
  568.             if self.show:
  569.                 if self.direction == "ws":
  570.                     self.clock.tick(self.fps)
  571.                     image_list = self.ws
  572.  
  573.                 if self.direction == "wss":
  574.                     self.clock.tick(self.fps)
  575.                     image_list = self.wss
  576.  
  577.                 if self.direction == "darkside":
  578.                     self.clock.tick(self.fps)
  579.                     image_list = self.darkside2
  580.                    
  581.                 time_now = pygame.time.get_ticks()
  582.                 if (time_now > self.next_frame_time):
  583.                     # Time until the next game
  584.                     inter_time_delay = 5000 // self.fps
  585.                     self.next_frame_time = time_now + inter_time_delay
  586.                     # Showing next frame
  587.                     self.anim_index += 1
  588.                     if self.anim_index >= len(image_list):
  589.                         self.anim_index = 0
  590.          
  591.                 if self.anim_index >= len(image_list):
  592.                     self.anim_index = 0
  593.                 player_image = image_list[self.anim_index]
  594.                
  595.                 player_rect = player_image.get_rect(center = self.get_rect().center)
  596.                 player_rect.centerx += 15
  597.                 player_rect.centery += -60
  598.                 window.blit(player_image, player_rect)
  599.  
  600.  
  601.     white = 255,255,252
  602.  
  603.     puff1 = puff(580,400,50,50,white)
  604.  
  605.  
  606.  
  607.  
  608.     # our player class
  609.     class shot: # level 2
  610.         def __init__(self,x,y,height,width,color):
  611.             self.x = x
  612.             self.y = y
  613.             self.height = height
  614.             self.width = width
  615.             self.upshot = [pygame.image.load("rightshot (" + str(i) + ").png").convert_alpha() for i in range(1, 5)]
  616.             self.downshot = [pygame.image.load("leftshot (" + str(i) + ").png").convert_alpha() for i in range(1, 5)]
  617.  
  618.             self.up = [pygame.image.load("upshot (" + str(i) + ").png").convert_alpha() for i in range(1, 5)]
  619.             self.down = [pygame.image.load("downshot (" + str(i) + ").png").convert_alpha() for i in range(1, 5)]
  620.  
  621.             self.expod = [pygame.image.load("expod (" + str(i) + ").png").convert_alpha() for i in range(1, 10)]
  622.  
  623.             self.time = 0
  624.  
  625.             self.color = color
  626.             self.rect = pygame.Rect(x,y,height,width)
  627.             self.fps = 60
  628.             self.clock = pygame.time.Clock()
  629.             self.next_frame_time = 0
  630.             self.anim_index = 0
  631.  
  632.             self.direction = "right"
  633.             self.direction = "left"
  634.             self.direction = "upshot"
  635.             self.direction = "downshot"
  636.  
  637.             self.direction = "expod"
  638.  
  639.             self.speed = 5
  640.  
  641.         def get_rect(self):
  642.             self.rect.topleft = (self.x,self.y)
  643.             return self.rect
  644.              
  645.  
  646.                
  647.         def draw(self):
  648.             self.rect.topleft = (self.x,self.y)
  649.             if self.direction == "right":
  650.                 self.clock.tick(self.fps)
  651.                 image_list = self.upshot
  652.  
  653.             elif self.direction == "left":
  654.                 self.clock.tick(self.fps)
  655.                 image_list = self.downshot
  656.  
  657.             if self.direction == "upshot":
  658.                 self.clock.tick(self.fps)
  659.                 image_list = self.up
  660.  
  661.             elif self.direction == "downshot":
  662.                 self.clock.tick(self.fps)
  663.                 image_list = self.down
  664.  
  665.  
  666.             elif self.direction == "expod":
  667.                 self.clock.tick(self.fps)
  668.                 image_list = self.expod
  669.                
  670.             time_now = pygame.time.get_ticks()
  671.             if (time_now > self.next_frame_time):
  672.                 # Time until the next game
  673.                 inter_time_delay = 3000 // self.fps
  674.                 self.next_frame_time = time_now + inter_time_delay
  675.                 # Showing next frame
  676.                 self.anim_index += 1
  677.                 if self.anim_index >= len(image_list):
  678.                     self.anim_index = 0
  679.      
  680.             if self.anim_index >= len(image_list):
  681.                 self.anim_index = 0
  682.             player_image = image_list[self.anim_index]
  683.             player_rect = player_image.get_rect(center = self.get_rect().center)
  684.             player_rect.centerx += 15
  685.             player_rect.centery += 10
  686.             window.blit(player_image, player_rect)
  687.  
  688.  
  689.     # our health class player health class
  690.     class health:
  691.         def __init__(self,x,y,height,width,color):
  692.             self.x = x
  693.             self.y = y
  694.             self.height = height
  695.             self.width = width
  696.             self.upshot = [pygame.image.load("enemy/health (" + str(i) + ").png").convert_alpha() for i in range(1, 17)]
  697.             self.time = 0
  698.  
  699.             self.color = color
  700.             self.rect = pygame.Rect(x,y,height,width)
  701.             self.fps = 60
  702.             self.clock = pygame.time.Clock()
  703.             self.next_frame_time = 0
  704.             self.anim_index = 0
  705.             self.speed = 5
  706.             self.direction = "up"
  707.             self.hit = False
  708.         def get_rect(self):
  709.             self.rect.topleft = (self.x,self.y)
  710.             return self.rect
  711.              
  712.  
  713.                
  714.         def draw(self):
  715.             self.rect.topleft = (self.x,self.y)
  716.             if self.hit:
  717.                 if self.direction == "up":
  718.                     self.clock.tick(self.fps)
  719.                     image_list = self.upshot
  720.  
  721.                    
  722.                 time_now = pygame.time.get_ticks()
  723.                 if (time_now > self.next_frame_time):
  724.                     # Time until the next game
  725.                     inter_time_delay = 3000 // self.fps
  726.                     self.next_frame_time = time_now + inter_time_delay
  727.                     # Showing next frame
  728.                     self.anim_index += 1
  729.                     if self.anim_index >= len(image_list):
  730.                         self.anim_index = 0
  731.          
  732.                 if self.anim_index >= len(image_list):
  733.                     self.anim_index = 0
  734.                 player_image = image_list[self.anim_index]
  735.                 window.blit(player_image, self.rect)
  736.  
  737.     white = 255,255,255
  738.  
  739.     heart = health(200,200,50,50,white)
  740.  
  741.     heart2 = health(200,200,50,50,white)
  742.  
  743.     class punch:
  744.         def __init__(self,x,y,height,width,color):
  745.             self.x = x
  746.             self.y = y
  747.             self.height = height
  748.             self.width = width
  749.             self.upshot = [pygame.image.load("pos (" + str(i) + ").png").convert_alpha() for i in range(1, 17)]
  750.             self.time = 0
  751.  
  752.             self.color = color
  753.             self.rect = pygame.Rect(x,y,height,width)
  754.             self.fps = 60
  755.             self.clock = pygame.time.Clock()
  756.             self.next_frame_time = 0
  757.             self.anim_index = 0
  758.             self.speed = 5
  759.             self.direction = "up"
  760.             self.hit = False
  761.         def get_rect(self):
  762.             self.rect.topleft = (self.x,self.y)
  763.             return self.rect
  764.              
  765.  
  766.                
  767.         def draw(self):
  768.             self.rect.topleft = (self.x,self.y)
  769.             if self.direction == "up":
  770.                 self.clock.tick(self.fps)
  771.                 image_list = self.upshot
  772.  
  773.                
  774.             time_now = pygame.time.get_ticks()
  775.             if (time_now > self.next_frame_time):
  776.                 # Time until the next game
  777.                 inter_time_delay = 3000 // self.fps
  778.                 self.next_frame_time = time_now + inter_time_delay
  779.                 # Showing next frame
  780.                 self.anim_index += 1
  781.                 if self.anim_index >= len(image_list):
  782.                     self.anim_index = 0
  783.      
  784.             if self.anim_index >= len(image_list):
  785.                 self.anim_index = 0
  786.             player_image = image_list[self.anim_index]
  787.             if self.hit:
  788.                 window.blit(player_image, self.rect)
  789.  
  790.  
  791.     punch1 = punch(200,200,50,50,white)
  792.  
  793.     # ------------------------- our portal class
  794.     class portal:
  795.         def __init__(self,x,y,height,width,color):
  796.             self.x = x
  797.             self.y = y
  798.             self.height = height
  799.             self.width = width
  800.             self.upshot = [pygame.image.load("pur (" + str(i) + ").png").convert_alpha() for i in range(1, 16)]
  801.  
  802.             self.color = color
  803.             self.rect = pygame.Rect(x,y,height,width)
  804.             self.fps = 60
  805.             self.clock = pygame.time.Clock()
  806.             self.next_frame_time = 0
  807.             self.anim_index = 0
  808.  
  809.             self.direction = "down"
  810.             self.direction = "up"
  811.             self.speed = 5
  812.  
  813.         def get_rect(self):
  814.             self.rect.topleft = (self.x,self.y)
  815.             return self.rect
  816.              
  817.  
  818.                
  819.         def draw(self):
  820.             self.rect.topleft = (self.x,self.y)
  821.             if self.direction == "up":
  822.                 self.clock.tick(self.fps)
  823.                 image_list = self.upshot
  824.  
  825.  
  826.                
  827.             time_now = pygame.time.get_ticks()
  828.             if (time_now > self.next_frame_time):
  829.                 # Time until the next game
  830.                 inter_time_delay = 3000 // self.fps
  831.                 self.next_frame_time = time_now + inter_time_delay
  832.                 # Showing next frame
  833.                 self.anim_index += 1
  834.                 if self.anim_index >= len(image_list):
  835.                     self.anim_index = 0
  836.      
  837.             if self.anim_index >= len(image_list):
  838.                 self.anim_index = 0
  839.             player_image = image_list[self.anim_index]
  840.             player_rect = player_image.get_rect(center = self.get_rect().center)
  841.             player_rect.centerx += 15
  842.             player_rect.centery += -60
  843.             window.blit(player_image, player_rect)
  844.     portal1 = portal(2000,1150,50,50,white)        
  845.     #-------------------- portal class
  846.  
  847.  
  848.     # our moving rope
  849.     class rop:
  850.         def __init__(self,x,y,height,width,color):
  851.             self.x = x
  852.             self.y = y
  853.             self.height = height
  854.             self.width = width
  855.             self.upshot = [pygame.image.load("rop (" + str(i) + ").png").convert_alpha() for i in range(1, 4)]
  856.            
  857.             self.nomove = [pygame.image.load("rop (" + str(i) + ").png").convert_alpha() for i in range(1, 2)]
  858.  
  859.             self.color = color
  860.             self.rect = pygame.Rect(x,y,height,width)
  861.             self.fps = 60
  862.             self.clock = pygame.time.Clock()
  863.             self.next_frame_time = 0
  864.             self.anim_index = 0
  865.  
  866.             self.direction = "nomove"
  867.             self.direction = "up"
  868.             self.speed = 5
  869.  
  870.         def get_rect(self):
  871.             self.rect.topleft = (self.x,self.y)
  872.             return self.rect
  873.              
  874.  
  875.                
  876.         def draw(self):
  877.             self.rect.topleft = (self.x,self.y)
  878.             if self.direction == "up":
  879.                 self.clock.tick(self.fps)
  880.                 image_list = self.upshot
  881.  
  882.             elif self.direction == "nomove":
  883.                 self.clock.tick(self.fps)
  884.                 image_list = self.nomove
  885.                
  886.             time_now = pygame.time.get_ticks()
  887.             if (time_now > self.next_frame_time):
  888.                 # Time until the next game
  889.                 inter_time_delay = 3000 // self.fps
  890.                 self.next_frame_time = time_now + inter_time_delay
  891.                 # Showing next frame
  892.                 self.anim_index += 1
  893.                 if self.anim_index >= len(image_list):
  894.                     self.anim_index = 0
  895.      
  896.             if self.anim_index >= len(image_list):
  897.                 self.anim_index = 0
  898.             player_image = image_list[self.anim_index]
  899.             window.blit(player_image, self.rect)
  900.  
  901.            
  902.            
  903.     white = 255, 255 ,255
  904.  
  905.     rop1 = rop(1370,850,50,50,white)
  906.  
  907.  
  908.  
  909.  
  910.  
  911.     class fire:
  912.         def __init__(self,x,y,height,width,color):
  913.             self.x = x
  914.             self.y = y
  915.             self.height = height
  916.             self.width = width
  917.             self.upshot = [pygame.image.load("pngs/fire_bowl_hanging/fi (" + str(i) + ").png").convert_alpha() for i in range(1, 5)]
  918.             self.color = color
  919.             self.rect = pygame.Rect(x,y,height,width)
  920.             self.fps = 60
  921.             self.clock = pygame.time.Clock()
  922.             self.next_frame_time = 0
  923.             self.anim_index = 0
  924.             self.direction = "nomove"
  925.             self.direction = "up"
  926.         def draw(self):
  927.             self.rect.topleft = (self.x,self.y)
  928.             if self.direction == "up":
  929.                 self.clock.tick(self.fps)
  930.                 image_list = self.upshot
  931.  
  932.  
  933.                
  934.             time_now = pygame.time.get_ticks()
  935.             if (time_now > self.next_frame_time):
  936.                 # Time until the next game
  937.                 inter_time_delay = 5000 // self.fps
  938.                 self.next_frame_time = time_now + inter_time_delay
  939.                 # Showing next frame
  940.                 self.anim_index += 1
  941.                 if self.anim_index >= len(image_list):
  942.                     self.anim_index = 0
  943.      
  944.             if self.anim_index >= len(image_list):
  945.                 self.anim_index = 0
  946.             player_image = image_list[self.anim_index]
  947.             window.blit(player_image, self.rect)
  948.  
  949.            
  950.            
  951.     white = 255, 255 ,255
  952.  
  953.     #---------------------------------------- LEVEL 2
  954.     fire1 = fire(280,541,50,50,white)
  955.     fire2 = fire(370,541,50,50,white)
  956.     fire3 = fire(150,810,50,50,white)
  957.     fire4 = fire(230,810,50,50,white)
  958.     fire5 = fire(420,938,50,50,white)
  959.     fire6 = fire(510,938,50,50,white)
  960.     fire7 = fire(1159,846,50,50,white)
  961.     #----------------------------------------
  962.  
  963.     class bowl:
  964.         def __init__(self,x,y,height,width,color):
  965.             self.x = x
  966.             self.y = y
  967.             self.height = height
  968.             self.width = width
  969.             self.upshot = [pygame.image.load("pngs/fire_bowl/fi (" + str(i) + ").png").convert_alpha() for i in range(1, 5)]
  970.             self.color = color
  971.             self.rect = pygame.Rect(x,y,height,width)
  972.             self.fps = 60
  973.             self.clock = pygame.time.Clock()
  974.             self.next_frame_time = 0
  975.             self.anim_index = 0
  976.             self.direction = "nomove"
  977.             self.direction = "up"
  978.         def draw(self):
  979.             self.rect.topleft = (self.x,self.y)
  980.             if self.direction == "up":
  981.                 self.clock.tick(self.fps)
  982.                 image_list = self.upshot
  983.  
  984.  
  985.                
  986.             time_now = pygame.time.get_ticks()
  987.             if (time_now > self.next_frame_time):
  988.                 # Time until the next game
  989.                 inter_time_delay = 5000 // self.fps
  990.                 self.next_frame_time = time_now + inter_time_delay
  991.                 # Showing next frame
  992.                 self.anim_index += 1
  993.                 if self.anim_index >= len(image_list):
  994.                     self.anim_index = 0
  995.      
  996.             if self.anim_index >= len(image_list):
  997.                 self.anim_index = 0
  998.             player_image = image_list[self.anim_index]
  999.             window.blit(player_image, self.rect)
  1000.  
  1001.  
  1002.     bigfire1 = bowl(90,100,50,50,white)
  1003.     bigfire2 = bowl(1360,360,50,50,white)
  1004.  
  1005.  
  1006.  
  1007.     # - enemy classes -------------------------------------------
  1008.  
  1009.  
  1010.     class rat:
  1011.         def __init__(self,x,y,height,width,color):
  1012.             self.x = x
  1013.             self.y = y
  1014.             self.height = height
  1015.             self.width = width
  1016.             self.upshot = [pygame.image.load("enemy/walk (" + str(i) + ").png").convert_alpha() for i in range(1, 10)]
  1017.             self.idle = [pygame.image.load("enemy/standright (" + str(i) + ").png").convert_alpha() for i in range(1, 20)]
  1018.             self.id = [pygame.image.load("enemy/standleft (" + str(i) + ").png").convert_alpha() for i in range(1, 20)]
  1019.             self.move2 = [pygame.image.load("enemy/left (" + str(i) + ").png").convert_alpha() for i in range(1, 10)]
  1020.  
  1021.             self.att = [pygame.image.load("enemy/bit (" + str(i) + ").png").convert_alpha() for i in range(1, 10)]
  1022.             self.at = [pygame.image.load("enemy/bit2 (" + str(i) + ").png").convert_alpha() for i in range(1, 10)]
  1023.             self.die = [pygame.image.load("enemy/died.png").convert_alpha()]
  1024.  
  1025.             self.color = color
  1026.             self.rect = pygame.Rect(x,y,height,width)
  1027.             self.fps = 60
  1028.             self.clock = pygame.time.Clock()
  1029.             self.next_frame_time = 0
  1030.             self.anim_index = 0
  1031.             self.time = 0
  1032.             self.direction = "move"
  1033.             self.direction = "move2"
  1034.  
  1035.             self.direction = "idle"
  1036.             self.direction = "att"
  1037.             self.direction = "at"
  1038.             self.direction = "id"
  1039.             self.direction = "die"
  1040.  
  1041.             self.speed = 1
  1042.             self.image = pygame.image.load("ratso.png").convert_alpha()
  1043.             self.image2 = pygame.image.load("ratso2.png").convert_alpha()
  1044.             self.font = pygame.font.Font("Gugi-Regular.ttf", 20)
  1045.             self.scoretext = self.font.render("Lv ??", True, (0, 0, 0))
  1046.             self.scorerect = self.scoretext.get_rect()
  1047.             self.scorerect.center = ((400,550))
  1048.  
  1049.             self.healthbar = (self.x + 17, self.y + 2, 31, 57)
  1050.             self.isJump = False
  1051.             self.jumpCount = 10
  1052.             self.isJump2 = False
  1053.             self.isJumpCount2 = 5
  1054.             self.hitbox2 = (self.x - 47, self.y + 11, 169, 52) # NEW
  1055.             self.hitbox = (self.x + 17, self.y + 11, 129, 52) # NEW
  1056.             self.hitbox3 = (self.x + 17, self.y + 2, 31, 57)
  1057.             self.health = 10
  1058.         def get_rect(self):
  1059.             self.rect.topleft = (self.x,self.y)
  1060.             return self.rect
  1061.              
  1062.  
  1063.  
  1064.  
  1065.         def draw(self):
  1066.             self.rect.topleft = (self.x,self.y)
  1067.             if self.direction == "move":
  1068.                 self.clock.tick(self.fps)
  1069.                 image_list = self.upshot
  1070.  
  1071.             elif self.direction == "idle":
  1072.                 self.clock.tick(self.fps)
  1073.                 image_list = self.idle
  1074.  
  1075.             elif self.direction == "id":
  1076.                 self.clock.tick(self.fps)
  1077.                 image_list = self.id
  1078.  
  1079.             elif self.direction == "move2":
  1080.                 self.clock.tick(self.fps)
  1081.                 image_list = self.move2
  1082.  
  1083.  
  1084.             elif self.direction == "att":
  1085.                 self.clock.tick(self.fps)
  1086.                 image_list = self.att
  1087.  
  1088.             elif self.direction == "at":
  1089.                 self.clock.tick(self.fps)
  1090.                 image_list = self.at
  1091.                
  1092.             elif self.direction == "die":
  1093.                 image_list = self.die
  1094.                
  1095.             time_now = pygame.time.get_ticks()
  1096.             if (time_now > self.next_frame_time):
  1097.                 # Time until the next game
  1098.                 inter_time_delay = 2500 // self.fps
  1099.                 self.next_frame_time = time_now + inter_time_delay
  1100.                 # Showing next frame
  1101.                 self.anim_index += 1
  1102.                 if self.anim_index >= len(image_list):
  1103.                     self.anim_index = 0
  1104.      
  1105.             if self.anim_index >= len(image_list):
  1106.                 self.anim_index = 0
  1107.                
  1108.             player_image = image_list[self.anim_index]
  1109.  
  1110.  
  1111.  
  1112.             self.hitbox = (self.x, self.y + 30, 46,60)
  1113.  
  1114.             # --------------------------------------------------------------------- center all of them
  1115.             player_rect = player_image.get_rect(midbottom = self.get_rect().midbottom)
  1116.             player_rect.centerx += 0
  1117.             player_rect.centery += -6
  1118.             window.blit(player_image, player_rect)
  1119.  
  1120.          # --------------------------------------------------------------------- center all of them
  1121.  
  1122.             self.hitbox2 = (self.x - 140, self.y - 22, 121, 40) # NEW
  1123.             self.hitbox = (self.x + 80, self.y - 22, 60, 40) # NEW
  1124.         # our enemy health bar
  1125.             pygame.draw.rect(window, (231, 76, 60), (self.x + 5, self.y - 45,59, 15)) # NEW
  1126.             pygame.draw.rect(window, (34, 153, 84), (self.x + 5, self.y - 45, 59 - (5 * (10 - self.health)), 15)) # NEW
  1127.             window.blit(self.scoretext,(self.x + 15,self.y - 45))
  1128.  
  1129.  
  1130.         def jump(self):
  1131.             # Check if mario is jumping and then execute the
  1132.             # jumping code.
  1133.             if self.isJump:
  1134.                 if self.jumpCount >= -10:
  1135.                     neg = 1
  1136.                     if self.jumpCount < 0:
  1137.                         neg = -1
  1138.                     self.y -= self.jumpCount**2 * 0.1 * neg
  1139.                     self.jumpCount -= 1
  1140.                 else:
  1141.                     self.isJump = False
  1142.                     self.jumpCount = 10
  1143.  
  1144.         def jump2(self):
  1145.             # Check if mario is jumping and then execute the
  1146.             # jumping code.
  1147.             if self.isJump2:
  1148.                 if self.isJumpCount2 >= -5:
  1149.                     neg = 1
  1150.                     if self.isJumpCount2 < 0:
  1151.                         neg = -1
  1152.                     self.y -= self.isJumpCount2**2 * 0.1 * neg
  1153.                     self.isJumpCount2 -= 1
  1154.                 else:
  1155.                     self.isJump2 = False
  1156.                     self.isJumpCount2 = 5
  1157.                    
  1158.                    
  1159.     rat1 = rat(610,1229,50,50,white) # level 2
  1160.     rats = [rat1]
  1161.     # - enemy classes -------------------------------------------------------------
  1162.     class collid: # collid 333333333333333333333333333
  1163.         def __init__(self,x,y,height,width,color):
  1164.             self.x = x
  1165.             self.y = y
  1166.             self.height = height
  1167.             self.width = width
  1168.             self.color = color
  1169.             self.rect = pygame.Rect(x,y,height,width)
  1170.  
  1171.         def get_rect(self):
  1172.            self.rect.topleft = (self.x,self.y)
  1173.            return self.rect
  1174.  
  1175.  
  1176.              
  1177.         def draw(self): # COLLID 2
  1178.             self.rect.topleft = (self.x,self.y)
  1179.  
  1180.  
  1181.     cos = (30,50,10)
  1182.  
  1183.  
  1184.     collid1 = collid(630,1098,320,50,white) # done
  1185.     collid11 = collid(630,260,320,830,white) # done
  1186.  
  1187.  
  1188.     collid2 = collid(80,988,20,450,white) # done
  1189.     collid02 = collid(1180,1226,50,10,white) # done
  1190.  
  1191.  
  1192.     collid3 = collid(860,537,990,10,white)
  1193.     crateco = collid(800,425,145,90,white)
  1194.     lever = collid(100,419,120,5,white)
  1195.     stopglitch = collid(100,419,120,5,white)
  1196.  
  1197.     top1 = collid(330,1255,50,10,cos) # done
  1198.     top5 = collid(540,1277,470,10,cos) # done
  1199.  
  1200.     top2 = collid(140,778,22170,10,white) # done
  1201.     top3 = collid(390,915,22170,10,white) # done
  1202.     top4 = collid(250,602,22170,10,white) # done
  1203.     top04 = collid(1090,816,22170,10,cos) # done
  1204.  
  1205.  
  1206.     collidmove = collid(1410,750,50,450,white) # level 2
  1207.     collidmove2 = collid(1400,790,50,450,white)
  1208.  
  1209.     collid4 = collid(1394,1276,459,10,white)
  1210.  
  1211.     collid5 = collid(1894,1210,259,10,white)
  1212.  
  1213.     collids = [top04,collid02,top5,top4,top3,collid2,collid3,crateco,collid4,lever,top1,top2,collid5,collid11]
  1214.  
  1215.                    
  1216.     class crate:
  1217.         def __init__(self,x,y,height,width,color):
  1218.             self.x = x
  1219.             self.y = y
  1220.             self.height = height
  1221.             self.width = width
  1222.             self.color = color
  1223.             self.rect = pygame.Rect(x,y,height,width)
  1224.             self.image = pygame.image.load("cr1.png").convert_alpha()
  1225.         def draw(self):
  1226.             self.rect.topleft = (self.x,self.y)
  1227.             window.blit(self.image,self.rect)
  1228.  
  1229.     crate1 = crate(1200,370,5,50,white)
  1230.     class end:
  1231.         def __init__(self,x,y,height,width,color):
  1232.             self.x = x
  1233.             self.y = y
  1234.             self.height = height
  1235.             self.width = width
  1236.             self.color = color
  1237.             self.rect = pygame.Rect(x,y,height,width)
  1238.             self.image = pygame.image.load("atest.png").convert_alpha()
  1239.         def draw(self):
  1240.             self.rect.topleft = (self.x,self.y)
  1241.             window.blit(self.image,self.rect)
  1242.        
  1243.  
  1244.  
  1245.            
  1246.     class stopmove: # level 2
  1247.         def __init__(self,x,y,height,width,color):
  1248.             self.x = x
  1249.             self.y = y
  1250.             self.height = height
  1251.             self.width = width
  1252.             self.color = color
  1253.             self.rect = pygame.Rect(x,y,height,width)
  1254.         def draw(self):
  1255.             self.rect.topleft = (self.x,self.y)
  1256.  
  1257.            
  1258.  
  1259.     class text:
  1260.         def __init__(self,x,y,height,width,color):
  1261.             self.x = x
  1262.             self.y = y
  1263.             self.height = height
  1264.             self.width = width
  1265.             self.color = color
  1266.             self.rect = pygame.Rect(x,y,height,width)
  1267.             self.font = pygame.font.Font("Alice.ttf", 20)
  1268.             self.scoretext = self.font.render("Push", True, (255,255,255))
  1269.             self.scorerect = self.scoretext.get_rect()
  1270.             self.scorerect.center = ((400,550))
  1271.             self.visible = False
  1272.         def draw(self):
  1273.             self.rect.topleft = (self.x,self.y)
  1274.             window.blit(self.scoretext,self.rect)
  1275.  
  1276.  
  1277.     class text2:
  1278.         def __init__(self,x,y,height,width,color):
  1279.             self.x = x
  1280.             self.y = y
  1281.             self.height = height
  1282.             self.width = width
  1283.             self.color = color
  1284.             self.rect = pygame.Rect(x,y,height,width)
  1285.             self.font = pygame.font.Font("Alice.ttf", 20)
  1286.             self.scoretext = self.font.render("'F' Bring Conveyor Down", True, (255,255,255))
  1287.             self.scorerect = self.scoretext.get_rect()
  1288.             self.scorerect.center = ((400,550))        
  1289.         def draw(self):
  1290.             self.rect.topleft = (self.x,self.y)
  1291.             window.blit(self.scoretext,self.rect)
  1292.  
  1293.  
  1294.     class text33:
  1295.         def __init__(self,x,y,height,width,color):
  1296.             self.x = x
  1297.             self.y = y
  1298.             self.height = height
  1299.             self.width = width
  1300.             self.color = color
  1301.             self.show = False
  1302.             self.rect = pygame.Rect(x,y,height,width)
  1303.             self.image = pygame.image.load("texto2.png").convert_alpha()
  1304.             self.font = pygame.font.Font("Alice.ttf", 50)
  1305.             self.scoretext = self.font.render("You Have Died.....", True, (255,255,255))
  1306.             self.scorerect = self.scoretext.get_rect()
  1307.             self.scorerect.center = ((400,550))        
  1308.         def draw(self):
  1309.             self.rect.topleft = (self.x,self.y)
  1310.             if self.show:
  1311.                 window.blit(self.image,self.rect)
  1312.  
  1313.  
  1314.            
  1315.     class text3:
  1316.         def __init__(self,x,y,height,width,color):
  1317.             self.x = x
  1318.             self.y = y
  1319.             self.height = height
  1320.             self.width = width
  1321.             self.color = color
  1322.             self.rect = pygame.Rect(x,y,height,width)
  1323.             self.image = pygame.image.load("hit.png")
  1324.             self.hit = False
  1325.         def draw(self):
  1326.             self.rect.topleft = (self.x,self.y)
  1327.             if self.hit:
  1328.                 window.blit(self.image,self.rect)
  1329.  
  1330.     red = 231, 76, 60
  1331.     hittext = text3(rat1.x,rat1.y,50,50,red)
  1332.  
  1333.  
  1334.  
  1335.     colors = 0,23,56
  1336.     colors2 = 0,123,56
  1337.  
  1338.     exit1 = button((colors),640,65,90,40, '')
  1339.     show1 = button((colors2),10,125,150,40, '')
  1340.  
  1341.     move_spot = button((colors),720,125,25,260, '')
  1342.  
  1343.     bar1 = button((colors),720,125,30,40, '')
  1344.     v1 = button((colors),720,125,30,40, '')
  1345.     v2 = button((colors),720,170,30,40, '')
  1346.     v3 = button((colors),720,190,30,40, '')
  1347.     v4 = button((colors),720,230,30,40, '')
  1348.     exit_game = button((colors),720,230,50,40, '')
  1349.     reset_game = button((colors),720,230,50,40, '')
  1350.     main_game = button((colors),720,230,50,40, '')
  1351.     switch_pause = button((colors),720,230,50,40, '')
  1352.     jump_sound = button((colors),720,230,50,40, '')
  1353.     land_sound = button((colors),720,230,50,40, '')
  1354.  
  1355.     add = 0
  1356.  
  1357.     # our switch
  1358.     files = ['swo (1).png', 'swo (2).png', 'swo (3).png']
  1359.     switches = [pygame.image.load(f) for f in files]
  1360.     current_switch = 1
  1361.     current_move = 1
  1362.     # Pause game
  1363.     new = ['switch_on_blue.png','switch_off.png']
  1364.     # our pause button score
  1365.     button1 = [pygame.image.load(n) for n in new]
  1366.     pause1 = 1
  1367.     unpause1 = 1
  1368.  
  1369.     # Rese Game
  1370.     new1 = ['switch_on_blue.png','switch_off.png']
  1371.     # our pause button score
  1372.     button11 = [pygame.image.load(n) for n in new1]
  1373.     pause11 = 1
  1374.     unpause11 = 1
  1375.  
  1376.     # Exit Game
  1377.     new11 = ['switch_on_blue.png','switch_off.png']
  1378.     # our pause button score
  1379.     button111 = [pygame.image.load(n) for n in new11]
  1380.     pause111 = 1
  1381.     unpause111 = 1
  1382.  
  1383.     # Main Game
  1384.     new111 = ['switch_on_blue.png','switch_off.png']
  1385.     # our pause button score
  1386.     button1111 = [pygame.image.load(n) for n in new111]
  1387.     pause1111 = 1
  1388.     unpause1111 = 1
  1389.    
  1390.     # Main Game
  1391.     new1111 = ['switch_on_blue.png','switch_off.png']
  1392.     # our pause button score
  1393.     button11111 = [pygame.image.load(n) for n in new1111]
  1394.     pause11111 = 1
  1395.     unpause11111 = 1
  1396.  
  1397.     # Main Game
  1398.     new11111 = ['switch_on_blue.png','switch_off.png']
  1399.     # our pause button score
  1400.     button111111 = [pygame.image.load(n) for n in new11111]
  1401.     pause111111 = 1
  1402.     unpause111111 = 1
  1403.    
  1404.     add = 0
  1405.     off = False
  1406.  
  1407.     def paused():
  1408.  
  1409.         switch_pause = button((colors),635,255,50,40, '')
  1410.  
  1411.                
  1412.         while pause:
  1413.             for event in pygame.event.get():
  1414.                 if event.type == pygame.QUIT:
  1415.                     pygame.quit()
  1416.                     quit()
  1417.  
  1418.                 if event.type == pygame.MOUSEBUTTONDOWN:
  1419.                     pos = pygame.mouse.get_pos()
  1420.                     if switch_pause.isOver(pos):
  1421.                         unpause()
  1422.                         clu.play()
  1423.  
  1424.  
  1425.  
  1426.             pygame.display.update()
  1427.  
  1428.             clock.tick(15)
  1429.  
  1430.            
  1431.     buttons = [exit1,show1,v1,v2,v3,v4,bar1,switch_pause,exit_game,reset_game,main_game,jump_sound,land_sound]
  1432.      
  1433.     bar11 = pygame.image.load("bar.png")
  1434.  
  1435.  
  1436.  
  1437.                
  1438.     text1 = text(1280,500,50,50,white)
  1439.  
  1440.     text22 = text2(1500,250,50,50,white)
  1441.     deathtext = text33(300,500,50,50,white)
  1442.  
  1443.  
  1444.     orange = (200,2,50)
  1445.     stopmove1 = stopmove(1587,400,180,80,orange)
  1446.  
  1447.     # if the player collids with this he should click w and the push animation should play
  1448.     pusho = stopmove(800,408,50,20,white)
  1449.     pusho2 = stopmove(800,408,50,20,white)
  1450.     lavaplays = stopmove(20,638,400,360,white) # level 2
  1451.     lavaplays2 = stopmove(80,958,600,360,white) # level 2
  1452.     lavaplays3 = stopmove(800,958,600,360,white) # level 2
  1453.  
  1454.  
  1455.  
  1456.     costo = 105,200,50
  1457.     text_show_collision = stopmove(567,400,50,50,white)
  1458.     text_show_collision2 = stopmove(1407,1100,190,150,costo)
  1459.  
  1460.  
  1461.     end1 = end(1155,-200,50,50,white)
  1462.  
  1463.  
  1464.     # speed lines when we push our rectangles
  1465.     linecolor  = 127, 140, 141
  1466.     line1 = stopmove(crate1.x + 70,crate1.y + 70,50,1,linecolor)
  1467.  
  1468.  
  1469.     # projectile for my bullets # level 2
  1470.     shot1 = shot(15,700,50,50,cos)
  1471.     shot2 = shot(15,850,50,50,cos)
  1472.     shot3 = shot(180,1010,50,50,cos)
  1473.     shot4 = shot(450,1010,50,50,cos)
  1474.  
  1475.     shot5 = shot(1250,1010,50,50,cos)
  1476.     shot6 = shot(1050,1010,50,50,cos)
  1477.  
  1478.  
  1479.  
  1480.     shots = [shot1,shot2,shot3,shot4,shot5,shot6]
  1481.  
  1482.  
  1483.     # level2 lavas
  1484.     #------------------------------------- platforms classes # LLEVEL 3#3333333333333333333333333333333333333
  1485.     lava1 = lavaa(245,5550,150,50,white)
  1486.     lava2 = lavaa(445,5550,150,50,white)
  1487.     lava3 = lavaa(645,5550,150,50,white)
  1488.    
  1489.     #------------------------------------- updownlavas classes # LLEVEL 3#3333333333333333333333333333333333333
  1490.     updown1 = lavaa2(250,5550,150,50,white)
  1491.     updown2 = lavaa2(445,5550,150,50,white)
  1492.     updown3 = lavaa2(645,5550,150,50,white)
  1493.     updown4 = lavaa2(745,5550,150,50,white)
  1494.  
  1495.  
  1496.     lava4 = lavaa(-1000,1450,9150,50,white)
  1497.  
  1498.     lava5 = lavaa(980,1340,150,50,white)
  1499.     lava6 = lavaa(1150,1340,150,50,white)
  1500.     lava7 = lavaa(1250,1340,150,50,white)
  1501.  
  1502.  
  1503.     lava8 = lavaa2(195,5550,150,50,white)
  1504.     lava9 = lavaa2(195,5550,150,50,white)
  1505.     lava10 = lavaa2(195,5550,150,50,white)
  1506.     # sides
  1507.        
  1508.     lava11 = lavaa(1850,1310,150,50,white)
  1509.     lava12 = lavaa(2050,1310,150,50,white)
  1510.    
  1511.     collidsides = [lava8,lava9,lava10]
  1512.  
  1513.     collidbottom2 = [lava1,lava2,lava3,lava4,lava5,lava6,lava7,lava11,lava12]
  1514.  
  1515.     # downs
  1516.     updownlava = [updown1,updown2,updown3]
  1517.    
  1518.     lavas = [lava1,lava2,lava3,lava5,lava6,lava7,lava8,lava9,lava10,lava11,lava12,updown1,updown2,updown3]
  1519.     # ---------------- rat collisions
  1520.     rat11 = stopmove(570,1210,50,50,cos) # level 2
  1521.     rat22 = stopmove(960,1210,50,50,cos)
  1522.  
  1523.     # ---------------- rat collisions
  1524.  
  1525.  
  1526.  
  1527.            
  1528.  
  1529.     # our game fps
  1530.     fps = 60
  1531.     clock = pygame.time.Clock()
  1532.  
  1533.     text_timer = 0
  1534.     text_timer2 = 0
  1535.  
  1536.                    
  1537.     particles = []
  1538.     playerman = player(360,330,50,50,white) # LEVEL 2
  1539.  
  1540.     lava = pygame.image.load("lava.png").convert_alpha()
  1541.     lava = pygame.transform.scale(lava,(lava.get_width()*2,lava.get_height()*2))
  1542.  
  1543.  
  1544.  
  1545.  
  1546.     # blit the rope
  1547.  
  1548.  
  1549.  
  1550.  
  1551.     # class background
  1552.     class bg: # level 3
  1553.         def __init__(self,x,y,height,width):
  1554.             self.x =x
  1555.             self.y = y
  1556.             self.height =height
  1557.             self.width = width
  1558.             self.test = pygame.image.load("level3bg.png").convert_alpha()
  1559.             self.rect = pygame.Rect(x,y,height,width)
  1560.         def draw(self):
  1561.             self.rect.topleft = (self.x,self.y)
  1562.             window.blit(self.test,self.rect)
  1563.  
  1564.     bg2 = bg(-0,0,0,0) # level 3
  1565.  
  1566.     bg1 = bg(-80,-310,0,0)
  1567.  
  1568.     # our cheese class
  1569.     class cheese:
  1570.         def __init__(self,x,y,height,width,color):
  1571.             self.x =x
  1572.             self.y = y
  1573.             self.height =height
  1574.             self.width = width
  1575.             self.color = color
  1576.             self.time = 0
  1577.             self.test = pygame.image.load("grey_mouse/cheese.png").convert_alpha()
  1578.             self.rect = pygame.Rect(x,y,height,width)
  1579.             self.font = pygame.font.Font("Alice.ttf", 30)
  1580.             self.scoretext = self.font.render("R", True, (255, 255, 255))
  1581.             self.scorerect = self.scoretext.get_rect()
  1582.             self.show = False
  1583.         def draw(self):
  1584.             self.rect.topleft = (self.x,self.y)
  1585.             window.blit(self.test, self.rect)
  1586.             if self.show:
  1587.                 window.blit(self.scoretext,(self.x + 10,self.y - 30))
  1588.            
  1589.     class chef:
  1590.         def __init__(self,x,y,height,width,color):
  1591.             self.x =x
  1592.             self.y = y
  1593.             self.height =height
  1594.             self.width = width
  1595.             self.color = color
  1596.             self.time = 0
  1597.             self.rect = pygame.Rect(x,y,height,width)
  1598.             self.ws = [pygame.image.load("grey_mouse/flo (" + str(i) + ").png").convert_alpha() for i in range(1, 15)]
  1599.             self.fps = 60
  1600.             self.clock = pygame.time.Clock()
  1601.             self.next_frame_time = 0
  1602.             self.anim_index = 0
  1603.             self.direction = "float"
  1604.         def get_rect(self):
  1605.             self.rect.topleft = (self.x,self.y)
  1606.             return self.rect
  1607.  
  1608.  
  1609.                
  1610.         def draw(self):
  1611.             self.rect.topleft = (self.x,self.y)
  1612.             if self.direction == "float":
  1613.                 self.clock.tick(self.fps)
  1614.                 image_list = self.ws
  1615.  
  1616.                
  1617.             time_now = pygame.time.get_ticks()
  1618.             if (time_now > self.next_frame_time):
  1619.                 # Time until the next game
  1620.                 inter_time_delay = 3000 // self.fps
  1621.                 self.next_frame_time = time_now + inter_time_delay
  1622.                 # Showing next frame
  1623.                 self.anim_index += 1
  1624.                 if self.anim_index >= len(image_list):
  1625.                     self.anim_index = 0
  1626.      
  1627.             if self.anim_index >= len(image_list):
  1628.                 self.anim_index = 0
  1629.             player_image = image_list[self.anim_index]
  1630.             window.blit(player_image, (self.x + 40,self.y))
  1631.  
  1632.  
  1633.     # level   2
  1634.     chef1 = chef(105,650,50,130,white)
  1635.     cheese1 = cheese(155,650,90,90,white)
  1636.  
  1637.     chef2 = chef(405,780,50,190,white)
  1638.     cheese2 = cheese(455,780,90,90,white)
  1639.  
  1640.     chef3 = chef(1105,680,50,130,white)
  1641.     cheese3 = cheese(1155,680,90,90,white)
  1642.  
  1643.  
  1644.     chefs = [chef1,chef2,chef3]
  1645.     cheeses = [cheese1,cheese2,cheese3]
  1646.  
  1647.     class newbg: # level 3
  1648.         def __init__(self,x,y,height,width,color):
  1649.             self.x = x
  1650.             self.y = y
  1651.             self.height = height
  1652.             self.width = width
  1653.             self.color = color
  1654.             self.image = pygame.image.load("level3.png").convert_alpha()
  1655.             self.rect  = pygame.Rect(x,y,height,width)
  1656.         def draw(self):
  1657.             self.rect.topleft = (self.x,self.y)
  1658.             window.blit(self.image,self.rect)
  1659.  
  1660.  
  1661.     level11 = newbg(-100,-350,0,0,white)    
  1662.     bgs = [bg1]
  1663.     # our game objects in a list
  1664.     object_list = [
  1665.         lava11,lava12,fire7,collid1,stopglitch,puff1,text22,rat1,collidmove,collidmove2,lava1,lava2,lava3,lava4,lava5,lava6,lava7,lava8,lava9,lava10,updown1,updown2,updown3,updown4,text1,level11,lavaplays,lavaplays2,lavaplays3,rat11,rat22,hittext, heart,heart2,fire5,fire6,fire3,fire4,fire2,fire1,pusho,pusho2,stopmove1,
  1666.         text_show_collision,
  1667.         text_show_collision2,deathtext]
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.     # remember on gimp to scale the stats to 540
  1674.     stat = pygame.image.load("statbut.png").convert_alpha()
  1675.  
  1676.     stat1 = pygame.image.load("hel1.png").convert_alpha()
  1677.  
  1678.     stat11 = pygame.image.load("health1.png").convert_alpha()
  1679.     settingsm = pygame.image.load("hel3.png").convert_alpha()
  1680.  
  1681.  
  1682.  
  1683.     healthba = pygame.image.load("healthba.png").convert_alpha()
  1684.     health = 10
  1685.     hitbox = (200, 200 + 2, 31, 57)
  1686.     health2 = 10
  1687.     hitbox2 = (200, 200 + 2, 31, 57)
  1688.  
  1689.     health3 = 10
  1690.     hitbox3 = (200, 200 + 2, 31, 57)
  1691.  
  1692.  
  1693.  
  1694.     # ----------------------------------- game settings
  1695.  
  1696.     show_settings = False
  1697.     exit11 = False
  1698.     setbutton = pygame.image.load("setbutton.png").convert_alpha()
  1699.  
  1700.     bar11 = pygame.image.load("bar.png").convert_alpha()
  1701.     # class background
  1702.     class back:
  1703.         def __init__(self,x,y,height,width):
  1704.             self.x =x
  1705.             self.y = y
  1706.             self.height =height
  1707.             self.width = width
  1708.             self.test = pygame.image.load("set.png").convert_alpha()
  1709.             self.rect = pygame.Rect(x,y,height,width)
  1710.         def draw(self):
  1711.             self.rect.topleft = (self.x,self.y)
  1712.             window.blit(self.test,self.rect)
  1713.  
  1714.     showtimer = 0
  1715.     showtimer2 = 0
  1716.     seti = back(230,-750,50,50)
  1717.  
  1718.     class particle:
  1719.         def __init__(self,x,y):
  1720.             self.x = x
  1721.             self.y = y
  1722.             self.x_vel = random.randrange(-10,13)//5
  1723.             self.y_vel = random.randrange(-10,-1)//5
  1724.             self.cheese = pygame.image.load("che1.png").convert_alpha()
  1725.             self.cheese = pygame.transform.scale(self.cheese,(self.cheese.get_width()//3,self.cheese.get_height()//3))
  1726.             self.lifetime = 0
  1727.         def draw(self,window):
  1728.             self.lifetime += 1
  1729.             if self.lifetime <30:
  1730.                 self.x -= self.x_vel
  1731.                 self.y -= self.y_vel
  1732.                 window.blit(self.cheese,(self.x,self.y))
  1733.  
  1734.     class particle2:
  1735.         def __init__(self,x,y):
  1736.             self.x = x
  1737.             self.y = y
  1738.             self.x_vel = random.randrange(-10,13)//5
  1739.             self.y_vel = random.randrange(-10,-1)//5
  1740.             self.lifetime = 0
  1741.         def draw(self,window):
  1742.             self.lifetime += 1
  1743.             if self.lifetime <30:
  1744.                 self.x -= self.x_vel
  1745.                 self.y -= self.y_vel
  1746.                 pygame.draw.circle(window,(153, 163, 164),(self.x,self.y),10)
  1747.                
  1748.     particles = []  
  1749.     # ----------------------------------- game settings
  1750.     def cheesemove():
  1751.         cheese1.y = chef1.rect.top + math.cos(math.radians(cheese1.time)) * 40
  1752.         cheese1.time += 2.3
  1753.         if cheese1.time >= 360:
  1754.             cheese1.time = 0
  1755.  
  1756.         cheese2.y  = chef2.rect.top + math.cos(math.radians(cheese2.time)) * 40
  1757.         cheese2.time += 2.3
  1758.         if cheese2.time >= 360:
  1759.             cheese2.time = 0
  1760.  
  1761.         cheese3.y = chef3.rect.top + math.cos(math.radians(cheese3.time)) * 40
  1762.         cheese3.time += 2.3
  1763.         if cheese3.time >= 360:
  1764.             cheese3.time = 0
  1765.            
  1766.  
  1767.  
  1768.  
  1769.     particless = []
  1770.  
  1771.     blito = True
  1772.  
  1773.    
  1774.  
  1775.  
  1776.    
  1777.     def redraw():
  1778.  
  1779.         for button in buttons:
  1780.             button.draw(window)
  1781.  
  1782.            
  1783.         for bg in bgs:
  1784.             bg.draw()
  1785.            
  1786.  
  1787.            
  1788.         collidmove2.draw()
  1789.         collidmove.draw()    
  1790.  
  1791.  
  1792.         if blito:
  1793.             # our bullets
  1794.             for shot in shots:
  1795.                 shot.draw()
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.         crate1.draw()
  1802.  
  1803.         portal1.draw()
  1804.         playerman.draw()
  1805.  
  1806.         if blito == False:
  1807.             for shot in shots:
  1808.                 shot.draw()
  1809.  
  1810.                
  1811.         for particle2 in particless:
  1812.             particle2.draw(window)        
  1813.  
  1814.  
  1815.         for cheese in cheeses:
  1816.             cheese.draw()
  1817.         for chef in chefs:
  1818.             chef.draw()            
  1819.  
  1820.  
  1821.         swtich_image = switches[current_switch]
  1822.         display.blit(swtich_image, swtich_image.get_rect(midbottom = (collidmove.x + 190,collidmove.y + 440)))
  1823.        
  1824.         for obj in object_list:
  1825.  
  1826.             obj.draw()
  1827.  
  1828.  
  1829.  
  1830.         for collid in collids:
  1831.             collid.draw()
  1832.  
  1833.         display.blit(healthba, (-1,0))
  1834.         # player health HHEHEHEHEHE
  1835.         hitbox = (5, 35 + 2, 31, 57)
  1836.         pygame.draw.rect(window, (167, 70, 47), (hitbox[0], hitbox[1] - 4, 170 - (5 * (10 - health)),  10)) # NEW
  1837.         pygame.draw.rect(window, (24, 10, 6), (hitbox[0], hitbox[1] - 25, 170 - (5 * (10 - health)),  10)) # NEW
  1838.         pygame.draw.rect(window, (54, 24, 16), (hitbox[0], hitbox[1] - 26, 170 - (5 * (10 - health)),  10)) # NEW
  1839.         pygame.draw.rect(window, (243, 130, 104), (hitbox[0], hitbox[1] - 25, 170 - (5 * (10 - health)),  10)) # NEW
  1840.         pygame.draw.rect(window, (221, 109, 83), (hitbox[0], hitbox[1] - 24, 170 - (5 * (10 - health)),  23)) # NEW
  1841.         pygame.draw.rect(window, (199, 84, 57), (hitbox[0], hitbox[1] - 20, 170 - (5 * (10 - health)), 20)) # NEWright = True
  1842.  
  1843.         hitbox2 = (5, 89 + 2, 31, 57)
  1844.         pygame.draw.rect(window, (13, 16, 17), (hitbox2[0], hitbox2[1] - 21, 170 - (5 * (10 - health2)),  20)) # NEW
  1845.         pygame.draw.rect(window, (146,236,244), (hitbox2[0], hitbox2[1] - 20, 170 - (5 * (10 - health2)),  20)) # NEW
  1846.         pygame.draw.rect(window, (95, 212, 231), (hitbox2[0], hitbox2[1] - 18, 170 - (5 * (10 - health2)),  20)) # NEW
  1847.         pygame.draw.rect(window, (13, 16, 17), (hitbox2[0], hitbox2[1] - 8, 170 - (5 * (10 - health2)),  15)) # NEW
  1848.         pygame.draw.rect(window, (57, 182, 214), (hitbox2[0], hitbox2[1] - 10, 170 - (5 * (10 - health2)),  20)) # NEW
  1849.         pygame.draw.rect(window, (114, 203, 226), (hitbox2[0], hitbox2[1] - 16, 170 - (5 * (10 - health2)),  20)) # NEW
  1850.  
  1851.         hitbox3 = (660, 50 + 2, 31, 57)
  1852.         pygame.draw.rect(window, (17,48,42,255), (hitbox3[0], hitbox3[1] - 21, 120 - (5 * (10 - health3)),  20)) # NEW
  1853.         pygame.draw.rect(window, (89,243,212,255), (hitbox3[0], hitbox3[1] - 20, 120 - (5 * (10 - health3)),  20)) # NEW
  1854.         pygame.draw.rect(window, (87,205,182,255), (hitbox3[0], hitbox3[1] - 18, 120 - (5 * (10 - health3)),  20)) # NEW
  1855.         pygame.draw.rect(window, (71,190,166,255), (hitbox3[0], hitbox3[1] - 8, 120 - (5 * (10 - health3)),  15)) # NEW
  1856.         pygame.draw.rect(window, (57,160,139,255), (hitbox3[0], hitbox3[1] - 10, 120 - (5 * (10 - health3)),  20)) # NEW
  1857.         pygame.draw.rect(window, (71,190,166,255), (hitbox3[0], hitbox3[1] - 16, 120 - (5 * (10 - health3)),  20)) # NEW
  1858.         display.blit(settingsm,(655,-100))
  1859.  
  1860.        
  1861.         display.blit(stat1, (0,0))
  1862.  
  1863.  
  1864.     # ----------------------------------- game settings
  1865.         seti.draw()
  1866.        
  1867.  
  1868.  
  1869.  
  1870.         position = bar1.x,bar1.y
  1871.         window.blit(bar11,(position))
  1872.  
  1873.         # our bar imagead
  1874.         window.blit(bar11,(bar1.x - 5,bar1.y ))
  1875.  
  1876.         mew = button1[pause1]
  1877.         window.blit(mew, mew.get_rect(midbottom = (switch_pause.x + 18,switch_pause.y + 35)))
  1878.  
  1879.         mews = button11[pause11]
  1880.         window.blit(mews, mews.get_rect(midbottom = (exit_game.x + 18,exit_game.y + 38)))
  1881.  
  1882.         mewss = button111[pause111]
  1883.         window.blit(mewss, mewss.get_rect(midbottom = (reset_game.x + 18,reset_game.y + 36)))
  1884.  
  1885.         mewsss = button1111[pause1111]
  1886.         window.blit(mewsss, mewsss.get_rect(midbottom = (main_game.x + 18,main_game.y + 31)))
  1887.  
  1888.         mewssss = button11111[pause11111]
  1889.         window.blit(mewssss, mewssss.get_rect(midbottom = (jump_sound.x + 15,jump_sound.y + 35)))
  1890.        
  1891.         mewsssss = button111111[pause111111]
  1892.         window.blit(mewsssss, mewsssss.get_rect(midbottom = (land_sound.x + 15,land_sound.y + 35)))
  1893.                
  1894.         text_show_collision2.draw()
  1895.         pos = pygame.mouse.get_pos()
  1896.      
  1897.  
  1898.         for particle in particles:
  1899.             particle.draw(window)
  1900.  
  1901.  
  1902.         rop1.draw()
  1903.  
  1904.         for collid in collids:
  1905.             collid.draw()
  1906.  
  1907.         px,py = playerman.x,playerman.y
  1908.  
  1909.         if not playerman.direction == "DEath2" and not playerman.direction == "DEath":
  1910.             if playerman.get_rect().y > 510:
  1911.                 scroll_offset = playerman.y - 510
  1912.                 # scroll objects ...
  1913.                 for obj in object_list:
  1914.                     obj.y -= scroll_offset # change all of them to player x and y
  1915.                 for shot in shots:
  1916.                     shot.y -= scroll_offset
  1917.                 for collid in collids:
  1918.                     collid.y -= scroll_offset
  1919.                 for bg in bgs:
  1920.                     bg.y -= scroll_offset
  1921.  
  1922.                 # ... and scroll player
  1923.                 playerman.y -= scroll_offset
  1924.                 py -= scroll_offset
  1925.                 crate1.y -= scroll_offset
  1926.                 for cheese in cheeses:
  1927.                     cheese.y -= scroll_offset
  1928.                 for chef in chefs:
  1929.                     chef.y -= scroll_offset
  1930.                 rop1.y -= scroll_offset
  1931.                 portal1.y -= scroll_offset
  1932.  
  1933.  
  1934.  
  1935.  
  1936.     left = True
  1937.  
  1938.     stopmoving = True
  1939.  
  1940.     textup = True
  1941.  
  1942.     timer = 0
  1943.     attack = 0
  1944.     up1 = True
  1945.     up2 = True
  1946.     # our main loop
  1947.     move1 = False
  1948.     move2 = False
  1949.  
  1950.  
  1951.  
  1952.  
  1953.     switch1 = True
  1954.     switch2 = True
  1955.     switch3 = True
  1956.  
  1957.  
  1958.     in_spot = True
  1959.  
  1960.     in_spot2 = True
  1961.  
  1962.  
  1963.     circle = Circle( blacks,  400, 350, 50, 50 )
  1964.  
  1965.     # positioning script
  1966.     def position():
  1967.         if in_spot:
  1968.             bar1.y = seti.y + 210
  1969.  
  1970.         cheese2.x = chef2.x + 50
  1971.         cheese3.x = chef3.x + 50
  1972.  
  1973.  
  1974.         for lavaa in collidsides:
  1975.             if playerman.rect.colliderect(lavaa.rect):
  1976.                 if playerman.direction == "DEath":
  1977.                     puff1.x = playerman.x
  1978.                     puff1.y = playerman.y
  1979.                     puff1.direction = "darkside"
  1980.  
  1981.         for lavaa in collidbottom2:
  1982.             if playerman.rect.colliderect(lavaa.rect):
  1983.                 if playerman.direction == "DEath":
  1984.                     puff1.x = playerman.x
  1985.                     puff1.y = playerman.y
  1986.                    
  1987.            
  1988.         lever.x = rop1.x  + 10
  1989.         lever.y = rop1.y + 202
  1990.        
  1991.         stopglitch.x = rop1.x  + 10
  1992.         stopglitch.y = rop1.y + 200
  1993.  
  1994.         v1.y = seti.y + 220
  1995.         v2.y = seti.y + 290
  1996.         v3.y = seti.y + 350
  1997.         v4.y = seti.y + 430
  1998.         switch_pause.x = seti.x + 410
  1999.         switch_pause.y = seti.y + 358
  2000.        
  2001.         jump_sound.x = seti.x + 350
  2002.         jump_sound.y = seti.y + 459
  2003.        
  2004.         land_sound.x = seti.x + 350
  2005.         land_sound.y = seti.y + 530
  2006.        
  2007.         exit_game.x = seti.x + 410
  2008.         exit_game.y = seti.y + 299
  2009.  
  2010.         reset_game.x = seti.x + 410
  2011.         reset_game.y = seti.y + 259
  2012.  
  2013.         main_game.x = seti.x + 410
  2014.         main_game.y = seti.y + 219
  2015.  
  2016.         exit1.x = seti.x + 410
  2017.         exit1.y = seti.y + 160
  2018.        
  2019.         # the rect that our player will collid with and it will allow use to push
  2020.         pusho.x = crateco.x - 5
  2021.         pusho.y = crateco.y + 40
  2022.         # the rect that our player will collid with and it will allow use to push
  2023.         pusho2.x = crateco.x + 99
  2024.         pusho2.y = crateco.y + 50
  2025.  
  2026.         if not playerjump == False:
  2027.             if playerman.direction == "DEath" or playerman.direction == "DEath2":
  2028.                 deathtext.x = playerman.x + 150
  2029.                 deathtext.show = True
  2030.        
  2031.  
  2032.         # punch
  2033.         if playerman.direction == "att":
  2034.             punch1.x = playerman.x + 55
  2035.             punch1.y = playerman.y - 14
  2036.            
  2037.         if playerman.direction == "att2":
  2038.             punch1.x = playerman.x - 19
  2039.             punch1.y = playerman.y - 14
  2040.            
  2041.         # this scrolls our jumping hitbox with the player
  2042.         crateco.x = crate1.x + 20
  2043.         crateco.y = crate1.y + 66
  2044.  
  2045.  
  2046.  
  2047.  
  2048.         hittext.x = rat1.x - 100
  2049.         hittext.y = rat1.y - 150
  2050.  
  2051.  
  2052.  
  2053.    
  2054.  
  2055.     moving = True
  2056.     x = 10
  2057.     y = 10
  2058.     x_change = 0
  2059.     y_change = 0
  2060.     old_x = x
  2061.     old_y = y
  2062.     tons = 0
  2063.     pa = 0
  2064.     e_clicked = False
  2065.     hit = True
  2066.     # our rat timer
  2067.     move = True
  2068.     move2 = True
  2069.     move3 = True
  2070.     attack2 = 0
  2071.     move_timer = 0
  2072.     move_timer2 = 0
  2073.     rat1_attack = 0
  2074.  
  2075.     pos = pygame.mouse.get_pos()
  2076.  
  2077.     click = True
  2078.    
  2079.     trans = 0
  2080.     trano = True
  2081.     adds = False
  2082.     exiting = False
  2083.     ex = 0
  2084.     reseting = False
  2085.     res = 0
  2086.    
  2087.     # Runing the game/ the main loop
  2088.     if_f = False
  2089.     run = True
  2090.     poop = False
  2091.     lavap = True
  2092.     lavap2 = True
  2093.     pushtimer = 0
  2094.     clo = True
  2095.     o = True
  2096.     os = True
  2097.     oos = True
  2098.     pushvalue = True
  2099.     snif = 0
  2100.     r = False
  2101.     PUNCH = True
  2102.  
  2103.     puffs = 0
  2104.     playerjump = True
  2105.     death = 0
  2106.     deathscreen = True
  2107.     diescreen1 = True
  2108.     # treansition
  2109.     dead_screen = True
  2110.     # fire ball hit player
  2111.  
  2112.     # ---------- projectiles
  2113.     nothit = True
  2114.     poops = True
  2115.    
  2116.     nothit2 = True
  2117.     poops2 = True
  2118.  
  2119.     nothit3 = True
  2120.     poops3 = True
  2121.     # ------------ projectiles
  2122.  
  2123.     load = 0
  2124.     pufo = 0
  2125.     load_transition_screen = True
  2126.     damaging = 0
  2127.     right = True
  2128.     left = True
  2129.     #if cheese score
  2130.     cheesescore = 0
  2131.     # rat score
  2132.     ratscore = 1
  2133.     player_double_jump = True
  2134.  
  2135.     # shoot the proejctiles timer
  2136.     shoot = 0
  2137.     # the player will start movign
  2138.     move_player_timer = 0
  2139.     # this is to show the deathtext at player pos and then stop it
  2140.     screenshake = 0
  2141.  
  2142.     showpos = True
  2143.     while run:
  2144.         # Making game run with fps
  2145.         for event in pygame.event.get():
  2146.             if event.type == pygame.QUIT:
  2147.                 run = False
  2148.  
  2149.             if event.type == pygame.KEYDOWN:
  2150.                 if event.key == pygame.K_f:
  2151.                     if playerman.rect.colliderect(text_show_collision2.rect):
  2152.                         sw.play()
  2153.                         if_f = True
  2154.                         if current_switch == 0:
  2155.                             current_move = 1
  2156.                         elif current_switch == len(switches)-1:
  2157.                             current_move = -1
  2158.                         current_switch += current_move
  2159.  
  2160.             elif event.type == pygame.MOUSEBUTTONDOWN:
  2161.                 pos = pygame.mouse.get_pos()
  2162.                 if show1.isOver(pos):
  2163.                     show_settings = True
  2164.                     showtimer = 0
  2165.                     show1.x = 999
  2166.                     uis.play()
  2167.  
  2168.                    
  2169.  
  2170.                 if exit1.isOver(pos):
  2171.                     exit11 = True
  2172.                     showtimer2 = 0
  2173.                     show1.x = 675
  2174.                     kit.play()
  2175.                 # pause
  2176.                 if switch_pause.isOver(pos):
  2177.                     if pause1 == 0:
  2178.                         unpause1 = 1
  2179.                     elif pause1 == len(new)-1:
  2180.                         unpause1 = -1
  2181.                     pause1 += unpause1
  2182.                     adds = True
  2183.                     clicks.play()
  2184.  
  2185.                    
  2186.                    
  2187.                 # exit game button
  2188.                 if exit_game.isOver(pos):
  2189.                     exiting = True
  2190.                     if pause11 == 0:
  2191.                         unpause11 = 1
  2192.                     elif pause11 == len(new1)-1:
  2193.                         unpause11 = -1
  2194.                     pause11 += unpause11
  2195.                     clicks.play()
  2196.  
  2197.    
  2198.                 # reset game button
  2199.                 if reset_game.isOver(pos):
  2200.                     uiss.play()
  2201.                     reseting = True
  2202.                     if pause111 == 0:
  2203.                         unpause111 = 1
  2204.                     elif pause111 == len(new11)-1:
  2205.                         unpause111 = -1
  2206.                     pause111 += unpause111
  2207.                     clicks.play()
  2208.  
  2209.                 # main_game game button
  2210.                 if main_game.isOver(pos):
  2211.                     if pause1111 == 0:
  2212.                         unpause1111 = 1
  2213.                         clu.play()
  2214.                     elif pause1111 == len(new111)-1:
  2215.                         clicks.play()
  2216.                         unpause1111 = -1
  2217.                     pause1111 += unpause1111
  2218.                        
  2219.                 # main_game game button
  2220.                 if jump_sound.isOver(pos):
  2221.                     if pause11111 == 0:
  2222.                         unpause11111 = 1
  2223.                         clu.play()
  2224.                     elif pause11111 == len(new1111)-1:
  2225.                         unpause11111 = -1
  2226.                         clicks.play()
  2227.                         jump.stop()
  2228.  
  2229.                     pause11111 += unpause11111
  2230.  
  2231.                 # main_game game button
  2232.                 if land_sound.isOver(pos):
  2233.                     if pause111111 == 0:
  2234.                         unpause111111 = 1
  2235.                         clu.play()
  2236.                     elif pause111111 == len(new11111)-1:
  2237.                         unpause111111 = -1
  2238.                         clicks.play()
  2239.  
  2240.  
  2241.                     pause111111 += unpause111111
  2242.                    
  2243.     # --------------------------------------------------- BUTTON CONTRO
  2244.  
  2245.  
  2246.  
  2247.                        
  2248.                   # this is our bar1 the gray part that we will be able to move
  2249.                 if move_spot.isOver(pos):
  2250.                     if bar1.isOver(pos):
  2251.                         in_spot = False
  2252.                         click = True
  2253.                         #time.sleep(0.2)
  2254.            
  2255.             if not move_spot.isOver(pos):
  2256.                 if not bar1.isOver(pos):
  2257.                     click = False
  2258.  
  2259.  
  2260.  
  2261.         # make our uprightlavas the direction
  2262.         for lavaa2 in updownlava:
  2263.             lavaa2.direction = "updownlava"
  2264.            
  2265.         for lavaa2 in collidsides:
  2266.             lavaa2.direction = "ws"
  2267.            
  2268.         if bar1.rect.colliderect(v1.rect):
  2269.             pygame.mixer.music.set_volume(0.3)
  2270.  
  2271.         if bar1.rect.colliderect(v2.rect):
  2272.             pygame.mixer.music.set_volume(0.8)
  2273.            
  2274.         if bar1.rect.colliderect(v3.rect):
  2275.             pygame.mixer.music.set_volume(0.6)
  2276.  
  2277.         if bar1.rect.colliderect(v4.rect):
  2278.             pygame.mixer.music.set_volume(0.1)
  2279.  
  2280.  
  2281.            
  2282.  
  2283.         if bar1.rect.bottom >= move_spot.rect.bottom:
  2284.             bar1.y = 360
  2285.  
  2286.            
  2287.         if click:
  2288.             pos = pygame.mouse.get_pos()
  2289.             click = pygame.mouse.get_pressed()
  2290.             bar1.y = pos[1]
  2291.  
  2292.  
  2293.         # draw them on our player x and y
  2294.  
  2295.  
  2296.         if playerman.rect.colliderect(collid1.rect):
  2297.             playerman.y += 4
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.     # ----------------------------- what happens if our player touches the projectile
  2308.         keepmoving = True
  2309.         if keepmoving:
  2310.             for one in range(len(shots)-1,-1,-1):
  2311.                 if playerman.rect.colliderect(shots[one].rect):
  2312.                     if health > -23:
  2313.                         if damaging <= 100:
  2314.                             damaging += 1
  2315.                             blito = False
  2316.                             health  -= 0.1
  2317.                             shots[one].direction = "expod"
  2318.                             shots[one].x = playerman.x
  2319.                             shots[one].y = playerman.y - 20
  2320.  
  2321.                         else:
  2322.                             del shots[one]
  2323.                             damaging = 0
  2324.                             heart2.hit = False
  2325.                     else:
  2326.                         playerman.direction = "DEath2"
  2327.                         if showpos:
  2328.                             playerman.isJump = True
  2329.                             playerjump = False
  2330.                             deathtext.x = playerman.x - 150
  2331.                             deathtext.y = playerman.y - 150
  2332.                             deathtext.show = True
  2333.                             showpos = False
  2334.  
  2335.                
  2336.             if damaging == 5 or damaging == 20 or damaging == 40 or damaging == 60 or damaging == 90:
  2337.                 damagesound.play()
  2338.                 heart2.hit = True
  2339.  
  2340.  
  2341.  
  2342.  
  2343.         # what happens if thje palyer collids with the shot7
  2344.         if player_double_jump:
  2345.             if playerman.rect.colliderect(shot6.rect) and damaging == 20:
  2346.                 playerman.isJump = True
  2347.  
  2348.         if playerman.rect.colliderect(shot5.rect):
  2349.             player_double_jump = False
  2350.            
  2351.  
  2352.            
  2353.  
  2354.        
  2355.         if playerman.rect.colliderect(shot1.rect):
  2356.             nothit = False
  2357.         if playerman.rect.colliderect(shot2.rect):
  2358.             poops = False
  2359.         if playerman.rect.colliderect(shot3.rect):
  2360.             nothit2 = False
  2361.         if playerman.rect.colliderect(shot4.rect):
  2362.             poops2 = False
  2363.         if playerman.rect.colliderect(shot5.rect):
  2364.             nothit3 = False
  2365.         if playerman.rect.colliderect(shot6.rect):
  2366.             poops3 = False            
  2367.     # --------------------------------------------------- BUTTON CONTRO
  2368.  
  2369.         # load our main game when we click this button
  2370.         if pause1111 == 0:
  2371.             game_intro()
  2372.  
  2373.  
  2374.         # if the player falls out the map
  2375.  
  2376.        
  2377.         if playerman.rect.colliderect(lava4.rect):
  2378.             playerman.direction = "DEath"
  2379.  
  2380.  
  2381.         # our settings showing up
  2382.         if show_settings:
  2383.             if showtimer < 82:
  2384.                 seti.y += 8
  2385.                 showtimer += 1
  2386.                 in_spot = True
  2387.                 if bar1.rect.colliderect(v1.rect):
  2388.                     bar1.y = v1.y
  2389.                     in_spot = False
  2390.                    
  2391.                 if bar1.rect.colliderect(v2.rect):
  2392.                     bar1.y = v2.y
  2393.                     in_spot = False
  2394.  
  2395.                 if bar1.rect.colliderect(v3.rect):
  2396.                     bar1.y = v3.y
  2397.                     in_spot = False
  2398.                    
  2399.                 if bar1.rect.colliderect(v4.rect):
  2400.                     bar1.y = v4.y
  2401.                     in_spot = False
  2402.  
  2403.         if exit11:
  2404.             if showtimer2  < 82:
  2405.                 showtimer2 += 1
  2406.                 seti.y -= 8
  2407.                 if bar1.rect.colliderect(v1.rect):
  2408.                     bar1.y = v1.y
  2409.                     in_spot = False
  2410.  
  2411.                 if bar1.rect.colliderect(v2.rect):
  2412.                     bar1.y = v2.y
  2413.                     in_spot = False
  2414.  
  2415.                 if bar1.rect.colliderect(v3.rect):
  2416.                     bar1.y = v3.y
  2417.                     in_spot = False
  2418.                    
  2419.                 if bar1.rect.colliderect(v4.rect):
  2420.                     bar1.y = v4.y
  2421.                     in_spot = False
  2422.                
  2423.     # telling what to do when we say the word 'key'
  2424.         keys = pygame.key.get_pressed()
  2425.  
  2426.  
  2427.     #----------------- level 2 code
  2428.         if cheesescore == 3 and playerman.rect.colliderect(portal1.rect):
  2429.             reseting = True
  2430.            
  2431.  
  2432.     #---------------------------------------------------------- STAMINA CODE
  2433.  
  2434.         if keys[pygame.K_e]:
  2435.             e_clicked = True
  2436.            
  2437.         if e_clicked:
  2438.             tons += 1
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.     # ------------------------------------- play lava sound when collisions
  2446.         if playerman.rect.colliderect(lavaplays.rect):
  2447.             if lavap:
  2448.                 La.play(-1)
  2449.                 lavap = False
  2450.  
  2451.                
  2452.         if not playerman.rect.colliderect(lavaplays.rect):
  2453.             La.stop()
  2454.             lavap = True
  2455.  
  2456.  
  2457.         if playerman.rect.colliderect(lavaplays2.rect):
  2458.             if lavap2:
  2459.                 La2.play(-1)
  2460.                 lavap2 = False
  2461.  
  2462.                
  2463.         if not playerman.rect.colliderect(lavaplays2.rect):
  2464.             La2.stop()
  2465.             lavap2 = True
  2466.   # ------------------------------------------------- PAUSE              
  2467.  
  2468.  
  2469.         if adds:
  2470.             if add < 5:
  2471.                 add += 1
  2472.             else:
  2473.                 pause = True
  2474.                 paused()
  2475.                 adds = False
  2476.                 add = 0
  2477.  
  2478.         if exiting:
  2479.             if ex < 10:
  2480.                 ex += 1
  2481.             else:
  2482.                 pygame.quit()
  2483.  
  2484.         if reseting:
  2485.  
  2486.             if res < 10:
  2487.                 res += 1
  2488.  
  2489.             else:
  2490.                 circle.circleInTransition()
  2491.  
  2492.  
  2493.         # player death
  2494.  
  2495.                
  2496.         if adds == False:
  2497.              
  2498.             if pause1 == 0:
  2499.                 if pause == False:
  2500.                     pause1 = 1
  2501.  
  2502.  
  2503.         # player death
  2504.         if playerman.y == 1000:
  2505.             transition.play()
  2506.             circle.circleOutInInOut()
  2507.             load_transition_screen = False
  2508.  
  2509.  
  2510.            
  2511.         if load_transition_screen:
  2512.             transition.play()
  2513.             circle.circleOutInInOut()
  2514.             load_transition_screen = False
  2515.  
  2516.  
  2517.         if unpause111111 == 0:
  2518.             land[1].stop()
  2519.             land[0].stop()
  2520.            
  2521.         # Shortining playerman.x and playerman.y
  2522.         px,py = playerman.x,playerman.y
  2523.         move_right = keys[pygame.K_d] # change to d and the other one a
  2524.         move_left = keys[pygame.K_a]
  2525.  
  2526.         move_hit = False
  2527.         move_hit2 = False
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534.                
  2535.   # ------------------------------------------------- PAUSE              
  2536.         rat1.jump()
  2537.         rat1.jump2()
  2538.         for one in range(len(rats)-1,-1,-1):
  2539.             if hit:
  2540.                 if tons > 10:
  2541.                     if playerman.direction == "Idle":
  2542.                         playerman.direction = "att"
  2543.                         hits.play()
  2544.                         if playerman.rect.colliderect(rats[one].rect):
  2545.                             if rats[one].health > -2:
  2546.                                 rats[one].health -= 1
  2547.                                 random.choice(enemyhits).play()
  2548.  
  2549.                             else:
  2550.                                 rats[one].direction = "die"
  2551.  
  2552.                                 heart.hit = False
  2553.                                 rats[one].isJump = True
  2554.                                 ratscore += 1
  2555.                                 print(ratscore)
  2556.                                 move3 = False
  2557.                                 move2 = False
  2558.                                 move = False
  2559.                                 if oos:
  2560.                                     die.play()
  2561.                                     oos = False
  2562.  
  2563.  
  2564.                                
  2565.                        
  2566.                     if playerman.direction == "leftid":
  2567.                         playerman.direction = "att2"
  2568.                         hits.play()
  2569.  
  2570.                         stopmoving = False
  2571.                         if playerman.rect.colliderect(rats[one].rect):
  2572.                             if rats[one].health > -2:
  2573.                                 rats[one].health -= 1
  2574.                                 random.choice(enemyhits).play()
  2575.  
  2576.                             else:
  2577.                                 rats[one].direction = "die"
  2578.                                 heart.hit = False
  2579.                                 rats[one].isJump = True
  2580.                                 move3 = False
  2581.                                 move2 = False
  2582.                                 move = False
  2583.                                 if oos:
  2584.                                     die.play()
  2585.                                     oos = False
  2586.  
  2587.                                 move3 = False
  2588.                                 move2 = False
  2589.                                 move = False
  2590.  
  2591.  
  2592.                                
  2593.                     if playerman.rect.colliderect(rats[one].rect) and not rat1.rect.colliderect(rat11.rect) and not rat1.rect.colliderect(rat22.rect):
  2594.                             if playerman.direction == "att" or rat1.direction == "att2":
  2595.                                 rat1.x += 2
  2596.                                 rat1.isJump2 = True
  2597.  
  2598.  
  2599.  
  2600.                     if not playerman.direction == "DEath" and not playerman.direction == "DEath2":
  2601.                         if playerman.rect.colliderect(rats[one].rect):
  2602.                             move3 = False
  2603.                             move2 = False
  2604.                             move = False
  2605.                        
  2606.                     if health2 > -21:
  2607.                         health2 -= 0.3
  2608.                     else:
  2609.                         if playerman.direction == "att":
  2610.                             playerman.direction = "Idle"
  2611.                         if playerman.direction == "att2":
  2612.                             playerman.direction = "leftid"
  2613.  
  2614.                         hit = False
  2615.                         hittext.hit = False
  2616.                     if tons > 30:
  2617.                         tons = 0
  2618.                         e_clicked = False
  2619.                         if playerman.direction == "att":
  2620.                             playerman.direction = "Idle"
  2621.                         if playerman.direction == "att2":
  2622.                             playerman.direction = "leftid"
  2623.  
  2624.                        
  2625.         if playerman.direction == "att" or playerman.direction == "att2":
  2626.             punch1.hit = True
  2627.         if playerman.direction == "Idle" or playerman.direction == "leftid":
  2628.             punch1.hit = False
  2629.  
  2630.            
  2631.         if playerman.rect.colliderect(rat1.rect):
  2632.             if playerman.direction == "att" or playerman.direction == "att2":
  2633.                 hittext.hit = True
  2634.                 punch1.hit = True
  2635.  
  2636.             if playerman.direction == "Idle":
  2637.                 hittext.hit = False
  2638.                 punch1.hit = False
  2639.                
  2640.         if not playerman.rect.colliderect(rat1.rect):
  2641.             hittext.hit = False
  2642.  
  2643.         if hit == False:
  2644.             if health2 < 10:
  2645.                 health2 += 0.2
  2646.             else:
  2647.                 if keys[pygame.K_e]:
  2648.                     hit = True
  2649.  
  2650.     #---------------------------------------------------------- STAMINA CODE
  2651.                    
  2652.             # MOVE OUR text down if we click F
  2653.         if if_f:
  2654.             text22.y += 5
  2655.  
  2656.         if move:
  2657.             if move_timer < 300:
  2658.                 move_timer += 1
  2659.             else:
  2660.                 rat1.direction = "move2"
  2661.                 rat1.x += 1
  2662.  
  2663.  
  2664.         if move2:
  2665.             if move_timer2 < 300:
  2666.                 move_timer2 += 1
  2667.             else:
  2668.                 rat1.direction = "move"
  2669.                 rat1.x -= 1
  2670.  
  2671.                
  2672.         if rat1.rect.colliderect(rat11.rect) and not rat1.direction == "die":
  2673.             rat1.direction = "idle"
  2674.             move = True
  2675.             move2 = False
  2676.             move_timer2 = 0
  2677.  
  2678.            
  2679.         elif rat1.rect.colliderect(rat22.rect) and not rat1.direction == "die":
  2680.             rat1.direction = "id"
  2681.             move = False
  2682.             move2 = True
  2683.             move_timer = 0
  2684.            
  2685.  
  2686.         if not playerman.direction == "DEath" and not playerman.direction == "DEath2":
  2687.             if move3:
  2688.                 if playerman.rect.colliderect(rat1.hitbox):
  2689.                     rat1.x += 3
  2690.                     rat1.direction = "move2"
  2691.  
  2692.                 elif playerman.rect.colliderect(rat1.hitbox2):
  2693.                     rat1.x -= 3
  2694.                     rat1.direction = "move"
  2695.  
  2696.    
  2697.  
  2698.  
  2699.            
  2700.         if not playerman.direction == "DEath" and not playerman.direction == "DEath2":
  2701.             if rat1.direction == "move2":
  2702.                 if playerman.rect.colliderect(rat1.rect):
  2703.                     move = False
  2704.                     move2 = False
  2705.                     rat1.direction = "id"
  2706.  
  2707.  
  2708.  
  2709.         # our hurt on our player x and y
  2710.         heart.x = playerman.x + 10
  2711.         heart.y = playerman.y - 60
  2712.        
  2713.         heart2.x = playerman.x + 10
  2714.         heart2.y = playerman.y - 60
  2715.  
  2716.         if not playerman.rect.colliderect(rat1.rect) and not playerman.rect.colliderect(rat1.hitbox2) and not playerman.rect.colliderect(rat1.hitbox):
  2717.             heart.hit = False
  2718.    
  2719.  
  2720.         if not playerman.direction == "DEath" and not playerman.direction == "DEath2":    
  2721.             if playerman.rect.colliderect(rat1.rect):
  2722.                 if rat1.direction == "move2" or rat1.direction == "id" or rat1.direction == "at":
  2723.                     if playerman.direction == "right"  and not rat1.direction == "die":
  2724.                         rat1.direction = "id"
  2725.  
  2726.                     move = False
  2727.                     move2 = False
  2728.                     attack += 1
  2729.                     if attack >= 50:
  2730.                         if not rat1.direction == "die":
  2731.                             rat1.direction = "at"
  2732.                             heart.hit = True
  2733.                             if o:
  2734.                                 if rat1.direction == "at" or "att":
  2735.                                     phit.play()
  2736.                                     o = False
  2737.                     else:
  2738.                         o = True
  2739.                         heart.hit = False
  2740.                        
  2741.                     if attack > 70:
  2742.                         rat1.direction = "id"
  2743.                         attack = 0
  2744.  
  2745.  
  2746.  
  2747.  
  2748.         if not playerman.direction == "DEath" and not playerman.direction == "DEath2":
  2749.             if rat1.direction == "move":
  2750.                 if playerman.rect.colliderect(rat1.rect):
  2751.                     move = False
  2752.                     move2 = False
  2753.  
  2754.         #- ---------------------------------- this is moving our player
  2755.  
  2756.         if rat1.direction == "at":
  2757.             move_hit = True
  2758.  
  2759.            
  2760.         if rat1.direction == "att":
  2761.             move_hit2 = True
  2762.  
  2763.  
  2764.         #- ---------------------------------- this is moving our player
  2765.  
  2766.         if not playerman.direction == "DEath" and not playerman.direction == "DEath2":
  2767.             if playerman.rect.colliderect(rat1.rect):
  2768.                 move = False
  2769.                 move2 = False
  2770.                 if playerman.direction == "left" and not rat1.direction == "die" and playerman.rect.colliderect(rat1.hitbox):
  2771.                     rat1.direction = "idle"
  2772.  
  2773.                 if rat1.direction == "move" or rat1.direction == "idle" or rat1.direction == "att":
  2774.                     attack2 += 1
  2775.                     if attack2 >= 50:
  2776.                         rat1.direction = "att"
  2777.                         heart.hit = True
  2778.                         if os:
  2779.                             if rat1.direction == "at" or "att":
  2780.                                 phit.play()
  2781.                                 os = False
  2782.                     else:
  2783.                         os = True
  2784.                         heart.hit = False
  2785.  
  2786.                     if attack2 > 70:
  2787.                         rat1.direction = "idle"
  2788.                         attack2 = 0
  2789.                         move_timer2 = 300
  2790.  
  2791.                    
  2792.         if not playerman.rect.colliderect(rat1.rect) and not playerman.rect.colliderect(rat1.hitbox2) and not playerman.rect.colliderect(rat1.hitbox) and not rat1.rect.colliderect(rat11.rect):
  2793.             if not move and not move2:
  2794.                     if rat1.direction == "move2" or rat1.direction == "id" or rat1.direction == "at":
  2795.                         move2 = True
  2796.                         move_timer = 300
  2797.                         move_timer2 = 300
  2798.                         rat1.direction = "move"
  2799.                     elif rat1.direction == "move" or rat1.direction == "idle" or rat1.direction == "att":
  2800.                         move = True
  2801.                         move_timer2 = 300
  2802.                         move_timer = 300
  2803.                         rat1.direction = "move2"
  2804.                
  2805.  
  2806.         if playerman.direction == "DEath" or playerman.direction == "DEath2":
  2807.             if not move and not move2:
  2808.                 if rat1.direction == "move2" or rat1.direction == "id" or rat1.direction == "at":
  2809.                     move2 = True
  2810.                     move_timer = 300
  2811.                     move_timer2 = 300
  2812.                     rat1.direction = "move"
  2813.                 elif rat1.direction == "move" or rat1.direction == "idle" or rat1.direction == "att":
  2814.                     move = True
  2815.                     move_timer2 = 300
  2816.                     move_timer = 300
  2817.                     rat1.direction = "move2"
  2818.        
  2819.                    
  2820.         if playerman.rect.colliderect(rat1.rect):
  2821.             if rat1.direction == "at" or rat1.direction == "att":
  2822.                 if health > -23:
  2823.                     health -= 0.1
  2824.                 else:
  2825.                     if playerman.direction == "left" or playerman.direction == "leftid":
  2826.                         playerman.direction = "DEath2"
  2827.                         playerjump = False
  2828.                         deathtext.x = playerman.x - 100
  2829.                         deathtext.y = playerman.y - 150
  2830.                     else:
  2831.                         playerman.direction  = "DEath"
  2832.                         deathtext.show = True
  2833.                         playerjump = False
  2834.                         deathtext.x = playerman.x - 100
  2835.                         deathtext.y = playerman.y - 150
  2836.  
  2837.  
  2838.         if dead_screen:
  2839.             if playerman.direction == "DEath" or playerman.direction == "DEath2":
  2840.                 if death < 160:
  2841.                     death += 1
  2842.                    
  2843.  
  2844.  
  2845.                 else:
  2846.                     reseting = True
  2847.                     if deathscreen:
  2848.                         uiss.play()
  2849.                         deathscreen = False
  2850.  
  2851.                 if death < 60:
  2852.                     deathtext.y -= 5
  2853.                     if diescreen1:
  2854.                         diescreen.play()
  2855.                         diescreen1 = False
  2856.  
  2857.  
  2858.  
  2859.         # --- -show the player death when in the lavaaa
  2860.         for lavaa in lavas:
  2861.             if playerman.get_rect().colliderect(lavaa.rect):
  2862.                 showpos = False
  2863.                 dead_screen = False
  2864.                 health = -23
  2865.                 playerman.direction = "DEath"
  2866.                 puff1.direction = "ws"
  2867.                 puff1.show = True
  2868.                 deathtext.show = False
  2869.                 if playerjump:
  2870.                     evil.play()
  2871.                     playerman.isJump = True
  2872.                     playerjump = False
  2873.                     deathtext.x = playerman.x - 150
  2874.                     deathtext.y = playerman.y - 150
  2875.  
  2876.  
  2877.        
  2878.  
  2879.        
  2880.  
  2881.  
  2882.  
  2883.         if playerjump == False:
  2884.             if pufo < 65:
  2885.                 pufo += 1
  2886.             else:
  2887.                 puff1.show = False
  2888.                 dead_screen = True
  2889.                 deathtext.show = True
  2890.  
  2891.     # ------------------------------------------------------------------------------------------------- SO MUCH CODE AHHAHAHAHAHHA
  2892.  
  2893.         if not rat1.direction == "die":
  2894.             if not playerman.direction == "DEath" and not playerman.direction == "DEath2":
  2895.                 if playerman.rect.colliderect(rat11.rect) and playerman.rect.colliderect(rat1.rect):
  2896.                     move3 = False
  2897.                     move2 = False
  2898.                     move = False
  2899.  
  2900.  
  2901.                    
  2902.  
  2903.                 if not playerman.rect.colliderect(rat11.rect) and not playerman.rect.colliderect(rat1.rect):
  2904.                     move3 = True
  2905.  
  2906.  
  2907.  
  2908.                 if playerman.rect.colliderect(rat22.rect) and playerman.rect.colliderect(rat1.rect):
  2909.                     move3 = False
  2910.                     move2 = False
  2911.                     move = False
  2912.  
  2913.                 if not playerman.rect.colliderect(rat22.rect) and not playerman.rect.colliderect(rat1.rect):
  2914.                     move3 = True
  2915.  
  2916.        
  2917.  
  2918.     # ------------------------------------------------------------------------------------------------- SO MUCH CODE AHHAHAHAHAHHA
  2919.  
  2920.         text2.visible = True
  2921.  
  2922.  
  2923.         if crateco.rect.colliderect(lava1.rect):
  2924.             crateco.y += 2
  2925.  
  2926.  
  2927.  
  2928.         if current_switch == 1:
  2929.             playerman.speed = 1.9
  2930.             con.stop()
  2931.         rop1.direction = "nomove"
  2932.  
  2933.         if current_switch == 2:
  2934.             if lever.rect.colliderect(collidmove.rect):
  2935.                 rop1.direction = "up"
  2936.                 rop1.y += playerman.speed
  2937.  
  2938.  
  2939.                    
  2940.                 if pushvalue:
  2941.                     if playerman.rect.colliderect(text_show_collision2.rect):
  2942.                         con.play()
  2943.                         pushvalue = False
  2944.                     if not playerman.rect.colliderect(text_show_collision2.rect):
  2945.                         con.stop()
  2946.                         pushvalue = True
  2947.                
  2948.             else:
  2949.                 rop1.direction = "nomove"
  2950.                 pushvalue = True
  2951.                 con.stop()
  2952.         if current_switch == 0:
  2953.             if lever.rect.colliderect(collidmove2.rect):
  2954.                 rop1.y -= playerman.speed
  2955.                
  2956.                 rop1.direction = "up"
  2957.                 if pushvalue:
  2958.                     if playerman.rect.colliderect(collidmove2):
  2959.                         con.play()
  2960.                         pushvalue = False
  2961.                     if not playerman.rect.colliderect(collidmove2):
  2962.                         con.stop()
  2963.                         pushvalue = True
  2964.             else:
  2965.                 rop1.direction = "nomove"
  2966.                 pushvalue = True
  2967.                 con.stop()
  2968.  
  2969.         if playerman.rect.colliderect(stopglitch.rect):
  2970.             move_right = False
  2971.             move_left = False
  2972.             playerman.speed = 1.9
  2973.  
  2974. # -------------- HOMEworkSSS
  2975. # first one is music
  2976. # second one is  deportes
  2977. # third one is bicicleta
  2978. # forth one is un libro
  2979. # is la tera
  2980.  
  2981. #
  2982.          # screenshakey
  2983.         if shot4.rect.bottom >= lavaplays2.rect.bottom:
  2984.             screenshake = 30
  2985.  
  2986.         if screenshake > 0:
  2987.             screenshake -= 1
  2988.  
  2989.         render_offset = [0,0]
  2990.         if screenshake:
  2991.             render_offset[0] = random.randint(0, 8) - 4
  2992.             render_offset[1] = random.randint(0, 8) - 4
  2993.  
  2994.         position()
  2995.  
  2996.        
  2997.        
  2998.         # move our projectiles up and down
  2999.          # Making bird move left and right
  3000.         if nothit:
  3001.             shot1.x = lavaplays.rect.right - math.sin(math.radians(shot1.time)) * 400
  3002.             shot1.time += 1
  3003.             if shot1.time >= 180:
  3004.                 shot1.time = 0
  3005.             if shot1.rect.right >= lavaplays.rect.right:
  3006.                 shot1.direction = "left"
  3007.             if shot1.rect.left  <= lavaplays.rect.left:
  3008.                 shot1.direction = "right"
  3009.                 if shot1.x <= lavaplays.rect.left:
  3010.                     if playerman.rect.colliderect(lavaplays.rect):
  3011.                         ball.play()# if the object y is >= 700 then change the direction and minus the y
  3012.  
  3013.  
  3014.         if shoot < 70:
  3015.             shoot += 1
  3016.         else:
  3017.             poop = True
  3018.  
  3019.         if poops:
  3020.             if poop:
  3021.                 shot2.x = lavaplays.rect.right - math.sin(math.radians(shot2.time)) * 400
  3022.                 shot2.time += 1
  3023.                 if shot2.time >= 180:
  3024.                     shot2.time = 0
  3025.                 if shot2.rect.right >= lavaplays.rect.right:
  3026.                     shot2.direction = "left"
  3027.                 if shot2.rect.left  <= lavaplays.rect.left:
  3028.                     shot2.direction = "right"
  3029.                     if shot2.x <= lavaplays.rect.left:
  3030.                         if playerman.rect.colliderect(lavaplays.rect):
  3031.                             ball.play()# if the object y is >= 700 then change the direction and minus the y
  3032.  
  3033.  
  3034.        
  3035.         # move our projectiles up and down
  3036.          # Making bird move left and right
  3037.         if nothit2:
  3038.             shot3.y = lavaplays2.rect.bottom - math.sin(math.radians(shot3.time)) * 400
  3039.             shot3.time += 1.5
  3040.             if shot3.time >= 180:
  3041.                 shot3.time = 0
  3042.             if shot3.rect.top <= lavaplays2.rect.top:
  3043.                 poop = True# if the object y is <= 200 then change the direction  and add to the y
  3044.                 shot3.direction = "downshot"
  3045.             if shot3.rect.bottom >= lavaplays2.rect.bottom:
  3046.                 shot3.direction = "upshot"
  3047.                 if shot3.y >= lavaplays2.rect.bottom:
  3048.                     if playerman.rect.colliderect(lavaplays2.rect):
  3049.                         ball.play()# if the object y is >= 700 then change the direction and minus the y
  3050.  
  3051.  
  3052.         if poops2:
  3053.             if poop:
  3054.                 shot4.y = lavaplays2.rect.bottom - math.sin(math.radians(shot4.time)) * 400
  3055.                 shot4.time += 1.5
  3056.                 if shot4.time >= 180:
  3057.                     shot4.time = 0
  3058.                 if shot4.rect.top <= lavaplays2.rect.top: # if the object y is <= 200 then change the direction  and add to the y
  3059.                     shot4.direction = "downshot"
  3060.                 if shot4.rect.bottom >= lavaplays2.rect.bottom:
  3061.                     shot4.direction = "upshot"
  3062.                     if shot4.y >= lavaplays2.rect.bottom:
  3063.                         if playerman.rect.colliderect(lavaplays2.rect):
  3064.                             ball.play()# if the object y is >= 700 then change the direction and minus the y
  3065.  
  3066.  
  3067.  
  3068.  
  3069.         # move our projectiles up and down
  3070.          # Making bird move left and right
  3071.         if nothit3:
  3072.             shot5.y = lavaplays3.rect.bottom - math.sin(math.radians(shot5.time)) * 400
  3073.             shot5.time += 1.5
  3074.             if shot5.time >= 180:
  3075.                 shot5.time = 0
  3076.             if shot5.rect.top <= lavaplays3.rect.top:
  3077.                 poop = True# if the object y is <= 200 then change the direction  and add to the y
  3078.                 shot5.direction = "downshot"
  3079.             if shot5.rect.bottom >= lavaplays2.rect.bottom:
  3080.                 shot5.direction = "upshot"
  3081.                 if shot5.y >= lavaplays3.rect.bottom:
  3082.                     if playerman.rect.colliderect(lavaplays3.rect):
  3083.                         ball.play()# if the object y is >= 700 then change the direction and minus the y
  3084.  
  3085.  
  3086.         if poops3:
  3087.             if poop:
  3088.                 shot6.y = lavaplays3.rect.bottom - math.sin(math.radians(shot6.time)) * 400
  3089.                 shot6.time += 1.5
  3090.                 if shot6.time >= 180:
  3091.                     shot6.time = 0
  3092.                 if shot6.rect.top <= lavaplays3.rect.top: # if the object y is <= 200 then change the direction  and add to the y
  3093.                     shot6.direction = "downshot"
  3094.                 if shot6.rect.bottom >= lavaplays3.rect.bottom:
  3095.                     shot6.direction = "upshot"
  3096.                     if shot6.y >= lavaplays3.rect.bottom:
  3097.                         if playerman.rect.colliderect(lavaplays3.rect):
  3098.                             ball.play()# if the object y is >= 700 then change the direction and minus the y
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.                        
  3106.         if textup:
  3107.             if playerman.rect.colliderect(text_show_collision.rect):
  3108.                 text_show_collision.x = playerman.x
  3109.                 text_show_collision.y = playerman.y
  3110.                 if text_timer < 100:
  3111.                     text_timer += 1
  3112.                     text1.y -= 1
  3113.                 text1.visible = True
  3114.  
  3115.  
  3116.  
  3117.         #
  3118.         if PUNCH:
  3119.             if playerman.direction == "att" or playerman.direction == "att2":
  3120.                 stopmoving = False
  3121.  
  3122.             elif not  playerman.direction == "att" or playerman.direction == "att2":
  3123.                 stopmoving = True
  3124.  
  3125.        
  3126.            
  3127.         if stopmoving:
  3128.             if playerman.rect.colliderect(pusho.rect):
  3129.                 if keys[pygame.K_d]:
  3130.                     playerman.direction = "Push"
  3131.                     right = False
  3132.                     left = False
  3133.                     move_hit2 = False
  3134.                     move_hit = False
  3135.                     if text_timer2 < 250:
  3136.                         text_timer2 += 1
  3137.                         text1.y += 2
  3138.  
  3139.                     crate1.x += 1
  3140.                     for x in range(3):
  3141.                         x, y = crate1.rect.center
  3142.                         particless.append( particle2( crate1.x,crate1.y + 150 ) )
  3143.                 else:
  3144.                     playerman.direction = "Idle"
  3145.                     right = True
  3146.                     left = True
  3147.            
  3148.  
  3149.             if playerman.rect.colliderect(pusho2.rect):
  3150.  
  3151.                 if keys[pygame.K_a]:
  3152.                     playerman.direction = "Push2"
  3153.                     right = False
  3154.                     left = False
  3155.                     move_hit2 = False
  3156.                     move_hit = False
  3157.                     if text_timer2 < 250:
  3158.                         text_timer2 += 1
  3159.                         text1.y += 2
  3160.  
  3161.                     crate1.x -= 1
  3162.                     for x in range(3):
  3163.                         x, y = crate1.rect.center
  3164.                         particless.append( particle2(crate1.x + 170 ,crate1.y + 150 ) )
  3165.                 else:
  3166.                     playerman.direction = "leftid"  
  3167.                     right = True
  3168.                     left = True
  3169.    
  3170.         if not playerman.direction == "DEath" and not playerman.direction == "DEath2":
  3171.             if keys[pygame.K_SPACE]:
  3172.                 if playerman.direction == "Push":
  3173.                     playerman.direction = "Idle"
  3174.  
  3175.  
  3176.             if keys[pygame.K_SPACE]:
  3177.                 if playerman.direction == "Push2":
  3178.                     playerman.direction = "leftid"
  3179.  
  3180.  
  3181.  
  3182.  
  3183.         if crateco.rect.colliderect(stopmove1.rect):
  3184.             stopmoving = False
  3185.             PUNCH = False
  3186.  
  3187.            
  3188.            
  3189.  
  3190.  
  3191.            
  3192.         # telling what to do when we say the word 'key'
  3193.         keys = pygame.key.get_pressed()
  3194.         # Shortining playerman.x and playerman.y
  3195.         px,py = playerman.x,playerman.y
  3196.  
  3197.  
  3198.  
  3199. # ------------------------------- PICK UP CHEESE\
  3200.  
  3201.         cheesemove()
  3202.            
  3203.         for one in range(len(chefs)-1,-1,-1):
  3204.             if playerman.rect.colliderect(chefs[one].rect):
  3205.                 cheese1.show = True
  3206.             else:
  3207.                 cheese1.show = False
  3208.             if keys[pygame.K_r]:
  3209.                 r = True
  3210.                    
  3211.  
  3212.        
  3213.         if r:
  3214.             if snif < 95:
  3215.                 snif += 3
  3216.                 if playerman.direction == "Idle":
  3217.                     playerman.direction = "snif"
  3218.                 if playerman.direction == "leftid":
  3219.                     playerman.direction = "snif2"
  3220.                
  3221.                 for x in range(1):
  3222.                     for one in range(len(cheeses)-1,-1,-1):
  3223.                         if playerman.rect.colliderect(cheeses[one].rect):
  3224.                             x, y = cheeses[one].rect.center
  3225.                             particles.append( particle(cheeses[one].x, cheeses[one].y ) )
  3226.  
  3227.             else:
  3228.                 if playerman.direction == "snif":
  3229.                     playerman.direction = "Idle"
  3230.                     snif = 0
  3231.                     r = False
  3232.                    
  3233.                 if playerman.direction == "snif2":
  3234.                     playerman.direction = "leftid"
  3235.                     snif = 0
  3236.                     r = False
  3237.                 for one in range(len(cheeses)-1,-1,-1):
  3238.                     if playerman.rect.colliderect(cheeses[one].rect):
  3239.                         coin.play()
  3240.                         del cheeses[one]
  3241.                         cheesescore += 1
  3242.                         print(cheesescore)
  3243.  
  3244. # ------------------------------- PICK UP CHEESE
  3245.  
  3246.            
  3247.  
  3248.         if playerman.direction == "right":
  3249.             playerman.direction = "Idle"
  3250.  
  3251.         if playerman.direction == "left":
  3252.             playerman.direction = "leftid"
  3253.  
  3254.  
  3255.  
  3256. # ---------------------------- movement area
  3257.  
  3258.         if not playerman.direction == "DEath" and not playerman.direction == "DEath2":
  3259.             # player 'A' movment
  3260.             if keys[pygame.K_a]:
  3261.                 for obj in object_list:
  3262.                     obj.x += playerman.speed
  3263.                 crate1.x += playerman.speed
  3264.                 for shot in shots:
  3265.                     shot.x += playerman.speed
  3266.                 for collid in collids:
  3267.                     collid.x += playerman.speed
  3268.                 for bg in bgs:
  3269.                     bg.x += playerman.speed
  3270.  
  3271.                 if right:
  3272.                     playerman.direction = "left"
  3273.  
  3274.                 for cheese in cheeses:
  3275.                     cheese.x += playerman.speed
  3276.                 for chef in chefs:
  3277.                     chef.x += playerman.speed  
  3278.                 rop1.x += playerman.speed
  3279.                 portal1.x += playerman.speed
  3280.                
  3281.             # player 'D' movment
  3282.             elif keys[pygame.K_d]:
  3283.  
  3284.                 for obj in object_list:
  3285.                     obj.x -= playerman.speed
  3286.                 for shot in shots:
  3287.                     shot.x -= playerman.speed
  3288.                 for collid in collids:
  3289.                     collid.x -= playerman.speed
  3290.                 for bg in bgs:
  3291.                     bg.x -= playerman.speed
  3292.                 if left:
  3293.                     playerman.direction = "right"
  3294.                    
  3295.                 crate1.x -= playerman.speed
  3296.  
  3297.                 for cheese in cheeses:
  3298.                     cheese.x -= playerman.speed
  3299.                 for chef in chefs:
  3300.                     chef.x -= playerman.speed  
  3301.                 rop1.x -= playerman.speed
  3302.                 portal1.x -= playerman.speed
  3303.  
  3304.        
  3305.  
  3306.  
  3307.  
  3308.  
  3309.  
  3310.  
  3311.         if not playerman.direction == "DEath" and not playerman.direction == "DEath2":
  3312.             if playerman.y < 50:
  3313.                 for obj in object_list:
  3314.                     obj.y += playerman.speed
  3315.                 for shot in shots:
  3316.                     shot.y += playerman.speed
  3317.                 for collid in collids:
  3318.                     collid.y += playerman.speed
  3319.  
  3320.                 for bg in bgs:
  3321.                     bg.y += playerman.speed
  3322.  
  3323.                 crate1.y += playerman.speed
  3324.                 for cheese in cheeses:
  3325.                     cheese.y += playerman.speed
  3326.                 for chef in chefs:
  3327.                     chef.y += playerman.speed              
  3328.                
  3329.                 rop1.y += playerman.speed
  3330.                 portal1.y += playerman.speed
  3331.  
  3332.        
  3333.                        
  3334.  
  3335.         if not playerman.direction == "Death" and not playerman.direction == "DEath2":
  3336.             if keys[pygame.K_d]:
  3337.                 if playerman.direction == "jump2":
  3338.                     playerman.direction = "jump"
  3339.  
  3340.  
  3341.             if keys[pygame.K_a]:
  3342.                 if playerman.direction == "jump":
  3343.                     playerman.direction = "jump2"
  3344.  
  3345.                                
  3346.         platform_rect_list = [p.get_rect()  for p in collids]
  3347.  
  3348.         player_rect = playerman.get_rect()
  3349.         player_rect.topleft = (px, py)
  3350.  
  3351.         playerman.y = py
  3352.         if player_rect.collidelist(platform_rect_list) < 0:
  3353.             playerman.x = px
  3354.                
  3355.  
  3356.        
  3357.         if not playerman.direction == "DEath" and not playerman.direction == "DEath2":
  3358.             if move_right:
  3359.                 for obj in object_list:
  3360.                     obj.x -= playerman.speed
  3361.                 for shot in shots:
  3362.                     shot.x -= playerman.speed
  3363.                 for collid in collids:
  3364.                     collid.x -= playerman.speed
  3365.  
  3366.                 for bg in bgs:
  3367.                     bg.x -= playerman.speed
  3368.                 crate1.x -= playerman.speed
  3369.                 for cheese in cheeses:
  3370.                     cheese.x -= playerman.speed
  3371.                 for chef in chefs:
  3372.                     chef.x -= playerman.speed              
  3373.                 rop1.x -= playerman.speed  
  3374.                 portal1.x -= playerman.speed
  3375.                
  3376.             if move_left:
  3377.                 for obj in object_list:
  3378.                     obj.x += playerman.speed
  3379.                 for shot in shots:
  3380.                     shot.x += playerman.speed
  3381.                 for collid in collids:
  3382.                     collid.x += playerman.speed
  3383.                 crate1.x += playerman.speed
  3384.  
  3385.                 for bg in bgs:
  3386.                     bg.x += playerman.speed
  3387.  
  3388.                 for cheese in cheeses:
  3389.                     cheese.x += playerman.speed
  3390.                 for chef in chefs:
  3391.                     chef.x += playerman.speed    
  3392.                 rop1.x += playerman.speed  
  3393.                 portal1.x += playerman.speed
  3394.  
  3395.         if move_hit:
  3396.             for obj in object_list:
  3397.                 obj.x -= 0.5
  3398.             for shot in shots:
  3399.                 shot.x -= 0.5
  3400.             for collid in collids:
  3401.                 collid.x -= 0.5
  3402.             crate1.x -= 0.5
  3403.  
  3404.             for bg in bgs:
  3405.                 bg.x -= 0.5
  3406.             portal1.x -= 0.5
  3407.             for cheese in cheeses:
  3408.                 cheese.x -= 0.5
  3409.             for chef in chefs:
  3410.                 chef.x -= 0.5
  3411.             rop1.x -= 0.5
  3412.            
  3413.         if move_hit2:
  3414.             for obj in object_list:
  3415.                 obj.x += 0.5
  3416.             for shot in shots:
  3417.                 shot.x += 0.5
  3418.             for collid in collids:
  3419.                 collid.x += 0.5
  3420.             crate1.x += 0.5
  3421.  
  3422.             for bg in bgs:
  3423.                 bg.x += 0.5
  3424.  
  3425.             for cheese in cheeses:
  3426.                 cheese.x += 0.5
  3427.             for chef in chefs:
  3428.                 chef.x += 0.5
  3429.             portal1.x += 0.5
  3430.  
  3431.             rop1.x += 0.5  
  3432.  
  3433.         if load_transition_screen == False:
  3434.             if move_player_timer < 20:
  3435.                 move_player_timer += 1
  3436.             else:
  3437.  
  3438.                        
  3439.                 platform_rect_list = [p.get_rect() for p in collids] # get_rect()
  3440.                 player_rect = playerman.get_rect()
  3441.                 player_rect.topleft = (px, py)
  3442.  
  3443.                 playerman.y = py
  3444.                 cI = player_rect.collidelist(platform_rect_list)
  3445.                 if cI >= 0:
  3446.                     # undo movement of platforms dependent on the direction and intersection distance
  3447.                     dx = 0
  3448.                     if move_right:
  3449.                         dx = platform_rect_list[cI].left - player_rect.right
  3450.                     if move_left:
  3451.                         dx = platform_rect_list[cI].right - player_rect.left
  3452.                     if move_hit:
  3453.                         dx = platform_rect_list[cI].left - player_rect.right
  3454.                     if move_hit2:
  3455.                         dx = platform_rect_list[cI].right - player_rect.left
  3456.  
  3457.                     for collid in collids:
  3458.                         collid.x -= dx
  3459.                         collid.get_rect()
  3460.                     for obj in object_list:
  3461.                         obj.x -= dx
  3462.                     for shot in shots:
  3463.                         shot.x -= dx
  3464.                     crate1.x -= dx
  3465.                     for bg in bgs:
  3466.                         bg.x -= dx
  3467.                     for cheese in cheeses:
  3468.                         cheese.x -= dx
  3469.                     for chef in chefs:
  3470.                         chef.x -= dx
  3471.                    
  3472.                     portal1.x -= dx
  3473.                     rop1.x -= dx  
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.         if not playerman.isJump:  
  3481.             playerman.y += playerman.fall
  3482.             playerman.fall += 0.8
  3483.             playerman.isJump = False
  3484.  
  3485.  
  3486.  
  3487.         # For player to get on top of platform
  3488.        
  3489.             collide = False
  3490.  
  3491.             for collid in collids:
  3492.                 if playerman.get_rect().colliderect(collid.rect):
  3493.                     collide = True
  3494.                     playerman.JumpCount = 10
  3495.                     right = True
  3496.                     left = True
  3497.                     playerman.y = collid.rect.top - playerman.height
  3498.                     if playerman.rect.right > collid.rect.left and playerman.rect.left < collid.rect.left - playerman.width:
  3499.                         playerman.x = collid.rect.left - playerman.width
  3500.                     if playerman.rect.left < collid.rect.right and playerman.rect.right > collid.rect.right + playerman.width:
  3501.                         playerman.x = collid.rect.right
  3502.  
  3503.                     if playerman.direction == "jump":
  3504.                         playerman.direction = "Idle"
  3505.                         if unpause111111 == 1:
  3506.                             land[1].play()
  3507.                             land[0].play()
  3508.  
  3509.                        
  3510.                     if playerman.direction == "jump2":
  3511.                         playerman.direction = "leftid"
  3512.                         if unpause111111 == 1:
  3513.                             land[1].play()
  3514.                             land[0].play()
  3515.                            
  3516.  
  3517.  
  3518.  
  3519.             if collide:
  3520.                 playerman.isJump = False
  3521.                 playerman.fall = 1
  3522.  
  3523.  
  3524.    
  3525.  
  3526.             # Player jumping
  3527.             if not playerman.direction == "DEath" and not playerman.direction == "DEath2":
  3528.                 if collide:
  3529.                     if keys[pygame.K_SPACE]:
  3530.                         playerman.isJump = True
  3531.                         right = False
  3532.                         left = False
  3533.                         if unpause11111 == 1:
  3534.                             jump.play()
  3535.                     playerman.fall = 0
  3536.  
  3537.         ##  playerman.isJump = False  <--  omit this line.  already False
  3538.             # What will happen when player jumps
  3539.         else:
  3540.  
  3541.             collideBottom = False
  3542.             for collid in collids:
  3543.                 if (playerman.get_rect().colliderect(collid.rect) and
  3544.                     playerman.y + playerman.height > collid.rect.bottom):
  3545.                    
  3546.                     collideBottom = True
  3547.                     playerman.y = collid.rect.bottom
  3548.                     break
  3549.  
  3550.             if not collideBottom and playerman.JumpCount >= 0:    
  3551.                 playerman.y -= (playerman.JumpCount*abs(playerman.JumpCount))*0.3
  3552.  
  3553.                 playerman.JumpCount -= 1
  3554.                 if playerman.direction == "right" or playerman.direction == "Idle":
  3555.                     playerman.direction = "jump"
  3556.  
  3557.                 if playerman.direction == "left" or playerman.direction == "leftid":
  3558.                     playerman.direction = "jump2"
  3559.  
  3560.  
  3561.  
  3562.  
  3563.             else:
  3564.                 playerman.isJump = False
  3565.                 playerman.JumpCount = 10
  3566.  
  3567.  
  3568.  
  3569.         # redrawing the window
  3570.         redraw()
  3571.         window.blit(window,(render_offset))
  3572.  
  3573.  
  3574.         # updating the game
  3575.         pygame.display.update()
  3576.  
  3577.  
  3578.     # quiting the game
  3579.     pygame.quit()
  3580.     unpause()
  3581.  
Add Comment
Please, Sign In to add comment