Advertisement
LegitBrainless

Untitled

Mar 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.07 KB | None | 0 0
  1. import pygame
  2. import random
  3. pygame.init()
  4.  
  5.  
  6. #Graphics
  7. win = pygame.display.set_mode((1800, 768), pygame.RESIZABLE)
  8. pygame.display.set_caption("Jotaro's revenge")
  9. bg = pygame.image.load('bg.png')
  10. life = pygame.image.load('heart.png')
  11. dio = pygame.image.load('dio.png')
  12. tb = pygame.image.load('pinktb.png')
  13. font = pygame.font.SysFont('comicsans', 40, True)
  14. font2 = pygame.font.SysFont('comicsans', 20, True)
  15. idle = [pygame.image.load('jojo1.png'), pygame.image.load('jojo2.png'), pygame.image.load('jojo3.png'), pygame.image.load('jojo4.png'), pygame.image.load('jojo5.png'), pygame.image.load('jojo6.png'), pygame.image.load('jojo7.png'), pygame.image.load('jojo8.png'), pygame.image.load('jojo9.png'), pygame.image.load('jojo10.png'), pygame.image.load('jojo11.png'), pygame.image.load('jojo12.png'), pygame.image.load('jojo13.png'), pygame.image.load('jojo14.png'), pygame.image.load('jojo15.png'), pygame.image.load('jojo16.png')]
  16. darken = pygame.image.load('darken.png')
  17.  
  18.  
  19. #Sound
  20. music = pygame.mixer.music.load('jotaro.mp3')
  21. timestop = pygame.mixer.Sound('zawordu.wav')
  22. pygame.mixer.music.play(-1)
  23.  
  24. pygame.mixer.music.set_volume(0.2)
  25. pygame.mixer.music.pause()
  26.  
  27.  
  28.  
  29. #classes and definitions
  30. class player(object):
  31. def __init__(self, x, y, width, height):
  32. self.x = x
  33. self.y = y
  34. self.width = width
  35. self.height = height
  36. self.vel = 15
  37. self.hitbox = (137, self.y, self.width, self.height)
  38. self.walkcount = 0
  39. def draw(self, win):#Animation
  40. win.blit(idle[self.walkcount//3], (self.x,self.y))
  41. self.walkcount += 1
  42. if self.walkcount == 11:#14 on 1 v6rra v2iksem kui 3 korda (piltide arv)
  43. self.walkcount = 0
  44. self.hitbox = (137, self.y, self.width, self.height)
  45. #pygame.draw.rect(win, (255,0,0), self.hitbox, 2)
  46.  
  47. def hit(self):
  48. print('hit')
  49. self.score += 100
  50.  
  51. #texts
  52. class textbox1(object):
  53. def __init__(self,x,y,width,height):
  54. self.x = x
  55. self.y = y
  56. self.width = width
  57. self.height = height
  58. self.vel = 6
  59. self.hitbox = (self.x, self.y, self.width, self.height)
  60.  
  61. def draw(self, win):
  62. text = font.render('the', 1, (255,255,255))
  63. win.blit(text, (self.x, self.y))
  64. self.hitbox = (self.x, self.y, self.width, self.height)
  65. #pygame.draw.rect(win, (255,0,0), self.hitbox, 2)
  66.  
  67. class textbox2(object):
  68. def __init__(self,x,y,width,height):
  69. self.x = x
  70. self.y = y
  71. self.width = width
  72. self.height = height
  73. self.vel = 6
  74. self.hitbox = (self.x, self.y, self.width, self.height)
  75.  
  76. def draw(self, win):
  77. text = font.render('an', 1, (255,255,255))
  78. win.blit(text, (self.x, self.y))
  79. self.hitbox = (self.x, self.y, self.width, self.height)
  80. #pygame.draw.rect(win, (255,0,0), self.hitbox, 2)
  81.  
  82. class textbox3(object):
  83. def __init__(self,x,y,width,height):
  84. self.x = x
  85. self.y = y
  86. self.width = width
  87. self.height = height
  88. self.vel = 6
  89. self.hitbox = (self.x, self.y, self.width, self.height)
  90.  
  91. def draw(self, win):
  92. text = font.render('a', 1, (255,255,255))
  93. win.blit(text, (self.x, self.y))
  94. self.hitbox = (self.x, self.y, self.width, self.height)
  95. #pygame.draw.rect(win, (255,0,0), self.hitbox, 2)
  96.  
  97. class textbox4(object):
  98. def __init__(self,x,y,width,height):
  99. self.x = x
  100. self.y = y
  101. self.width = width
  102. self.height = height
  103. self.vel = 6
  104. self.hitbox = (self.x, self.y, self.width, self.height)
  105.  
  106. def draw(self, win):
  107. text = font.render('No article', 1, (255,255,255))
  108. win.blit(text, (self.x, self.y))
  109. self.hitbox = (self.x, self.y, self.width, self.height)
  110. #pygame.draw.rect(win, (255,0,0), self.hitbox, 2)
  111.  
  112. #class textbox5(object):
  113. #def __init__(self,x,y,width,height):
  114. #self.x = x
  115. #self.y = y
  116. #self.width = width
  117. #self.height = height
  118. #self.vel = 6
  119. #self.hitbox = (self.x, self.y, self.width, self.height)
  120.  
  121. #def draw(self, win):
  122. #self.hitbox = (self.x, self.y, self.width, self.height)
  123. #pygame.draw.rect(win, (255,0,0), (self.hitbox), 2)
  124.  
  125. class text1(object):
  126. def __init__(self,x,y,width,height):
  127. self.x = x
  128. self.y = y
  129. self.width = width
  130. self.height = height
  131. self.hitbox = (self.x, self.y, self.width, self.height)
  132.  
  133. def draw(self, win):
  134. win.blit(text1, (self.x, self.y))
  135. self.hitbox = (self.x, self.y, self.width, self.height)
  136. #pygame.draw.rect(win, (255,0,0), self.hitbox, 2)
  137.  
  138. class score(object):
  139. def __init__(self,x,y,width,height):
  140. self.x = x
  141. self.y = y
  142. self.width = width
  143. self.height = height
  144. self.hitbox = (self.x, self.y, self.width, self.height)
  145.  
  146. def draw(self, win):
  147. text = font.render('Score: ' + str(man.score), 1, (255,255,255))
  148. win.blit(text, (self.x, self.y))
  149. self.hitbox = (self.x, self.y, self.width, self.height)
  150. #pygame.draw.rect(win, (255,0,0), self.hitbox, 2)
  151.  
  152. #textbox
  153. class startspeech(object):
  154. def __init__(self,x,y):
  155. self.x = x
  156. self.y = y
  157.  
  158. def draw(self, win):
  159. if article1.x > 2529 and article1.x < 2535:
  160. text = font2.render("H", 1, (0,0,0))
  161. win.blit(text, (self.x, self.y))
  162. if article1.x > 2523 and article1.x < 2529:
  163. text = font2.render("HA", 1, (0,0,0))
  164. win.blit(text, (self.x, self.y))
  165. if article1.x > 2517 and article1.x < 2523:
  166. text = font2.render("HAH", 1, (0,0,0))
  167. win.blit(text, (self.x, self.y))
  168. if article1.x > 2511 and article1.x < 2517:
  169. text = font2.render("HAHA", 1, (0,0,0))
  170. win.blit(text, (self.x, self.y))
  171. if article1.x > 2505 and article1.x < 2511:
  172. text = font2.render("HAHAH", 1, (0,0,0))
  173. win.blit(text, (self.x, self.y))
  174. if article1.x > 2499 and article1.x < 2505:
  175. text = font2.render("HAHAHA", 1, (0,0,0))
  176. win.blit(text, (self.x, self.y))
  177. if article1.x > 2493 and article1.x < 2499:
  178. text = font2.render("HAHAHA!", 1, (0,0,0))
  179. win.blit(text, (self.x, self.y))
  180. if article1.x > 2487 and article1.x < 2493:
  181. text = font2.render("HAHAHA! Y", 1, (0,0,0))
  182. win.blit(text, (self.x, self.y))
  183. if article1.x > 2481 and article1.x < 2487:
  184. text = font2.render("HAHAHA! Yo", 1, (0,0,0))
  185. win.blit(text, (self.x, self.y))
  186. if article1.x > 2475 and article1.x < 2481:
  187. text = font2.render("HAHAHA! You", 1, (0,0,0))
  188. win.blit(text, (self.x, self.y))
  189. if article1.x > 2469 and article1.x < 2475:
  190. text = font2.render("HAHAHA! You c", 1, (0,0,0))
  191. win.blit(text, (self.x, self.y))
  192. if article1.x > 2463 and article1.x < 2469:
  193. text = font2.render("HAHAHA! You ca", 1, (0,0,0))
  194. win.blit(text, (self.x, self.y))
  195. if article1.x > 2457 and article1.x < 2463:
  196. text = font2.render("HAHAHA! You can", 1, (0,0,0))
  197. win.blit(text, (self.x, self.y))
  198. if article1.x > 2451 and article1.x < 2457:
  199. text = font2.render("HAHAHA! You can n", 1, (0,0,0))
  200. win.blit(text, (self.x, self.y))
  201. if article1.x > 2445 and article1.x < 2451:
  202. text = font2.render("HAHAHA! You can ne", 1, (0,0,0))
  203. win.blit(text, (self.x, self.y))
  204. if article1.x > 2439 and article1.x < 2445:
  205. text = font2.render("HAHAHA! You can nev", 1, (0,0,0))
  206. win.blit(text, (self.x, self.y))
  207. if article1.x > 2433 and article1.x < 2439:
  208. text = font2.render("HAHAHA! You can neve", 1, (0,0,0))
  209. win.blit(text, (self.x, self.y))
  210. if article1.x > 2427 and article1.x < 2433:
  211. text = font2.render("HAHAHA! You can never", 1, (0,0,0))
  212. win.blit(text, (self.x, self.y))
  213. if article1.x > 2421 and article1.x < 2427:
  214. text = font2.render("HAHAHA! You can never d", 1, (0,0,0))
  215. win.blit(text, (self.x, self.y))
  216. if article1.x > 2415 and article1.x < 2421:
  217. text = font2.render("HAHAHA! You can never de", 1, (0,0,0))
  218. win.blit(text, (self.x, self.y))
  219. if article1.x > 2409 and article1.x < 2415:
  220. text = font2.render("HAHAHA! You can never def", 1, (0,0,0))
  221. win.blit(text, (self.x, self.y))
  222. if article1.x > 2403 and article1.x < 2409:
  223. text = font2.render("HAHAHA! You can never defe", 1, (0,0,0))
  224. win.blit(text, (self.x, self.y))
  225. if article1.x > 2397 and article1.x < 2403:
  226. text = font2.render("HAHAHA! You can never defea", 1, (0,0,0))
  227. win.blit(text, (self.x, self.y))
  228. if article1.x > 2391 and article1.x < 2397:
  229. text = font2.render("HAHAHA! You can never defeat", 1, (0,0,0))
  230. win.blit(text, (self.x, self.y))
  231. if article1.x > 2385 and article1.x < 2391:
  232. text = font2.render("HAHAHA! You can never defeat m", 1, (0,0,0))
  233. win.blit(text, (self.x, self.y))
  234. if article1.x > 2379 and article1.x < 2385:
  235. text = font2.render("HAHAHA! You can never defeat me", 1, (0,0,0))
  236. win.blit(text, (self.x, self.y))
  237. if article1.x > 2373 and article1.x < 2379:
  238. text = font2.render("HAHAHA! You can never defeat me,", 1, (0,0,0))
  239. win.blit(text, (self.x, self.y))
  240. if article1.x > 2367 and article1.x < 2373:
  241. text = font2.render("HAHAHA! You can never defeat me, D", 1, (0,0,0))
  242. win.blit(text, (self.x, self.y))
  243. if article1.x > 2361 and article1.x < 2367:
  244. text = font2.render("HAHAHA! You can never defeat me, DI", 1, (0,0,0))
  245. win.blit(text, (self.x, self.y))
  246. if article1.x > 2355 and article1.x < 2361:
  247. text = font2.render("HAHAHA! You can never defeat me, DIO", 1, (0,0,0))
  248. win.blit(text, (self.x, self.y))
  249. if article1.x > 2349 and article1.x < 2355:
  250. text = font2.render("HAHAHA! You can never defeat me, DIO,", 1, (0,0,0))
  251. win.blit(text, (self.x, self.y))
  252. if article1.x > 2343 and article1.x < 2349:
  253. text = font2.render("HAHAHA! You can never defeat me, DIO, a", 1, (0,0,0))
  254. win.blit(text, (self.x, self.y))
  255. if article1.x > 2337 and article1.x < 2343:
  256. text = font2.render("HAHAHA! You can never defeat me, DIO, an", 1, (0,0,0))
  257. win.blit(text, (self.x, self.y))
  258. if article1.x > 2331 and article1.x < 2337:
  259. text = font2.render("HAHAHA! You can never defeat me, DIO, and", 1, (0,0,0))
  260. win.blit(text, (self.x, self.y))
  261. if article1.x > 2325 and article1.x < 2331:
  262. text = font2.render("HAHAHA! You can never defeat me, DIO, and m", 1, (0,0,0))
  263. win.blit(text, (self.x, self.y))
  264. if article1.x > 2319 and article1.x < 2325:
  265. text = font2.render("HAHAHA! You can never defeat me, DIO, and my", 1, (0,0,0))
  266. win.blit(text, (self.x, self.y))
  267. if article1.x > 2313 and article1.x < 2319:
  268. text = font2.render("HAHAHA! You can never defeat me, DIO, and my a", 1, (0,0,0))
  269. win.blit(text, (self.x, self.y))
  270. if article1.x > 2307 and article1.x < 2313:
  271. text = font2.render("HAHAHA! You can never defeat me, DIO, and my ar", 1, (0,0,0))
  272. win.blit(text, (self.x, self.y))
  273. if article1.x > 2301 and article1.x < 2307:
  274. text = font2.render("HAHAHA! You can never defeat me, DIO, and my arm", 1, (0,0,0))
  275. win.blit(text, (self.x, self.y))
  276. if article1.x > 2295 and article1.x < 2301:
  277. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army", 1, (0,0,0))
  278. win.blit(text, (self.x, self.y))
  279. if article1.x > 2289 and article1.x < 2295:
  280. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army o", 1, (0,0,0))
  281. win.blit(text, (self.x, self.y))
  282. if article1.x > 2283 and article1.x < 2289:
  283. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of", 1, (0,0,0))
  284. win.blit(text, (self.x, self.y))
  285. if article1.x > 2277 and article1.x < 2283:
  286. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of a", 1, (0,0,0))
  287. win.blit(text, (self.x, self.y))
  288. if article1.x > 2263 and article1.x < 2277:
  289. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of ar", 1, (0,0,0))
  290. win.blit(text, (self.x, self.y))
  291. if article1.x > 2257 and article1.x < 2263:
  292. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of art", 1, (0,0,0))
  293. win.blit(text, (self.x, self.y))
  294. if article1.x > 2251 and article1.x < 2257:
  295. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of arti", 1, (0,0,0))
  296. win.blit(text, (self.x, self.y))
  297. if article1.x > 2245 and article1.x < 2251:
  298. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of artic", 1, (0,0,0))
  299. win.blit(text, (self.x, self.y))
  300. if article1.x > 2239 and article1.x < 2245:
  301. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of articl", 1, (0,0,0))
  302. win.blit(text, (self.x, self.y))
  303. if article1.x > 2233 and article1.x < 2239:
  304. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of article", 1, (0,0,0))
  305. win.blit(text, (self.x, self.y))
  306. if article1.x > 2227 and article1.x < 2233:
  307. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of articles", 1, (0,0,0))
  308. win.blit(text, (self.x, self.y))
  309. if article1.x > 1900 and article1.x < 2227:
  310. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of articles.", 1, (0,0,0))
  311. win.blit(text, (self.x, self.y))
  312.  
  313. #class endspeech(object):
  314. #def __init__(self,x,y):
  315. #self.x = x
  316. #self.y = y
  317.  
  318. #def draw(self, win):
  319.  
  320. #ylesanne
  321. class task(object):
  322. def __init__(self,x,y):
  323. self.x = x
  324. self.y = y
  325.  
  326. def draw(self, win):
  327. if article1.x > 1900 and article1.x < 2227:
  328. text = font.render('In order to weaken DIO', 1, (255,255,255))
  329. win.blit(text, (self.x, self.y))
  330.  
  331. class task2(object):
  332. def __init__(self,x,y):
  333. self.x = x
  334. self.y = y
  335.  
  336. def draw(self, win):
  337. if article1.x > 1900 and article1.x < 2227:
  338. text = font.render('you must destroy the', 1, (255,255,255))
  339. win.blit(text, (self.x, self.y))
  340.  
  341. class task3(object):
  342. def __init__(self,x,y):
  343. self.x = x
  344. self.y = y
  345.  
  346. def draw(self, win):
  347. if article1.x > 1900 and article1.x < 2227:
  348. text = font.render('grammatically correct articles', 1, (255,255,255))
  349. win.blit(text, (self.x, self.y))
  350.  
  351.  
  352. #6ige vastus
  353. #class answer(object):
  354. #def __init__(self,x,y):
  355. #self.x = x
  356. #self.y = y
  357. #def draw(self, win):
  358. #if valik in the:
  359. #word = "[THE]"
  360. #elif valik in an:
  361. #word = "[AN]"
  362. #elif valik in a:
  363. #word = "[A]"
  364. #elif valik in empty:
  365. #word = "[NO ARTICLE]"
  366. #if articlevale and article1.x > 1200:
  367. #text = font.render('The correct article was ' + (word), 1, (255,255,255))
  368. #win.blit(text, (self.x, self.y))
  369.  
  370.  
  371. #pop up classes
  372. class boss(object):
  373. def __init__(self, x, y,):
  374. self.x = x
  375. self.y = y
  376. def draw(self, win):
  377. if article1.x > 1900 and article1.x < 2535 or viga == 0:
  378. win.blit(dio, (self.x,self.y))
  379. man.vel = 0
  380. pygame.mixer.music.pause()
  381. elif article1.x < 1900:
  382. man.vel = 15
  383. pygame.mixer.music.unpause()
  384.  
  385. class talk(object):
  386. def __init__(self, x, y):
  387. self.x = x
  388. self.y = y
  389. def draw(self, win):
  390. if article1.x > 1900 and article1.x < 2535 or viga == 0:
  391. win.blit(tb, (self.x,self.y))
  392.  
  393. class darkmode(object):
  394. def __init__(self, x, y):
  395. self.x = x
  396. self.y = y
  397. def draw(self, win):
  398. if article1.x > 1900 and article1.x < 2535 or viga == 0:
  399. win.blit(darken, (self.x,self.y))
  400.  
  401.  
  402. #SÜDAMED
  403. class heart(object):
  404. def __init__(self,x,y,):
  405. self.x = x
  406. self.y = y
  407. self.visible = True
  408. def draw(self, win):
  409. if self.visible:
  410. win.blit(life, (self.x, self.y))
  411.  
  412. class heart2(object):
  413. def __init__(self,x,y):
  414. self.x = x
  415. self.y = y
  416. self.visible2 = True
  417. def draw(self, win):
  418. if self.visible2:
  419. win.blit(life, (self.x, self.y))
  420.  
  421. class heart3(object):
  422. def __init__(self,x,y):
  423. self.x = x
  424. self.y = y
  425. self.visible3 = True
  426. def draw(self, win):
  427. if self.visible3:
  428. win.blit(life, (self.x, self.y))
  429.  
  430.  
  431. def level():
  432. article1.vel += 1
  433. article2.vel += 1
  434. article3.vel += 1
  435. article4.vel += 1
  436.  
  437. def combobonus():
  438. bonus = combo * 15
  439. man.score +=bonus
  440.  
  441. def drawgamewindow():
  442. win.blit(bg,(0,0))
  443. article1.draw(win)
  444. article2.draw(win)
  445. article3.draw(win)
  446. article4.draw(win)
  447. #article5.draw(win)
  448. text2.draw(win)
  449. text3.draw(win)
  450. #fail.draw(win)
  451. elu.draw(win)
  452. elu2.draw(win)
  453. elu3.draw(win)
  454. must.draw(win)
  455. man.draw(win)
  456. enemy.draw(win)
  457. speech.draw(win)
  458. speech1.draw(win)
  459. goal.draw(win)
  460. goal2.draw(win)
  461. goal3.draw(win)
  462. pygame.display.update()
  463.  
  464.  
  465. #k6ik vajalik crap
  466. the = ["... Second World War ended in 1945.","Can Nathan play … piano?","Fred always says dogs make … best pets","Many doctors recommend immunization shots to prevent … flu.","She cured … cold by drinking ginger tea.","We spent … whole time listening to boring speeches.","I spent … summer on a beach in Florida.","She thinks that … world is changing quickly.","Do you know … name of her perfume?","I enjoyed … DVD you gave me for my birthday."," … dentist doesn’t have any openings for two months.","Is there any water on … Moon?","When I turned on my new laptop, … screen exploded!","If … price keeps going up, I’m going to buy an electric car.","Every winter, … lake freezes over and we can go ice skating.","I heard that … mall will house a movie theater."]
  467. an = ["Whenever I go swimming, I end up with … earache.","I was on the phone with them for … entire hour!","Researchers hope that beneath the frozen layer lies … ocean.","It is … especially important thing!","If I were rich, I would buy … apartment.","It only took … hour.","Wow! That is … expensive car!","Look, there's … orange on the table.","Karen, you have … unusually small head.","Is there … internet cafe around here?","I need to send … important email.","You should take … umbrella with you.","She baked … enormous steak instead.","Greg and Taylor took … amazing vacation to Sweden last week.","Maddie really is … unhappy person."]
  468. a = ["Do you have … bigger room in the hotel?","She jogs at least four times … week.","We have to find … better way to do this.","This bag is made of … much stronger material than my last one.","That brand of organic coffee costs $90 … pound!","Can you play … musical instrument?","Do you own … Ferrari?","Air should be … universal human right.","He has 3 cats and … horse.","Sammy has … few ideas which could really help us.","She has … few clients, and she isn’t earning very much.","Ned had … stroke last year.","He is from … European country, but I don’t know which one.","Larry doesn’t own … car.","It looks like it’s going to be … rainy day today."]
  469. empty = ["I’m pretty sure … cheetahs are the fastest animals on the planet.","They have … little money for food or education.","Armadillos are most active at … night.","Have you ever heard of … Halloween?","Do you want to meet up for dinner on … Friday?","I didn’t sleep at all … last night.","Welcome to … Tuvana Island!","This school has … great teachers.","I love … stories like that!","Why do … fruit and … vegetables taste so good?","Tina has … few friends. She should meet more people."]
  470. laused = [the, an, a, empty]
  471. run = True
  472. article1 = textbox1(3000, 125, 1, 25)
  473. article2 = textbox2(3000, 275, 1, 25)
  474. article3 = textbox3(3000, 425, 1, 25)
  475. article4 = textbox4(3000, 575, 1, 25)
  476. #article5 = textbox5(3000, 600, 1, 25)
  477. articlevale = False
  478. suvaline = random.choice(laused)
  479. text2 = text1(100, 50, 100, 50)
  480. valik = random.choice(suvaline)
  481. text1 = font.render(valik, 1, (255,255,255))
  482. text3 = score(100, 668, 100, 50)
  483. man = player(100, 300, 65, 125)
  484. elu = heart(300, 668)
  485. elu2 = heart2(342, 668)
  486. elu3 = heart3(384, 668)
  487. enemy = boss(1000, 400)
  488. speech = talk(750, 515)
  489. speech1 = startspeech(830, 580)
  490. goal = task(400, 200)
  491. goal2 = task2(400, 250)
  492. goal3 = task3(400, 300)
  493. #fail = answer(470, 668)
  494. must = darkmode(0,0)
  495. man.score = 0
  496. viga = 3
  497. combo = 0
  498.  
  499.  
  500. #mainloop
  501. while run:
  502. pygame.time.delay(20)
  503.  
  504. for event in pygame.event.get():
  505. if event.type == pygame.QUIT:
  506. run = False
  507.  
  508. #artiklite liikumine ja muu tegevus
  509. article1.x -= article1.vel
  510. article2.x -= article2.vel
  511. article3.x -= article2.vel
  512. article4.x -= article2.vel
  513. #article5.x -= article2.vel
  514.  
  515.  
  516. if article1.x > 2555 and article1.x < 2560:
  517. timestop.play()
  518.  
  519. #artikkel 1 liikumine
  520. if article1.y - article1.height < man.hitbox[1] + man.hitbox[3] and article1.y + article1.height > man.hitbox[1]:
  521. if article1.x + article1.width > man.hitbox[0] and article1.x < man.hitbox[0] + man.hitbox[2]:
  522. print('1')
  523. if suvaline == (the):
  524. print('6IGE')
  525. man.hit()
  526. article1.x = 1900
  527. article2.x = 1900
  528. article3.x = 1900
  529. article4.x = 1900
  530. suvaline = random.choice(laused)
  531. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  532. level()
  533. combo += 1
  534. if combo == 3:
  535. combobonus()
  536. if combo == 5:
  537. combobonus()
  538. if combo == 10:
  539. combobonus()
  540. if combo == 15:
  541. combobonus()
  542. if combo == 20:
  543. combobonus()
  544. else:
  545. print('vale')
  546. articlevale = True
  547. article1.x = 1900
  548. article2.x = 1900
  549. article3.x = 1900
  550. article4.x = 1900
  551. #article5.x = 3000
  552. combo = 0
  553. viga -= 1
  554. if viga == 0:
  555. article1.x = 3000
  556. article2.x = 3000
  557. article3.x = 3000
  558. article4.x = 3000
  559. if article1.x < 2000:
  560. article1.vel = 0
  561. article2.vel = 0
  562. article3.vel = 0
  563. article4.vel = 0
  564. else:
  565. suvaline = random.choice(laused)
  566. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  567. if viga == 2:
  568. elu3.visible3 = False
  569. elif viga == 1:
  570. elu2.visible2 = False
  571. elu3.visible3 = False
  572. else:
  573. elu.visible = False
  574. elu2.visible2 = False
  575. elu3.visible3 = False
  576.  
  577. #artikkel 2 liikumine
  578. if article2.y - article2.height < man.hitbox[1] + man.hitbox[3] and article2.y + article2.height > man.hitbox[1]:
  579. if article2.x + article2.width > man.hitbox[0] and article2.x < man.hitbox[0] + man.hitbox[2]:
  580. print('2')
  581. if suvaline == (an):
  582. print('6IGE')
  583. man.hit()
  584. article1.x = 1900
  585. article2.x = 1900
  586. article3.x = 1900
  587. article4.x = 1900
  588. suvaline = random.choice(laused)
  589. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  590. level()
  591. combo += 1
  592. if combo == 3:
  593. combobonus()
  594. if combo == 5:
  595. combobonus()
  596. if combo == 10:
  597. combobonus()
  598. if combo == 15:
  599. combobonus()
  600. if combo == 20:
  601. combobonus()
  602. else:
  603. print('vale')
  604. articlevale = True
  605. article1.x = 1900
  606. article2.x = 1900
  607. article3.x = 1900
  608. article4.x = 1900
  609. #article5.x = 3000
  610. combo = 0
  611. viga -= 1
  612. if viga == 0:
  613. article1.x = 3000
  614. article2.x = 3000
  615. article3.x = 3000
  616. article4.x = 3000
  617. if article1.x < 2000:
  618. article1.vel = 0
  619. article2.vel = 0
  620. article3.vel = 0
  621. article4.vel = 0
  622. else:
  623. suvaline = random.choice(laused)
  624. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  625. if viga == 2:
  626. elu3.visible3 = False
  627. elif viga == 1:
  628. elu2.visible2 = False
  629. elu3.visible3 = False
  630. else:
  631. elu.visible = False
  632. elu2.visible2 = False
  633. elu3.visible3 = False
  634.  
  635. #artikkel 3 liikumine
  636. if article3.y - article3.height < man.hitbox[1] + man.hitbox[3] and article3.y + article3.height > man.hitbox[1]:
  637. if article3.x + article3.width > man.hitbox[0] and article3.x < man.hitbox[0] + man.hitbox[2]:
  638. print('3')
  639. if suvaline == (a):
  640. print('6IGE')
  641. man.hit()
  642. article1.x = 1900
  643. article2.x = 1900
  644. article3.x = 1900
  645. article4.x = 1900
  646. suvaline = random.choice(laused)
  647. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  648. level()
  649. combo += 1
  650. if combo == 3:
  651. combobonus()
  652. if combo == 5:
  653. combobonus()
  654. if combo == 10:
  655. combobonus()
  656. if combo == 15:
  657. combobonus()
  658. if combo == 20:
  659. combobonus()
  660. else:
  661. print('vale')
  662. articlevale = True
  663. article1.x = 1900
  664. article2.x = 1900
  665. article3.x = 1900
  666. article4.x = 1900
  667. #article5.x = 3000
  668. combo = 0
  669. viga -= 1
  670. if viga == 0:
  671. article1.x = 3000
  672. article2.x = 3000
  673. article3.x = 3000
  674. article4.x = 3000
  675. if article1.x < 2000:
  676. article1.vel = 0
  677. article2.vel = 0
  678. article3.vel = 0
  679. article4.vel = 0
  680. else:
  681. suvaline = random.choice(laused)
  682. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  683. if viga == 2:
  684. elu3.visible3 = False
  685. elif viga == 1:
  686. elu2.visible2 = False
  687. elu3.visible3 = False
  688. else:
  689. elu.visible = False
  690. elu2.visible2 = False
  691. elu3.visible3 = False
  692.  
  693. #artikkel 4 liikumine
  694. if article4.y - article4.height < man.hitbox[1] + man.hitbox[3] and article4.y + article4.height > man.hitbox[1]:
  695. if article4.x + article4.width > man.hitbox[0] and article4.x < man.hitbox[0] + man.hitbox[2]:
  696. print('4')
  697. if suvaline == (empty):
  698. print('6IGE')
  699. man.hit()
  700. article1.x = 1900
  701. article2.x = 1900
  702. article3.x = 1900
  703. article4.x = 1900
  704. suvaline = random.choice(laused)
  705. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  706. level()
  707. combo += 1
  708. if combo == 3:
  709. combobonus()
  710. if combo == 5:
  711. combobonus()
  712. if combo == 10:
  713. combobonus()
  714. if combo == 15:
  715. combobonus()
  716. if combo == 20:
  717. combobonus()
  718. else:
  719. print('vale')
  720. articlevale = True
  721. article1.x = 1900
  722. article2.x = 1900
  723. article3.x = 1900
  724. article4.x = 1900
  725. #article5.x = 3000
  726. combo = 0
  727. viga -= 1
  728. if viga == 0:
  729. article1.x = 3000
  730. article2.x = 3000
  731. article3.x = 3000
  732. article4.x = 3000
  733. if article1.x < 2000:
  734. article1.vel = 0
  735. article2.vel = 0
  736. article3.vel = 0
  737. article4.vel = 0
  738. else:
  739. suvaline = random.choice(laused)
  740. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  741. if viga == 2:
  742. elu3.visible3 = False
  743. elif viga == 1:
  744. elu2.visible2 = False
  745. elu3.visible3 = False
  746. else:
  747. elu.visible = False
  748. elu2.visible2 = False
  749. elu3.visible3 = False
  750.  
  751.  
  752. #player movement
  753. keys = pygame.key.get_pressed()
  754.  
  755. if keys[pygame.K_w] and man.y > man.vel + 69 or keys[pygame.K_UP] and man.y > man.vel + 69:
  756. man.y -= man.vel
  757.  
  758. if keys[pygame.K_s] and man.y < 690 - man.height - man.vel or keys[pygame.K_DOWN] and man.y < 690 - man.height - man.vel:
  759. man.y += man.vel
  760.  
  761.  
  762. drawgamewindow()
  763.  
  764.  
  765.  
  766.  
  767. pygame.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement