Advertisement
LegitBrainless

Untitled

Mar 20th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.05 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. class endspeech(object):
  352. def __init__(self,x,y):
  353. self.x = x
  354. self.y = y
  355. self.endlause = "M"
  356. def draw(self, win):
  357. if viga == 0:
  358. if article1.x > 0 and article1.x < 3000:
  359. text = font2.render(self.endlause, 1, (0,0,0))
  360. win.blit(text, (self.x, self.y))
  361.  
  362.  
  363. #6ige vastus
  364. #class answer(object):
  365. #def __init__(self,x,y):
  366. #self.x = x
  367. #self.y = y
  368. #def draw(self, win):
  369. #if valik in the:
  370. #word = "[THE]"
  371. #elif valik in an:
  372. #word = "[AN]"
  373. #elif valik in a:
  374. #word = "[A]"
  375. #elif valik in empty:
  376. #word = "[NO ARTICLE]"
  377. #if articlevale and article1.x > 1200:
  378. #text = font.render('The correct article was ' + (word), 1, (255,255,255))
  379. #win.blit(text, (self.x, self.y))
  380.  
  381.  
  382. #pop up classes
  383. class boss(object):
  384. def __init__(self, x, y,):
  385. self.x = x
  386. self.y = y
  387. def draw(self, win):
  388. if article1.x > 1900 and article1.x < 2535 or viga == 0:
  389. win.blit(dio, (self.x,self.y))
  390. man.vel = 0
  391. pygame.mixer.music.pause()
  392. elif article1.x < 1900:
  393. man.vel = 15
  394. pygame.mixer.music.unpause()
  395.  
  396. class talk(object):
  397. def __init__(self, x, y):
  398. self.x = x
  399. self.y = y
  400. def draw(self, win):
  401. if article1.x > 1900 and article1.x < 2535 or viga == 0:
  402. win.blit(tb, (self.x,self.y))
  403.  
  404. class darkmode(object):
  405. def __init__(self, x, y):
  406. self.x = x
  407. self.y = y
  408. def draw(self, win):
  409. if article1.x > 1900 and article1.x < 2535 or viga == 0:
  410. win.blit(darken, (self.x,self.y))
  411.  
  412.  
  413. #SÜDAMED
  414. class heart(object):
  415. def __init__(self,x,y,):
  416. self.x = x
  417. self.y = y
  418. self.visible = True
  419. def draw(self, win):
  420. if self.visible:
  421. win.blit(life, (self.x, self.y))
  422.  
  423. class heart2(object):
  424. def __init__(self,x,y):
  425. self.x = x
  426. self.y = y
  427. self.visible2 = True
  428. def draw(self, win):
  429. if self.visible2:
  430. win.blit(life, (self.x, self.y))
  431.  
  432. class heart3(object):
  433. def __init__(self,x,y):
  434. self.x = x
  435. self.y = y
  436. self.visible3 = True
  437. def draw(self, win):
  438. if self.visible3:
  439. win.blit(life, (self.x, self.y))
  440.  
  441.  
  442. def level():
  443. article1.vel += 1
  444. article2.vel += 1
  445. article3.vel += 1
  446. article4.vel += 1
  447.  
  448. def combobonus():
  449. bonus = combo * 15
  450. man.score +=bonus
  451.  
  452. def drawgamewindow():
  453. win.blit(bg,(0,0))
  454. article1.draw(win)
  455. article2.draw(win)
  456. article3.draw(win)
  457. article4.draw(win)
  458. #article5.draw(win)
  459. text2.draw(win)
  460. text3.draw(win)
  461. #fail.draw(win)
  462. elu.draw(win)
  463. elu2.draw(win)
  464. elu3.draw(win)
  465. must.draw(win)
  466. man.draw(win)
  467. enemy.draw(win)
  468. speech.draw(win)
  469. speech1.draw(win)
  470. speech2.draw(win)
  471. goal.draw(win)
  472. goal2.draw(win)
  473. goal3.draw(win)
  474. pygame.display.update()
  475.  
  476.  
  477. #k6ik vajalik
  478. 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."]
  479. 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."]
  480. 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."]
  481. 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."]
  482. laused = [the, an, a, empty]
  483. run = True
  484. article1 = textbox1(3000, 125, 1, 25)
  485. article2 = textbox2(3000, 275, 1, 25)
  486. article3 = textbox3(3000, 425, 1, 25)
  487. article4 = textbox4(3000, 575, 1, 25)
  488. #article5 = textbox5(3000, 600, 1, 25)
  489. articlevale = False
  490. suvaline = random.choice(laused)
  491. text2 = text1(100, 50, 100, 50)
  492. valik = random.choice(suvaline)
  493. text1 = font.render(valik, 1, (255,255,255))
  494. text3 = score(100, 668, 100, 50)
  495. man = player(100, 300, 65, 125)
  496. elu = heart(300, 668)
  497. elu2 = heart2(342, 668)
  498. elu3 = heart3(384, 668)
  499. enemy = boss(1000, 400)
  500. speech = talk(750, 515)
  501. speech1 = startspeech(830, 580)
  502. speech2 = endspeech(830, 580)
  503. goal = task(400, 200)
  504. goal2 = task2(400, 250)
  505. goal3 = task3(400, 300)
  506. #fail = answer(470, 668)
  507. must = darkmode(0,0)
  508. man.score = 0
  509. viga = 3
  510. combo = 0
  511.  
  512.  
  513. #mainloop
  514. while run:
  515. pygame.time.delay(20)
  516.  
  517. for event in pygame.event.get():
  518. if event.type == pygame.QUIT:
  519. run = False
  520.  
  521. #artiklite liikumine ja muu tegevus
  522. article1.x -= article1.vel
  523. article2.x -= article2.vel
  524. article3.x -= article2.vel
  525. article4.x -= article2.vel
  526. #article5.x -= article2.vel
  527.  
  528.  
  529. if article1.x > 2555 and article1.x < 2560:
  530. timestop.play()
  531.  
  532. #artikkel 1 liikumine
  533. if article1.y - article1.height < man.hitbox[1] + man.hitbox[3] and article1.y + article1.height > man.hitbox[1]:
  534. if article1.x + article1.width > man.hitbox[0] and article1.x < man.hitbox[0] + man.hitbox[2]:
  535. print('1')
  536. if suvaline == (the):
  537. print('6IGE')
  538. man.hit()
  539. article1.x = 1900
  540. article2.x = 1900
  541. article3.x = 1900
  542. article4.x = 1900
  543. suvaline = random.choice(laused)
  544. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  545. level()
  546. combo += 1
  547. if combo == 3:
  548. combobonus()
  549. if combo == 5:
  550. combobonus()
  551. if combo == 10:
  552. combobonus()
  553. if combo == 15:
  554. combobonus()
  555. if combo == 20:
  556. combobonus()
  557. else:
  558. print('vale')
  559. articlevale = True
  560. article1.x = 1900
  561. article2.x = 1900
  562. article3.x = 1900
  563. article4.x = 1900
  564. #article5.x = 3000
  565. combo = 0
  566. viga -= 1
  567. if viga == 0:
  568. article1.vel = 6
  569. article2.vel = 6
  570. article3.vel = 6
  571. article4.vel = 6
  572. article1.x = 3001
  573. article2.x = 3001
  574. article3.x = 3001
  575. article4.x = 3001
  576. if article1.x < 2000:
  577. article1.vel = 0
  578. article2.vel = 0
  579. article3.vel = 0
  580. article4.vel = 0
  581. else:
  582. suvaline = random.choice(laused)
  583. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  584. if viga == 2:
  585. elu3.visible3 = False
  586. elif viga == 1:
  587. elu2.visible2 = False
  588. elu3.visible3 = False
  589. else:
  590. elu.visible = False
  591. elu2.visible2 = False
  592. elu3.visible3 = False
  593.  
  594. #artikkel 2 liikumine
  595. if article2.y - article2.height < man.hitbox[1] + man.hitbox[3] and article2.y + article2.height > man.hitbox[1]:
  596. if article2.x + article2.width > man.hitbox[0] and article2.x < man.hitbox[0] + man.hitbox[2]:
  597. print('2')
  598. if suvaline == (an):
  599. print('6IGE')
  600. man.hit()
  601. article1.x = 1900
  602. article2.x = 1900
  603. article3.x = 1900
  604. article4.x = 1900
  605. suvaline = random.choice(laused)
  606. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  607. level()
  608. combo += 1
  609. if combo == 3:
  610. combobonus()
  611. if combo == 5:
  612. combobonus()
  613. if combo == 10:
  614. combobonus()
  615. if combo == 15:
  616. combobonus()
  617. if combo == 20:
  618. combobonus()
  619. else:
  620. print('vale')
  621. articlevale = True
  622. article1.x = 1900
  623. article2.x = 1900
  624. article3.x = 1900
  625. article4.x = 1900
  626. #article5.x = 3000
  627. combo = 0
  628. viga -= 1
  629. if viga == 0:
  630. article1.vel = 6
  631. article2.vel = 6
  632. article3.vel = 6
  633. article4.vel = 6
  634. article1.x = 3001
  635. article2.x = 3001
  636. article3.x = 3001
  637. article4.x = 3001
  638. if article1.x < 2000:
  639. article1.vel = 0
  640. article2.vel = 0
  641. article3.vel = 0
  642. article4.vel = 0
  643. else:
  644. suvaline = random.choice(laused)
  645. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  646. if viga == 2:
  647. elu3.visible3 = False
  648. elif viga == 1:
  649. elu2.visible2 = False
  650. elu3.visible3 = False
  651. else:
  652. elu.visible = False
  653. elu2.visible2 = False
  654. elu3.visible3 = False
  655.  
  656. #artikkel 3 liikumine
  657. if article3.y - article3.height < man.hitbox[1] + man.hitbox[3] and article3.y + article3.height > man.hitbox[1]:
  658. if article3.x + article3.width > man.hitbox[0] and article3.x < man.hitbox[0] + man.hitbox[2]:
  659. print('3')
  660. if suvaline == (a):
  661. print('6IGE')
  662. man.hit()
  663. article1.x = 1900
  664. article2.x = 1900
  665. article3.x = 1900
  666. article4.x = 1900
  667. suvaline = random.choice(laused)
  668. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  669. level()
  670. combo += 1
  671. if combo == 3:
  672. combobonus()
  673. if combo == 5:
  674. combobonus()
  675. if combo == 10:
  676. combobonus()
  677. if combo == 15:
  678. combobonus()
  679. if combo == 20:
  680. combobonus()
  681. else:
  682. print('vale')
  683. articlevale = True
  684. article1.x = 1900
  685. article2.x = 1900
  686. article3.x = 1900
  687. article4.x = 1900
  688. #article5.x = 3000
  689. combo = 0
  690. viga -= 1
  691. if viga == 0:
  692. article1.vel = 6
  693. article2.vel = 6
  694. article3.vel = 6
  695. article4.vel = 6
  696. article1.x = 3001
  697. article2.x = 3001
  698. article3.x = 3001
  699. article4.x = 3001
  700. if article1.x < 2000:
  701. article1.vel = 0
  702. article2.vel = 0
  703. article3.vel = 0
  704. article4.vel = 0
  705. else:
  706. suvaline = random.choice(laused)
  707. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  708. if viga == 2:
  709. elu3.visible3 = False
  710. elif viga == 1:
  711. elu2.visible2 = False
  712. elu3.visible3 = False
  713. else:
  714. elu.visible = False
  715. elu2.visible2 = False
  716. elu3.visible3 = False
  717.  
  718. #artikkel 4 liikumine
  719. if article4.y - article4.height < man.hitbox[1] + man.hitbox[3] and article4.y + article4.height > man.hitbox[1]:
  720. if article4.x + article4.width > man.hitbox[0] and article4.x < man.hitbox[0] + man.hitbox[2]:
  721. print('4')
  722. if suvaline == (empty):
  723. print('6IGE')
  724. man.hit()
  725. article1.x = 1900
  726. article2.x = 1900
  727. article3.x = 1900
  728. article4.x = 1900
  729. suvaline = random.choice(laused)
  730. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  731. level()
  732. combo += 1
  733. if combo == 3:
  734. combobonus()
  735. if combo == 5:
  736. combobonus()
  737. if combo == 10:
  738. combobonus()
  739. if combo == 15:
  740. combobonus()
  741. if combo == 20:
  742. combobonus()
  743. else:
  744. print('vale')
  745. articlevale = True
  746. article1.x = 1900
  747. article2.x = 1900
  748. article3.x = 1900
  749. article4.x = 1900
  750. #article5.x = 3000
  751. combo = 0
  752. viga -= 1
  753. if viga == 0:
  754. article1.vel = 6
  755. article2.vel = 6
  756. article3.vel = 6
  757. article4.vel = 6
  758. article1.x = 3001
  759. article2.x = 3001
  760. article3.x = 3001
  761. article4.x = 3001
  762. if article1.x < 2000:
  763. article1.vel = 0
  764. article2.vel = 0
  765. article3.vel = 0
  766. article4.vel = 0
  767. else:
  768. suvaline = random.choice(laused)
  769. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  770. if viga == 2:
  771. elu3.visible3 = False
  772. elif viga == 1:
  773. elu2.visible2 = False
  774. elu3.visible3 = False
  775. else:
  776. elu.visible = False
  777. elu2.visible2 = False
  778. elu3.visible3 = False
  779.  
  780.  
  781. #player movement
  782. keys = pygame.key.get_pressed()
  783.  
  784. if keys[pygame.K_w] and man.y > man.vel + 69 or keys[pygame.K_UP] and man.y > man.vel + 69:
  785. man.y -= man.vel
  786.  
  787. 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:
  788. man.y += man.vel
  789.  
  790.  
  791. drawgamewindow()
  792.  
  793.  
  794.  
  795.  
  796. pygame.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement