Advertisement
Mr-A

A-MaYheM (main)

May 4th, 2013
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 76.33 KB | None | 0 0
  1. #By Mr.A a.k.a A-MAN
  2. #
  3. #All rights for this code are reserved for the only creator.
  4. #
  5. ##Feel free to use any part of this code, but don't claim as your own.
  6. #
  7. #CopyRights 2011-2012 by Mr.A
  8.  
  9.  
  10. import pygame, sys, random
  11. import levels
  12. from pygame.locals import *
  13. from time import *
  14. GAMENAME = 'A-MaYheM'
  15. WINDOWWIDTH = 600
  16. WINDOWHEIGHT = 600
  17. PLAYERSPEED = 9
  18. BACKCOLOR = (0, 0, 0)
  19. FPS = 200
  20. carspeed = 100
  21. MOUSEAPPEAR = True
  22. pygame.init()
  23. pygame.mixer.init()
  24. pygame.mixer.pre_init(22050, -16, 4, 4096)
  25. music = ['1.ogg', '2.ogg' , '3.ogg']
  26. pygame.mixer.music.load(music[0])
  27. movedirx = 0
  28. movediry = 0
  29. passmen = True
  30. black = (0, 0, 0)
  31. Clock = pygame.time.Clock()
  32. pygame.display.set_caption(GAMENAME)
  33. windowSurface = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT), 0, 32)
  34. crypo= 74
  35. pause = 1
  36. t2colpi = True
  37. basicfont = pygame.font.SysFont(None, 50)
  38. energyfont = pygame.font.SysFont(None, 35)
  39. stagefont = pygame.font.SysFont(None, 80)
  40. passfont = pygame.font.SysFont(None, 40)
  41. wrongpassfont = pygame.font.SysFont(None, 20)
  42. threetwoone = pygame.font.SysFont(None, 110)
  43. gosys = pygame.font.SysFont(None, 200)
  44. scorefont = pygame.font.SysFont(None, 35)
  45. carxop = False
  46. passyfile = open('passy.roc', 'r')
  47. passytext = passyfile.read()
  48. if passytext != "omar":
  49.  
  50.     p0= pygame.image.load('mycar0.bmp').convert()
  51.     p0b= p0.get_rect()
  52.     p1= pygame.image.load('mycar1.bmp').convert()
  53.     p1b= p1.get_rect()
  54.     p2= pygame.image.load('mycar2.bmp').convert()
  55.     p2b= p2.get_rect()
  56.     p= pygame.image.load('mycar.bmp').convert()
  57.     pb= p.get_rect()
  58. else:
  59.     carxop = True
  60. if carxop:
  61.     p0= pygame.image.load('carx0.bmp').convert()
  62.     p0b= p0.get_rect()
  63.     p1= pygame.image.load('carx1.bmp').convert()
  64.     p1b= p1.get_rect()
  65.     p2= pygame.image.load('carx2.bmp').convert()
  66.     p2b= p2.get_rect()
  67.     p= pygame.image.load('carx.bmp').convert()
  68.     pb= p.get_rect()    
  69. passyfile.close
  70.  
  71. if carxop:
  72.     PLAYERSPEED = 15
  73.    
  74. t3isthere = False
  75. t5isthere = False
  76. fx= random.randint(70, 630)
  77.  
  78. windowSurface.fill(black)
  79. pygame.display.update()
  80. credit= pygame.image.load('cred.bmp').convert()
  81. creditb = credit.get_rect()
  82. creditb.center = windowSurface.get_rect().center
  83. windowSurface.blit(credit, creditb)
  84. pygame.display.update()
  85. sleep(3)
  86.  
  87.  
  88. #_______________trackssp_________:
  89. track1= pygame.image.load('track1.bmp').convert()
  90. track1b= track1.get_rect()
  91. t1bordr = pygame.image.load('t1border.bmp').convert()
  92. t1bordrb= t1bordr.get_rect()
  93. t1bordrb.centery =  windowSurface.get_rect().centery
  94. t1bordrb.right = windowSurface.get_rect().width
  95. t1bordl = pygame.image.load('t1border.bmp').convert()
  96. t1bordlb = t1bordl.get_rect()
  97. t1bordlb.centery =  windowSurface.get_rect().centery
  98. t1bordlb.left = 0
  99.  
  100.  
  101. t2bordr = pygame.image.load('t2border.bmp').convert()
  102. t2bordrb= t2bordr.get_rect()
  103. t2bordrb.centery =  windowSurface.get_rect().centery
  104. t2bordrb.right = windowSurface.get_rect().width
  105. t2bordl = pygame.image.load('t2border.bmp').convert()
  106. t2bordlb = t2bordl.get_rect()
  107. t2bordlb.centery =  windowSurface.get_rect().centery
  108. t2bordlb.left = 0
  109. track2= pygame.image.load('track2.bmp').convert()
  110. track2b= track2.get_rect()
  111. track2line= pygame.image.load('track2line.bmp').convert()
  112. track2lineb= track2line.get_rect()
  113. track2line2= pygame.image.load('track2line2.bmp').convert()
  114. track2line2b= track2line2.get_rect()
  115. track2line3= pygame.image.load('track2line3.bmp').convert()
  116. track2line3b= track2line3.get_rect()
  117. t2line2color = [track2line, track2line2, track2line3]
  118. track2lineb.bottom = windowSurface.get_rect().top
  119. track2lineb.centerx = windowSurface.get_rect().centerx - 175
  120. track2line2b.bottom = windowSurface.get_rect().top - 300
  121. track2line2b.centerx = windowSurface.get_rect().centerx + 175
  122. track2line3b.bottom = windowSurface.get_rect().top - 600
  123. track2line3b.centerx = windowSurface.get_rect().centerx
  124.  
  125. track3= pygame.image.load('track3.bmp').convert()
  126. track3b= track3.get_rect()
  127. t3bordr = pygame.image.load('t3border.bmp').convert()
  128. t3bordrb= t3bordr.get_rect()
  129. t3bordrb.centery =  windowSurface.get_rect().centery
  130. t3bordrb.right = windowSurface.get_rect().width
  131. t3bordl = pygame.image.load('t3border.bmp').convert()
  132. t3bordlb = t3bordl.get_rect()
  133. t3bordlb.centery =  windowSurface.get_rect().centery
  134. t3bordlb.left = 0
  135. t3cov = pygame.image.load('track3_top.bmp').convert()
  136. t3ani = pygame.image.load('track3_ani.bmp').convert()
  137. t3anib1 = t3ani.get_rect()
  138. t3anib2 = t3ani.get_rect()
  139. t3anib1.centerx = windowSurface.get_rect().centerx
  140. t3anib1.bottom = windowSurface.get_rect().top - 600
  141. t3anib2.centerx = windowSurface.get_rect().centerx
  142. t3anib2.bottom = windowSurface.get_rect().top - 300
  143.  
  144. track4= pygame.image.load('track4.bmp').convert()
  145. track4b= track4.get_rect()
  146. t4thundl1= pygame.image.load('thundr1.bmp').convert()
  147. t4thundl2= pygame.image.load('thundr2.bmp').convert()
  148. t4thundl3= pygame.image.load('thundr3.bmp').convert()
  149. t4thundr1= pygame.image.load('thundl1.bmp').convert()
  150. t4thundr2= pygame.image.load('thundl2.bmp').convert()
  151. t4thundr3= pygame.image.load('thundl3.bmp').convert()
  152. t4thundl1b= t4thundl1.get_rect()
  153. t4thundl2b= t4thundl2.get_rect()
  154. t4thundl3b= t4thundl3.get_rect()
  155. t4thundr1b= t4thundr1.get_rect()
  156. t4thundr2b= t4thundr2.get_rect()
  157. t4thundr3b= t4thundr3.get_rect()
  158.  
  159. t4thundl1b.top = windowSurface.get_rect().top
  160. t4thundl1b.left = windowSurface.get_rect().left + 120
  161. t4thundr1b.right = windowSurface.get_rect().right - 120
  162. t4thundr1b.top = windowSurface.get_rect().top
  163.  
  164. t4thundl2b.top = windowSurface.get_rect().top
  165. t4thundl2b.left = windowSurface.get_rect().left + 120
  166. t4thundr2b.right = windowSurface.get_rect().right - 120
  167. t4thundr2b.top = windowSurface.get_rect().top
  168.  
  169. t4thundl3b.top = windowSurface.get_rect().top
  170. t4thundl3b.left = windowSurface.get_rect().left + 120
  171. t4thundr3b.right = windowSurface.get_rect().right - 120
  172. t4thundr3b.top = windowSurface.get_rect().top
  173.  
  174. track5= pygame.image.load('track5.bmp').convert()
  175. track5b= track5.get_rect()
  176. t5bordr = pygame.image.load('t5border.bmp').convert()
  177. t5bordrb= t5bordr.get_rect()
  178. t5bordrb.centery =  windowSurface.get_rect().centery
  179. t5bordrb.right = windowSurface.get_rect().width
  180. t5bordl = pygame.image.load('t5border.bmp').convert()
  181. t5bordlb = t5bordl.get_rect()
  182. t5bordlb.centery =  windowSurface.get_rect().centery
  183. t5bordlb.left = 0
  184. t5flake1 = pygame.image.load('track5_flake1.bmp').convert()
  185. t5flake1b1 = t5flake1.get_rect()
  186. t5flake1b2 = t5flake1.get_rect()
  187. t5flake1b3 = t5flake1.get_rect()
  188. t5flake1b4 = t5flake1.get_rect()
  189. t5flake1b5 = t5flake1.get_rect()
  190. t5flake1b1.bottom= windowSurface.get_rect().top - 100
  191. t5flake1b2.bottom= windowSurface.get_rect().top - 250
  192. t5flake1b3.bottom= windowSurface.get_rect().top - 400
  193. t5flake1b4.bottom= windowSurface.get_rect().top - 550
  194. t5flake1b5.bottom= windowSurface.get_rect().top - 700
  195. t5flake1bteam= [t5flake1b1, t5flake1b2, t5flake1b3, t5flake1b4, t5flake1b5]
  196. t5flake1b1.centerx= windowSurface.get_rect().left + 530
  197. t5flake1b2.centerx= windowSurface.get_rect().left + 170
  198. t5flake1b3.centerx= windowSurface.get_rect().left + 430
  199. t5flake1b4.centerx= windowSurface.get_rect().left + 70
  200. t5flake1b5.centerx= windowSurface.get_rect().left + 280
  201. t5cov = pygame.image.load('t5top.bmp').convert()
  202. #_______________end_________:
  203.  
  204. p0b.centerx = windowSurface.get_rect().centerx
  205. p0b.centery = windowSurface.get_rect().centery
  206. p1b.centerx = windowSurface.get_rect().centerx
  207. p1b.centery = windowSurface.get_rect().centery
  208. p2b.centerx = windowSurface.get_rect().centerx
  209. p2b.centery = windowSurface.get_rect().centery
  210. playerpics= [p0, p1, p2]*1200
  211. playerbodies= [p0b, p1b, p2b]*1200
  212. laser0= pygame.image.load('laserbeam.bmp').convert()
  213. laser1= pygame.image.load('laserbeamb.bmp').convert()
  214. claser0= pygame.image.load('claserbeam.bmp').convert()
  215. claser1= pygame.image.load('claserbeamb.bmp').convert()
  216. laser2= pygame.image.load('c1.bmp').convert()
  217. claser2= pygame.image.load('c2.bmp').convert()
  218. ESH1 = pygame.image.load('Esh1.bmp').convert()
  219. ESH2 = pygame.image.load('Esh2.bmp').convert()
  220. brick = pygame.image.load('lobstacle.bmp').convert()
  221. ibrick = pygame.image.load('iobstacle.bmp').convert()
  222. hbrick = pygame.image.load('hobstacle.bmp').convert()
  223. sbrick = pygame.image.load('obstacle.bmp').convert()
  224. rbrick = pygame.image.load('robstacle.bmp').convert()
  225. hp = pygame.image.load('hp.bmp').convert()
  226. ep = pygame.image.load('energy.bmp').convert()
  227. AZone = pygame.image.load('A-zone.bmp').convert()
  228.  
  229.  
  230. attacks = [laser0, laser1, claser0, claser1, laser2, claser2, ESH2, ESH1]
  231. Eshield= [ESH1, ESH2]
  232. laser0b = laser0.get_rect()
  233. laser1b = laser1.get_rect()
  234. claser0b = claser0.get_rect()
  235. claser1b = claser1.get_rect()
  236. laser2b = laser2.get_rect()
  237. claser2b = claser2.get_rect()
  238. ESHb = ESH1.get_rect()
  239. brickbody= brick.get_rect()
  240. ibrickbody= ibrick.get_rect()
  241. hbrickbody= hbrick.get_rect()
  242. sbrickbody = sbrick.get_rect()
  243. rbrickbody = rbrick.get_rect()
  244. hpbody = hp.get_rect()
  245. epbody = ep.get_rect()
  246. AZoneb = AZone.get_rect()
  247. AZoneb.centerx = windowSurface.get_rect().centerx
  248. AZoneb.centery = -25
  249.  
  250. objects = [brick, ibrick, hbrick, sbrick, rbrick, AZone]
  251. #___________________explosions___________________:
  252. exp0 = pygame.image.load('exp0.bmp').convert()
  253. exp1 = pygame.image.load('exp1.bmp').convert()
  254. exp2 = pygame.image.load('exp2.bmp').convert()
  255. exp3 = pygame.image.load('exp3.bmp').convert()
  256. exp4 = pygame.image.load('exp4.bmp').convert()
  257. exp5 = pygame.image.load('exp5.bmp').convert()
  258. exp6 = pygame.image.load('exp6.bmp').convert()
  259. exp7 = pygame.image.load('exp7.bmp').convert()
  260. exp8 = pygame.image.load('exp8.bmp').convert()
  261. exp9 = pygame.image.load('exp9.bmp').convert()
  262. exp10 = pygame.image.load('exp10.bmp').convert()
  263. exp11 = pygame.image.load('exp11.bmp').convert()
  264. exb0 = exp0.get_rect()
  265. exb1 = exp1.get_rect()
  266. exb2 = exp2.get_rect()
  267. exb3 = exp3.get_rect()
  268. exb4 = exp4.get_rect()
  269. exb5 = exp5.get_rect()
  270. exb6 = exp6.get_rect()
  271. exb7 = exp7.get_rect()
  272. exb8 = exp8.get_rect()
  273. exb9 = exp9.get_rect()
  274. exb10 = exp10.get_rect()
  275. exb11 = exp11.get_rect()
  276. explosion= [exp0, exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8, exp9, exp10, exp11]
  277. explosionb= [exb0, exb1, exb2, exb3, exb4, exb5, exb6, exb7, exb8, exb9, exb10, exb11]
  278. bexp0 = pygame.image.load('bexp0.bmp').convert()
  279. bexp1 = pygame.image.load('bexp1.bmp').convert()
  280. bexp2 = pygame.image.load('bexp2.bmp').convert()
  281. bexp3 = pygame.image.load('bexp3.bmp').convert()
  282. bexp4 = pygame.image.load('bexp4.bmp').convert()
  283. bexp5 = pygame.image.load('bexp5.bmp').convert()
  284. bexp6 = pygame.image.load('bexp6.bmp').convert()
  285. bexp7 = pygame.image.load('bexp7.bmp').convert()
  286. bexp8 = pygame.image.load('bexp8.bmp').convert()
  287. bexp9 = pygame.image.load('bexp9.bmp').convert()
  288. bigexplosion= [bexp0, bexp1, bexp2, bexp3, bexp4, bexp5, bexp6, bexp7, bexp8, bexp9]
  289. #end:
  290. energy = pygame.image.load('live.bmp').convert()
  291. energyb = energy.get_rect()
  292. #_____________bpad______________:
  293. bouncepadr = pygame.image.load('ruwa.bmp').convert()
  294. bouncepadrb= bouncepadr.get_rect()
  295. bouncepadrb.centery =  windowSurface.get_rect().centery
  296. bouncepadrb.right = windowSurface.get_rect().width
  297. bouncepadl = pygame.image.load('ruwa.bmp').convert()
  298. bouncepadlb= bouncepadl.get_rect()
  299. bouncepadlb.centery =  windowSurface.get_rect().centery
  300. bouncepadlb.left = 0
  301. #end:
  302. #_______passsysfilespreparation_________:
  303. num1 = pygame.image.load('1numb.bmp').convert()
  304. num2 = pygame.image.load('2numb.bmp').convert()
  305. num3 = pygame.image.load('3numb.bmp').convert()
  306. num4 = pygame.image.load('4numb.bmp').convert()
  307. num5 = pygame.image.load('5numb.bmp').convert()
  308. num6 = pygame.image.load('6numb.bmp').convert()
  309. num7 = pygame.image.load('7numb.bmp').convert()
  310. num8 = pygame.image.load('8numb.bmp').convert()
  311. num9 = pygame.image.load('9numb.bmp').convert()
  312. num0 = pygame.image.load('0numb.bmp').convert()
  313. numdel = pygame.image.load('delnumb.bmp').convert()
  314. numselection = pygame.image.load('pdnumb.bmp').convert()
  315. numpad = [num1, num2, num3, num4, num5, num6, num7, num8, num9, num0, numdel, numselection]
  316. num1bdy= num1.get_rect()
  317. num2bdy= num2.get_rect()
  318. num3bdy= num3.get_rect()
  319. num4bdy= num4.get_rect()
  320. num5bdy= num5.get_rect()
  321. num6bdy= num6.get_rect()
  322. num7bdy= num7.get_rect()
  323. num8bdy= num8.get_rect()
  324. num9bdy= num9.get_rect()
  325. num0bdy= num0.get_rect()
  326. numdelbdy= numdel.get_rect()
  327. numselectionbdy = numselection.get_rect()
  328. #end:
  329. #_______energy bar_________:
  330. eb1 = pygame.image.load('energy1.bmp').convert()
  331. eb2 = pygame.image.load('energy2.bmp').convert()
  332. eb3 = pygame.image.load('energy3.bmp').convert()
  333. eb4 = pygame.image.load('energy4.bmp').convert()
  334. eb5 = pygame.image.load('energy5.bmp').convert()
  335. eb6 = pygame.image.load('energy6.bmp').convert()
  336. eb7 = pygame.image.load('energy7.bmp').convert()
  337. eb8 = pygame.image.load('energy8.bmp').convert()
  338. eb9 = pygame.image.load('energy9.bmp').convert()
  339. eb10 = pygame.image.load('energy10.bmp').convert()
  340. eb11 = pygame.image.load('energy11.bmp').convert()
  341. eb12 = pygame.image.load('energy12.bmp').convert()
  342. eb13 = pygame.image.load('energy13.bmp').convert()
  343. eb14 = pygame.image.load('energy14.bmp').convert()
  344. eb15 = pygame.image.load('energy15.bmp').convert()
  345. eb16 = pygame.image.load('energy16.bmp').convert()
  346. eb17 = pygame.image.load('energy17.bmp').convert()
  347. eb18 = pygame.image.load('energy18.bmp').convert()
  348. eb19 = pygame.image.load('energy19.bmp').convert()
  349. eb20 = pygame.image.load('energy20.bmp').convert()
  350. eb21 = pygame.image.load('energy21.bmp').convert()
  351. eb22 = pygame.image.load('energy22.bmp').convert()
  352. eb23 = pygame.image.load('energy23.bmp').convert()
  353. eb24 = pygame.image.load('energy24.bmp').convert()
  354. eb25 = pygame.image.load('energy25.bmp').convert()
  355. eb26 = pygame.image.load('energy26.bmp').convert()
  356. eb27 = pygame.image.load('energy27.bmp').convert()
  357. eb28 = pygame.image.load('energy28.bmp').convert()
  358. eb29 = pygame.image.load('energy29.bmp').convert()
  359. eb30 = pygame.image.load('energy30.bmp').convert()
  360. eb31 = pygame.image.load('energy31.bmp').convert()
  361. eb32 = pygame.image.load('energy32.bmp').convert()
  362. eb33 = pygame.image.load('energy33.bmp').convert()
  363. eb34 = pygame.image.load('energy34.bmp').convert()
  364. eb35 = pygame.image.load('energy35.bmp').convert()
  365. eb36 = pygame.image.load('energy36.bmp').convert()
  366.  
  367. ebt = [eb1, eb1, eb2, eb2, eb3, eb3, eb4, eb4, eb5, eb5, eb6, eb6, eb7, eb7, eb8, eb8, eb9, eb9, eb10, eb10, eb11, eb11, eb12, eb12, eb13, eb13, eb14, eb14, eb15, eb15, eb16, eb16, eb17, eb17, eb18, eb18, eb19, eb19, eb20, eb20, eb21, eb21, eb22, eb22, eb23, eb23, eb24, eb24, eb25, eb25, eb26, eb26, eb27, eb27, eb28, eb28, eb29, eb29, eb30, eb30, eb31, eb31, eb32, eb32, eb33, eb33, eb34, eb34, eb35, eb35, eb36, eb36]
  368.  
  369. eb1b = eb1.get_rect()
  370. eb2b = eb2.get_rect()
  371. eb3b = eb3.get_rect()
  372. eb4b = eb4.get_rect()
  373. eb5b = eb5.get_rect()
  374. eb6b = eb6.get_rect()
  375. eb7b = eb7.get_rect()
  376. eb8b = eb8.get_rect()
  377. eb9b = eb9.get_rect()
  378. eb10b = eb10.get_rect()
  379. eb11b = eb11.get_rect()
  380. eb12b = eb12.get_rect()
  381. eb13b = eb13.get_rect()
  382. eb14b = eb14.get_rect()
  383. eb15b = eb15.get_rect()
  384. eb16b = eb16.get_rect()
  385. eb17b = eb17.get_rect()
  386. eb18b = eb18.get_rect()
  387. eb19b = eb19.get_rect()
  388. eb20b = eb20.get_rect()
  389. eb21b = eb21.get_rect()
  390. eb22b = eb22.get_rect()
  391. eb23b = eb23.get_rect()
  392. eb24b = eb24.get_rect()
  393. eb25b = eb25.get_rect()
  394. eb26b = eb26.get_rect()
  395. eb27b = eb27.get_rect()
  396. eb28b = eb28.get_rect()
  397. eb29b = eb29.get_rect()
  398. eb30b = eb30.get_rect()
  399. eb31b = eb31.get_rect()
  400. eb32b = eb32.get_rect()
  401. eb33b = eb33.get_rect()
  402. eb34b = eb34.get_rect()
  403. eb35b = eb35.get_rect()
  404. eb36b = eb36.get_rect()
  405.  
  406.  
  407. eb1b.top =  windowSurface.get_rect().top + 15
  408. eb1b.left = windowSurface.get_rect().centerx + 90
  409. #end:
  410.  
  411. def Close():
  412.     pygame.quit()
  413.     sys.exit()
  414.  
  415.  
  416. def Track1(track1, track1b):
  417.     windowSurface.blit(track1, track1b)
  418.     windowSurface.blit(t1bordl, t1bordlb)
  419.     windowSurface.blit(t1bordr, t1bordrb)
  420.  
  421.  
  422.  
  423. def Track2(track2, track1b):
  424.     windowSurface.blit(track2, track1b)
  425.  
  426.     if t2colpi == True and stageiteration % 100 == 0:
  427.         random.shuffle(t2line2color)
  428.  
  429.     windowSurface.blit(t2line2color[1], track2line3b)
  430.     windowSurface.blit(t2line2color[2], track2line2b)
  431.     windowSurface.blit(t2line2color[0], track2lineb)
  432.     windowSurface.blit(t2bordl, t1bordlb)
  433.     windowSurface.blit(t2bordr, t1bordrb)
  434.     track2line2b.top += vehiclespeed
  435.     track2lineb.top += vehiclespeed
  436.     track2line3b.top += vehiclespeed
  437.     if track2line2b.top > WINDOWHEIGHT:
  438.         track2line2b.bottom = windowSurface.get_rect().top
  439.         track2line2b.centerx = windowSurface.get_rect().centerx
  440.  
  441.     if track2lineb.top > WINDOWHEIGHT:
  442.         track2lineb.bottom = windowSurface.get_rect().top
  443.         track2lineb.centerx = windowSurface.get_rect().centerx - 175
  444.  
  445.     if track2line3b.top > WINDOWHEIGHT:
  446.         track2line3b.bottom = windowSurface.get_rect().top
  447.         track2line3b.centerx = windowSurface.get_rect().centerx + 175
  448.  
  449.     return track2line2b, track2lineb, track2line3b
  450.    
  451.    
  452. def Track3(track3, track1b):
  453.     global t3isthere
  454.     windowSurface.blit(track3, track1b)
  455.     windowSurface.blit(t3bordl, t1bordlb)
  456.     windowSurface.blit(t3bordr, t1bordrb)
  457.     t3isthere = True
  458.  
  459.  
  460.  
  461. def Track4(track4, track1b):
  462.     global t4isthere
  463.     windowSurface.blit(track4, track1b)
  464.     t4isthere = True
  465.  
  466.  
  467. def Track5(track5, track1b, t5flake1bteam):
  468.     global fx, t5isthere
  469.     t5isthere = True
  470.     windowSurface.blit(track5, track1b)
  471.     windowSurface.blit(t1bordl, t1bordlb)
  472.     windowSurface.blit(t1bordr, t1bordrb)
  473.     windowSurface.blit(t5bordl, t5bordlb)
  474.     windowSurface.blit(t5bordr, t5bordrb)
  475.  
  476.  
  477.     if t5isthere:
  478.         windowSurface.blit(t5flake1, t5flake1b1)
  479.         windowSurface.blit(t5flake1, t5flake1b2)
  480.         windowSurface.blit(t5flake1, t5flake1b3)
  481.         windowSurface.blit(t5flake1, t5flake1b4)
  482.         windowSurface.blit(t5flake1, t5flake1b5)
  483.     for a in t5flake1bteam:
  484.         if a.top > WINDOWHEIGHT:
  485.             fx= random.randint(70, 530)
  486.             fy = random.randint(200, 700)
  487.             a.centerx= windowSurface.get_rect().left+ fx
  488.             a.bottom= windowSurface.get_rect().top- fy
  489.     t5flake1b1.top += 7
  490.     t5flake1b2.top += 7
  491.     t5flake1b3.top += 7
  492.     t5flake1b4.top += 7
  493.     t5flake1b5.top += 7
  494.            
  495.    
  496.    
  497. def hsmenu():
  498.     _score_ = ''
  499.     scrtxtd= []
  500.     scrtxte= []
  501.     ASC_VAL= 0
  502.     chkscrtxt = open('HighScores.man', 'r')
  503.     scrtxteb= chkscrtxt.readlines()
  504.     for a in range(len(scrtxteb)):
  505.         scrtxte.append(scrtxteb[a].rstrip('\n'))
  506.    
  507.        
  508.     for a in scrtxte:
  509.         _score_ = ''
  510.         for symb in a:
  511.             ASC_VAL = ord(symb)
  512.             ASC_VAL -= crypo
  513.             if ASC_VAL > 126:
  514.                 ASC_VAL -= 94
  515.             if ASC_VAL < 32:
  516.                 ASC_VAL += 94
  517.             _score_  += chr(ASC_VAL)
  518.        
  519.         scrtxtd.append(_score_)
  520.        
  521.    
  522.     textscore1 = basicfont.render('1st.   '+ scrtxtd[0], True, (255, 0, 0), (0 , 0 , 0))
  523.     textscore2 = basicfont.render('2nd.  '+ scrtxtd[1], True, (0, 255, 0), (0 , 0 , 0))
  524.     textscore3 = basicfont.render('3rd.   '+ scrtxtd[2], True, (0, 0, 255), (0 , 0 , 0))    
  525.     textscore4 = basicfont.render('4th.    '+ scrtxtd[3], True, (255, 128, 0), (0 , 0 , 0))
  526.     textscore5 = basicfont.render('5th.    '+ scrtxtd[4], True, (0, 255, 128), (0 , 0 , 0))
  527.     textscore6 = basicfont.render('6th.    '+ scrtxtd[5], True, (128, 0, 255), (0 , 0 , 0))
  528.     textscore7 = basicfont.render('7th.    '+ scrtxtd[6], True, (0, 255, 255), (0 , 0 , 0))    
  529.     textscore8 = basicfont.render('8th.    '+ scrtxtd[7], True, (255, 255, 0), (0 , 0 , 0))
  530.     textscore9 = basicfont.render('9th.    '+ scrtxtd[8], True, (255, 0, 255), (0 , 0 , 0))
  531.     textscore10 = basicfont.render('10th.  '+ scrtxtd[9], True, (128, 128, 128), (0 , 0 , 0))
  532.     texttopscore = basicfont.render('Top Scores', True, (255, 255, 255), (0 , 0 , 0))
  533.     textscore1b = textscore1.get_rect()        
  534.     textscore2b = textscore2.get_rect()
  535.     textscore3b = textscore3.get_rect()
  536.     textscore4b = textscore4.get_rect()
  537.     textscore5b = textscore5.get_rect()
  538.     textscore6b = textscore6.get_rect()
  539.     textscore7b = textscore7.get_rect()
  540.     textscore8b = textscore8.get_rect()
  541.     textscore9b = textscore9.get_rect()
  542.     textscore10b = textscore10.get_rect()
  543.     texttopscoreb = texttopscore.get_rect()
  544.    
  545.     textscore1b.left = windowSurface.get_rect().left +150
  546.     textscore2b.left = windowSurface.get_rect().left +150
  547.     textscore3b.left = windowSurface.get_rect().left +150
  548.     textscore4b.left = windowSurface.get_rect().left +150
  549.     textscore5b.left = windowSurface.get_rect().left +150
  550.     textscore6b.left = windowSurface.get_rect().left +150
  551.     textscore7b.left = windowSurface.get_rect().left +150
  552.     textscore8b.left = windowSurface.get_rect().left +150
  553.     textscore9b.left = windowSurface.get_rect().left +150
  554.     textscore10b.left = windowSurface.get_rect().left +150
  555.     texttopscoreb.centerx = windowSurface.get_rect().centerx
  556.     textscore1b.centery = windowSurface.get_rect().top + 100
  557.     textscore2b.centery = windowSurface.get_rect().top + 150
  558.     textscore3b.centery = windowSurface.get_rect().top + 200
  559.     textscore4b.centery = windowSurface.get_rect().top + 250
  560.     textscore5b.centery = windowSurface.get_rect().top + 300
  561.     textscore6b.centery = windowSurface.get_rect().top + 350
  562.     textscore7b.centery = windowSurface.get_rect().top + 400
  563.     textscore8b.centery = windowSurface.get_rect().top + 450
  564.     textscore9b.centery = windowSurface.get_rect().top + 500
  565.     textscore10b.centery = windowSurface.get_rect().top + 550
  566.     texttopscoreb.centery = windowSurface.get_rect().top+ 50
  567.     while True:
  568.         windowSurface.fill(BACKCOLOR)
  569.         windowSurface.blit(textscore1, textscore1b)
  570.         windowSurface.blit(textscore2, textscore2b)
  571.         windowSurface.blit(textscore3, textscore3b)
  572.         windowSurface.blit(textscore4, textscore4b)
  573.         windowSurface.blit(textscore5, textscore5b)
  574.         windowSurface.blit(textscore6, textscore6b)
  575.         windowSurface.blit(textscore7, textscore7b)
  576.         windowSurface.blit(textscore8, textscore8b)
  577.         windowSurface.blit(textscore9, textscore9b)
  578.         windowSurface.blit(textscore10, textscore10b)
  579.         windowSurface.blit(texttopscore, texttopscoreb)
  580.         pygame.display.update()
  581.         for event in pygame.event.get():
  582.             if event.type == QUIT:
  583.                 Close()
  584.             if event.type == KEYDOWN:
  585.                 if event.key == K_ESCAPE:
  586.                     Close()
  587.                 if event.key == K_BACKSPACE:
  588.                     windowSurface.fill((0, 0, 0))
  589.                     return
  590.                
  591.  
  592.        
  593.  
  594.        
  595.  
  596. def passmenu():
  597.     password = []
  598.     wrong = False
  599.     Right = False
  600.     hplace = 25
  601.     while True:
  602.         for event in pygame.event.get():
  603.             if event.type == QUIT:
  604.                 Close()
  605.             if hplace == 25:
  606.                 if event.type == KEYDOWN:
  607.                     if event.key == K_LEFT:
  608.                         hplace = 575
  609.                     if event.key == K_RIGHT:
  610.                         hplace += 55
  611.                     if event.key == K_SPACE:
  612.                         password.append(1)
  613.                 if event.type == QUIT:
  614.                     Close()
  615.                 if event.type == KEYDOWN:
  616.                     if event.key == K_ESCAPE:
  617.                         Close()
  618.                     if event.key == K_BACKSPACE:
  619.                         windowSurface.fill((0, 0, 0))
  620.                         return                        
  621.             elif hplace == 80:
  622.                 if event.type == KEYDOWN:
  623.                     if event.key == K_RIGHT:
  624.                         hplace += 55
  625.                     if event.key == K_LEFT:
  626.                         hplace -= 55
  627.                     if event.key == K_SPACE:
  628.                         password.append(2)
  629.                 if event.type == QUIT:
  630.                     Close()
  631.                 if event.type == KEYDOWN:
  632.                     if event.key == K_ESCAPE:
  633.                         Close()
  634.                     if event.key == K_BACKSPACE:
  635.                         windowSurface.fill((0, 0, 0))
  636.                         return                        
  637.             elif hplace == 135:
  638.  
  639.  
  640.                 if event.type == KEYDOWN:
  641.                     if event.key == K_RIGHT:
  642.                         hplace += 55
  643.                     if event.key == K_LEFT:
  644.                         hplace -= 55
  645.                     if event.key == K_SPACE:
  646.                         password.append(3)
  647.                 if event.type == QUIT:
  648.                     Close()
  649.                 if event.type == KEYDOWN:
  650.                     if event.key == K_ESCAPE:
  651.                         Close()
  652.                     if event.key == K_BACKSPACE:
  653.                         windowSurface.fill((0, 0, 0))
  654.                         return                        
  655.             elif hplace == 190:
  656.  
  657.  
  658.                 if event.type == KEYDOWN:
  659.                     if event.key == K_RIGHT:
  660.                         hplace += 55
  661.                     if event.key == K_LEFT:
  662.                         hplace -= 55
  663.                     if event.key == K_SPACE:
  664.                         password.append(4)
  665.                 if event.type == QUIT:
  666.                     Close()
  667.                 if event.type == KEYDOWN:
  668.                     if event.key == K_ESCAPE:
  669.                         Close()
  670.                     if event.key == K_BACKSPACE:
  671.                         windowSurface.fill((0, 0, 0))
  672.                         return                        
  673.             elif hplace == 245:
  674.  
  675.  
  676.                 if event.type == KEYDOWN:
  677.                     if event.key == K_RIGHT:
  678.                         hplace += 55
  679.                     if event.key == K_LEFT:
  680.                         hplace -= 55
  681.                     if event.key == K_SPACE:
  682.                         password.append(5)
  683.                 if event.type == QUIT:
  684.                     Close()
  685.                 if event.type == KEYDOWN:
  686.                     if event.key == K_ESCAPE:
  687.                         Close()
  688.                     if event.key == K_BACKSPACE:
  689.                         windowSurface.fill((0, 0, 0))
  690.                         return
  691.             elif hplace == 300:
  692.  
  693.  
  694.                 if event.type == KEYDOWN:
  695.                     if event.key == K_RIGHT:
  696.                         hplace += 55
  697.                     if event.key == K_LEFT:
  698.                         hplace -= 55
  699.                     if event.key == K_SPACE:
  700.                         password.append(6)
  701.                 if event.type == QUIT:
  702.                     Close()
  703.                 if event.type == KEYDOWN:
  704.                     if event.key == K_ESCAPE:
  705.                         Close()
  706.                     if event.key == K_BACKSPACE:
  707.                         windowSurface.fill((0, 0, 0))
  708.                         return
  709.             elif hplace == 355:
  710.  
  711.  
  712.                 if event.type == KEYDOWN:
  713.                     if event.key == K_RIGHT:
  714.                         hplace += 55
  715.                     if event.key == K_LEFT:
  716.                         hplace -= 55
  717.                     if event.key == K_SPACE:
  718.                         password.append(7)
  719.                 if event.type == QUIT:
  720.                     Close()
  721.                 if event.type == KEYDOWN:
  722.                     if event.key == K_ESCAPE:
  723.                         Close()
  724.                     if event.key == K_BACKSPACE:
  725.                         windowSurface.fill((0, 0, 0))
  726.                         return
  727.             elif hplace == 410:
  728.  
  729.  
  730.                 if event.type == KEYDOWN:
  731.                     if event.key == K_RIGHT:
  732.                         hplace += 55
  733.                     if event.key == K_LEFT:
  734.                         hplace -= 55
  735.                     if event.key == K_SPACE:
  736.                         password.append(8)
  737.                 if event.type == QUIT:
  738.                     Close()
  739.                 if event.type == KEYDOWN:
  740.                     if event.key == K_ESCAPE:
  741.                         Close()
  742.                     if event.key == K_BACKSPACE:
  743.                         windowSurface.fill((0, 0, 0))
  744.                         return
  745.             elif hplace == 465:
  746.  
  747.  
  748.                 if event.type == KEYDOWN:
  749.                     if event.key == K_RIGHT:
  750.                         hplace += 55
  751.                     if event.key == K_LEFT:
  752.                         hplace -= 55
  753.                     if event.key == K_SPACE:
  754.                         password.append(9)
  755.                 if event.type == QUIT:
  756.                     Close()
  757.                 if event.type == KEYDOWN:
  758.                     if event.key == K_ESCAPE:
  759.                         Close()
  760.                     if event.key == K_BACKSPACE:
  761.                         windowSurface.fill((0, 0, 0))
  762.                         return
  763.             elif hplace == 520:
  764.  
  765.  
  766.                 if event.type == KEYDOWN:
  767.                     if event.key == K_RIGHT:
  768.                         hplace += 55
  769.                     if event.key == K_LEFT:
  770.                         hplace -= 55
  771.                     if event.key == K_SPACE:
  772.                         password.append(0)
  773.                 if event.type == QUIT:
  774.                     Close()
  775.                 if event.type == KEYDOWN:
  776.                     if event.key == K_ESCAPE:
  777.                         Close()
  778.                     if event.key == K_BACKSPACE:
  779.                         windowSurface.fill((0, 0, 0))
  780.                         return
  781.             elif hplace == 575:
  782.  
  783.  
  784.                 if event.type == KEYDOWN:
  785.                     if event.key == K_LEFT:
  786.                         hplace -= 55
  787.                     if event.key == K_SPACE:
  788.                         if len(password) != 0:
  789.                             delthing = len(password) - 1
  790.                             password.remove(password[delthing])
  791.                     if event.key == K_RIGHT:
  792.                         hplace = 25
  793.                 if event.type == QUIT:
  794.                     Close()
  795.                 if event.type == KEYDOWN:
  796.                     if event.key == K_ESCAPE:
  797.                         Close()
  798.                     if event.key == K_BACKSPACE:
  799.                         windowSurface.fill((0, 0, 0))
  800.                         return
  801.  
  802.  
  803.  
  804.  
  805.  
  806.         windowSurface.fill(BACKCOLOR)
  807.         num1bdy.centerx= windowSurface.get_rect().left + 25
  808.         num1bdy.centery= windowSurface.get_rect().centery+ 50
  809.         num2bdy.centerx= windowSurface.get_rect().left + 80
  810.         num2bdy.centery= windowSurface.get_rect().centery +50
  811.         num3bdy.centerx= windowSurface.get_rect().left +135
  812.         num3bdy.centery= windowSurface.get_rect().centery  +50
  813.         num4bdy.centerx= windowSurface.get_rect().left +190
  814.         num4bdy.centery= windowSurface.get_rect().centery +50
  815.         num5bdy.centerx= windowSurface.get_rect().left +245
  816.         num5bdy.centery= windowSurface.get_rect().centery +50
  817.         num6bdy.centerx= windowSurface.get_rect().left +300
  818.         num6bdy.centery= windowSurface.get_rect().centery  +50
  819.         num7bdy.centerx= windowSurface.get_rect().left +355
  820.         num7bdy.centery= windowSurface.get_rect().centery +50
  821.         num8bdy.centerx= windowSurface.get_rect().left +410
  822.         num8bdy.centery= windowSurface.get_rect().centery +50
  823.         num9bdy.centerx= windowSurface.get_rect().left +465
  824.         num9bdy.centery= windowSurface.get_rect().centery+50
  825.         num0bdy.centerx= windowSurface.get_rect().left +520
  826.         num0bdy.centery= windowSurface.get_rect().centery +50
  827.         numdelbdy.centerx= windowSurface.get_rect().left +575
  828.         numdelbdy.centery= windowSurface.get_rect().centery +50
  829.  
  830.         numselectionbdy.centerx= windowSurface.get_rect().left + hplace
  831.         numselectionbdy.centery= windowSurface.get_rect().centery +50
  832.         passwordw= str(password).replace('[', '')
  833.         passwordw= str(passwordw).replace(',', ' ')
  834.         passwordw= str(passwordw).replace(']', '')
  835.  
  836.         thepass = passfont.render(str(passwordw), True, (255, 0, 0), (0 , 0 , 0))
  837.         thepassrect = thepass.get_rect()
  838.         thepassrect.centerx= windowSurface.get_rect().centerx
  839.         thepassrect.centery= windowSurface.get_rect().top + 100
  840.         wrongpassmess = wrongpassfont.render('The password you entered is incorrect', True, (255, 0, 0), (0 , 0 , 0))
  841.         rightpassmess = wrongpassfont.render('You Unlocked A-Machine Model A!', True, (255, 255, 0), (0 , 0 , 0))
  842.         wrongpassmessrect = wrongpassmess.get_rect()
  843.         wrongpassmessrect.centerx= windowSurface.get_rect().centerx
  844.         wrongpassmessrect.centery= windowSurface.get_rect().top + 50
  845.  
  846.         windowSurface.blit(num1, num1bdy)
  847.         windowSurface.blit(num2, num2bdy)
  848.         windowSurface.blit(num3, num3bdy)
  849.         windowSurface.blit(num4, num4bdy)
  850.         windowSurface.blit(num5, num5bdy)
  851.         windowSurface.blit(num6, num6bdy)
  852.         windowSurface.blit(num7, num7bdy)
  853.         windowSurface.blit(num8, num8bdy)
  854.         windowSurface.blit(num9, num9bdy)
  855.         windowSurface.blit(num0, num0bdy)
  856.         windowSurface.blit(numdel, numdelbdy)
  857.         windowSurface.blit(numselection, numselectionbdy)
  858.  
  859.  
  860.  
  861.  
  862.         if len(password) == 6:
  863.             windowSurface.blit(thepass, thepassrect)
  864.             pygame.display.update()
  865.             sleep(1)
  866.             password = []
  867.             print passwordw
  868.             if passwordw == "3  5  8  8  5  3":
  869.                 Right = True
  870.                 wrong = False
  871.                 print "hey"
  872.             if passwordw != "3  5  8  8  5  3":
  873.                 Right = False
  874.                 wrong = True
  875.  
  876.         if Right:
  877.             windowSurface.blit(rightpassmess, wrongpassmessrect)
  878.             passyfile = open('passy.roc', 'w')
  879.             passyfile.write('omar')
  880.             passyfile.close()
  881.  
  882.         if wrong:
  883.             windowSurface.blit(wrongpassmess, wrongpassmessrect)
  884.  
  885.         windowSurface.blit(thepass, thepassrect)
  886.         pygame.display.update()
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896. def menu():
  897.     menupos= 1
  898.     play = False
  899.     while True:
  900.         for event in pygame.event.get():
  901.             if event.type == QUIT:
  902.                 Close()
  903.  
  904.             if menupos == 1:
  905.                 if event.type == KEYDOWN:
  906.                     if event.key == K_DOWN:
  907.                         menupos += 1
  908.                     if event.key == K_SPACE:
  909.                         play = True
  910.             elif menupos == 2:
  911.                 if event.type == KEYDOWN:
  912.                     if event.key == K_UP:
  913.                         menupos -= 1
  914.                     if event.key == K_SPACE:
  915.                         hsmenu()
  916.                     if event.key == K_DOWN:
  917.                         menupos += 1
  918.             elif menupos == 3:
  919.                 if event.type == KEYDOWN:
  920.                     if event.key == K_UP:
  921.                         menupos -= 1
  922.                     if event.key == K_SPACE:
  923.                         passmenu()
  924.                     if event.key == K_DOWN:
  925.                         menupos += 1
  926.             elif menupos == 4:
  927.                 if event.type == KEYDOWN:
  928.                     if event.key == K_UP:
  929.                         menupos -= 1
  930.                     if event.key == K_SPACE:
  931.                         Close()
  932.  
  933.         if menupos == 1:
  934.             textstart = basicfont.render('Start Game', True, (255, 0, 0), (0 , 0 , 0))
  935.         else:
  936.             textstart = basicfont.render('Start Game', True, (255, 255, 255), (0, 0 , 0))
  937.  
  938.         if menupos == 2:
  939.             textoption = basicfont.render('High Scores', True, (255, 0, 0), (0 , 0 , 0))
  940.         else:
  941.             textoption = basicfont.render('High Scores', True, (255, 255, 255), (0, 0 , 0))
  942.  
  943.         if menupos == 3:
  944.             textpass = basicfont.render('Password', True, (255, 0, 0), (0 , 0 , 0))
  945.         else:
  946.             textpass = basicfont.render('Password', True, (255, 255, 255), (0, 0 , 0))
  947.  
  948.         if menupos == 4:
  949.             textexit = basicfont.render('Exit', True, (255, 0, 0), (0 , 0 , 0))
  950.         else:
  951.             textexit = basicfont.render('Exit', True, (255, 255, 255), (0, 0 , 0))
  952.  
  953.  
  954.         textstrect = textstart.get_rect()
  955.         textstrect.centerx= windowSurface.get_rect().centerx
  956.         textstrect.centery= windowSurface.get_rect().centery - 60
  957.         textoprect = textoption.get_rect()
  958.         textoprect.centerx= windowSurface.get_rect().centerx
  959.         textoprect.centery= windowSurface.get_rect().centery - 20
  960.         textparect = textpass.get_rect()
  961.         textparect.centerx= windowSurface.get_rect().centerx
  962.         textparect.centery= windowSurface.get_rect().centery + 20
  963.         textexrect = textexit.get_rect()
  964.         textexrect.centerx= windowSurface.get_rect().centerx
  965.         textexrect.centery= windowSurface.get_rect().centery + 60
  966.  
  967.         windowSurface.blit(textstart, textstrect)
  968.         windowSurface.blit(textexit, textexrect)
  969.         windowSurface.blit(textpass, textparect)
  970.         windowSurface.blit(textoption, textoprect)
  971.         pygame.display.update()
  972.         if play == True:
  973.             break
  974.  
  975.  
  976.  
  977.  
  978. def bounce():
  979.     global dobounce
  980.     dobounce = True
  981.     windowSurface.blit(bouncepadr, bouncepadrb)
  982.     windowSurface.blit(bouncepadl, bouncepadlb)
  983.    
  984.    
  985.    
  986.    
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995. pygame.mouse.set_visible(MOUSEAPPEAR)
  996. windowSurface.fill(BACKCOLOR)
  997.  
  998. #________________setting colorkeys_________________:
  999. for a in playerpics:
  1000.     colorkey = a.get_at((0,0))
  1001.     a.set_colorkey(colorkey)
  1002. for a in explosion:
  1003.     colorkey = a.get_at((0,0))
  1004.     a.set_colorkey(colorkey)
  1005. for a in bigexplosion:
  1006.     colorkey = a.get_at((0,0))
  1007.     a.set_colorkey(colorkey)
  1008. for a in attacks:
  1009.     colorkey = a.get_at((0,1))
  1010.     a.set_colorkey(colorkey)
  1011. for a in objects:
  1012.     colorkey = a.get_at((0,0))
  1013.     a.set_colorkey(colorkey)
  1014. for a in explosion:
  1015.     a.set_colorkey(black)
  1016. energy.set_colorkey(black)
  1017. bouncepadr.set_colorkey(black)
  1018. bouncepadl.set_colorkey(black)
  1019. t1bordl.set_colorkey(black)
  1020. t1bordr.set_colorkey(black)
  1021. t2bordl.set_colorkey(black)
  1022. t2bordr.set_colorkey(black)
  1023. t3bordl.set_colorkey(black)
  1024. t3bordr.set_colorkey(black)
  1025. t3ani.set_colorkey(black)
  1026. t3cov.set_colorkey(black)
  1027. t5bordl.set_colorkey(black)
  1028. t5bordr.set_colorkey(black)
  1029. t5flake1.set_colorkey(black)
  1030. t5cov.set_colorkey(black)
  1031. for a in numpad:
  1032.     a.set_colorkey(black)
  1033. for a in ebt:
  1034.     a.set_colorkey(black)
  1035. #setting end:
  1036. def restartduegameoverhahaha():
  1037.     global level, score, bulletspeed, lives, vehiclespeed, choice, energyint, dobounce, Esheildtrue, AEsheildtrue, shieldtime1, shieldtime2, stageiteration, movedirx, st1brick, st2brick, st3brick, st4brick, st5brick
  1038.     st1brick= []
  1039.     st2brick= []
  1040.     st3brick= []
  1041.     st4brick= []
  1042.     st5brick= []
  1043.     score = 1500 * int(level)
  1044.     bulletspeed = 30
  1045.     lives = 20
  1046.     vehiclespeed = 10
  1047.     if carxop:
  1048.         lives = 30
  1049.         vehiclespeed = 14
  1050.     choice = True
  1051.     energyint = 71
  1052.     dobounce = False
  1053.     Esheildtrue = False
  1054.     AEsheildtrue = False
  1055.     shieldtime1 = 0
  1056.     shieldtime2 = 0
  1057.     stageiteration= 0
  1058.     movedirx = 0
  1059.  
  1060. def _initialthings_():
  1061.     global score, las, lasb, moveright, moveleft, go, bulletspeed, notinlaser, level, st1brick, st2brick, st3brick
  1062.     return
  1063.    
  1064. score = 0
  1065. las = False
  1066. lasb = False
  1067. moveright = False
  1068. moveleft = False
  1069. go = False
  1070. bulletspeed = 30
  1071. notinlaser = True
  1072. level = 1
  1073. st1brick= []
  1074. st2brick= []
  1075. st3brick= []
  1076. st4brick= []
  1077. st5brick= []
  1078. st1hp= []
  1079. st1ep= []
  1080. explosionplace= []
  1081. iexplosionplace= []
  1082. bigexplosionplace= []
  1083. y = 0
  1084. lives = 20
  1085. vehiclespeed = 10
  1086. if carxop:
  1087.     lives = 30
  1088.     vehiclespeed = 16
  1089. gameover = False
  1090. trackc= track1
  1091. y= 0
  1092. z= 0
  1093. dashright = dashleft = False
  1094. dasho = False
  1095. dashspeed = 20
  1096. stageiteration= 0
  1097. choice = True
  1098. energyint = 71
  1099. ebt.reverse()
  1100. dobounce = False
  1101. lbouncevalue= 0
  1102. rbouncevalue= 0
  1103. bounceleft = False
  1104. bounceright= False
  1105. menu()
  1106. laserover = True
  1107. charge = False
  1108. chargeiteration= 0
  1109. cshot = False
  1110. clas = False
  1111. clasb = False
  1112. cgo = False
  1113. cspower = 0
  1114. cnotinlaser = True
  1115. t3isthere = False
  1116. choiceh = 0
  1117. choicee = 0
  1118. hx = 0
  1119. ex = 0
  1120. t4isthere = False
  1121. thunderloop = 1
  1122. Esheildtrue = False
  1123. AEsheildtrue = False
  1124. shieldtime1 = 0
  1125. shieldtime2 = 0
  1126. reflection = False
  1127. x= 0
  1128. ActivateAzone = False
  1129. sounds = []
  1130. channelexp = pygame.mixer.Channel(1)
  1131. channellas = pygame.mixer.Channel(3)
  1132.  
  1133.  
  1134. while True :
  1135.     for n in range(3600):
  1136.         t3isthere = False
  1137.         t4isthere = False
  1138.         t5isthere = False
  1139.         dobounce = False
  1140.         if stageiteration == 2:
  1141.             laserover = False
  1142.         while pause == 0:
  1143.             #_______________________buttons_assignment_____________________:
  1144.             for event in pygame.event.get():
  1145.                 if event.type == QUIT:
  1146.                     Close()
  1147.                 if event.type == KEYUP:
  1148.                     if event.key == K_F1:
  1149.                         pause = 1
  1150.                         moveleft = moveright= False
  1151.                     if event.key == K_ESCAPE:
  1152.                         Close()
  1153.         for event in pygame.event.get():
  1154.             if event.type == QUIT:
  1155.                 Close()
  1156.             if event.type == KEYDOWN:
  1157.                 if event.key == K_ESCAPE:
  1158.                     Close()
  1159.                 if gameover == False:
  1160.                     if laserover == False:
  1161.                         if event.key == K_SPACE:
  1162.                             if energyint > 0:
  1163.                                 charge = True
  1164.                            
  1165.                                
  1166.                 if gameover == False:
  1167.                     if event.key == K_LEFT:
  1168.                         if dashleft == False and dashright == False:
  1169.                             moveleft = True
  1170.  
  1171.  
  1172.                     if event.key == K_RIGHT:
  1173.                         if dashleft == False and dashright == False:
  1174.                             moveright = True
  1175.  
  1176.                     if event.key == K_LCTRL:
  1177.                         dasho = False
  1178.  
  1179.                     if dasho == True:
  1180.                         if event.key == K_LEFT:
  1181.                             if dashleft == False and dashright != True:
  1182.                                 moveleft = moveright = False
  1183.                                 dashleft= True
  1184.  
  1185.                         if event.key == K_RIGHT:
  1186.                             if dashleft == False and dashleft != True:
  1187.                                 moveleft = moveright = False
  1188.                                 dashright = True
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.             if event.type == KEYUP:
  1195.                 if event.key == K_DOWN and stageiteration > 1:
  1196.                     Esheildtrue= False
  1197.                     AEsheildtrue= False
  1198.                     chargeiteration= 0
  1199.                 if event.key ==  K_F1:
  1200.                     pause= 0
  1201.  
  1202.                 if gameover == False:
  1203.                     if laserover == False:
  1204.                         if notinlaser == True and energyint > 0 and cshot== False:
  1205.                            
  1206.                             if event.key == K_SPACE:
  1207.                                 las = pygame.mixer.Sound('4.wav')
  1208.                                 channellas.play(las)
  1209.                                 las = True
  1210.                                 go = False
  1211.                                 energyint -= 1
  1212.                                 charge= False
  1213.                                 chargeiteration= 0
  1214.                        
  1215.                         elif cshot == True and energyint > 1 and cnotinlaser == True:
  1216.                             if event.key == K_UP and stageiteration > 1:
  1217.                                 AEsheildtrue = True
  1218.                             else:
  1219.                                 AEsheildtrue = False
  1220.                             if event.key == K_SPACE:
  1221.  
  1222.                                 las = pygame.mixer.Sound('4.wav')
  1223.  
  1224.                                 channellas.play(las)
  1225.                                 clas = True
  1226.                                 cgo = False
  1227.                                 energyint -= 2
  1228.                                 charge= False
  1229.                                 chargeiteration= 0
  1230.                                 cshot = False
  1231.  
  1232.  
  1233.                 if event.key == K_LCTRL:
  1234.  
  1235.                     dasho = False
  1236.                 if event.key == K_LEFT:
  1237.  
  1238.                     moveleft = False
  1239.  
  1240.                 if event.key == K_RIGHT:
  1241.  
  1242.                     moveright = False
  1243.         #__________end_______________:
  1244.        
  1245.  
  1246.         if playerbodies[n].left < 19:
  1247.             moveleft = False
  1248.             dashleft = False
  1249.  
  1250.         if playerbodies[n].right > WINDOWWIDTH - 19:
  1251.             moveright = False
  1252.             dashright= False
  1253.  
  1254.         if moveleft == True:
  1255.             movedirx = movedirx - PLAYERSPEED
  1256.         if moveright == True:
  1257.             movedirx = movedirx + PLAYERSPEED
  1258.  
  1259.  
  1260.            
  1261.         if bounceleft == True:
  1262.             movedirx = movedirx - lbouncevalue
  1263.         if bounceright == True:
  1264.             movedirx = movedirx + rbouncevalue
  1265.  
  1266.  
  1267.  
  1268.         if dashleft == True:
  1269.             movedirx = movedirx - dashspeed
  1270.         if dashright == True:
  1271.             movedirx = movedirx + dashspeed
  1272.            
  1273.  
  1274.  
  1275.  
  1276.         p0b.centerx = windowSurface.get_rect().centerx + movedirx
  1277.         p0b.centery = windowSurface.get_rect().height - 100
  1278.         p1b.centerx = windowSurface.get_rect().centerx + movedirx
  1279.         p1b.centery = windowSurface.get_rect().height - 100
  1280.         p2b.centerx = windowSurface.get_rect().centerx + movedirx
  1281.         p2b.centery = windowSurface.get_rect().height - 100
  1282.         windowSurface.fill(BACKCOLOR)
  1283.         track1b.center = windowSurface.get_rect().center
  1284.  
  1285.  
  1286.         if (level == 1 or level == 2):
  1287.             if level == 1 and stageiteration == 1:
  1288.                 if stageiteration == 1 and pygame.mixer.music.get_busy():
  1289.                     pygame.mixer.music.stop()
  1290.                 pygame.mixer.music.load(music[0])
  1291.  
  1292.             Track1(track1, track1b)
  1293.             trackc= track1
  1294.            
  1295.         if (level == 3 or level == 4):
  1296.             Track2(track2, track1b)
  1297.             trackc= track2
  1298.             if level == 3 and stageiteration == 1:
  1299.                 if stageiteration == 1 and pygame.mixer.music.get_busy():
  1300.                     pygame.mixer.music.stop()
  1301.                 pygame.mixer.music.load(music[1])
  1302.             if level == 4 and stageiteration == 1:
  1303.                 if stageiteration == 1 and pygame.mixer.music.get_busy():
  1304.                     pygame.mixer.music.stop()
  1305.                 pygame.mixer.music.load(music[1])
  1306.  
  1307.         if (level == 5 or level == 6):
  1308.             Track3(track3, track1b)
  1309.             trackc= track3
  1310.             if stageiteration == 1:
  1311.                 if stageiteration == 1 and pygame.mixer.music.get_busy():
  1312.                     pygame.mixer.music.stop()
  1313.                 pygame.mixer.music.load(music[1])
  1314.  
  1315.            
  1316.         if (level == 7 or level == 8):
  1317.             Track5(track5, track1b, t5flake1bteam)
  1318.             trackc= track5
  1319.             if level == 8 and stageiteration == 1:
  1320.                 if stageiteration == 1 and pygame.mixer.music.get_busy():
  1321.                     pygame.mixer.music.stop()
  1322.                 pygame.mixer.music.load(music[2])
  1323.             if level == 7 and stageiteration == 1:
  1324.                 if stageiteration == 1 and pygame.mixer.music.get_busy():
  1325.                     pygame.mixer.music.stop()
  1326.                 pygame.mixer.music.load(music[1])
  1327.         if (level == 9 or level == 10):
  1328.             Track4(track4, track1b)
  1329.             trackc= track4
  1330.             if level == 8 and stageiteration == 1:
  1331.                 if stageiteration == 1 and pygame.mixer.music.get_busy():
  1332.                     pygame.mixer.music.stop()
  1333.                 pygame.mixer.music.load(music[2])
  1334.            
  1335.            
  1336.         if t4isthere == True:
  1337.             if thunderloop > 0 and thunderloop < 11:
  1338.                 thunder1= t4thundl1
  1339.                 thunder2= t4thundr1
  1340.             elif thunderloop > 10 and thunderloop < 21:
  1341.                 thunder1= t4thundl2
  1342.                 thunder2= t4thundr2
  1343.             elif thunderloop > 20 and thunderloop < 31:
  1344.                 thunder1= t4thundl3
  1345.                 thunder2= t4thundr3
  1346.             elif thunderloop > 30:
  1347.                 if thunderloop %20 == 0:
  1348.                     thunder1= t4thundr3
  1349.                     thunder2= t4thundl3
  1350.                     t4thundr3b.top += 48
  1351.                     t4thundl3b.top += 48
  1352.                 elif thunderloop %10 == 0:
  1353.                     thunder1= t4thundl3
  1354.                     thunder2= t4thundr3
  1355.                     t4thundr3b.top += 48
  1356.                     t4thundl3b.top += 48
  1357.  
  1358.             windowSurface.blit(thunder1, t4thundl3b)
  1359.             windowSurface.blit(thunder2, t4thundr3b)              
  1360.                    
  1361.             bounce()
  1362.             thunderloop += 1
  1363.  
  1364.             if t4thundr3b.top > WINDOWHEIGHT:
  1365.                 t4thundr3b.bottom = 0
  1366.                 thunderloop = 0
  1367.             if t4thundl3b.top > WINDOWHEIGHT:
  1368.                 t4thundl3b.bottom = 0
  1369.                 thunderloop = 0
  1370.         windowSurface.blit(playerpics[n], playerbodies[n])
  1371.         stageiteration, st1brick, st2brick, st3brick, st4brick, st5brick, st1hp, st1hp, x, level, lives, energyint, movedirx, st1ep =levels.levels_dat(windowSurface, brickbody, hbrickbody, sbrickbody, ibrickbody, rbrickbody, epbody, hpbody, stageiteration, st1brick, st2brick, st3brick, st4brick, st5brick, st1hp, x, level, lives, energyint, movedirx, st1ep, black,basicfont)
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.         if charge== True:
  1378.            
  1379.        
  1380.             laser0b.bottom = p2b.top
  1381.             laser0b.centerx = p2b.centerx
  1382.             laser2b.bottom = p2b.top -4
  1383.             laser2b.centerx = p2b.centerx
  1384.             claser0b.bottom = p2b.top
  1385.             claser0b.centerx = p2b.centerx
  1386.             claser2b.bottom = p2b.top -4
  1387.             claser2b.centerx = p2b.centerx
  1388.             if chargeiteration < 10:
  1389.                 pass
  1390.             elif chargeiteration <= 36:
  1391.                 if chargeiteration in [10, 11, 12, 16, 17, 18, 22, 23, 24, 28, 29, 30, 34, 35, 36]:
  1392.  
  1393.                     windowSurface.blit(laser0, laser0b)
  1394.                 elif chargeiteration in [13, 14, 15, 19, 20, 21, 25, 26, 27, 31, 32, 33]:
  1395.                     windowSurface.blit(laser2, laser2b)
  1396.            
  1397.             elif chargeiteration > 36:
  1398.                 if chargeiteration % 4 == 0 or chargeiteration % 5 == 0:
  1399.                     windowSurface.blit(claser0, claser0b)
  1400.  
  1401.                 else:
  1402.                     windowSurface.blit(claser2, claser2b)
  1403.                 cshot = True
  1404.                    
  1405.            
  1406.             chargeiteration += 1
  1407.  
  1408.         if AEsheildtrue:
  1409.             Esheildtrue= True
  1410.             AEsheildtrue= False
  1411.             chargeiteration= 0
  1412.  
  1413.         if Esheildtrue and stageiteration == 1:
  1414.             Esheildtrue= False
  1415.             AEsheildtrue= False
  1416.             chargeiteration= 0
  1417.            
  1418.  
  1419.  
  1420.  
  1421.         if Esheildtrue:
  1422.             shieldtime2 = time()
  1423.            
  1424.             ESHb.centerx = p2b.centerx
  1425.             if n % 2== 0:
  1426.  
  1427.  
  1428.                 ESHb.top = p2b.top - 2
  1429.                 windowSurface.blit(Eshield[0], ESHb)
  1430.                
  1431.             else:
  1432.                 ESHb.top = p2b.top
  1433.                 windowSurface.blit(Eshield[1], ESHb)
  1434.             if shieldtime2- shieldtime1 > 1:
  1435.                 energyint -= 2
  1436.                 shieldtime1= time()
  1437.                 if energyint <= 2:
  1438.                     Esheildtrue= False
  1439.                
  1440.                
  1441.            
  1442.            
  1443.  
  1444.         if las == True and clas == False:
  1445.  
  1446.             laser0b.centerx = p2b.centerx
  1447.             laser0b.bottom = p2b.top
  1448.             windowSurface.blit(laser0, laser0b)
  1449.             las = False
  1450.             lasb = True
  1451.  
  1452.         elif clas == True :
  1453.  
  1454.             claser0b.centerx = p2b.centerx
  1455.             claser0b.bottom = p2b.top
  1456.             windowSurface.blit(claser0, claser0b)
  1457.             clas = False
  1458.             clasb = True            
  1459.  
  1460.  
  1461.  
  1462.  
  1463.         if lasb == True and go == False:
  1464.             notinlaser = False
  1465.             laser1b.centerx = p2b.centerx
  1466.             laser1b.bottom = p2b.top - 10
  1467.  
  1468.  
  1469.             go = True
  1470.  
  1471.         elif clasb == True and cgo == False:
  1472.             cnotinlaser = False
  1473.             claser1b.centerx = p2b.centerx
  1474.             claser1b.bottom = p2b.top - 10
  1475.  
  1476.                
  1477.  
  1478.             cgo = True
  1479.  
  1480.         if lasb == True and go == True:
  1481.             laser1b.bottom -=  bulletspeed
  1482.             windowSurface.blit(laser1, laser1b)
  1483.          
  1484.  
  1485.         elif clasb == True and cgo == True:
  1486.             claser1b.bottom -=  bulletspeed
  1487.             windowSurface.blit(claser1, claser1b)
  1488.  
  1489.            
  1490.  
  1491.  
  1492.  
  1493.  
  1494.         for a in st1brick:
  1495.             windowSurface.blit(brick, a)
  1496.  
  1497.                
  1498.             if laser1b.colliderect(a):
  1499.                 explosionplace.append(a)
  1500.                 st1brick.remove(a)
  1501.                 laser1b[1]= -35
  1502.                 score += 200
  1503.  
  1504.                  
  1505.             elif claser1b.colliderect(a):
  1506.                 explosionplace.append(a)
  1507.                 cspower += 1
  1508.                 score += 200
  1509.                 st1brick.remove(a)
  1510.                 if cspower == 2:
  1511.                     claser1b[1]= -10035
  1512.                     cspower = 0
  1513.  
  1514.  
  1515.  
  1516.  
  1517.             if playerbodies[n].colliderect(a):
  1518.                 explosionplace.append(a)
  1519.                 st1brick.remove(a)
  1520.                 if not Esheildtrue:
  1521.                     lives -=1
  1522.                 else:
  1523.                     score += 10
  1524.                        
  1525.  
  1526.  
  1527.  
  1528.         for a in st2brick:
  1529.             windowSurface.blit(ibrick, a)
  1530.  
  1531.             if laser1b.colliderect(a):
  1532.                 iexplosionplace.append(a)
  1533.                 laser1b[1]= -1000
  1534.  
  1535.                
  1536.             if claser1b.colliderect(a):
  1537.                 iexplosionplace.append(a)
  1538.                 cspower += 2
  1539.                
  1540.                 if cspower > 1:
  1541.                     claser1b[1]= -1035
  1542.                     cspower = 0
  1543.  
  1544.              
  1545.             if playerbodies[n].colliderect(a):
  1546.                 explosionplace.append(a)
  1547.                 st2brick.remove(a)
  1548.                 if not Esheildtrue:
  1549.                     lives -=3
  1550.                 else:
  1551.                     score += 10
  1552.                     lives -= 2
  1553.  
  1554.         for a in st3brick:
  1555.             windowSurface.blit(hbrick, a)
  1556.  
  1557.             if laser1b.colliderect(a):
  1558.                 iexplosionplace.append(a)
  1559.                 st1brick.append(a)
  1560.                 st3brick.remove(a)
  1561.                 laser1b[1]= -1000
  1562.  
  1563.             elif claser1b.colliderect(a):
  1564.                 if cspower == 1:
  1565.                     iexplosionplace.append(a)
  1566.                     st1brick.append(a)
  1567.                     st3brick.remove(a)
  1568.                     cspower +=1
  1569.                     score += 200
  1570.                    
  1571.  
  1572.                 elif cspower == 0:
  1573.                     iexplosionplace.append(a)
  1574.                     cspower += 2
  1575.                     score += 400
  1576.                     st3brick.remove(a)
  1577.                    
  1578.                
  1579.                
  1580.                 if cspower == 2:
  1581.                     claser1b[1]= -1035
  1582.                     cspower = 0
  1583.  
  1584.  
  1585.             if playerbodies[n].colliderect(a):
  1586.                 iexplosionplace.append(a)
  1587.                 if not Esheildtrue:
  1588.                     lives -=2
  1589.                 else:
  1590.                     score += 10
  1591.                     lives -= 1
  1592.                 st3brick.remove(a)
  1593.  
  1594.         for a in st4brick:
  1595.             windowSurface.blit(sbrick, a)
  1596.  
  1597.             if laser1b.colliderect(a):
  1598.                 explosionplace.append(a)
  1599.                 st4brick.remove(a)
  1600.                 laser1b[1]= -35
  1601.                 score += 150
  1602.  
  1603.             elif claser1b.colliderect(a):
  1604.                 explosionplace.append(a)
  1605.                 st4brick.remove(a)
  1606.                 cspower += 1
  1607.                 score += 350
  1608.                 if cspower == 2:
  1609.                     claser1b[1]= -35
  1610.                     cspower = 0
  1611.  
  1612.             if playerbodies[n].colliderect(a):
  1613.                 explosionplace.append(a)
  1614.                 st4brick.remove(a)
  1615.                 if not Esheildtrue:
  1616.                     lives -=1
  1617.                 else:
  1618.                     score += 10
  1619.  
  1620.  
  1621.         for a in st5brick:
  1622.             windowSurface.blit(rbrick, a)
  1623.             if laser1b.colliderect(a) or claser1b.colliderect(a):
  1624.                 reflection = True
  1625.  
  1626.             elif claser1b.colliderect(a):
  1627.                 reflection = True
  1628.  
  1629.             if playerbodies[n].colliderect(a):
  1630.                 explosionplace.append(a)
  1631.                 st5brick.remove(a)
  1632.                 if not Esheildtrue:
  1633.                     lives -=1
  1634.                 else:
  1635.                     score += 10
  1636.  
  1637.  
  1638.         for a in st1hp:
  1639.             windowSurface.blit(hp, a)
  1640.  
  1641.             if laser1b.colliderect(a):
  1642.                 explosionplace.append(a)
  1643.                 st1hp.remove(a)
  1644.                 score += 1000
  1645.                 laser1b[1]= -35
  1646.                
  1647.             if claser1b.colliderect(a):
  1648.                 explosionplace.append(a)
  1649.                 st1hp.remove(a)
  1650.                 cspower += 1
  1651.                 score += 1000
  1652.                 if cspower == 2:
  1653.                     claser1b[1]= -1035
  1654.                     cspower = 0
  1655.  
  1656.             if playerbodies[n].colliderect(a):
  1657.                 st1hp.remove(a)
  1658.                 lives += 3
  1659.  
  1660.         for a in st1ep:
  1661.             windowSurface.blit(ep, a)
  1662.  
  1663.             if laser1b.colliderect(a):
  1664.                 explosionplace.append(a)
  1665.                 st1ep.remove(a)
  1666.                 score += 1000
  1667.                 laser1b[1]= -35
  1668.                
  1669.             if claser1b.colliderect(a):
  1670.                 explosionplace.append(a)
  1671.                 st1ep.remove(a)
  1672.                 cspower += 1
  1673.                 score += 1000
  1674.                 if cspower == 2:
  1675.                     claser1b[1]= -1035
  1676.                     cspower = 0
  1677.  
  1678.             if playerbodies[n].colliderect(a):
  1679.                 st1ep.remove(a)
  1680.                 if energyint < 62:
  1681.                     energyint += 10
  1682.                 else:
  1683.                     energyint = 71
  1684.                    
  1685.         if playerbodies[n].colliderect(laser1b):
  1686.             explosionplace.append(playerbodies[n])
  1687.             laser1b.top = WINDOWHEIGHT +1000
  1688.             if not Esheildtrue:
  1689.                 lives -=1
  1690.             else:
  1691.                 score += 10
  1692.  
  1693.         if playerbodies[n].colliderect(claser1b):
  1694.             explosionplace.append(playerbodies[1])
  1695.             claser1b.top = WINDOWHEIGHT +1000
  1696.             cspower = 0
  1697.             if not Esheildtrue:
  1698.                 lives -=2
  1699.             else:
  1700.                 lives -=1            
  1701.  
  1702.         if playerbodies[n].colliderect(bouncepadrb) and dobounce == True:
  1703.             bounceleft = True
  1704.             lbouncevalue= 30
  1705.  
  1706.         if playerbodies[n].colliderect(bouncepadlb) and dobounce == True:
  1707.             bounceright = True
  1708.             rbouncevalue= 30
  1709.  
  1710.         if bounceleft == True:
  1711.             if lbouncevalue > 0:
  1712.                 lbouncevalue -= 1
  1713.             else:
  1714.                 lbouncevalue= 0
  1715.                 bounceleft = False  
  1716.  
  1717.  
  1718.         if bounceright == True:
  1719.             if rbouncevalue > 0:
  1720.                 rbouncevalue -= 1
  1721.             else:
  1722.                 rbouncevalue= 0
  1723.                 bounceright = False
  1724.  
  1725.         #A-zone activation            
  1726.         if stageiteration == 2500:
  1727.             ActivateAzone = True
  1728.  
  1729.         if ActivateAzone == True:
  1730.            
  1731.             windowSurface.blit(AZone, AZoneb)
  1732.             AZoneb[1] = AZoneb[1] + vehiclespeed
  1733.             if AZoneb.top >= playerbodies[n].top:
  1734.                 pygame.time.delay(250)
  1735.                 vehiclespeed += 3
  1736.                 PLAYERSPEED += 3
  1737.                 AZoneb = AZone.get_rect()
  1738.                 AZoneb.centerx = windowSurface.get_rect().centerx
  1739.                 AZoneb.centery = -25
  1740.                 ActivateAzone = False      
  1741.  
  1742.                
  1743.                
  1744.                
  1745.  
  1746.  
  1747.                
  1748.            
  1749.         while lives < 1 :
  1750.             pygame.mixer.stop()
  1751.  
  1752.             for event in pygame.event.get():
  1753.                 if event.type == QUIT:
  1754.                     Close()
  1755.                 if event.type == KEYUP:
  1756.                     moveleft = moveright= False
  1757.                     if event.key == K_ESCAPE:
  1758.                         Close()
  1759.             bulletspeed += 30
  1760.             vehiclespeed= 0
  1761.             windowSurface.fill(BACKCOLOR)
  1762.             gameover = True
  1763.  
  1764.             for a in st1brick:
  1765.                 windowSurface.blit(brick, a)
  1766.                 pygame.display.flip()    
  1767.             for a in bigexplosion:
  1768.                 windowSurface.fill(BACKCOLOR)
  1769.                 windowSurface.blit(bigexplosion[z], playerbodies[n])
  1770.                 z +=1
  1771.                 exlsound = pygame.mixer.Sound('7.wav')
  1772.                 exlsound.play()
  1773.                 pygame.display.flip()
  1774.                 if z == 10:
  1775.                     while z == 10:
  1776.                         windowSurface.fill(BACKCOLOR)
  1777.                         for d in st1brick:
  1778.                             windowSurface.blit(brick, d)
  1779.                             pygame.display.flip()
  1780.                             pygame.time.delay(20)
  1781.                             for event in pygame.event.get():
  1782.                                 if event.type == QUIT:
  1783.                                     Close()
  1784.                                 if event.type == KEYUP:
  1785.                                     moveleft = moveright= False
  1786.                                     if event.key == K_ESCAPE:
  1787.                                         Close()
  1788.                         try:
  1789.                             _score_ = ''
  1790.                             scrtxtd= []
  1791.                             scrtxte= []
  1792.                             ASC_VAL= 0
  1793.                             chkscrtxt = open('HighScores.man', 'r')
  1794.                             scrtxteb= chkscrtxt.readlines()
  1795.                             for c in range(len(scrtxteb)):
  1796.                                 scrtxte.append(scrtxteb[c].rstrip('\n'))
  1797.  
  1798.                                
  1799.                            
  1800.                                
  1801.                             for c in scrtxte:
  1802.                                 _score_ = ''
  1803.                                 for symb in c:
  1804.                                     ASC_VAL = ord(symb)
  1805.                                     ASC_VAL -= crypo
  1806.                                     if ASC_VAL > 126:
  1807.                                         ASC_VAL -= 94
  1808.                                     if ASC_VAL < 32:
  1809.                                         ASC_VAL += 94
  1810.                                     _score_  += chr(ASC_VAL)
  1811.                                
  1812.                                 scrtxtd.append(_score_)
  1813.                             chkscrtxt.close()
  1814.                             _score_ = ''
  1815.                            
  1816.                             for sn in range(10):
  1817.                            
  1818.                                 if score > int(scrtxtd[sn]):
  1819.  
  1820.                                     chkscrtxt = open('HighScores.man', 'w')
  1821.                                     for symb in str(score):
  1822.                                         ASC_VAL = ord(symb)
  1823.                                         ASC_VAL += crypo
  1824.                                         if ASC_VAL > 126:
  1825.                                             ASC_VAL -= 94
  1826.                                         if ASC_VAL < 32:
  1827.                                             ASC_VAL += 94
  1828.                                         _score_  += chr(ASC_VAL)
  1829.                                     scrtxteb[sn]= _score_ + '\n'
  1830.                                     chkscrtxt.writelines(scrtxteb)
  1831.                                     scrtxteb= []
  1832.                                     chkscrtxt.close()
  1833.  
  1834.                                        
  1835.                                
  1836.                            
  1837.  
  1838.  
  1839.                             for c in range(256):
  1840.                                 windowSurface.fill(BACKCOLOR)
  1841.                                 gameoverfont = threetwoone.render('GAME OVER', True, (c, c, c), (0, 0 , 0))
  1842.                                 gameoverfontb= gameoverfont.get_rect()
  1843.                                 gameoverfontb.centery= windowSurface.get_rect().centery
  1844.                                 gameoverfontb.centerx= windowSurface.get_rect().centerx
  1845.                                 windowSurface.blit(gameoverfont, gameoverfontb)
  1846.                                 pygame.display.flip()
  1847.                                 pygame.time.delay(10)
  1848.  
  1849.                                 if c == 255:
  1850.                                     sleep(2)
  1851.                                     gameover = False
  1852.                                     restartduegameoverhahaha()
  1853.                                     z = 0
  1854.                                    
  1855.                                     for event in pygame.event.get():
  1856.                                         if event.type == QUIT:
  1857.                                             Close()
  1858.                                         if event.type == KEYUP:
  1859.                                             moveleft = moveright= False
  1860.                                             if event.key == K_ESCAPE:
  1861.                                                 Close()
  1862.                                 for event in pygame.event.get():
  1863.                                     if event.type == QUIT:
  1864.                                         Close()
  1865.                                     if event.type == KEYUP:
  1866.                                         moveleft = moveright= False
  1867.                                         if event.key == K_ESCAPE:
  1868.                                             Close()
  1869.  
  1870.                         except:
  1871.                             for c in range(256):
  1872.                                 windowSurface.fill(BACKCOLOR)
  1873.                                 gameoverfont = threetwoone.render('GAME OVER', True, (c, c, c), (0, 0 , 0))
  1874.                                 gameoverfontb= gameoverfont.get_rect()
  1875.                                 gameoverfontb.centery= windowSurface.get_rect().centery
  1876.                                 gameoverfontb.centerx= windowSurface.get_rect().centerx
  1877.                                 windowSurface.blit(gameoverfont, gameoverfontb)
  1878.                                 pygame.display.flip()
  1879.                                 pygame.time.delay(10)
  1880.  
  1881.                                 if c == 255:
  1882.                                     sleep(2)
  1883.                                     gameover = False
  1884.                                     restartduegameoverhahaha()
  1885.                                     z = 0
  1886.                                    
  1887.                                     for event in pygame.event.get():
  1888.                                         if event.type == QUIT:
  1889.                                             Close()
  1890.                                         if event.type == KEYUP:
  1891.                                             moveleft = moveright= False
  1892.                                             if event.key == K_ESCAPE:
  1893.                                                 Close()
  1894.                                 for event in pygame.event.get():
  1895.                                     if event.type == QUIT:
  1896.                                         Close()
  1897.                                     if event.type == KEYUP:
  1898.                                         moveleft = moveright= False
  1899.                                         if event.key == K_ESCAPE:
  1900.                                             Close()
  1901.                            
  1902.                                
  1903.                 Clock.tick(30)
  1904.  
  1905.  
  1906.  
  1907.         for a in st1brick:
  1908.  
  1909.             if a[1] > WINDOWHEIGHT:
  1910.                 st1brick.remove(a)
  1911.  
  1912.         for b in range(len(st1brick)):
  1913.             st1brick[b][1] = st1brick[b][1] + vehiclespeed
  1914.  
  1915.         for a in st4brick:
  1916.  
  1917.             if a[1] > WINDOWHEIGHT:
  1918.                 st4brick.remove(a)
  1919.  
  1920.         for b in range(len(st4brick)):
  1921.             st4brick[b][1] = st4brick[b][1] + vehiclespeed
  1922.  
  1923.         for a in st2brick:
  1924.  
  1925.             if a[1] > WINDOWHEIGHT:
  1926.                 st2brick.remove(a)
  1927.  
  1928.         for b in range(len(st2brick)):
  1929.             st2brick[b][1] = st2brick[b][1]+ vehiclespeed
  1930.  
  1931.  
  1932.         for a in st3brick:
  1933.  
  1934.             if a[1] > WINDOWHEIGHT:
  1935.                 st3brick.remove(a)
  1936.  
  1937.         for b in range(len(st3brick)):
  1938.             st3brick[b][1] = st3brick[b][1] + vehiclespeed
  1939.  
  1940.         for a in st5brick:
  1941.  
  1942.             if a[1] > WINDOWHEIGHT:
  1943.                 st5brick.remove(a)
  1944.  
  1945.         for b in range(len(st5brick)):
  1946.             st5brick[b][1] = st5brick[b][1] + vehiclespeed
  1947.  
  1948.  
  1949.  
  1950.  
  1951.         for a in st1hp:
  1952.  
  1953.             if a[1] > WINDOWHEIGHT:
  1954.                 st1hp.remove(a)
  1955.  
  1956.         for b in range(len(st1hp)):
  1957.             st1hp[b][1] = st1hp[b][1] + vehiclespeed
  1958.  
  1959.         for a in st1ep:
  1960.  
  1961.             if a[1] > WINDOWHEIGHT:
  1962.                 st1ep.remove(a)
  1963.  
  1964.         for b in range(len(st1ep)):
  1965.             st1ep[b][1] = st1ep[b][1] + vehiclespeed
  1966.  
  1967.         for q in explosionplace:
  1968.             exnsound = pygame.mixer.Sound('7.wav')
  1969.  
  1970.            
  1971.                
  1972.  
  1973.             windowSurface.blit(explosion[y], q)
  1974.             y += 1
  1975.             q[1]= q[1]+8
  1976.  
  1977.             if y == 12:
  1978.                 y = 0
  1979.                 explosionplace.remove(q)
  1980.  
  1981.         for q in iexplosionplace:
  1982.             exnsound = pygame.mixer.Sound('8.wav')
  1983.  
  1984.             windowSurface.blit(explosion[y], q)
  1985.             y += 1
  1986.             q[1]= q[1]
  1987.             if y == 12:
  1988.                 y = 0
  1989.                 iexplosionplace.remove(q)
  1990.  
  1991.         if claser1b.bottom < 0:
  1992.             claser1b[1] = -10000
  1993.             clas = False
  1994.             clasb = False
  1995.             cgo = False
  1996.             cnotinlaser= True
  1997.             cspower = 0
  1998.            
  1999.            
  2000.         if laser1b.bottom < 0:
  2001.             laser1b[1] = -10000
  2002.             las = False
  2003.             lasb = False
  2004.             go = False
  2005.             notinlaser= True
  2006.  
  2007.         if reflection:
  2008.             if laser1b.top > WINDOWHEIGHT :
  2009.                 bulletspeed = 30
  2010.                 las = False
  2011.                 lasb = False
  2012.                 go = False
  2013.                 notinlaser= True
  2014.                 reflection = False
  2015.                
  2016.             elif claser1b.top > WINDOWHEIGHT:
  2017.                 bulletspeed = 30
  2018.                 clas = False
  2019.                 clasb = False
  2020.                 cgo = False
  2021.                 cnotinlaser= True
  2022.                 cspower = 0
  2023.                 reflection = False
  2024.                
  2025.             else:
  2026.                 bulletspeed = -30
  2027.                
  2028.         if t5isthere:
  2029.             windowSurface.blit(t5cov, track1b)
  2030.  
  2031.  
  2032.  
  2033.  
  2034.            
  2035.  
  2036.  
  2037.         if t3isthere:
  2038.             windowSurface.blit(t3cov, track1b)
  2039.             windowSurface.blit(t3ani, t3anib1)
  2040.             windowSurface.blit(t3ani, t3anib2)
  2041.             t3anib1.top += vehiclespeed
  2042.             t3anib2.top += vehiclespeed
  2043.  
  2044.             if t3anib1.top > WINDOWHEIGHT:
  2045.                 t3anib1.bottom = 0
  2046.             if t3anib2.top > WINDOWHEIGHT:
  2047.                 t3anib2.bottom = 0
  2048.  
  2049.  
  2050.  
  2051.             if t3anib1.top > WINDOWHEIGHT:
  2052.                 t3anib1.bottom = 0
  2053.             if t3anib2.top > WINDOWHEIGHT:
  2054.                 t3anib2.bottom = 0
  2055.  
  2056.            
  2057.  
  2058.         textscore = scorefont.render(str(score), False, (255, 0, 0), (0 , 0 , 0))
  2059.         textscorest = scorefont.render('Score:', False, (255, 0, 0), (0 , 0 , 0))
  2060.         textener = basicfont.render(str(lives), False, (0, 200, 255), (0 , 0 , 0))
  2061.         textscrect = textscore.get_rect()
  2062.         textscstrect = textscorest.get_rect()
  2063.         textenerrect= textener.get_rect()
  2064.         textscrect.centerx= windowSurface.get_rect().centerx - 5
  2065.         textscstrect.centerx= windowSurface.get_rect().centerx - 115
  2066.         textscrect.centery= windowSurface.get_rect().top + 25
  2067.         textscstrect.centery= windowSurface.get_rect().top + 25
  2068.         textenerrect.centerx= windowSurface.get_rect().centerx - 200
  2069.         textenerrect.centery= windowSurface.get_rect().top + 25
  2070.         energyb.centerx= windowSurface.get_rect().centerx - 250
  2071.         energyb.centery= windowSurface.get_rect().top + 25
  2072.  
  2073.         textscore.set_colorkey(black)
  2074.         textscorest.set_colorkey(black)
  2075.         textener.set_colorkey(black)
  2076.         windowSurface.blit(textscore, textscrect)
  2077.         windowSurface.blit(textscorest, textscstrect)
  2078.         windowSurface.blit(textener, textenerrect)
  2079.         windowSurface.blit(energy, energyb)
  2080.         windowSurface.blit(ebt[energyint], eb1b)
  2081.  
  2082.         if level == 11:
  2083.             passcodeimg = pygame.image.load("passed.bmp")
  2084.             passcodeimgb= passcodeimg.get_rect()
  2085.             passcodeimgb.center = windowSurface.get_rect().center
  2086.             while True:
  2087.                 windowSurface.blit(passcodeimg, passcodeimgb)
  2088.                 for event in pygame.event.get():
  2089.                     if event.type == QUIT:
  2090.                         Close()
  2091.                     if event.type == KEYUP:
  2092.                         moveleft = moveright= False
  2093.                         if event.key == K_ESCAPE:
  2094.                             Close()
  2095.                 pygame.display.update()
  2096.  
  2097.         #3-2-1 go
  2098.         if stageiteration == 2:
  2099.             pygame.mixer.music.stop()
  2100.             pygame.mixer.music.play(-1, 12.0)
  2101.             vehiclespeed = 10
  2102.             PLAYERSPEED  = 9
  2103.             windowSurface.fill(BACKCOLOR)
  2104.             three = threetwoone.render('3', False, (255, 0, 0), (0, 0 , 0))
  2105.             threeb = three.get_rect()
  2106.             threeb.center = windowSurface.get_rect().center
  2107.             three.set_colorkey(black)
  2108.             p.set_colorkey(black)
  2109.             windowSurface.blit(trackc, track1b)
  2110.             windowSurface.blit(p, playerbodies[n])
  2111.             textscore.set_colorkey(black)
  2112.             textscorest.set_colorkey(black)
  2113.             textener.set_colorkey(black)
  2114.             windowSurface.blit(textscore, textscrect)
  2115.             windowSurface.blit(textscorest, textscstrect)
  2116.             windowSurface.blit(textener, textenerrect)
  2117.             windowSurface.blit(energy, energyb)
  2118.             windowSurface.blit(three, threeb)
  2119.             windowSurface.blit(ebt[energyint], eb1b)
  2120.             pygame.display.update()
  2121.             sleep(2)
  2122.             windowSurface.fill(BACKCOLOR)
  2123.             two = threetwoone.render('2', False, (0, 255, 0), (0, 0 , 0))
  2124.             two.set_colorkey(black)
  2125.             p.set_colorkey(black)
  2126.             windowSurface.blit(trackc, track1b)
  2127.             windowSurface.blit(p, playerbodies[n])
  2128.             textscore.set_colorkey(black)
  2129.             textscorest.set_colorkey(black)
  2130.             textener.set_colorkey(black)
  2131.             windowSurface.blit(textscore, textscrect)
  2132.             windowSurface.blit(textscorest, textscstrect)
  2133.             windowSurface.blit(textener, textenerrect)
  2134.             windowSurface.blit(energy, energyb)
  2135.             windowSurface.blit(two, threeb)
  2136.             windowSurface.blit(ebt[energyint], eb1b)
  2137.             pygame.display.update()
  2138.             sleep(2)
  2139.             windowSurface.fill(BACKCOLOR)
  2140.             one = threetwoone.render('1', False, (0, 0, 255), (0, 0 , 0))
  2141.             one.set_colorkey(black)
  2142.             p.set_colorkey(black)
  2143.             windowSurface.blit(trackc, track1b)
  2144.             windowSurface.blit(p, playerbodies[n])
  2145.             textscore.set_colorkey(black)
  2146.             textscorest.set_colorkey(black)
  2147.             textener.set_colorkey(black)
  2148.             windowSurface.blit(textscore, textscrect)
  2149.             windowSurface.blit(textscorest, textscstrect)
  2150.             windowSurface.blit(textener, textenerrect)
  2151.             windowSurface.blit(energy, energyb)
  2152.             windowSurface.blit(one, threeb)
  2153.             windowSurface.blit(ebt[energyint], eb1b)
  2154.             pygame.display.update()
  2155.             sleep(2)
  2156.             windowSurface.fill(BACKCOLOR)
  2157.             gowrite = gosys.render('GO!', False, (255, 255, 255), (0, 0 , 0))
  2158.             gowriteb= gowrite.get_rect()
  2159.             gowriteb.center = windowSurface.get_rect().center
  2160.             gowrite.set_colorkey(black)
  2161.             p.set_colorkey(black)
  2162.             windowSurface.blit(trackc, track1b)
  2163.             windowSurface.blit(p, playerbodies[n])
  2164.             textscore.set_colorkey(black)
  2165.             textscorest.set_colorkey(black)
  2166.             textener.set_colorkey(black)
  2167.             windowSurface.blit(textscore, textscrect)
  2168.             windowSurface.blit(textscorest, textscstrect)
  2169.             windowSurface.blit(textener, textenerrect)
  2170.             windowSurface.blit(energy, energyb)
  2171.             windowSurface.blit(gowrite, gowriteb)
  2172.             windowSurface.blit(ebt[energyint], eb1b)
  2173.             pygame.display.update()
  2174.             sleep(1)
  2175.            
  2176.        #3-2-1 go_end
  2177.         Clock.tick(carspeed)
  2178.         Clock.tick(FPS)      
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.         score += 1
  2186.         dobounce = False
  2187.  
  2188.         pygame.display.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement