Guest User

Untitled

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