Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.18 KB | None | 0 0
  1. # сохранение damir 13:15
  2. import pygame
  3. import sys
  4. import time
  5. from pygame.locals import *
  6.  
  7. pygame.init()
  8.  
  9. # импорт картинок
  10. background = pygame.image.load('img/background1.bmp')
  11.  
  12. lebedev = pygame.image.load('img/lebedev.png')
  13. sleeping = pygame.image.load('img/sleeping.png')
  14. sitting = pygame.image.load('img/sitting.bmp')
  15. Key = pygame.image.load('img/key.png')
  16. Key_True = pygame.image.load('img/Key_True.png')
  17. bed = pygame.image.load('img/bed.bmp')
  18. chair = pygame.image.load('img/chair.bmp')
  19. table = pygame.image.load('img/table.bmp')
  20. kitchen = pygame.image.load('img/kitchen.png')
  21. toilet = pygame.image.load('img/toilet.bmp')
  22. Game_Over = pygame.image.load('img/Game_Over.png')
  23.  
  24. # удаление фона
  25. lebedev.set_colorkey((0, 208, 0))
  26. sleeping.set_colorkey((0, 208, 0))
  27. sitting.set_colorkey((0, 208, 0))
  28. bed.set_colorkey((0, 208, 0))
  29. chair.set_colorkey((0, 208, 0))
  30. table.set_colorkey((0, 208, 0))
  31. toilet.set_colorkey((0, 208, 0))
  32.  
  33.  
  34. # размеры окна
  35. display_x = 1280
  36. display_y = 720
  37. # расположение артёмы
  38. x = -display_x + 420
  39. y = -50
  40. # расположение кухни
  41. x_kitchen = -display_x + 509
  42. y_kitchen = -display_y + 158
  43. # расположение стула
  44. x_chair = -150
  45. y_chair = -250
  46. # расположение ключа
  47. x_Key = -400
  48. y_Key = -400
  49. # расположение стола
  50. x_table = -50
  51. y_table = - 170
  52. # расположение туалета
  53. x_toilet = -50
  54. y_toilet = -520
  55. # расположение кровати
  56. x_bed = - display_x + 164 # размеры фотки
  57. y_bed = - 170
  58. # переменные
  59. GO_x = 1025
  60.  
  61. speed = 10
  62. step = 0
  63. key = False
  64. cur_Key = Key
  65. cur_lebedev = lebedev
  66.  
  67. sitting_n = 0
  68. kitchen_n = 0
  69.  
  70.  
  71. # text
  72. font = pygame.font.Font("Pixel.ttf", 24)
  73. str = "Разбудите Артемия (S). (Нажмите F чтобы скрывать диалоговое окно)"
  74. y_text = -40
  75.  
  76. game_display = pygame.display.set_mode((display_x, display_y), pygame.FULLSCREEN)
  77. pygame.display.set_caption("First Artem's day!")
  78.  
  79.  
  80.  
  81. # Начало основного цикла
  82. code_run = True
  83. while code_run:
  84. pygame.time.delay(25)
  85.  
  86. # Закрытие на крестик
  87. for event in pygame.event.get():
  88. if event.type == pygame.QUIT:
  89. print("escape work")
  90. code_run = False
  91.  
  92. game_display.blit(background, (0, 0))
  93.  
  94. buttons = pygame.key.get_pressed() # Передвижение
  95.  
  96. if buttons[pygame.K_w]:
  97. y += speed
  98. if buttons[pygame.K_a]:
  99. x += speed
  100. if buttons[pygame.K_s]:
  101. y -= speed
  102. if step == 0:
  103. str = "Доброе утро, пора посрать"
  104. step += 1
  105. if buttons[pygame.K_d]:
  106. x -= speed
  107.  
  108. if buttons[pygame.K_f]:
  109. if y_text == 100:
  110. y_text = -30
  111. else:
  112. y_text = 100
  113.  
  114.  
  115. if x >= x_toilet - 201 and x <= x_toilet - 0 and y >= y_toilet - 200 and y <= y_toilet - 0 and step == 1:
  116. if sitting_n == 0:
  117. str = "Добежал, красава! (X)"
  118. if buttons[pygame.K_x]:
  119. sitting_n = 1
  120. cur_lebedev = sitting
  121. str = "Любишь срать, люби убираться"
  122. if buttons[pygame.K_e]:
  123. sitting_n = 2
  124. str = "Вы смыли дизайн Лебедева. Пора кушать"
  125. step += 1
  126. elif buttons[pygame.K_w or pygame.K_a or pygame.K_s or pygame.K_d or pygame.K_x or pygame.K_f or pygame.K_z]:
  127. sitting_n = 2
  128. str = "Вы не смыли. Game over"
  129. GO_x = 0
  130.  
  131. if x >= x_kitchen - 509 and x <= x_kitchen - 0 and y >= y_kitchen - 158 and y <= y_kitchen - 0 and step == 2 and kitchen_n == 0:
  132. str = "Возьмите хлеб, сыр, колбасу для бутерброда (E)"
  133. if buttons[pygame.K_e]:
  134. kitchen_n = 1
  135. str = "Сыра нет, положить помидорку (yes - X, no - E)"
  136. if buttons[pygame.K_x]:
  137. str = "Помидор оказался не свежим, поэтому у Артемия пищевое отраление"
  138. time.sleep(3)
  139. GO_x = 0
  140. if buttons[pygame.K_e]:
  141. str = "Ок, тем более что она была не свежая. Чтобы выйти найдите ключ"
  142. step += 1
  143.  
  144.  
  145. if x >= x_chair - 189 and x <= x_chair - 0 and y >= y_chair - 40 and y <= y_chair - 0 and step == 3:
  146. str = "Сядьте за компьютер (X)"
  147. if buttons[pygame.K_x]:
  148. cur_lebedev = sitting
  149. str = "Запустите компьютер (Е)"
  150. if buttons[pygame.K_e]:
  151. str = "Hello world!"
  152. step += 1
  153. time.sleep(3)
  154. str = "Чтобы выйти найдите ключ"
  155.  
  156.  
  157. if x >= x_Key - 71 and x <= x_Key - 0 and y >= y_Key - 40 and y <= y_Key - 0 and step == 4:
  158. str = "Возьмите ключ (E)"
  159. if buttons[pygame.K_e]:
  160. x_Key = 100
  161. str = "Ключ взят"
  162. cur_Key = Key_True
  163.  
  164. # рассположение вещей на экране
  165. game_display.blit(cur_Key, (0, 0), (x_Key, y_Key, display_x, display_y))
  166. game_display.blit(table, (0, 0), (x_table, y_table, display_x, display_y))
  167. game_display.blit(kitchen, (0, 0), (x_kitchen, y_kitchen, display_x, display_y))
  168. game_display.blit(chair, (0, 0), (x_chair, y_chair, display_x, display_y))
  169. game_display.blit(toilet, (0, 0), (x_toilet, y_toilet, display_x, display_y))
  170.  
  171. if step == 0:
  172. game_display.blit(sleeping, (0, 0), (x_bed, y_bed, display_x, display_y))
  173. else:
  174. game_display.blit(bed, (0, 0), (x_bed, y_bed, display_x, display_y))
  175. game_display.blit(lebedev, (0, 0), (x, y, display_x, display_y))
  176.  
  177.  
  178. text = font.render(str, True, (0, 0, 0))
  179. game_display.blit(text, (0, 0), (-40, y_text, display_x, display_y))
  180.  
  181. game_display.blit(Game_Over, (0, 0), (GO_x, 0, display_x, display_y))
  182.  
  183. pygame.display.update()
  184.  
  185.  
  186. pygame.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement