Guest User

Untitled

a guest
Jun 17th, 2020
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 78.63 KB | None | 0 0
  1. # this is for snow
  2. import time
  3. import random
  4. import sys
  5. #------------
  6.  
  7. import pygame
  8. import math
  9. pygame.init()
  10.  
  11. pygame.mixer.init()
  12.  
  13.  
  14. # this is for play again button
  15. quit = False
  16. while not quit:
  17.            
  18.  
  19.     # ----
  20.  
  21.  
  22.     music = pygame.mixer.music.load("backgroundsong.wav")
  23.     pygame.mixer.music.play(-1)
  24.  
  25.     # shooting sound
  26.     shootsound = pygame.mixer.Sound("shootsound.wav")
  27.  
  28.     # hit the ice bergs sound
  29.     icesound = pygame.mixer.Sound("shoot.wav")
  30.  
  31.     # hurt sound
  32.     hurtsound = pygame.mixer.Sound("hite.wav")
  33.  
  34.     # jumpsound
  35.     jumpsound = pygame.mixer.Sound("sjump.wav")
  36.  
  37.     #coin sound
  38.     coinsound = pygame.mixer.Sound("coinssound.wav")
  39.  
  40.     # enemy hit sound
  41.     hitesound = pygame.mixer.Sound("h.wav")
  42.  
  43.     # enemy death sound
  44.     deathsound = pygame.mixer.Sound("death.wav")
  45.  
  46.     # health gain
  47.     healthsound = pygame.mixer.Sound("pw.wav")
  48.  
  49.     # walking sound
  50.     icesound = pygame.mixer.Sound("ices.wav")
  51.  
  52.     # ---------------------------------
  53.  
  54.  
  55.  
  56.  
  57.     # window
  58.     window = pygame.display.set_mode((800,800))
  59.     pygame.display.set_caption("new World")
  60.     #
  61.     # error bloccks
  62.     erblock = pygame.image.load("error.png")
  63.  
  64.     # trees images
  65.     treo = pygame.image.load("tree.png")
  66.  
  67.     # mountains
  68.     mounto = pygame.image.load("mount.png")
  69.  
  70.     # platform images
  71.     blocks = pygame.image.load("block.png")
  72.  
  73.     # coins image
  74.     heart = pygame.image.load("ht.png")
  75.  
  76.     # heart image
  77.     heartingss = pygame.image.load("health.png")
  78.  
  79.  
  80.  
  81.     # define the shooting sound for the player ------------------------
  82.  
  83.  
  84.  
  85.  
  86.     #---------------------------------------------
  87.  
  88.  
  89.     # window
  90.     window = pygame.display.set_mode((800,800))
  91.     pygame.display.set_caption("new World")
  92.     #
  93.     # error bloccks
  94.     erblock = pygame.image.load("error.png")
  95.  
  96.     # trees images
  97.     treo = pygame.image.load("tree.png")
  98.  
  99.     # mountains
  100.     mounto = pygame.image.load("mount.png")
  101.  
  102.     # platform images
  103.     blocks = pygame.image.load("block.png")
  104.  
  105.     # coins image
  106.     heart = pygame.image.load("heart.png")
  107.  
  108.     # heart image
  109.     heartingss = pygame.image.load("health.png")
  110.  
  111.  
  112.  
  113.    
  114.  
  115.     #----------------------------------------------------------
  116.  
  117.     # this is for the chat with the villager
  118.    
  119.     def imagelol():
  120.         title5 = pygame.image.load("vill.png")
  121.         title5 = pygame.transform.scale(title5,(title5.get_width()-115,title5.get_height()-115))
  122.         window.blit(title5,(20,100))
  123.  
  124.  
  125.  
  126.  
  127.        
  128.     #---------------------------------------------------
  129.  
  130.     def button(msg,x,y,w,h,ic,ac,action=None):
  131.         mouse = pygame.mouse.get_pos()
  132.         click = pygame.mouse.get_pressed()
  133.         if x+w > mouse[0] > x and y+h > mouse[1] > y:
  134.             window.blit(window, ac,(x,y,w,h))
  135.             if click[0] == 1 and action != None:
  136.                 action()
  137.  
  138.     #------------------------------------------------------
  139.  
  140.  
  141.  
  142.  
  143.     def villtext():
  144.         red = (200,0,0)
  145.         green = (0,200,0)
  146.         bright_red = (255,0,0)
  147.         bright_green = (0,255,0)
  148.        
  149.  
  150.         button("",170,370,40,40,green,bright_green,imagelol)
  151.  
  152.  
  153.     # ---------------------------------------------------------------------
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.     #----------------------------------------------------------
  163.     # snow class
  164.  
  165.  
  166.     def quitlol():
  167.         pygame.quit()
  168.         print("You Have Exited The Game")
  169.  
  170.  
  171.     #---------------------------------------------------
  172.  
  173.     def button(msg,x,y,w,h,ic,ac,action=None):
  174.         mouse = pygame.mouse.get_pos()
  175.         click = pygame.mouse.get_pressed()
  176.  
  177.         if x+w > mouse[0] > x and y+h > mouse[1] > y:
  178.             pygame.draw.rect(window, ac,(x,y,w,h))
  179.             if click[0] == 1 and action != None:
  180.                 action()        
  181.         else:
  182.             pygame.draw.rect(window, ic,(x,y,w,h))
  183.         smallText = pygame.font.SysFont("comicsansms",20)
  184.         textSurf, textRect = text_objects(msg, smallText)
  185.         textRect.center = ( (x+(w/2)), (y+(h/2)) )
  186.         window.blit(textSurf, textRect)
  187.        
  188.     #------------------------------------------------------
  189.  
  190.  
  191.     def text_objects(text, font):
  192.         textSurface = font.render(text, True, black)
  193.         return textSurface, textSurface.get_rect()
  194.  
  195.     def game_intro():
  196.         red = (200,0,0)
  197.         green = (0,200,0)
  198.         bright_red = (255,0,0)
  199.         bright_green = (0,255,0)
  200.        
  201.         intro = True
  202.         while intro:
  203.             for event in pygame.event.get():
  204.                 #print(event)
  205.                 if event.type == pygame.QUIT:
  206.                     pygame.quit()
  207.                     quit()
  208.                    
  209.  
  210.             bks = pygame.image.load("game.png")
  211.             window.blit(bks,(0,0))
  212.  
  213.            
  214.  
  215.            
  216.             title5 = pygame.image.load("title.png")
  217.             title5 = pygame.transform.scale(title5,(title5.get_width()-115,title5.get_height()-115))
  218.             window.blit(title5,(20,100))
  219.             # start 1
  220.             bts1 = pygame.image.load("buts.png")
  221.             bts1 = pygame.transform.scale(bts1,(bts1.get_width()//6,bts1.get_height()//6))
  222.  
  223.             # start 2 button
  224.             bts2 = pygame.image.load("buts.png")
  225.             bts2 = pygame.transform.scale(bts2,(bts2.get_width()//5,bts2.get_height()//5))
  226.  
  227.  
  228.  
  229.             # quit 1
  230.             qu1 = pygame.image.load("quitbut.png")
  231.             qu1 = pygame.transform.scale(qu1,(qu1.get_width()//6,qu1.get_height()//6))
  232.  
  233.             # quit2 2 button
  234.             qu2 = pygame.image.load("quitbut.png")
  235.             qu2 = pygame.transform.scale(qu2,(qu2.get_width()//5,qu2.get_height()//5))
  236.             button("Start Game",320,380,190,60,green,bright_green,game_loop)
  237.             button("Quit Game",330,470,180,60,green,bright_green,quitlol)
  238.  
  239.             scrollbg = pygame.image.load("scrollup.png")
  240.             scrollbg = pygame.transform.scale(scrollbg,(scrollbg.get_width()-115,scrollbg.get_height()-115))
  241.             window.blit(scrollbg,(220,300))    
  242.  
  243.     # make the square brighter if collideded with the buttons
  244.             mouse = pygame.mouse.get_pos()
  245.             if 460+120 > mouse[0] > 280 and 350+100 > mouse[1] > 350:
  246.                 window.blit(bts2,(300,280))
  247.             else:
  248.                 window.blit(bts1,(300,300))
  249.  
  250.  
  251.  
  252.  
  253.                 # quit button
  254.             if 450+110 > mouse[0] > 280 and 450+50 > mouse[1] > 450:
  255.                 window.blit(qu2,(300,370))
  256.             else:
  257.                 window.blit(qu1,(300,390))
  258.     # ---------------------------------------------------------------------
  259.  
  260.  
  261.  
  262.             clock.tick(2160)
  263.  
  264.      
  265.             pygame.display.update()
  266.  
  267.  
  268.  
  269.     #----------------------------------------------------------
  270.  
  271.  
  272.        
  273.  
  274.  
  275.     # background
  276.     bg = pygame.image.load("bg.png")
  277.  
  278.  
  279.     # ice mountains
  280.     ice = pygame.image.load("ice1.png")
  281.  
  282.     #
  283.     icyy = pygame.image.load("ice2.png")
  284.     # player projectiles
  285.     slash = pygame.image.load("heart.png")
  286.      # space bar key
  287.     spi = [
  288.             pygame.image.load("j1.png"),
  289.             pygame.image.load("j2.png")]
  290.  
  291.     standingright = [pygame.image.load("d1.png"),
  292.                     pygame.image.load("d2.png"),
  293.                     pygame.image.load("d3.png"),
  294.                     pygame.image.load("d4.png"),
  295.                     pygame.image.load("d5.png"),
  296.                     pygame.image.load("d6.png"),
  297.                     pygame.image.load("d7.png"),
  298.                     pygame.image.load("d8.png"),
  299.                     pygame.image.load("d9.png"),
  300.                     pygame.image.load("d10.png"),
  301.                     pygame.image.load("d11.png"),
  302.                     pygame.image.load("d12.png"),
  303.                     pygame.image.load("d13.png"),
  304.                     pygame.image.load("d14.png"),
  305.                     pygame.image.load("d15.png")]
  306.  
  307.     standingleft =[pygame.image.load("s1.png"),
  308.                 pygame.image.load("s2.png"),
  309.                 pygame.image.load("s3.png"),
  310.                 pygame.image.load("s4.png"),
  311.                 pygame.image.load("s5.png"),
  312.                 pygame.image.load("s6.png"),
  313.                 pygame.image.load("s7.png"),
  314.                 pygame.image.load("s8.png"),
  315.                 pygame.image.load("s9.png"),
  316.                 pygame.image.load("s10.png"),
  317.                 pygame.image.load("s11.png"),
  318.                 pygame.image.load("s12.png"),
  319.                 pygame.image.load("s13.png"),
  320.                 pygame.image.load("s14.png"),
  321.                 pygame.image.load("s15.png")]
  322.  
  323.  
  324.  
  325.     rights = [pygame.image.load("L1.png"),
  326.             pygame.image.load("L2.png"),
  327.             pygame.image.load("L3.png"),
  328.             pygame.image.load("L4.png"),
  329.             pygame.image.load("L5.png"),
  330.             pygame.image.load("L6.png"),
  331.             pygame.image.load("L7.png"),
  332.             pygame.image.load("L8.png"),
  333.             pygame.image.load("L9.png"),
  334.             pygame.image.load("L10.png"),
  335.             pygame.image.load("L11.png"),
  336.             pygame.image.load("L12.png"),
  337.             pygame.image.load("L13.png"),
  338.             pygame.image.load("L14.png"),
  339.             pygame.image.load("L15.png")]
  340.  
  341.  
  342.     lefts = [pygame.image.load("e1.png"),
  343.             pygame.image.load("e2.png"),
  344.             pygame.image.load("e3.png"),
  345.             pygame.image.load("e4.png"),
  346.             pygame.image.load("e5.png"),
  347.             pygame.image.load("e6.png"),
  348.             pygame.image.load("e7.png"),
  349.             pygame.image.load("e8.png"),
  350.             pygame.image.load("e9.png"),
  351.             pygame.image.load("e10.png"),
  352.             pygame.image.load("e11.png"),
  353.             pygame.image.load("e12.png"),
  354.             pygame.image.load("e13.png"),
  355.             pygame.image.load("e14.png"),
  356.             pygame.image.load("e15.png")]
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.     # trees
  365.     tree = pygame.image.load("treo.png")
  366.  
  367.     # bushes
  368.     bushes = pygame.image.load("bush.png")
  369.     #
  370.     class tree:
  371.         def __init__(self,x,y,height,width,color):
  372.             self.x = x
  373.             self.y = y
  374.             self.height = height
  375.             self.width = width
  376.             self.errors = pygame.image.load("treo.png")
  377.             self.color = color
  378.             self.rect = pygame.Rect(x,y,height,width)
  379.         def draw(self):
  380.             self.rect.topleft = (self.x,self.y)
  381.             window.blit(self.errors,self.rect)
  382.     black = (0,0,0)
  383.     tree1 = tree(150,300,60,60,black)
  384.     trees = [tree1]
  385.  
  386.  
  387.     class bush:
  388.         def __init__(self,x,y,height,width,color):
  389.             self.x = x
  390.             self.y = y
  391.             self.height = height
  392.             self.width = width
  393.             self.errors = pygame.image.load("bush.png")
  394.             self.color = color
  395.             self.rect = pygame.Rect(x,y,height,width)
  396.         def draw(self):
  397.             self.rect.topleft = (self.x,self.y)
  398.             window.blit(self.errors,self.rect)
  399.     bush1 = bush(-987210,-87510,100,100,black)
  400.     bushes = [bush1]
  401.        
  402.     # erro block class
  403.     class error:
  404.         def __init__(self,x,y,height,width,color):
  405.             self.x = x
  406.             self.y = y
  407.             self.height = height
  408.             self.width = width
  409.             self.erblock = pygame.image.load("error.png")
  410.             self.color = color
  411.             self.rect = pygame.Rect(x,y,height,width)
  412.         def draw(self):
  413.             self.rect.topleft = (self.x,self.y)
  414.             player_rect = erblock.get_rect(center = self.rect.center)
  415.             player_rect.centerx += 20 # 10 is just an example
  416.             player_rect.centery += -20 # 15 is just an example
  417.             window.blit(self.erblock,self.rect)
  418.     white = (255,255,255)
  419.     error1 = error(-60,504,50,50,white)
  420.     errors = [error1]
  421.     platformGroup = pygame.sprite.Group
  422.     platformList = []
  423.     level = ["p                                     ",
  424.              "p                                       ",
  425.              "p                                   ",
  426.              "p                                      ",
  427.              "p                                 ",
  428.              "p                                  ",
  429.              "p                                      ",
  430.              "p                                      ",
  431.              "p                                    ",
  432.              "p                                   ",
  433.              "                    ",]
  434.     for iy, row in enumerate(level):
  435.         for ix, col in enumerate(row):
  436.             if col == "p":
  437.                 new_platforms = error(-60, iy*70, 50,60,(255,255,255))
  438.                 errors.append(new_platforms)
  439.  
  440.  
  441.     # my players class
  442.     # player class
  443.  
  444.     class player:
  445.         def __init__(self,x,y,height,width,color):
  446.             self.x = x
  447.             self.y = y
  448.             self.color = color
  449.             self.height  = height
  450.             self.width = width
  451.             self.speed = 5
  452.             self.isJump = False
  453.             self.JumpCount = 10
  454.             self.fall = 0
  455.             #hit box
  456.             self.hitbox = (self.x + 20, self.y, 28, 60)
  457.             self.stand = pygame.image.load("stands.png")
  458.             self.rights = [pygame.image.load("L1.png"),
  459.             pygame.image.load("L2.png"),
  460.             pygame.image.load("L3.png"),
  461.             pygame.image.load("L4.png"),
  462.             pygame.image.load("L5.png"),
  463.             pygame.image.load("L6.png"),
  464.             pygame.image.load("L7.png"),
  465.             pygame.image.load("L8.png"),
  466.             pygame.image.load("L9.png"),
  467.             pygame.image.load("L10.png"),
  468.             pygame.image.load("L11.png"),
  469.             pygame.image.load("L12.png"),
  470.             pygame.image.load("L13.png"),
  471.             pygame.image.load("L14.png"),
  472.             pygame.image.load("L15.png")]
  473.             self.lefts = [pygame.image.load("e1.png"),
  474.             pygame.image.load("e2.png"),
  475.             pygame.image.load("e3.png"),
  476.             pygame.image.load("e4.png"),
  477.             pygame.image.load("e5.png"),
  478.             pygame.image.load("e6.png"),
  479.             pygame.image.load("e7.png"),
  480.             pygame.image.load("e8.png"),
  481.             pygame.image.load("e9.png"),
  482.             pygame.image.load("e10.png"),
  483.             pygame.image.load("e11.png"),
  484.             pygame.image.load("e12.png"),
  485.             pygame.image.load("e13.png"),
  486.             pygame.image.load("e14.png"),
  487.             pygame.image.load("e15.png")]
  488.             self.standingright = [pygame.image.load("d1.png"),
  489.                     pygame.image.load("d2.png"),
  490.                     pygame.image.load("d3.png"),
  491.                     pygame.image.load("d4.png"),
  492.                     pygame.image.load("d5.png"),
  493.                     pygame.image.load("d6.png"),
  494.                     pygame.image.load("d7.png"),
  495.                     pygame.image.load("d8.png"),
  496.                     pygame.image.load("d9.png"),
  497.                     pygame.image.load("d10.png"),
  498.                     pygame.image.load("d11.png"),
  499.                     pygame.image.load("d12.png"),
  500.                     pygame.image.load("d13.png"),
  501.                     pygame.image.load("d14.png"),
  502.                     pygame.image.load("d15.png")]
  503.             self.standingleft =[pygame.image.load("s1.png"),
  504.                 pygame.image.load("s2.png"),
  505.                 pygame.image.load("s3.png"),
  506.                 pygame.image.load("s4.png"),
  507.                 pygame.image.load("s5.png"),
  508.                 pygame.image.load("s6.png"),
  509.                 pygame.image.load("s7.png"),
  510.                 pygame.image.load("s8.png"),
  511.                 pygame.image.load("s9.png"),
  512.                 pygame.image.load("s10.png"),
  513.                 pygame.image.load("s11.png"),
  514.                 pygame.image.load("s12.png"),
  515.                 pygame.image.load("s13.png"),
  516.                 pygame.image.load("s14.png"),
  517.                 pygame.image.load("s15.png")]
  518.             self.rights = [pygame.transform.scale(image,(image.get_width()//5,image.get_height()//5)) for image in self.rights]
  519.             self.lefts = [pygame.transform.scale(image,(image.get_width()//5,image.get_height()//5)) for image in self.lefts]
  520.             self.standingright = [pygame.transform.scale(image,(image.get_width()//5,image.get_height()//5)) for image in self.standingright]
  521.             self.standingleft = [pygame.transform.scale(image,(image.get_width()//5,image.get_height()//5)) for image in self.standingleft]
  522.             self.bo_index = 0
  523.             self.anim_index = 0
  524.             self.stans_index = 0
  525.             self.direction = "right"
  526.             self.direction = "left"
  527.             self.direction = "standright"
  528.             self.direction = "standleft"
  529.             self.health = 10
  530.             self.hitbox = (self.x + -30, self.y + 0, 31, 57)
  531.             # playerman hitbox
  532.             self.hits = (self.x + 20, self.y, 28,60)
  533.  
  534.             self.rect = pygame.rect = pygame.Rect(self.x,self.y,width, height)
  535.  
  536.  
  537.  
  538.         def draw(self):
  539.             self.rect.topleft = (self.x,self.y)
  540.  
  541.             if self.direction == "right":
  542.                 image_list = self.rights
  543.             elif self.direction == "standright":
  544.                 image_list = self.standingright
  545.             elif self.direction == "left":
  546.                 image_list = self.lefts
  547.             else:
  548.                 image_list = self.standingleft
  549.  
  550.             if self.anim_index >= len(image_list):
  551.                 self.anim_index = 0
  552.             player_image = image_list[self.anim_index]
  553.             self.anim_index += 1
  554.  
  555.             player_rect = player_image.get_rect(center = self.rect.center)
  556.             player_rect.centerx += 20 # 10 is just an example
  557.             player_rect.centery += -9 # 15 is just an example
  558.             window.blit(player_image, player_rect)
  559.             self.hits = (self.x + 20, self.y, 28,60)
  560.             pygame.draw.rect(window, (255,0,0), (self.hitbox[0], self.hitbox[1] - 40, 80, 10)) # NEW
  561.             pygame.draw.rect(window, (0,255,0), (self.hitbox[0], self.hitbox[1] - 40, 80 - (5 * (10 - self.health)), 10))
  562.             self.hitbox = (self.x + -30, self.y + 0, 31, 57)
  563.  
  564.  
  565.     # health icon
  566.     heat = pygame.image.load("health.png")
  567.     # player icon
  568.     icon = pygame.image.load("icon.png")
  569.  
  570.  
  571.     # floor platforms class
  572.     class platform:
  573.         def __init__(self,x,y,height,width,color):
  574.             self.x = x
  575.             self.y = y
  576.             self.height = height
  577.             self.width = width
  578.             self.color = color
  579.             self.blocks = pygame.image.load("block.png")
  580.             self.rect = pygame.Rect(x,y,height,width)
  581.         def draw(self):
  582.             self.rect.topleft = (self.x,self.y)
  583.             window.blit(self.blocks,self.rect)
  584.  
  585.  
  586.            
  587.     # trees class
  588.     class icess:
  589.         def __init__(self,x,y,height,width,color):
  590.             self.x = x
  591.             self.y = y
  592.             self.height = height
  593.             self.width = width
  594.             self.color = color
  595.             self.icyy = pygame.image.load("ice2.png")
  596.             self.icyy = pygame.transform.scale(self.icyy,(self.icyy.get_width()-44,self.icyy.get_height()-44))
  597.             self.rect = pygame.Rect(x,y,height,width)
  598.             self.hitbox = (self.x + 5, self.y + 1, 10, 72)
  599.         def draw(self):
  600.             self.rect.topleft = (self.x,self.y)
  601.             player_rect = icyy.get_rect(center = self.rect.center)
  602.             player_rect.centerx += 0 # 10 is just an example
  603.             player_rect.centery += -50 # 15 is just an example
  604.             window.blit(icyy, player_rect)
  605.             self.hitbox = (self.x + 5, self.y + 1, 10, 72)
  606.     black = (0,0,0)
  607.     ice1 = icess(255450,16540,50434,134320,black)
  608.     icing = [ice1]
  609.     #
  610.  
  611.     class dice:
  612.         def __init__(self,x,y,height,width,color):
  613.             self.x = x
  614.             self.y = y
  615.             self.height = height
  616.             self.width = width
  617.             self.color = color
  618.             self.ice = pygame.image.load("ice1.png")
  619.             self.ice = pygame.transform.scale(self.ice,(self.ice.get_width()-44,self.ice.get_height()-44))
  620.             self.rect = pygame.Rect(x,y,height,width)
  621.             # the hitbox our projectiles will be colliding with
  622.             self.hitbox = (self.x + 0, self.y + 1, 10, 72)
  623.         def draw(self):
  624.             self.rect.topleft = (self.x,self.y)
  625.             player_rect = ice.get_rect(center = self.rect.center)
  626.             player_rect.centerx += -14 # 10 is just an example
  627.             player_rect.centery += -15 # 15 is just an example
  628.             window.blit(ice, player_rect)
  629.             # hit box our projectile will be colliding with
  630.             self.hitbox = (self.x + 0, self.y + 1, 10, 72)
  631.  
  632.  
  633.     black = (0,0,0)
  634.     ice2 = dice(254550,494540,10,30,black)
  635.     dicing = [ice2]
  636.  
  637.  
  638.  
  639.  
  640.     # coins class
  641.     htb = pygame.image.load("ht.png")
  642.     class coin:
  643.         def __init__(self,x,y,height,width,color):
  644.             self.x = x
  645.             self.y = y
  646.             self.htb = pygame.image.load("ht.png")
  647.             self.height = height
  648.             self.width = width
  649.             self.color = color
  650.             self.rect = pygame.Rect(x,y,height,width)
  651.         def draw(self):
  652.             self.rect.topleft = (self.x,self.y)
  653.             player_rect = heart.get_rect(center = self.rect.center)
  654.             player_rect.centerx += 0 # 10 is just an example
  655.             player_rect.centery += 0 # 15 is just an example
  656.             window.blit(heart, player_rect)
  657.  
  658.  
  659.     # bullet class
  660.  
  661.  
  662.     class projectile(object):
  663.        def __init__(self, x, y, dirx, diry, color):
  664.            self.x = x
  665.            self.y = y
  666.            self.dirx = dirx
  667.            self.diry = diry
  668.            self.slash = pygame.image.load("heart.png")
  669.            self.rect  = self.slash.get_rect()
  670.            self.rect.topleft = ( self.x, self.y )
  671.            self.speed = 10
  672.            self.color = color
  673.        def move(self):
  674.            self.x += self.dirx * self.speed
  675.            self.y += self.diry * self.speed
  676.        def draw(self, window):
  677.            self.rect.topleft = (round(self.x), round(self.y))
  678.            window.blit(self.slash,self.rect)
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.     sigh  = pygame.image.load("alert.png")
  688.     class alrt:
  689.         def __init__(self,x,y,height,width,color):
  690.             self.x = x
  691.             self.y = y
  692.             self.sigh = pygame.image.load("alert.png")
  693.             self.sigh = pygame.transform.scale(self.sigh,(self.sigh.get_width()*3,self.sigh.get_height()*3))
  694.             self.height = height
  695.             self.width = width
  696.             self.color = color
  697.             self.rect = pygame.Rect(x,y,height,width)
  698.         def draw(self):
  699.             self.rect.topleft = (self.x,self.y)
  700.             player_rect = sigh.get_rect(center = self.rect.center)
  701.             player_rect.centerx += 10 # 10 is just an example
  702.             player_rect.centery += -15 # 15 is just an example
  703.             window.blit(self.sigh,self.rect)
  704.     black  = (0,0,0)
  705.     alert1 = alrt(170,370,50,50,black)
  706.     alerting = [alert1]
  707.  
  708.     # exit image
  709.     exits = pygame.image.load("exit.png")
  710.     class exi:
  711.         def __init__(self,x,y,height,width,color):
  712.             self.x = x
  713.             self.y = y
  714.             self.color = color
  715.             self.height = height
  716.             self.width  = width
  717.             self.exits = pygame.image.load("exit.png")
  718.             self.exits = pygame.transform.scale(self.exits,(self.exits.get_width()*3,self.exits.get_height()*3))
  719.             self.rect = pygame.Rect(x,y,height,width)
  720.         def draw(self):
  721.             self.rect.topleft = (self.x,self.y)
  722.             window.blit(self.exits,self.rect)
  723.  
  724.     # define the text class
  725.     black = (0,0,0)
  726.     exit1 = exi(160,140,40,40,black)
  727.     exiting = [exit1]
  728.  
  729.  
  730.     # text imgae
  731.     te = pygame.image.load("text.png")
  732.     # text class
  733.     class texto:
  734.         def __init__(self,x,y,height,width,color):
  735.             self.x = x
  736.             self.y = y
  737.             self.height = height
  738.             self.width = width
  739.             self.color = color
  740.             self.te = pygame.image.load("text.png")
  741.             self.te = pygame.transform.scale(self.te,(self.te.get_width()-20,self.te.get_height()-20))
  742.             self.rect = pygame.Rect(x,y,height,width)
  743.         def draw(self):
  744.             self.rect.topleft = (self.x,self.y)
  745.             window.blit(self.te,self.rect)
  746.             pygame.draw.rect(window,self.color,self.rect)
  747.     # define text class
  748.     black = (0,0,0)
  749.     text1 = texto(50,100,50,50,black)
  750.     texting = [text1]
  751.  
  752.  
  753.     # house image
  754.     housee = pygame.image.load("house.png")
  755.     # house
  756.     class house:
  757.         def __init__(self,x,y,height,width,color):
  758.             self.x = x
  759.             self.y =y
  760.             self.height = height
  761.             self.width = width
  762.             self.color = color
  763.             self.housee = pygame.image.load("house.png")
  764.             self.rect = pygame.Rect(x,y,height,width)
  765.         def draw(self):
  766.             self.rect.topleft = (self.x,self.y)
  767.             window.blit(self.housee,self.rect)
  768.     # define the house class
  769.     white = (255,255,255)
  770.     house1 = house(50,290,60,60,white)
  771.     housing = [house1]
  772.     # player image
  773.     man = [pygame.image.load("i1.png"),
  774.         pygame.image.load("i1.png"),
  775.         pygame.image.load("i2.png"),
  776.         pygame.image.load("i3.png"),
  777.         pygame.image.load("i4.png"),
  778.         pygame.image.load("i5.png"),
  779.         pygame.image.load("i6.png"),
  780.         pygame.image.load("i7.png"),
  781.         pygame.image.load("i8.png"),
  782.         pygame.image.load("i9.png"),
  783.         pygame.image.load("i10.png"),
  784.         pygame.image.load("i11.png"),
  785.         pygame.image.load("i12.png"),
  786.         pygame.image.load("i13.png"),
  787.         pygame.image.load("i14.png"),
  788.         pygame.image.load("i15.png")]
  789.  
  790.  
  791.  
  792.     # player villager
  793.     class villager:
  794.         def __init__(self,x,y,height,width,color):
  795.             self.x = x
  796.             self.y = y
  797.             self.height = height
  798.             self.width = width
  799.             self.color = color
  800.             self.man =[
  801.             pygame.image.load("i1.png"),
  802.             pygame.image.load("i1.png"),
  803.             pygame.image.load("i2.png"),
  804.             pygame.image.load("i3.png"),
  805.             pygame.image.load("i4.png"),
  806.             pygame.image.load("i5.png"),
  807.             pygame.image.load("i6.png"),
  808.             pygame.image.load("i7.png"),
  809.             pygame.image.load("i8.png"),
  810.             pygame.image.load("i9.png"),
  811.             pygame.image.load("i10.png"),
  812.             pygame.image.load("i11.png"),
  813.             pygame.image.load("i12.png"),
  814.             pygame.image.load("i13.png"),
  815.             pygame.image.load("i14.png"),
  816.             pygame.image.load("i15.png")]
  817.             self.direction = "so"
  818.             self.anim_index = 0
  819.             self.so_index = 0
  820.             self.man = [pygame.transform.scale(image,(image.get_width()//5,image.get_height()//5)) for image in self.man]
  821.             self.rect = pygame.Rect(x,y,height,width)
  822.         def draw(self):
  823.             self.rect.topleft = (self.x,self.y)
  824.             if self.direction == "so":
  825.                 window.blit(self.man[self.anim_index], self.rect)
  826.  
  827.                 self.anim_index += 1
  828.                 if self.anim_index == len(self.man):
  829.                     self.anim_index = 0
  830.  
  831.  
  832.  
  833.     # image of the sigh
  834.     sighimage = pygame.image.load("sigh.png")
  835.     # level 1 sigh class
  836.     class sign:
  837.         def __init__(self,x,y,height,width,color):
  838.             self.x = x
  839.             self.y = y
  840.             self.color = color
  841.             self.height = height
  842.             self.width = width
  843.             self.sighimage = pygame.image.load("sigh.png")
  844.             self.sighimage = pygame.transform.scale(self.sighimage,(self.sighimage.get_width()-10,self.sighimage.get_height()-10))
  845.             self.rect = pygame.Rect(x,y,height,width)
  846.         def draw(self):
  847.             self.rect.topleft = (self.x,self.y)
  848.             window.blit(self.sighimage,self.rect)
  849.  
  850.     # define level 1 sighn
  851.     black = (0,0,0)
  852.     sighn1 = sign(-33,300,50,50,black)
  853.     signs = [sighn1]
  854.  
  855.  
  856.  
  857.     # enemy animations
  858.     esleft = [pygame.image.load("esleft1.png"),
  859.             pygame.image.load("esleft1.png"),
  860.             pygame.image.load("esleft2.png"),
  861.             pygame.image.load("esleft3.png"),
  862.             pygame.image.load("esleft4.png"),
  863.             pygame.image.load("esleft5.png"),
  864.             pygame.image.load("esleft6.png"),
  865.             pygame.image.load("esleft7.png"),
  866.             pygame.image.load("esleft8.png"),
  867.             pygame.image.load("esleft9.png"),
  868.             pygame.image.load("esleft10.png"),
  869.             pygame.image.load("esleft11.png"),
  870.             pygame.image.load("esleft12.png"),
  871.             pygame.image.load("esleft13.png"),
  872.             pygame.image.load("esleft14.png"),
  873.             pygame.image.load("esleft15.png"),
  874.             pygame.image.load("esleft16.png"),
  875.             pygame.image.load("esleft17.png"),
  876.                               ]
  877.  
  878.  
  879.     esright = [pygame.image.load("esright1.png"),
  880.             pygame.image.load("esright1.png"),
  881.             pygame.image.load("esright2.png"),
  882.             pygame.image.load("esright3.png"),
  883.             pygame.image.load("esright4.png"),
  884.             pygame.image.load("esright5.png"),
  885.             pygame.image.load("esright6.png"),
  886.             pygame.image.load("esright7.png"),
  887.             pygame.image.load("esright8.png"),
  888.             pygame.image.load("esright9.png"),
  889.             pygame.image.load("esright10.png"),
  890.             pygame.image.load("esright11.png"),
  891.             pygame.image.load("esright12.png"),
  892.             pygame.image.load("esright13.png"),
  893.             pygame.image.load("esright14.png"),
  894.             pygame.image.load("esright15.png"),
  895.             pygame.image.load("esright16.png"),
  896.             pygame.image.load("esright17.png"),
  897.                               ]
  898.  
  899.  
  900.     class enemys:
  901.         def __init__(self,x,y,height,width,end):
  902.             self.x = x
  903.             self.y =y
  904.             self.esright = [pygame.image.load("esright1.png"),
  905.             pygame.image.load("esright1.png"),
  906.             pygame.image.load("esright2.png"),
  907.             pygame.image.load("esright3.png"),
  908.             pygame.image.load("esright4.png"),
  909.             pygame.image.load("esright5.png"),
  910.             pygame.image.load("esright6.png"),
  911.             pygame.image.load("esright7.png"),
  912.             pygame.image.load("esright8.png"),
  913.             pygame.image.load("esright9.png"),
  914.             pygame.image.load("esright10.png"),
  915.             pygame.image.load("esright11.png"),
  916.             pygame.image.load("esright12.png"),
  917.             pygame.image.load("esright13.png"),
  918.             pygame.image.load("esright14.png"),
  919.             pygame.image.load("esright15.png"),
  920.             pygame.image.load("esright16.png"),
  921.             pygame.image.load("esright17.png"),
  922.                               ]
  923.             self.esleft = [pygame.image.load("esleft1.png"),
  924.             pygame.image.load("esleft1.png"),
  925.             pygame.image.load("esleft2.png"),
  926.             pygame.image.load("esleft3.png"),
  927.             pygame.image.load("esleft4.png"),
  928.             pygame.image.load("esleft5.png"),
  929.             pygame.image.load("esleft6.png"),
  930.             pygame.image.load("esleft7.png"),
  931.             pygame.image.load("esleft8.png"),
  932.             pygame.image.load("esleft9.png"),
  933.             pygame.image.load("esleft10.png"),
  934.             pygame.image.load("esleft11.png"),
  935.             pygame.image.load("esleft12.png"),
  936.             pygame.image.load("esleft13.png"),
  937.             pygame.image.load("esleft14.png"),
  938.             pygame.image.load("esleft15.png"),
  939.             pygame.image.load("esleft16.png"),
  940.             pygame.image.load("esleft17.png"),
  941.                               ]
  942.             self.esright = [pygame.transform.scale(image,(image.get_width()//3,image.get_height()//3)) for image in self.esright]
  943.             self.esleft = [pygame.transform.scale(image,(image.get_width()//3,image.get_height()//3)) for image in self.esleft]
  944.             self.height = height
  945.             self.width = width
  946.             self.anim_index = 0
  947.             self.distance = 80
  948.             self.speed = 8
  949.             self.vel = 3
  950.             self.path = [x,end]
  951.             self.Walking_index = 0
  952.             self.hitbox = (self.x + 17, self.y + 2, 31, 57)
  953.             self.rect = pygame.Rect(x,y,height,width)
  954.             COOLDOWN = 30
  955.             # enemys health
  956.             self.health = 10
  957.             self.visible = True
  958.  
  959.         # this makes the enemy move right and left
  960.         def draw(self,window):
  961.             self.move()
  962.             if self.Walking_index + 1 >= 33:
  963.                 self.Walking_index = 0
  964.             if self.vel > 0:
  965.                 window.blit(self.esright[self.Walking_index//3], (self.x,self.y))
  966.                 self.Walking_index += 1
  967.             else:
  968.                 window.blit(self.esleft[self.Walking_index//3], (self.x,self.y))
  969.                 self.Walking_index += 1
  970.  
  971.     # this moves the enemy left and right
  972.         def move(self):
  973.             if self.visible:
  974.                 if self.vel > 0:
  975.                    if self.x + self.vel < self.path[1]:
  976.                        self.x += self.vel
  977.                    else:
  978.                        self.vel = self.vel * -1
  979.                        self.Walking_index = 0
  980.                 else:
  981.                    if self.x - self.vel >  self.path[0]:
  982.                        self.x += self.vel
  983.                    else:
  984.                        self.vel = self.vel * -1
  985.                        self.Walking_index = 0
  986.                     # the hit box for the enemy the health
  987.                 pygame.draw.rect(window, (255,0,0), (self.hitbox[0], self.hitbox[1] - 20, 70, 10)) # NEW
  988.                 pygame.draw.rect(window, (0,255,0), (self.hitbox[0], self.hitbox[1] - 20, 70 - (5 * (10 - self.health)), 10))
  989.                 self.hitbox = (self.x + 47, self.y + 31, 50, 72)
  990.  
  991.      
  992.     # THIS PART MAKES  the enemy not scroll with the player
  993.         def scroll(self,sx, sy):
  994.             self.x += sx
  995.             self.y += sy
  996.             self.path[0] += sx
  997.             self.path[1] += sx
  998.  
  999.  
  1000.  
  1001.     #-----------------------------------------------------------------------------------------------------
  1002.  
  1003.     smallice = pygame.image.load("fals.png")
  1004.     class smallice:
  1005.         def __init__(self,x,y,height,width,color):
  1006.             self.x = x
  1007.             self.y = y
  1008.             self.height = height
  1009.             self.width = width
  1010.             self.color = color
  1011.             self.smallice = pygame.image.load("fals.png")
  1012.             self.smallice = pygame.transform.scale(self.smallice,(self.smallice.get_width()-2,self.smallice.get_height()-2))
  1013.             self.rect = pygame.Rect(x,y,height,width)
  1014.             self.hits = (self.x + 20, self.y, 28,60)
  1015.             self.health = 10
  1016.             # the hitbox our projectiles will be colliding with
  1017.             self.hitbox = (self.x + 0, self.y + 1, 10, 72)
  1018.         def draw(self):
  1019.             self.rect.topleft = (self.x,self.y)
  1020.             player_rect = self.smallice.get_rect(center = self.rect.center)
  1021.             player_rect.centerx += 0 # 10 is just an example
  1022.             player_rect.centery += 70 # 15 is just an example
  1023.             window.blit(self.smallice, player_rect)
  1024.             self.hits = (self.x + 20, self.y, 28,60)
  1025.             pygame.draw.rect(window, (255,0,0), (self.hitbox[0], self.hitbox[1] - 60, 50, 10)) # NEW
  1026.             pygame.draw.rect(window, (0,255,0), (self.hitbox[0], self.hitbox[1] - 60, 50 - (5 * (10 - self.health)), 10))
  1027.             self.hitbox = (self.x + -20, self.y + 30, 31, 57)
  1028.  
  1029.     # define the small ices
  1030.     black = (0,0,0)
  1031.     smallice1 = smallice(550,215,20,20,black)
  1032.     smallice2 = smallice(750,215,20,20,black)
  1033.     smallice3 = smallice(950,215,20,20,black)
  1034.     smallice4 = smallice(1110,215,20,20,black)
  1035.     small = [smallice1]
  1036.     smalls = [smallice2]
  1037.     smallss = [smallice3]
  1038.     smallsss = [smallice4]
  1039.  
  1040.     # enemys bullets
  1041.     littleice = pygame.image.load("littleboy.png")
  1042.     class Bullet(object):
  1043.        def __init__(self, x, y,color):
  1044.            self.x = x
  1045.            self.y = y
  1046.            self.littleice = pygame.image.load("littleboy.png")
  1047.            self.hitbox  = self.littleice.get_rect()
  1048.            self.rect  = self.littleice.get_rect()
  1049.            self.rect.topleft = (self.x,self.y)
  1050.            self.speed = 10
  1051.            self.color = color
  1052.            self.hitbox = (self.x + 57, self.y + 33, 29, 52) # NEW
  1053.        def draw(self, window):
  1054.             self.rect.topleft = (self.x,self.y)
  1055.             player_rect = self.littleice.get_rect(center = self.rect.center)
  1056.             player_rect.centerx += 0 # 10 is just an example
  1057.             player_rect.centery += 0 # 15 is just an example
  1058.             window.blit(self.littleice, player_rect)
  1059.             self.hitbox = (self.x + 97, self.y + 33, 10, 10) # NEW
  1060.             window.blit(self.littleice,self.rect)
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.     #---------------------------------------------------------------------------------------------
  1068.  
  1069.  
  1070.  
  1071.  
  1072.            
  1073.  
  1074.  
  1075.  
  1076.     # enemy icon image
  1077.     enemyi = pygame.image.load("ei.png")
  1078.     # enemy icon class
  1079.     class enemyicon:
  1080.         def __init__(self,x,y,height,width,color):
  1081.             self.x = x
  1082.             self.y  = y
  1083.             self.height = height
  1084.             self.width = width
  1085.             self.color  = color
  1086.             self.enemyi = pygame.image.load("ei.png")
  1087.             self.rect = pygame.Rect(x,y,height,width)
  1088.             self.enemyi = pygame.transform.scale(self.enemyi,(self.enemyi.get_width()//3,self.enemyi.get_height()//3))
  1089.         def draw(self):
  1090.             self.rect.topleft = (self.x,self.y)
  1091.             window.blit(self.enemyi,self.rect)
  1092.  
  1093.  
  1094.  
  1095.  
  1096.     # hurt image
  1097.     hurts = [pygame.image.load("HURT1.png"),
  1098.             pygame.image.load("HURT2.png"),
  1099.             pygame.image.load("HURT3.png"),
  1100.             pygame.image.load("HURT4.png")]
  1101.                  
  1102.                                
  1103.                              
  1104.     def hurt():
  1105.         delay = 105
  1106.         next_frame = pygame.time.get_ticks() + delay
  1107.         if pygame.time.get_ticks() >= next_frame:
  1108.             next_frame = pygame.time.get_ticks() + delay
  1109.             hurts = [pygame.image.load("HURT1.png"),
  1110.                 pygame.image.load("HURT2.png"),
  1111.                 pygame.image.load("HURT3.png"),
  1112.                 pygame.image.load("HURT4.png")]
  1113.                  
  1114.        
  1115.        
  1116.  
  1117.            
  1118.     # define enemy icon class
  1119.     black = (0,0,0)
  1120.     enemyi1 = enemyicon(40,90,50,50,black)
  1121.     enemyicons = [enemyi1]
  1122.        
  1123.     # define the enemy class
  1124.     black = (0,0,0)
  1125.     enemys1 = enemys(400,399,104,64,500)
  1126.     enemys2 = enemys(650,399,104,64,900)
  1127.     enemying = [enemys1]
  1128.     enemyings = [enemys2]
  1129.  
  1130.  
  1131.     # define the villager class
  1132.     red = (255,255,0)
  1133.     villager1 = villager(150,400,20,20,red)
  1134.     villaging = [villager1]
  1135.  
  1136.  
  1137.     black = (0,0,0)
  1138.     white = (255,255,255)
  1139.     green = (0,255,0)
  1140.  
  1141.  
  1142.  
  1143.            
  1144.  
  1145.     #_------
  1146.  
  1147.  
  1148.     # colors
  1149.     White = (255,255,255)
  1150.     Black = ((0,0,0))
  1151.     Yellow = ((231,253,0))
  1152.  
  1153.     # frames per second
  1154.     FPS = 60
  1155.     clock = pygame.time.Clock()
  1156.  
  1157.  
  1158.     # define player class
  1159.     playerman = player(50,460,60,30,Black)
  1160.  
  1161.     # coins
  1162.     coin1 = coin(340,450,30,30, Yellow)
  1163.     coin2 = coin(370,450,30,30, Yellow)
  1164.     coin3 = coin(370,420,30,30, Yellow)
  1165.     coin4 = coin(340,420,30,30, Yellow)
  1166.     coin5 = coin(480,450,30,30, Yellow)
  1167.     coin6 = coin(530,450,30,30, Yellow)
  1168.  
  1169.     Coins_list = [coin1,coin2,coin3,coin4,coin5,coin6]
  1170.  
  1171.  
  1172.  
  1173.     # enemy base
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.     # define platforms class
  1181.     plat = platform(-1000,500,6310,20,White)
  1182.     platforms = [plat]
  1183.     platformGroup = pygame.sprite.Group
  1184.     platformList = []
  1185.     level = ["                                                                                                                                                                    ",
  1186.              "                                                                                                                                                            t                     ",
  1187.              "              to      to      to     to      to      to     to      to      to     to      to      to                                                                                                                           ",
  1188.              "p      p      p      p      p      p      p      p      p      p      p      p      p      p      p      p      p     p     p     p      p      p      p      p      p      p      p      p      p      p      p      p      p      p      p      p     p     p     ",
  1189.              "                                                                                                                                                                          ",
  1190.              "                                                                                                                                                                          ",
  1191.              "                                                                                                                                                                          "    ,
  1192.              "    b      b      b       b      b      b       b                                                                                                                    ",
  1193.              "              s      s      s      s                                                                                                                           ",
  1194.              "              b       b       b      b       b       b      b       b       b      b       b       b                                                                                                                                         ",
  1195.              "p      p      p      p      p      p      p      p      p      p      p      p      p      p      p      p      p     p     p     p      p      p      p      p      p      p      p      p      p      p      p      p      p      p      p      p     p     p     ",]
  1196.  
  1197.                  
  1198.  
  1199.     for iy, row in enumerate(level):
  1200.         for ix, col in enumerate(row):
  1201.             if col == "p":
  1202.                 new_platforms = platform(ix*10, iy*50, 10,10,(255,255,255))
  1203.                 platforms.append(new_platforms)
  1204.  
  1205.  
  1206.     for iy, row in enumerate(level):
  1207.         for ix, col in enumerate(row):
  1208.             if col == "s":
  1209.                 new_platforms = dice(ix*30, iy*50, 10,250,(255,255,255))
  1210.                 dicing.append(new_platforms)
  1211.  
  1212.     for iy, row in enumerate(level):
  1213.         for ix, col in enumerate(row):
  1214.             if col == "t":
  1215.                 new_platforms = icess(ix*30, iy*110, 10,10,(255,255,255))
  1216.                 icing.append(new_platforms)
  1217.     for iy, row in enumerate(level):
  1218.         for ix, cols in enumerate(row):
  1219.             if cols == "b":
  1220.                 new_platforms = bush(ix*20, iy*15, 10,10,(255,255,255))
  1221.                 bushes.append(new_platforms)
  1222.  
  1223.  
  1224.  
  1225.     for iy, row in enumerate(level):
  1226.         for ix, cols in enumerate(row):
  1227.             if cols == "o":
  1228.                 new_platforms = tree(ix*20, iy* -20, 10,10,(255,255,255))
  1229.                 trees.append(new_platforms)
  1230.  
  1231.  
  1232.  
  1233.  
  1234.     # enemy -5 def function call the function under the enemy thing when you hit it
  1235.     def minusenemyhealthtext():
  1236.         font1 = pygame.font.SysFont('BLOODY.tff', 100)
  1237.         stext = font1.render('-5', 1, (255,0,0))
  1238.         window.blit(stext, (450 - (stext.get_width()/2),300))
  1239.         pygame.display.update()
  1240.  
  1241.     # this function ads +5 when ever we drink or health potion
  1242.     def plushealth():
  1243.        
  1244.         font2 = pygame.font.SysFont('comicsans', 100)
  1245.         sstext = font2.render('+5', 1, (0,255,0))
  1246.         window.blit(sstext, (450 - (sstext.get_width()/2),200))
  1247.         pygame.display.update()
  1248.  
  1249.  
  1250.     #-------------------------------- enemy shoots left and right
  1251.  
  1252.     shotsright = pygame.image.load("canss.png")
  1253.     class enemyshoot:
  1254.         def __init__(self,x,y,height,width,color):
  1255.             self.x = x
  1256.             self.y =y
  1257.             self.height = height
  1258.             self.width = width
  1259.             self.color = color
  1260.             self.shootsright = pygame.image.load("canss.png")
  1261.             self.shootsright = pygame.transform.scale(self.shootsright,(self.shootsright.get_width()-150,self.shootsright.get_height()-150))            
  1262.             self.rect = pygame.Rect(x,y,height,width)
  1263.             self.health = 10
  1264.             self.hitbox = (self.x + -20, self.y + 30, 31, 57)
  1265.         def draw(self):
  1266.             self.rect.topleft = (self.x,self.y)
  1267.             window.blit(self.shootsright,self.rect)
  1268.             self.hits = (self.x + 20, self.y, 28,60)
  1269.             pygame.draw.rect(window, (255,0,0), (self.hitbox[0], self.hitbox[1] - 60, 50, 10)) # NEW
  1270.             pygame.draw.rect(window, (0,255,0), (self.hitbox[0], self.hitbox[1] - 60, 50 - (5 * (10 - self.health)), 10))
  1271.             self.hitbox = (self.x + 100, self.y + 200, 81, 87)
  1272.  
  1273.  
  1274.     black = (0,0,0)
  1275.     enemyshoots1 = enemyshoot(1100,10,100,100,black)        
  1276.     enemyshooting = [enemyshoots1]
  1277.  
  1278.     #------------------------------------------------------------------------------
  1279.     # enemys bullets
  1280.     ksud = pygame.image.load("heart.png")
  1281.     class Bools(object):
  1282.        def __init__(self, x, y,color):
  1283.            self.x = x
  1284.            self.y = y
  1285.            self.ksud = pygame.image.load("heart.png")
  1286.            self.hitbox  = self.ksud.get_rect()
  1287.            self.rect  = self.ksud.get_rect()
  1288.            self.rect.topleft = (self.x,self.y)
  1289.            self.speed = 10
  1290.            self.color = color
  1291.            self.hitbox = (self.x + 57, self.y + 33, 29, 52) # NEW
  1292.        def draw(self, window):
  1293.             self.rect.topleft = (self.x,self.y)
  1294.             player_rect = self.ksud.get_rect(center = self.rect.center)
  1295.             player_rect.centerx += 0 # 10 is just an example
  1296.             player_rect.centery += 0 # 15 is just an example
  1297.             window.blit(self.ksud, player_rect)
  1298.             self.hitbox = (self.x + 97, self.y + 33, 10, 10) # NEW
  1299.             window.blit(self.ksud,self.rect)
  1300.  
  1301.  
  1302.  
  1303.  
  1304.     #------------------------------------------------------------------------------
  1305.             # this the text for moving left right and shit
  1306.     text5 = pygame.image.load("scrollt.png")
  1307.     class screentext:
  1308.         def __init__(self,x,y,height,width,color):
  1309.             self.x = x
  1310.             self.y = y
  1311.             self.height = height
  1312.             self.width = width
  1313.             self.color = color
  1314.             self.rect = pygame.Rect(x,y,height,width)
  1315.             self.text5 = pygame.image.load("scrollt.png")
  1316.             self.text5 = pygame.transform.scale(self.text5,(self.text5.get_width()-120,self.text5.get_height()-120))
  1317.         def draw(self):
  1318.             self.rect.topleft = (self.x,self.y)
  1319.             window.blit(self.text5,self.rect)
  1320.  
  1321.        
  1322.  
  1323.        
  1324.     black = (0,0,0)
  1325.     text2 = screentext(10,540,50,50,black)
  1326.     screentexts = [text2]
  1327.            
  1328.            
  1329.     # this text is for the scroll on the player stats
  1330.     scroll3 = pygame.image.load("scrollup.png")
  1331.     class scrolltext:
  1332.         def __init__(self,x,y,height,width,color):
  1333.             self.x = x
  1334.             self.y = y
  1335.             self.height = height
  1336.             self.width = width
  1337.             self.color = color
  1338.             self.rect = pygame.Rect(x,y,height,width)
  1339.             self.scroll3 = pygame.image.load("scrollup.png")
  1340.             self.scroll3 = pygame.transform.scale(self.scroll3,(self.scroll3.get_width()//3,self.scroll3.get_height()//3))
  1341.         def draw(self):
  1342.             self.rect.topleft = (self.x,self.y)
  1343.             window.blit(self.scroll3,self.rect)
  1344.  
  1345.        
  1346.  
  1347.        
  1348.     black = (0,0,0)
  1349.     scroll5 = scrolltext(10,-0,0,50,black)
  1350.     scrolltexts = [scroll5]
  1351.  
  1352.  
  1353.  
  1354.     # this is the hearts displayed next to the coin scores
  1355.     ht2 = pygame.image.load("ht.png")
  1356.     class hearttext:
  1357.         def __init__(self,x,y,height,width,color):
  1358.             self.x = x
  1359.             self.y = y
  1360.             self.height = height
  1361.             self.width = width
  1362.             self.color = color
  1363.             self.rect = pygame.Rect(x,y,height,width)
  1364.             self.ht2 = pygame.image.load("ht.png")
  1365.             self.ht2 = pygame.transform.scale(self.ht2,(self.ht2.get_width()//10,self.ht2.get_height()//10))
  1366.         def draw(self):
  1367.             self.rect.topleft = (self.x,self.y)
  1368.             window.blit(self.ht2,self.rect)
  1369.     # enemys bullets
  1370.     ksud = pygame.image.load("bullet4.png")
  1371.     class Boolss(object):
  1372.        def __init__(self, x, y,color, xspeed, yspeed):
  1373.            self.x = x
  1374.            self.y = y
  1375.            self.xspeed = xspeed
  1376.            self.yspeed = yspeed
  1377.            self.ksud = pygame.image.load("bullet4.png")
  1378.            self.hitbox  = self.ksud.get_rect()
  1379.            self.rect  = self.ksud.get_rect()
  1380.            self.rect.topleft = (self.x,self.y)
  1381.            self.ksud = pygame.transform.scale(self.ksud,(self.ksud.get_width()//16,self.ksud.get_height()//16))
  1382.            self.color = color
  1383.            self.hitbox = (self.x + 57, self.y + 33, 29, 52) # NEW
  1384.        def draw(self, window):
  1385.             self.rect.topleft = (self.x,self.y)
  1386.             player_rect = self.ksud.get_rect(center = self.rect.center)
  1387.             player_rect.centerx += 0 # 10 is just an example
  1388.             player_rect.centery += 0 # 15 is just an example
  1389.             self.hitbox = (self.x + 97, self.y + 33, 10, 10) # NEW
  1390.             window.blit(self.ksud,self.rect)
  1391.        
  1392.  
  1393.        
  1394.     black = (0,0,0)
  1395.     hrttext5 = hearttext(40,30,0,50,black)
  1396.     heartexts = [hrttext5]
  1397.  
  1398.     # varabile for image text sighns
  1399.     # main game loop
  1400.  
  1401.  
  1402.     def game_loop():
  1403.        
  1404.  
  1405.  
  1406.  
  1407.  
  1408.        
  1409.         # position image
  1410.         thisispos = pygame.image.load("poslol.png")
  1411.         # poisiton class health UP
  1412.         class pos5:
  1413.             def __init__(self,x,y,height,width,color):
  1414.                 self.x = x
  1415.                 self.y = y
  1416.                 self.height = height
  1417.                 self.width = width
  1418.                 self.color = color
  1419.                 self.thisispos = pygame.image.load("poslol.png")
  1420.                 self.thisispos = pygame.transform.scale(self.thisispos,(self.thisispos.get_width()//8,self.thisispos.get_height()//8))
  1421.                 self.rect = pygame.Rect(x,y,height,width)
  1422.                 # the hitbox our projectiles will be colliding with
  1423.                 self.hitbox = (self.x + 0, self.y + 1, 10, 72)
  1424.             def draw(self):
  1425.                 self.rect.topleft = (self.x,self.y)
  1426.                 player_rect = self.thisispos.get_rect(center = self.rect.center)
  1427.                 player_rect.centerx += -10 # 10 is just an example
  1428.                 player_rect.centery += 29 # 15 is just an example
  1429.                 window.blit(self.thisispos, player_rect)
  1430.                 self.hitbox = (self.x + -20, self.y + 30, 21, 67)
  1431.  
  1432.         # define the pos class
  1433.         black = (0,0,0)
  1434.         pos1 = pos5(950,390,50,50,black)
  1435.         poses = [pos1]
  1436.  
  1437.  
  1438.  
  1439.        
  1440.        
  1441.         # coin scoring
  1442.         font = pygame.font.Font('BLOODY.ttf',49)
  1443.         score = 0
  1444.         loltext = font.render("" + str(score), True, (255,255,255))
  1445.         lolrect = loltext.get_rect()
  1446.         lolrect.center = ((130,60))
  1447.  
  1448.         #this is enemy scoring
  1449.         font = pygame.font.Font('BLOODY.ttf',49)
  1450.         enemyscore = 0
  1451.         enemyors = font.render("" + str(score), True, (255,255,255))
  1452.         enemydors = enemyors.get_rect()
  1453.         enemydors.center = ((130,125))
  1454.  
  1455.        
  1456.         shootsright = []
  1457.         bullets = []
  1458.         bulls = []
  1459.         bullss = []
  1460.         bullsss = []
  1461.         bullssss = []
  1462.        
  1463.         runninggame = True
  1464.         while runninggame:
  1465.             clock.tick(FPS)
  1466.             for event in pygame.event.get():
  1467.                 if event.type == pygame.QUIT:
  1468.                     runninggame = False
  1469.  
  1470.  
  1471.  
  1472.                
  1473.          
  1474.  
  1475.         # -------- shoot the bullets when you click your mouse
  1476.            
  1477.  
  1478.                 if event.type == pygame.MOUSEBUTTONDOWN:
  1479.  
  1480.  
  1481.  
  1482.                    
  1483.                
  1484.                 # this is for the bullets
  1485.                     if len(bullets) < 2:
  1486.                         shootsound.play()
  1487.  
  1488.                         start_x, start_y = playerman.x+playerman.width//2, playerman.y + playerman.height-54
  1489.                         mouse_x, mouse_y = event.pos
  1490.  
  1491.                         dir_x, dir_y = mouse_x - start_x, mouse_y - start_y
  1492.                         distance = math.sqrt(dir_x**2 + dir_y**2)
  1493.                         if distance > 0:
  1494.                             new_bullet = projectile(start_x, start_y, dir_x/distance, dir_y/distance, (0,0,0))
  1495.                             bullets.append(new_bullet)
  1496.         # this is displaying the bullets for the player            
  1497.             for bullet in bullets[:]:
  1498.                 bullet.move()
  1499.                 if bullet.x < 0 or bullet.x > 900 or bullet.y < 0 or bullet.y > 900:
  1500.                     bullets.pop(bullets.index(bullet))
  1501.  
  1502.         #--------------------------------------------------------------------------------------------------------- enemys
  1503.  
  1504.             # enemys 1
  1505.             for bullet in bullets:
  1506.                 if bullet.rect.colliderect(enemys2.hitbox):
  1507.                     if enemys2.health > -5:
  1508.                         enemys2.health -= 1
  1509.                         bullets.pop(bullets.index(bullet))
  1510.                         hitesound.play()
  1511.                             # this function calss the -5 text appearing and dispearing on my screen
  1512.                         minusenemyhealthtext()
  1513.                     else:
  1514.                         for oe in range(len(enemyings)-1,-1,-1):
  1515.                                 deathsound.play()
  1516.                                 del enemyings[oe]
  1517.  
  1518.                 # enemys 2
  1519.             for bullet in bullets:
  1520.                 if bullet.rect.colliderect(enemys1.hitbox):
  1521.                     if enemys1.health > -5:
  1522.                         enemys1.health -= 1
  1523.                         bullets.pop(bullets.index(bullet))
  1524.                         hitesound.play()
  1525.                                 # this function calss the -5 text appearing and dispearing on my screen
  1526.                         minusenemyhealthtext()
  1527.                     else:
  1528.                         for one in range(len(enemying)-1,-1,-1):
  1529.                                 deathsound.play()
  1530.                                 del enemying[one]
  1531.  
  1532.  
  1533.  
  1534.         #---------------------------------------------------------------------------------------------------------
  1535.  
  1536.  
  1537.                    
  1538.  
  1539.  
  1540.  
  1541.             # if collides with the sharp tiles
  1542.             for bullet in bullets:
  1543.                 for icess in icing:
  1544.                     if bullet.rect.colliderect(icess.hitbox):
  1545.                         bullets.pop(bullets.index(bullet))
  1546.                         icesound.play()
  1547.                         print("YO YOU COLLIDED THAT SHIT")
  1548.             for bullet in bullets:
  1549.                 for dice in dicing:
  1550.                     if bullet.rect.colliderect(dice.hitbox):
  1551.                         bullets.pop(bullets.index(bullet))
  1552.                         icesound.play()
  1553.                         print("yo fam you collided with that sharp thing")
  1554.                                
  1555.  
  1556.                    
  1557.             # health players
  1558.             for dice in dicing:
  1559.                 if playerman.rect.colliderect(dice.hitbox):
  1560.                     hurtsound.play()
  1561.                     if playerman.health > -6:
  1562.                         playerman.health -= 1
  1563.                         playerman.x = 10
  1564.                        
  1565.  
  1566.                     else:
  1567.                         print("cant delete him")
  1568.  
  1569.  
  1570.  
  1571.             for pos5 in poses:
  1572.                 if playerman.rect.colliderect(pos5.hitbox):
  1573.                     healthsound.play()
  1574.                     playerman.health += 5
  1575.                     del poses[one]
  1576.                     # this function loads +5 for the player
  1577.                     plushealth()
  1578.  
  1579.         # ----------------------------------------------------------------------------
  1580.         # collision between the ices
  1581.  
  1582.             for bullet in bullets:
  1583.                 for bull in bulls:
  1584.                     for smallice in small:
  1585.                         if bullet.rect.colliderect(smallice.rect):
  1586.                             icesound.play()
  1587.                             if smallice.health > 1:
  1588.                                 smallice.health -= 1
  1589.  
  1590.                             else:
  1591.                                 del small[one]
  1592.                                 if bull.y < 1050 and bull.y > 2160:
  1593.                                     print("by by mfs")
  1594.                                
  1595.  
  1596.                            
  1597.  
  1598.             # collision between the ices
  1599.  
  1600.             for bullet in bullets:
  1601.                 for firstb in bullss:
  1602.                     for smallice in smalls:
  1603.                         if bullet.rect.colliderect(smallice.rect):
  1604.                             icesound.play()
  1605.                             if smallice.health > 1:
  1606.                                 smallice.health -= 1
  1607.  
  1608.                             else:
  1609.                                 del smalls[one]
  1610.                                 if firstb.y < 1050 and firstb.y > 2160:
  1611.                                     print("by by mfs")
  1612.  
  1613.  
  1614.  
  1615.  
  1616.                                    
  1617.             # collision between the ices
  1618.  
  1619.             for bullet in bullets:
  1620.                 for secondb in bullsss:
  1621.                     for smallice in smallss:
  1622.                         if bullet.rect.colliderect(smallice.rect):
  1623.                             icesound.play()
  1624.                             if smallice.health > 1:
  1625.                                 smallice.health -= 1
  1626.  
  1627.                             else:
  1628.                                 del smallss[one]
  1629.                                 if secondb.y < 1050 and secondb.y > 2160:
  1630.                                     print("by by mfs")
  1631.  
  1632.  
  1633.  
  1634.             # collision between the ices
  1635.  
  1636.             for bullet in bullets:
  1637.                 for thirdb in bullssss:
  1638.                     for smallice in smallsss:
  1639.                         if bullet.rect.colliderect(smallice.rect):
  1640.                             icesound.play()
  1641.                             if smallice.health > 1:
  1642.                                 smallice.health -= 1
  1643.  
  1644.                             else:
  1645.                                 del smallsss[one]
  1646.                                 if thirdb.y < 1050 and thirdb.y > 2160:
  1647.                                     print("by by mfs")
  1648.                                
  1649.            # ----------------------------------------------------------------------------
  1650.         # collision between the ices
  1651.  
  1652.                                             #Poping bullets from list
  1653.                
  1654.  
  1655.             for bull in bulls:
  1656.                 if playerman.rect.colliderect(bull.hitbox):
  1657.                     playerman.health -=1
  1658.                     bulls.pop(bulls.index(bull))
  1659.                    
  1660.  
  1661.             for firstb in bullss:
  1662.                 if playerman.rect.colliderect(firstb.hitbox):
  1663.                     playerman.health -=1
  1664.                     bullss.pop(bullss.index(firstb))
  1665.  
  1666.  
  1667.  
  1668.             for secondb in bullsss:
  1669.                 if playerman.rect.colliderect(secondb.hitbox):
  1670.                     playerman.health -=1
  1671.                     bullsss.pop(bullsss.index(secondb))
  1672.  
  1673.  
  1674.  
  1675.  
  1676.             for thirdb in bullssss:
  1677.                 if playerman.rect.colliderect(thirdb.hitbox):
  1678.                     playerman.health -=1
  1679.                     bullssss.pop(bullssss.index(thirdb))
  1680.  
  1681.  
  1682.             # health players
  1683.             for shootss in shootsright:
  1684.                 if playerman.rect.colliderect(shootss.rect):
  1685.                     hurtsound.play()
  1686.                     playerman.health -= 1
  1687.  
  1688.  
  1689.                    
  1690.  
  1691.         #---------------------------------------------------------------------------------------------------------------------------------------------            
  1692.         # projectile class for each of the bullets
  1693.             for bull in bulls:
  1694.                 if bull.y < 550 and bull.y > 0:
  1695.                     bull.y += 4
  1696.                 else:
  1697.                     bulls.pop(bulls.index(bull))
  1698.             if len(bulls) < 1:
  1699.                     bulls.append(Bullet(round(smallice1.x+smallice1.width-107),round(smallice1.y + smallice1.height-50),(0,0,0)))
  1700.  
  1701.             for firstb in bullss:
  1702.                 if firstb.y < 550 and bull.y > 0:
  1703.                     firstb.y += 5
  1704.                 else:
  1705.                     bullss.pop(bullss.index(firstb))
  1706.             if len(bullss) < 1:
  1707.                     bullss.append(Bullet(round(smallice2.x+smallice2.width-107),round(smallice2.y + smallice2.height-50),(0,0,0)))
  1708.  
  1709.             for secondb in bullsss:
  1710.                 if secondb.y < 550 and secondb.y > 0:
  1711.                     secondb.y += 6
  1712.                 else:
  1713.                     bullsss.pop(bullsss.index(secondb))
  1714.             if len(bullsss) < 1:
  1715.                     bullsss.append(Bullet(round(smallice3.x+smallice3.width-107),round(smallice3.y + smallice3.height-50),(0,0,0)))
  1716.  
  1717.  
  1718.             for thirdb in bullssss:
  1719.                 if thirdb.y < 550 and thirdb.y > 0:
  1720.                     thirdb.y += 7
  1721.                 else:
  1722.                     bullssss.pop(bullssss.index(thirdb))
  1723.             if len(bullssss) < 1:
  1724.                     bullssss.append(Bullet(round(smallice4.x+smallice4.width-107),round(smallice4.y + smallice4.height-50),(0,0,0)))
  1725.             for shootss in shootsright:
  1726.                 shootss.x += shootss.xspeed
  1727.                 shootss.y += shootss.yspeed
  1728.                 if shootss.x > 500 or shootss.x < 0 or shootss.y > 500 or shootss.y < 0:
  1729.                     shootsright.pop(shootsright.index(shootss))
  1730.  
  1731.  
  1732.  
  1733.  
  1734.             if len(shootsright) < 1:
  1735.                 start_x = round(enemyshoots1.x+enemyshoots1.width+30)
  1736.                 start_y = round(enemyshoots1.y + enemyshoots1.height+120)
  1737.                 target_x = playerman.x+playerman.width//2
  1738.                 target_y = playerman.y+playerman.width//2
  1739.                 dir_x, dir_y = round((target_x - start_x) / 55),  round((target_y - start_y) / 55)
  1740.                 distance = math.sqrt(dir_x**2 + dir_y**2)
  1741.                 if distance > 0:
  1742.                     shootsright.append(Boolss(start_x,start_y,(0,0,0),dir_x, dir_y))
  1743.         #---------------------------------------------------------------------------------------------------------------------------------------------            
  1744.             keys = pygame.key.get_pressed()
  1745.  
  1746.  
  1747.  
  1748.  
  1749.             # Jump and Collisions
  1750.  
  1751.                    
  1752.             # camera left and right movement
  1753.             if playerman.y < 250:
  1754.                 playerman.y += 1
  1755.                 for platform in platforms:
  1756.                     platform.y += playerman.speed
  1757.                 for coin in Coins_list:
  1758.                     coin.y += playerman.speed
  1759.                 for error in errors:
  1760.                     error.y += playerman.speed
  1761.                 for dice in dicing:
  1762.                     dice.y += playerman.speed
  1763.                 for icess in icing:
  1764.                     icess.y += playerman.speed
  1765.                 for bush in bushes:
  1766.                     bush.y += playerman.speed
  1767.  
  1768.                 for alrt in alerting:
  1769.                     alrt.y += playerman.speed
  1770.                 for villager in villaging:
  1771.                     villager.y += playerman.speed
  1772.                 for house in housing:
  1773.                     house.y += playerman.speed
  1774.                 for tree in trees:
  1775.                     tree.y += playerman.speed
  1776.                 for sign in signs:
  1777.                     sign.y += playerman.speed
  1778.                 for pos5 in poses:
  1779.                     pos5.y += playerman.speed
  1780.                 for smallice in small:
  1781.                     smallice.y += playerman.speed
  1782.  
  1783.                 for enemyshoot in enemyshooting:
  1784.                     enemyshoot.y += playerman.speed
  1785.  
  1786.         #--------------------------------------------------------
  1787.                     # bullets for ice falling camera control
  1788.  
  1789.                 for bull in bulls:
  1790.                     bull.y += playerman.speed
  1791.                 for firstb in bullss:
  1792.                     firstb.y += playerman.speed
  1793.                 for secondb in bullsss:
  1794.                     secondb.y += playerman.speed
  1795.                 for thirdb in bullssss:
  1796.                     thirdb.y += playerman.speed
  1797.  
  1798.  
  1799.         #----------------------------------------------
  1800.                         # the ice fallings camera cdontrol
  1801.                 for smallice in smalls:
  1802.                     smallice.y += playerman.speed
  1803.                 for smallice in smallss:
  1804.                     smallice.y += playerman.speed
  1805.                 for smallice in smallsss:
  1806.                     smallice.y += playerman.speed
  1807.  
  1808.         #----------------------------------------------
  1809.                        
  1810.                 for screentext in screentexts:
  1811.                     screentext.y += playerman.speed
  1812.  
  1813.                    
  1814.                 for enemys in enemying:
  1815.                     enemys.scroll(0,+  playerman.speed)
  1816.  
  1817.  
  1818.                    
  1819.                 for enemys in enemyings:
  1820.                     enemys.scroll(0,+  playerman.speed)
  1821.          
  1822.  
  1823.                 for shootss in shootsright:
  1824.                     shootss.y += playerman.speed
  1825.  
  1826.  
  1827.                  
  1828.                    
  1829.  
  1830.             # camera up movement:
  1831.             if playerman.y > 500:
  1832.                 playerman.y -= playerman.fall
  1833.                 for platform in platforms:
  1834.                     platform.y -= playerman.fall
  1835.                 for coin in Coins_list:
  1836.                     coin.y -= playerman.fall
  1837.                 for error in errors:
  1838.                     error.y -= playerman.fall
  1839.                 for dice in dicing:
  1840.                     dice.y -= playerman.fall
  1841.                 for icess in icing:
  1842.                     icess.y -= playerman.fall
  1843.                 for bush in bushes:
  1844.                     bush.y -= playerman.fall
  1845.                 for villager in villaging:
  1846.                     villager.y -= playerman.fall
  1847.                 for house in housing:
  1848.                     house.y -= playerman.fall
  1849.                 for alrt in alerting:
  1850.                     alrt.y -= playerman.fall
  1851.                 for tree in trees:
  1852.                     tree.y -= playerman.fall
  1853.                 for sign in signs:
  1854.                     sign.y -= playerman.fall
  1855.                 for pos5 in poses:
  1856.                     pos5.y -= playerman.fall
  1857.                 for enemyshoot in enemyshooting:
  1858.                     enemyshoot.y -= playerman.fall
  1859.  
  1860.  
  1861.         #----------------------------------------------
  1862.  
  1863.                        
  1864.                 for smallice in small:
  1865.                     smallice.y -= playerman.fall
  1866.  
  1867.                 for smallice in smalls:
  1868.                     smallice.y -= playerman.fall
  1869.                 for smallice in smallss:
  1870.                     smallice.y -= playerman.fall
  1871.                 for smallice in smallsss:
  1872.                     smallice.y -= playerman.fall
  1873.  
  1874.  
  1875.         #----------------------------------------------
  1876.                         # camera controlf for falling ice
  1877.                 for bull in bulls:
  1878.                     bull.y -= playerman.fall
  1879.  
  1880.                 for firstb in bullss:
  1881.                     firstb.y -= playerman.fall
  1882.                 for secondb in bullsss:
  1883.                     secondb.y -= playerman.fall
  1884.                 for thirdb in bullssss:
  1885.                     thirdb.y -= playerman.fall
  1886.  
  1887.  
  1888.         #----------------------------------------------
  1889.  
  1890.                 for screentext in screentexts:
  1891.                     screentext.y -= playerman.fall
  1892.  
  1893.  
  1894.                 for enemys in enemying:
  1895.                     enemys.scroll(0, -playerman.fall)
  1896.  
  1897.                 for enemys in enemyings:
  1898.                     enemys.scroll(0, -playerman.fall)
  1899.                                
  1900.  
  1901.  
  1902.                 for shootss in shootsright:
  1903.                     shootss.y -= playerman.fall
  1904.  
  1905.  
  1906.  
  1907.  
  1908.             keys = pygame.key.get_pressed()
  1909.  
  1910.             # key binds for the player
  1911.             if keys[pygame.K_a]:
  1912.                 playerman.x -= playerman.speed
  1913.                 playerman.direction = "left"
  1914.                 # camera controll for left
  1915.                 if playerman.x < 100:
  1916.                     playerman.x += playerman.speed
  1917.                     for platform in platforms:
  1918.                         platform.x += playerman.speed
  1919.                     for coin in Coins_list:
  1920.                         coin.x += playerman.speed
  1921.                     for error in errors:
  1922.                         error.x += playerman.speed
  1923.                     for dice in dicing:
  1924.                         dice.x += playerman.speed
  1925.                     for icess in icing:
  1926.                         icess.x += playerman.speed
  1927.                     for bush in bushes:
  1928.                         bush.x += playerman.speed
  1929.                     for villager in villaging:
  1930.                         villager.x += playerman.speed
  1931.                     for house in housing:
  1932.                         house.x += playerman.speed
  1933.                     for alrt in alerting:
  1934.                         alrt.x += playerman.speed
  1935.                     for tree in trees:
  1936.                         tree.x += playerman.speed
  1937.                     for sign in signs:
  1938.                         sign.x += playerman.speed
  1939.                     for pos5 in poses:
  1940.                         pos5.x += playerman.speed
  1941.                     for enemyshoot in enemyshooting:
  1942.                         enemyshoot.x += playerman.speed
  1943.                        
  1944.                     for shootss in shootsright:
  1945.                         shootss.x += playerman.speed
  1946.  
  1947.  
  1948.  
  1949.         #----------------------------------------------
  1950.                         # the ice fallings camera cdontrol
  1951.                     for smallice in small:
  1952.                         smallice.x += playerman.speed
  1953.                     for smallice in smalls:
  1954.                         smallice.x += playerman.speed
  1955.                     for smallice in smallss:
  1956.                         smallice.x += playerman.speed
  1957.                     for smallice in smallsss:
  1958.                         smallice.x += playerman.speed
  1959.         #----------------------------------------------
  1960.  
  1961.                        
  1962.                     for bull in bulls:
  1963.                         bull.x += playerman.speed
  1964.                     for firstb in bullss:
  1965.                         firstb.x += playerman.speed
  1966.                     for secondb in bullsss:
  1967.                         secondb.x += playerman.speed
  1968.                     for thirdb in bullssss:
  1969.                         thirdb.x += playerman.speed
  1970.         #----------------------------------------------
  1971.  
  1972.                     for screentext in screentexts:
  1973.                         screentext.x += playerman.speed
  1974.  
  1975.                        
  1976.                     for enemys in enemying:
  1977.                         enemys.scroll(playerman.speed,0)
  1978.                     for enemys in enemyings:
  1979.                         enemys.scroll(playerman.speed,0)
  1980.  
  1981.  
  1982.  
  1983.          
  1984.  
  1985.  
  1986.                
  1987.             elif keys[pygame.K_d]:
  1988.                 playerman.x += playerman.speed
  1989.                 playerman.direction = "right"
  1990.                 # camera for right:
  1991.                 if playerman.x > 400:
  1992.                     playerman.x -= playerman.speed
  1993.                     for platform in platforms:
  1994.                         platform.x -= playerman.speed
  1995.                     for coin in Coins_list:
  1996.                         coin.x -= playerman.speed
  1997.                     for error in errors:
  1998.                         error.x -= playerman.speed
  1999.                     for dice in dicing:
  2000.                         dice.x -= playerman.speed
  2001.                     for icess in icing:
  2002.                         icess.x -= playerman.speed
  2003.                     for bush in bushes:
  2004.                         bush.x -= playerman.speed
  2005.  
  2006.                     for villager in villaging:
  2007.                         villager.x -= playerman.speed
  2008.                     for house in housing:
  2009.                         house.x -= playerman.speed
  2010.                     for alrt in alerting:
  2011.                         alrt.x -= playerman.speed
  2012.                     for tree in trees:
  2013.                         tree.x -= playerman.speed
  2014.                     for sign in signs:
  2015.                         sign.x -= playerman.speed
  2016.                     for pos5 in poses:
  2017.                         pos5.x -= playerman.speed
  2018.  
  2019.                     for enemyshoot in enemyshooting:
  2020.                         enemyshoot.x -= playerman.speed
  2021.  
  2022.                     for shootss in shootsright:
  2023.                         shootss.x -= playerman.speed
  2024.         #----------------------------------------------
  2025.                         # the ice fallings camera cdontrol
  2026.  
  2027.                     for smallice in small:
  2028.                         smallice.x -= playerman.speed
  2029.                     for smallice in smalls:
  2030.                         smallice.x -= playerman.speed
  2031.                     for smallice in smallss:
  2032.                         smallice.x -= playerman.speed                
  2033.                     for smallice in smallsss:
  2034.                         smallice.x -= playerman.speed
  2035.      
  2036.         #----------------------------------------------
  2037.                        
  2038.                     for screentext in screentexts:
  2039.                         screentext.x -= playerman.speed                    
  2040.  
  2041.         #----------------------------------------------
  2042.  
  2043.                     for bull in bulls:
  2044.                         bull.x -= playerman.speed
  2045.                     for firstb in bullss:
  2046.                         firstb.x -= playerman.speed
  2047.                     for secondb in bullsss:
  2048.                         secondb.x -= playerman.speed
  2049.                     for thirdb in bullssss:
  2050.                         thirdb.x -= playerman.speed
  2051.                
  2052.         #----------------------------------------------
  2053.                        
  2054.                     for enemys in enemying:
  2055.                         enemys.scroll(-playerman.speed, 0)
  2056.  
  2057.                     for enemys in enemyings:
  2058.                         enemys.scroll(-playerman.speed, 0)
  2059.  
  2060.                     # button for vill text
  2061.  
  2062.  
  2063.  
  2064.  
  2065.             else:
  2066.                 if playerman.direction == "right":
  2067.                     playerman.direction = "standright"
  2068.                 else:
  2069.                     if playerman.direction == "left":
  2070.                         playerman.direction = "standleft"
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.             if not playerman.isJump:
  2077.                 playerman.y += playerman.fall
  2078.                 playerman.fall += 1
  2079.                 collide = False
  2080.                 playerman.isJump = False
  2081.                 for platform in platforms:
  2082.                     if playerman.rect.colliderect(platform.rect):
  2083.                         collide = True
  2084.                         isJump = False
  2085.                         playerman.y = platform.rect.top - playerman.height + 1
  2086.                         if playerman.rect.right > platform.rect.left and playerman.rect.left < platform.rect.left - playerman.width:
  2087.                             playerman.x = platform.rect.left - playerman.width
  2088.                         if playerman.rect.left < platform.rect.right and playerman.rect.right > platform.rect.right + playerman.width:
  2089.                             playerman.x = platform.rect.right
  2090.  
  2091.  
  2092.  
  2093.                 for one in range(len(Coins_list)-1,-1,-1):
  2094.                     if playerman.rect.colliderect(Coins_list[one].rect):
  2095.                         coinsound.play()
  2096.                         del Coins_list[one]
  2097.                         score += 1
  2098.                         loltext = font.render("" + str(score), True, (255,255,255))
  2099.                         lolrect.center = ((130,60))
  2100.  
  2101.  
  2102.                    
  2103.                 if collide:  
  2104.                     if keys[pygame.K_SPACE]:
  2105.                         jumpsound.play()
  2106.                         playerman.isJump = True
  2107.                     playerman.fall = 0
  2108.             else:
  2109.                 if playerman.JumpCount >= 0:
  2110.                     playerman.y -= (playerman.JumpCount*abs(playerman.JumpCount))*0.3
  2111.                     playerman.JumpCount -= 1
  2112.                 else:
  2113.                     playerman.isJump = False
  2114.                     playerman.JumpCount = 10
  2115.                    
  2116.                
  2117.             # display the player and the screen
  2118.             window.fill((106, 237, 249))
  2119.             window.blit(bg,(0,0))
  2120.  
  2121.             for pos5 in poses:
  2122.                 pos5.draw()
  2123.  
  2124.             for tree in trees:
  2125.                 tree.draw()
  2126.             for bush in bushes:
  2127.                 bush.draw()
  2128.             for icess in icing:
  2129.                 icess.draw()
  2130.             for dice in dicing:
  2131.                 dice.draw()
  2132.  
  2133.             for sign in signs:
  2134.                 sign.draw()
  2135.             for error in errors:
  2136.                 error.draw()
  2137.             for house in housing:
  2138.                 house.draw()
  2139.             playerman.draw()
  2140.             for coin in Coins_list:
  2141.                 coin.draw()
  2142.             for platform in platforms:
  2143.                 platform.draw()
  2144.  
  2145.            
  2146.             for enemys in enemying:
  2147.                 enemys.draw(window)
  2148.             for enemys in enemyings:
  2149.                 enemys.draw(window)
  2150.  
  2151.             for villager in villaging:
  2152.                 villager.draw()
  2153.                  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.            
  2159.             # draw the falling icy
  2160.             for smallice in small:
  2161.                 smallice.draw()
  2162.             for smallice in smalls:
  2163.                 smallice.draw()
  2164.             for smallice in smallss:
  2165.                 smallice.draw()
  2166.             for smallice in smallsss:
  2167.                 smallice.draw()
  2168.  
  2169.         #---------------------------------------
  2170.             # draw the falling bullets    
  2171.             for bull in bulls:
  2172.                 bull.draw(window)
  2173.                
  2174.             for firstb in bullss:
  2175.                 firstb.draw(window)
  2176.  
  2177.             for secondb in bullsss:
  2178.                 secondb.draw(window)
  2179.  
  2180.             for thirdb in bullssss:
  2181.                 thirdb.draw(window)
  2182.  
  2183.             for enemyshoot in enemyshooting:
  2184.                 enemyshoot.draw()
  2185.  
  2186.                
  2187.             for screentext in screentexts:
  2188.                 screentext.draw()
  2189.  
  2190.             for scrolltext in scrolltexts:
  2191.                 scrolltext.draw()
  2192.  
  2193.             for heartext in heartexts:
  2194.                 heartext.draw()
  2195.  
  2196.                
  2197.             for bullet in bullets:
  2198.                 bullet.draw(window)
  2199.             for shootss in shootsright:
  2200.                 shootss.draw(window)
  2201.             for enemyicon in enemyicons:
  2202.                 enemyicon.draw()
  2203.  
  2204.             window.blit(loltext,lolrect)
  2205.             window.blit(enemyors,enemydors)
  2206.            
  2207.             for alrt in alerting:
  2208.                 alrt.draw()
  2209.             # villager talk
  2210.             villtext()
  2211.  
  2212.                
  2213.             pygame.display.update()
  2214.  
  2215.     game_intro()
  2216.     game_loop()
Add Comment
Please, Sign In to add comment