Advertisement
LegitBrainless

Untitled

Mar 20th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.66 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. fall = [pygame.image.load('fall1.png'), pygame.image.load('fall2.png'), pygame.image.load('fall3.png'), pygame.image.load('fall4.png'), pygame.image.load('fall5.png'), pygame.image.load('fall6.png'), pygame.image.load('fall7.png')]
  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. self.fallcount = 0
  40. def draw(self, win):#Animation
  41. if viga == 0:
  42. if self.fallcount == 20:
  43. win.blit(fall[6], (self.x,self.y))
  44. if self.fallcount < 20:
  45. win.blit(fall[self.fallcount//3], (self.x,self.y))
  46. self.fallcount += 1
  47. if self.walkcount == 47:#14 on 1 v6rra v2iksem kui 3 korda (piltide arv)
  48. self.walkcount = 0
  49. elif standing:
  50. win.blit(idle[self.walkcount//3], (self.x,self.y))
  51. self.walkcount += 1
  52. self.hitbox = (137, self.y, self.width, self.height)
  53. #pygame.draw.rect(win, (255,0,0), self.hitbox, 2)
  54.  
  55. def hit(self):
  56. print('hit')
  57. self.score += 100
  58.  
  59. #texts
  60. class textbox1(object):
  61. def __init__(self,x,y,width,height):
  62. self.x = x
  63. self.y = y
  64. self.width = width
  65. self.height = height
  66. self.vel = 6
  67. self.hitbox = (self.x, self.y, self.width, self.height)
  68.  
  69. def draw(self, win):
  70. text = font.render('the', 1, (255,255,255))
  71. win.blit(text, (self.x, self.y))
  72. self.hitbox = (self.x, self.y, self.width, self.height)
  73. #pygame.draw.rect(win, (255,0,0), self.hitbox, 2)
  74.  
  75. class textbox2(object):
  76. def __init__(self,x,y,width,height):
  77. self.x = x
  78. self.y = y
  79. self.width = width
  80. self.height = height
  81. self.vel = 6
  82. self.hitbox = (self.x, self.y, self.width, self.height)
  83.  
  84. def draw(self, win):
  85. text = font.render('an', 1, (255,255,255))
  86. win.blit(text, (self.x, self.y))
  87. self.hitbox = (self.x, self.y, self.width, self.height)
  88. #pygame.draw.rect(win, (255,0,0), self.hitbox, 2)
  89.  
  90. class textbox3(object):
  91. def __init__(self,x,y,width,height):
  92. self.x = x
  93. self.y = y
  94. self.width = width
  95. self.height = height
  96. self.vel = 6
  97. self.hitbox = (self.x, self.y, self.width, self.height)
  98.  
  99. def draw(self, win):
  100. text = font.render('a', 1, (255,255,255))
  101. win.blit(text, (self.x, self.y))
  102. self.hitbox = (self.x, self.y, self.width, self.height)
  103. #pygame.draw.rect(win, (255,0,0), self.hitbox, 2)
  104.  
  105. class textbox4(object):
  106. def __init__(self,x,y,width,height):
  107. self.x = x
  108. self.y = y
  109. self.width = width
  110. self.height = height
  111. self.vel = 6
  112. self.hitbox = (self.x, self.y, self.width, self.height)
  113.  
  114. def draw(self, win):
  115. text = font.render('No article', 1, (255,255,255))
  116. win.blit(text, (self.x, self.y))
  117. self.hitbox = (self.x, self.y, self.width, self.height)
  118. #pygame.draw.rect(win, (255,0,0), self.hitbox, 2)
  119.  
  120. #class textbox5(object):
  121. #def __init__(self,x,y,width,height):
  122. #self.x = x
  123. #self.y = y
  124. #self.width = width
  125. #self.height = height
  126. #self.vel = 6
  127. #self.hitbox = (self.x, self.y, self.width, self.height)
  128.  
  129. #def draw(self, win):
  130. #self.hitbox = (self.x, self.y, self.width, self.height)
  131. #pygame.draw.rect(win, (255,0,0), (self.hitbox), 2)
  132.  
  133. class text1(object):
  134. def __init__(self,x,y,width,height):
  135. self.x = x
  136. self.y = y
  137. self.width = width
  138. self.height = height
  139. self.hitbox = (self.x, self.y, self.width, self.height)
  140.  
  141. def draw(self, win):
  142. win.blit(text1, (self.x, self.y))
  143. self.hitbox = (self.x, self.y, self.width, self.height)
  144. #pygame.draw.rect(win, (255,0,0), self.hitbox, 2)
  145.  
  146. class score(object):
  147. def __init__(self,x,y,width,height):
  148. self.x = x
  149. self.y = y
  150. self.width = width
  151. self.height = height
  152. self.hitbox = (self.x, self.y, self.width, self.height)
  153.  
  154. def draw(self, win):
  155. text = font.render('Score: ' + str(man.score), 1, (255,255,255))
  156. win.blit(text, (self.x, self.y))
  157. self.hitbox = (self.x, self.y, self.width, self.height)
  158. #pygame.draw.rect(win, (255,0,0), self.hitbox, 2)
  159.  
  160. #textbox
  161. class startspeech(object):
  162. def __init__(self,x,y):
  163. self.x = x
  164. self.y = y
  165.  
  166. def draw(self, win):
  167. if article1.x > 2529 and article1.x < 2535:
  168. text = font2.render("H", 1, (0,0,0))
  169. win.blit(text, (self.x, self.y))
  170. if article1.x > 2523 and article1.x < 2529:
  171. text = font2.render("HA", 1, (0,0,0))
  172. win.blit(text, (self.x, self.y))
  173. if article1.x > 2517 and article1.x < 2523:
  174. text = font2.render("HAH", 1, (0,0,0))
  175. win.blit(text, (self.x, self.y))
  176. if article1.x > 2511 and article1.x < 2517:
  177. text = font2.render("HAHA", 1, (0,0,0))
  178. win.blit(text, (self.x, self.y))
  179. if article1.x > 2505 and article1.x < 2511:
  180. text = font2.render("HAHAH", 1, (0,0,0))
  181. win.blit(text, (self.x, self.y))
  182. if article1.x > 2499 and article1.x < 2505:
  183. text = font2.render("HAHAHA", 1, (0,0,0))
  184. win.blit(text, (self.x, self.y))
  185. if article1.x > 2493 and article1.x < 2499:
  186. text = font2.render("HAHAHA!", 1, (0,0,0))
  187. win.blit(text, (self.x, self.y))
  188. if article1.x > 2487 and article1.x < 2493:
  189. text = font2.render("HAHAHA! Y", 1, (0,0,0))
  190. win.blit(text, (self.x, self.y))
  191. if article1.x > 2481 and article1.x < 2487:
  192. text = font2.render("HAHAHA! Yo", 1, (0,0,0))
  193. win.blit(text, (self.x, self.y))
  194. if article1.x > 2475 and article1.x < 2481:
  195. text = font2.render("HAHAHA! You", 1, (0,0,0))
  196. win.blit(text, (self.x, self.y))
  197. if article1.x > 2469 and article1.x < 2475:
  198. text = font2.render("HAHAHA! You c", 1, (0,0,0))
  199. win.blit(text, (self.x, self.y))
  200. if article1.x > 2463 and article1.x < 2469:
  201. text = font2.render("HAHAHA! You ca", 1, (0,0,0))
  202. win.blit(text, (self.x, self.y))
  203. if article1.x > 2457 and article1.x < 2463:
  204. text = font2.render("HAHAHA! You can", 1, (0,0,0))
  205. win.blit(text, (self.x, self.y))
  206. if article1.x > 2451 and article1.x < 2457:
  207. text = font2.render("HAHAHA! You can n", 1, (0,0,0))
  208. win.blit(text, (self.x, self.y))
  209. if article1.x > 2445 and article1.x < 2451:
  210. text = font2.render("HAHAHA! You can ne", 1, (0,0,0))
  211. win.blit(text, (self.x, self.y))
  212. if article1.x > 2439 and article1.x < 2445:
  213. text = font2.render("HAHAHA! You can nev", 1, (0,0,0))
  214. win.blit(text, (self.x, self.y))
  215. if article1.x > 2433 and article1.x < 2439:
  216. text = font2.render("HAHAHA! You can neve", 1, (0,0,0))
  217. win.blit(text, (self.x, self.y))
  218. if article1.x > 2427 and article1.x < 2433:
  219. text = font2.render("HAHAHA! You can never", 1, (0,0,0))
  220. win.blit(text, (self.x, self.y))
  221. if article1.x > 2421 and article1.x < 2427:
  222. text = font2.render("HAHAHA! You can never d", 1, (0,0,0))
  223. win.blit(text, (self.x, self.y))
  224. if article1.x > 2415 and article1.x < 2421:
  225. text = font2.render("HAHAHA! You can never de", 1, (0,0,0))
  226. win.blit(text, (self.x, self.y))
  227. if article1.x > 2409 and article1.x < 2415:
  228. text = font2.render("HAHAHA! You can never def", 1, (0,0,0))
  229. win.blit(text, (self.x, self.y))
  230. if article1.x > 2403 and article1.x < 2409:
  231. text = font2.render("HAHAHA! You can never defe", 1, (0,0,0))
  232. win.blit(text, (self.x, self.y))
  233. if article1.x > 2397 and article1.x < 2403:
  234. text = font2.render("HAHAHA! You can never defea", 1, (0,0,0))
  235. win.blit(text, (self.x, self.y))
  236. if article1.x > 2391 and article1.x < 2397:
  237. text = font2.render("HAHAHA! You can never defeat", 1, (0,0,0))
  238. win.blit(text, (self.x, self.y))
  239. if article1.x > 2385 and article1.x < 2391:
  240. text = font2.render("HAHAHA! You can never defeat m", 1, (0,0,0))
  241. win.blit(text, (self.x, self.y))
  242. if article1.x > 2379 and article1.x < 2385:
  243. text = font2.render("HAHAHA! You can never defeat me", 1, (0,0,0))
  244. win.blit(text, (self.x, self.y))
  245. if article1.x > 2373 and article1.x < 2379:
  246. text = font2.render("HAHAHA! You can never defeat me,", 1, (0,0,0))
  247. win.blit(text, (self.x, self.y))
  248. if article1.x > 2367 and article1.x < 2373:
  249. text = font2.render("HAHAHA! You can never defeat me, D", 1, (0,0,0))
  250. win.blit(text, (self.x, self.y))
  251. if article1.x > 2361 and article1.x < 2367:
  252. text = font2.render("HAHAHA! You can never defeat me, DI", 1, (0,0,0))
  253. win.blit(text, (self.x, self.y))
  254. if article1.x > 2355 and article1.x < 2361:
  255. text = font2.render("HAHAHA! You can never defeat me, DIO", 1, (0,0,0))
  256. win.blit(text, (self.x, self.y))
  257. if article1.x > 2349 and article1.x < 2355:
  258. text = font2.render("HAHAHA! You can never defeat me, DIO,", 1, (0,0,0))
  259. win.blit(text, (self.x, self.y))
  260. if article1.x > 2343 and article1.x < 2349:
  261. text = font2.render("HAHAHA! You can never defeat me, DIO, a", 1, (0,0,0))
  262. win.blit(text, (self.x, self.y))
  263. if article1.x > 2337 and article1.x < 2343:
  264. text = font2.render("HAHAHA! You can never defeat me, DIO, an", 1, (0,0,0))
  265. win.blit(text, (self.x, self.y))
  266. if article1.x > 2331 and article1.x < 2337:
  267. text = font2.render("HAHAHA! You can never defeat me, DIO, and", 1, (0,0,0))
  268. win.blit(text, (self.x, self.y))
  269. if article1.x > 2325 and article1.x < 2331:
  270. text = font2.render("HAHAHA! You can never defeat me, DIO, and m", 1, (0,0,0))
  271. win.blit(text, (self.x, self.y))
  272. if article1.x > 2319 and article1.x < 2325:
  273. text = font2.render("HAHAHA! You can never defeat me, DIO, and my", 1, (0,0,0))
  274. win.blit(text, (self.x, self.y))
  275. if article1.x > 2313 and article1.x < 2319:
  276. text = font2.render("HAHAHA! You can never defeat me, DIO, and my a", 1, (0,0,0))
  277. win.blit(text, (self.x, self.y))
  278. if article1.x > 2307 and article1.x < 2313:
  279. text = font2.render("HAHAHA! You can never defeat me, DIO, and my ar", 1, (0,0,0))
  280. win.blit(text, (self.x, self.y))
  281. if article1.x > 2301 and article1.x < 2307:
  282. text = font2.render("HAHAHA! You can never defeat me, DIO, and my arm", 1, (0,0,0))
  283. win.blit(text, (self.x, self.y))
  284. if article1.x > 2295 and article1.x < 2301:
  285. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army", 1, (0,0,0))
  286. win.blit(text, (self.x, self.y))
  287. if article1.x > 2289 and article1.x < 2295:
  288. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army o", 1, (0,0,0))
  289. win.blit(text, (self.x, self.y))
  290. if article1.x > 2283 and article1.x < 2289:
  291. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of", 1, (0,0,0))
  292. win.blit(text, (self.x, self.y))
  293. if article1.x > 2277 and article1.x < 2283:
  294. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of a", 1, (0,0,0))
  295. win.blit(text, (self.x, self.y))
  296. if article1.x > 2263 and article1.x < 2277:
  297. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of ar", 1, (0,0,0))
  298. win.blit(text, (self.x, self.y))
  299. if article1.x > 2257 and article1.x < 2263:
  300. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of art", 1, (0,0,0))
  301. win.blit(text, (self.x, self.y))
  302. if article1.x > 2251 and article1.x < 2257:
  303. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of arti", 1, (0,0,0))
  304. win.blit(text, (self.x, self.y))
  305. if article1.x > 2245 and article1.x < 2251:
  306. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of artic", 1, (0,0,0))
  307. win.blit(text, (self.x, self.y))
  308. if article1.x > 2239 and article1.x < 2245:
  309. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of articl", 1, (0,0,0))
  310. win.blit(text, (self.x, self.y))
  311. if article1.x > 2233 and article1.x < 2239:
  312. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of article", 1, (0,0,0))
  313. win.blit(text, (self.x, self.y))
  314. if article1.x > 2227 and article1.x < 2233:
  315. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of articles", 1, (0,0,0))
  316. win.blit(text, (self.x, self.y))
  317. if article1.x > 1900 and article1.x < 2227:
  318. text = font2.render("HAHAHA! You can never defeat me, DIO, and my army of articles.", 1, (0,0,0))
  319. win.blit(text, (self.x, self.y))
  320.  
  321.  
  322. #ylesanne
  323. class task(object):
  324. def __init__(self,x,y):
  325. self.x = x
  326. self.y = y
  327.  
  328. def draw(self, win):
  329. if article1.x > 1900 and article1.x < 2227:
  330. text = font.render('In order to weaken DIO', 1, (255,255,255))
  331. win.blit(text, (self.x, self.y))
  332.  
  333. class task2(object):
  334. def __init__(self,x,y):
  335. self.x = x
  336. self.y = y
  337.  
  338. def draw(self, win):
  339. if article1.x > 1900 and article1.x < 2227:
  340. text = font.render('you must destroy the', 1, (255,255,255))
  341. win.blit(text, (self.x, self.y))
  342.  
  343. class task3(object):
  344. def __init__(self,x,y):
  345. self.x = x
  346. self.y = y
  347.  
  348. def draw(self, win):
  349. if article1.x > 1900 and article1.x < 2227:
  350. text = font.render('grammatically correct articles', 1, (255,255,255))
  351. win.blit(text, (self.x, self.y))
  352.  
  353. class endspeech(object):
  354. def __init__(self,x,y):
  355. self.x = x
  356. self.y = y
  357. self.endlause = "M"
  358. def draw(self, win):
  359. if viga == 0:
  360. text = font2.render("MUDA! MUDA! MUDA! You're still making too many grammar mistakes!", 1, (0,0,0))
  361. win.blit(text, (self.x, self.y))
  362.  
  363.  
  364.  
  365.  
  366. #6ige vastus
  367. #class answer(object):
  368. #def __init__(self,x,y):
  369. #self.x = x
  370. #self.y = y
  371. #def draw(self, win):
  372. #if valik in the:
  373. #word = "[THE]"
  374. #elif valik in an:
  375. #word = "[AN]"
  376. #elif valik in a:
  377. #word = "[A]"
  378. #elif valik in empty:
  379. #word = "[NO ARTICLE]"
  380. #if articlevale and article1.x > 1200:
  381. #text = font.render('The correct article was ' + (word), 1, (255,255,255))
  382. #win.blit(text, (self.x, self.y))
  383.  
  384.  
  385. #pop up classes
  386. class boss(object):
  387. def __init__(self, x, y,):
  388. self.x = x
  389. self.y = y
  390. def draw(self, win):
  391. if article1.x > 1900 and article1.x < 2535 or viga == 0:
  392. win.blit(dio, (self.x,self.y))
  393. man.vel = 0
  394. pygame.mixer.music.pause()
  395. elif article1.x < 1900:
  396. man.vel = 15
  397. pygame.mixer.music.unpause()
  398.  
  399. class talk(object):
  400. def __init__(self, x, y):
  401. self.x = x
  402. self.y = y
  403. def draw(self, win):
  404. if article1.x > 1900 and article1.x < 2535 or viga == 0:
  405. win.blit(tb, (self.x,self.y))
  406.  
  407. class darkmode(object):
  408. def __init__(self, x, y):
  409. self.x = x
  410. self.y = y
  411. def draw(self, win):
  412. if article1.x > 1900 and article1.x < 2535 or viga == 0:
  413. win.blit(darken, (self.x,self.y))
  414.  
  415.  
  416. #SÜDAMED
  417. class heart(object):
  418. def __init__(self,x,y,):
  419. self.x = x
  420. self.y = y
  421. self.visible = True
  422. def draw(self, win):
  423. if self.visible:
  424. win.blit(life, (self.x, self.y))
  425.  
  426. class heart2(object):
  427. def __init__(self,x,y):
  428. self.x = x
  429. self.y = y
  430. self.visible2 = True
  431. def draw(self, win):
  432. if self.visible2:
  433. win.blit(life, (self.x, self.y))
  434.  
  435. class heart3(object):
  436. def __init__(self,x,y):
  437. self.x = x
  438. self.y = y
  439. self.visible3 = True
  440. def draw(self, win):
  441. if self.visible3:
  442. win.blit(life, (self.x, self.y))
  443.  
  444.  
  445. def level():
  446. article1.vel += 2
  447. article2.vel += 2
  448. article3.vel += 2
  449. article4.vel += 2
  450.  
  451. def combobonus():
  452. bonus = combo * 15
  453. man.score +=bonus
  454.  
  455. def drawgamewindow():
  456. win.blit(bg,(0,0))
  457. article1.draw(win)
  458. article2.draw(win)
  459. article3.draw(win)
  460. article4.draw(win)
  461. #article5.draw(win)
  462. text2.draw(win)
  463. text3.draw(win)
  464. #fail.draw(win)
  465. elu.draw(win)
  466. elu2.draw(win)
  467. elu3.draw(win)
  468. must.draw(win)
  469. man.draw(win)
  470. enemy.draw(win)
  471. speech.draw(win)
  472. speech1.draw(win)
  473. speech2.draw(win)
  474. goal.draw(win)
  475. goal2.draw(win)
  476. goal3.draw(win)
  477. pygame.display.update()
  478.  
  479.  
  480. #k6ik vajalik
  481. 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."]
  482. 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."]
  483. 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."]
  484. 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."]
  485. laused = [the, an, a, empty]
  486. run = True
  487. article1 = textbox1(3000, 125, 1, 25)
  488. article2 = textbox2(3000, 275, 1, 25)
  489. article3 = textbox3(3000, 425, 1, 25)
  490. article4 = textbox4(3000, 575, 1, 25)
  491. #article5 = textbox5(3000, 600, 1, 25)
  492. articlevale = False
  493. suvaline = random.choice(laused)
  494. text2 = text1(100, 50, 100, 50)
  495. valik = random.choice(suvaline)
  496. text1 = font.render(valik, 1, (255,255,255))
  497. text3 = score(100, 668, 100, 50)
  498. man = player(100, 300, 65, 125)
  499. elu = heart(300, 668)
  500. elu2 = heart2(342, 668)
  501. elu3 = heart3(384, 668)
  502. enemy = boss(1000, 400)
  503. speech = talk(750, 515)
  504. speech1 = startspeech(830, 580)
  505. speech2 = endspeech(830, 580)
  506. goal = task(400, 200)
  507. goal2 = task2(400, 250)
  508. goal3 = task3(400, 300)
  509. #fail = answer(470, 668)
  510. must = darkmode(0,0)
  511. man.score = 0
  512. viga = 3
  513. combo = 0
  514. standing = True
  515.  
  516.  
  517. #mainloop
  518. while run:
  519. pygame.time.delay(20)
  520.  
  521. for event in pygame.event.get():
  522. if event.type == pygame.QUIT:
  523. run = False
  524.  
  525. #artiklite liikumine ja muu tegevus
  526. article1.x -= article1.vel
  527. article2.x -= article2.vel
  528. article3.x -= article2.vel
  529. article4.x -= article2.vel
  530. #article5.x -= article2.vel
  531.  
  532.  
  533. if article1.x > 2555 and article1.x < 2560:
  534. timestop.play()
  535.  
  536. #artikkel 1 liikumine
  537. if article1.y - article1.height < man.hitbox[1] + man.hitbox[3] and article1.y + article1.height > man.hitbox[1]:
  538. if article1.x + article1.width > man.hitbox[0] and article1.x < man.hitbox[0] + man.hitbox[2]:
  539. print('1')
  540. if suvaline == (the):
  541. print('6IGE')
  542. man.hit()
  543. article1.x = 1900
  544. article2.x = 1900
  545. article3.x = 1900
  546. article4.x = 1900
  547. suvaline = random.choice(laused)
  548. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  549. level()
  550. combo += 1
  551. if combo == 3:
  552. combobonus()
  553. if combo == 5:
  554. combobonus()
  555. if combo == 10:
  556. combobonus()
  557. if combo == 15:
  558. combobonus()
  559. if combo == 20:
  560. combobonus()
  561. else:
  562. print('vale')
  563. articlevale = True
  564. article1.x = 1900
  565. article2.x = 1900
  566. article3.x = 1900
  567. article4.x = 1900
  568. #article5.x = 3000
  569. combo = 0
  570. viga -= 1
  571. if viga == 0:
  572. standing = False
  573. article1.vel = 6
  574. article2.vel = 6
  575. article3.vel = 6
  576. article4.vel = 6
  577. article1.x = 10000
  578. article2.x = 10000
  579. article3.x = 10000
  580. article4.x = 10000
  581. if article1.x < 2000:
  582. article1.vel = 0
  583. article2.vel = 0
  584. article3.vel = 0
  585. article4.vel = 0
  586. else:
  587. suvaline = random.choice(laused)
  588. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  589. if viga == 2:
  590. elu3.visible3 = False
  591. elif viga == 1:
  592. elu2.visible2 = False
  593. elu3.visible3 = False
  594. else:
  595. elu.visible = False
  596. elu2.visible2 = False
  597. elu3.visible3 = False
  598.  
  599. #artikkel 2 liikumine
  600. if article2.y - article2.height < man.hitbox[1] + man.hitbox[3] and article2.y + article2.height > man.hitbox[1]:
  601. if article2.x + article2.width > man.hitbox[0] and article2.x < man.hitbox[0] + man.hitbox[2]:
  602. print('2')
  603. if suvaline == (an):
  604. print('6IGE')
  605. man.hit()
  606. article1.x = 1900
  607. article2.x = 1900
  608. article3.x = 1900
  609. article4.x = 1900
  610. suvaline = random.choice(laused)
  611. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  612. level()
  613. combo += 1
  614. if combo == 3:
  615. combobonus()
  616. if combo == 5:
  617. combobonus()
  618. if combo == 10:
  619. combobonus()
  620. if combo == 15:
  621. combobonus()
  622. if combo == 20:
  623. combobonus()
  624. else:
  625. print('vale')
  626. articlevale = True
  627. article1.x = 1900
  628. article2.x = 1900
  629. article3.x = 1900
  630. article4.x = 1900
  631. #article5.x = 3000
  632. combo = 0
  633. viga -= 1
  634. if viga == 0:
  635. standing = False
  636. article1.vel = 6
  637. article2.vel = 6
  638. article3.vel = 6
  639. article4.vel = 6
  640. article1.x = 10000
  641. article2.x = 10000
  642. article3.x = 10000
  643. article4.x = 10000
  644. if article1.x < 2000:
  645. article1.vel = 0
  646. article2.vel = 0
  647. article3.vel = 0
  648. article4.vel = 0
  649. else:
  650. suvaline = random.choice(laused)
  651. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  652. if viga == 2:
  653. elu3.visible3 = False
  654. elif viga == 1:
  655. elu2.visible2 = False
  656. elu3.visible3 = False
  657. else:
  658. elu.visible = False
  659. elu2.visible2 = False
  660. elu3.visible3 = False
  661.  
  662. #artikkel 3 liikumine
  663. if article3.y - article3.height < man.hitbox[1] + man.hitbox[3] and article3.y + article3.height > man.hitbox[1]:
  664. if article3.x + article3.width > man.hitbox[0] and article3.x < man.hitbox[0] + man.hitbox[2]:
  665. print('3')
  666. if suvaline == (a):
  667. print('6IGE')
  668. man.hit()
  669. article1.x = 1900
  670. article2.x = 1900
  671. article3.x = 1900
  672. article4.x = 1900
  673. suvaline = random.choice(laused)
  674. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  675. level()
  676. combo += 1
  677. if combo == 3:
  678. combobonus()
  679. if combo == 5:
  680. combobonus()
  681. if combo == 10:
  682. combobonus()
  683. if combo == 15:
  684. combobonus()
  685. if combo == 20:
  686. combobonus()
  687. else:
  688. print('vale')
  689. articlevale = True
  690. article1.x = 1900
  691. article2.x = 1900
  692. article3.x = 1900
  693. article4.x = 1900
  694. #article5.x = 3000
  695. combo = 0
  696. viga -= 1
  697. if viga == 0:
  698. standing = False
  699. article1.vel = 6
  700. article2.vel = 6
  701. article3.vel = 6
  702. article4.vel = 6
  703. article1.x = 10000
  704. article2.x = 10000
  705. article3.x = 10000
  706. article4.x = 10000
  707. if article1.x < 2000:
  708. article1.vel = 0
  709. article2.vel = 0
  710. article3.vel = 0
  711. article4.vel = 0
  712. else:
  713. suvaline = random.choice(laused)
  714. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  715. if viga == 2:
  716. elu3.visible3 = False
  717. elif viga == 1:
  718. elu2.visible2 = False
  719. elu3.visible3 = False
  720. else:
  721. elu.visible = False
  722. elu2.visible2 = False
  723. elu3.visible3 = False
  724.  
  725. #artikkel 4 liikumine
  726. if article4.y - article4.height < man.hitbox[1] + man.hitbox[3] and article4.y + article4.height > man.hitbox[1]:
  727. if article4.x + article4.width > man.hitbox[0] and article4.x < man.hitbox[0] + man.hitbox[2]:
  728. print('4')
  729. if suvaline == (empty):
  730. print('6IGE')
  731. man.hit()
  732. article1.x = 1900
  733. article2.x = 1900
  734. article3.x = 1900
  735. article4.x = 1900
  736. suvaline = random.choice(laused)
  737. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  738. level()
  739. combo += 1
  740. if combo == 3:
  741. combobonus()
  742. if combo == 5:
  743. combobonus()
  744. if combo == 10:
  745. combobonus()
  746. if combo == 15:
  747. combobonus()
  748. if combo == 20:
  749. combobonus()
  750. else:
  751. print('vale')
  752. articlevale = True
  753. article1.x = 1900
  754. article2.x = 1900
  755. article3.x = 1900
  756. article4.x = 1900
  757. #article5.x = 3000
  758. combo = 0
  759. viga -= 1
  760. if viga == 0:
  761. standing = False
  762. article1.vel = 6
  763. article2.vel = 6
  764. article3.vel = 6
  765. article4.vel = 6
  766. article1.x = 10000
  767. article2.x = 10000
  768. article3.x = 10000
  769. article4.x = 10000
  770. if article1.x < 2000:
  771. article1.vel = 0
  772. article2.vel = 0
  773. article3.vel = 0
  774. article4.vel = 0
  775. else:
  776. suvaline = random.choice(laused)
  777. text1 = font.render(random.choice(suvaline), 1, (255,255,255))
  778. if viga == 2:
  779. elu3.visible3 = False
  780. elif viga == 1:
  781. elu2.visible2 = False
  782. elu3.visible3 = False
  783. else:
  784. elu.visible = False
  785. elu2.visible2 = False
  786. elu3.visible3 = False
  787.  
  788.  
  789. #player movement
  790. keys = pygame.key.get_pressed()
  791.  
  792. if keys[pygame.K_w] and man.y > man.vel + 69 or keys[pygame.K_UP] and man.y > man.vel + 69:
  793. man.y -= man.vel
  794.  
  795. 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:
  796. man.y += man.vel
  797.  
  798.  
  799. drawgamewindow()
  800.  
  801.  
  802.  
  803.  
  804. pygame.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement