Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # сохранение damir 13:15
- import pygame
- import sys
- import time
- from pygame.locals import *
- pygame.init()
- # импорт картинок
- background = pygame.image.load('img/background1.bmp')
- lebedev = pygame.image.load('img/lebedev.png')
- sleeping = pygame.image.load('img/sleeping.png')
- sitting = pygame.image.load('img/sitting.bmp')
- Key = pygame.image.load('img/key.png')
- Key_True = pygame.image.load('img/Key_True.png')
- bed = pygame.image.load('img/bed.bmp')
- chair = pygame.image.load('img/chair.bmp')
- table = pygame.image.load('img/table.bmp')
- kitchen = pygame.image.load('img/kitchen.png')
- toilet = pygame.image.load('img/toilet.bmp')
- Game_Over = pygame.image.load('img/Game_Over.png')
- # удаление фона
- lebedev.set_colorkey((0, 208, 0))
- sleeping.set_colorkey((0, 208, 0))
- sitting.set_colorkey((0, 208, 0))
- bed.set_colorkey((0, 208, 0))
- chair.set_colorkey((0, 208, 0))
- table.set_colorkey((0, 208, 0))
- toilet.set_colorkey((0, 208, 0))
- # размеры окна
- display_x = 1280
- display_y = 720
- # расположение артёмы
- x = -display_x + 420
- y = -50
- # расположение кухни
- x_kitchen = -display_x + 509
- y_kitchen = -display_y + 158
- # расположение стула
- x_chair = -150
- y_chair = -250
- # расположение ключа
- x_Key = -400
- y_Key = -400
- # расположение стола
- x_table = -50
- y_table = - 170
- # расположение туалета
- x_toilet = -50
- y_toilet = -520
- # расположение кровати
- x_bed = - display_x + 164 # размеры фотки
- y_bed = - 170
- # переменные
- GO_x = 1025
- speed = 10
- step = 0
- key = False
- cur_Key = Key
- cur_lebedev = lebedev
- sitting_n = 0
- kitchen_n = 0
- # text
- font = pygame.font.Font("Pixel.ttf", 24)
- str = "Разбудите Артемия (S). (Нажмите F чтобы скрывать диалоговое окно)"
- y_text = -40
- game_display = pygame.display.set_mode((display_x, display_y), pygame.FULLSCREEN)
- pygame.display.set_caption("First Artem's day!")
- # Начало основного цикла
- code_run = True
- while code_run:
- pygame.time.delay(25)
- # Закрытие на крестик
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- print("escape work")
- code_run = False
- game_display.blit(background, (0, 0))
- buttons = pygame.key.get_pressed() # Передвижение
- if buttons[pygame.K_w]:
- y += speed
- if buttons[pygame.K_a]:
- x += speed
- if buttons[pygame.K_s]:
- y -= speed
- if step == 0:
- str = "Доброе утро, пора посрать"
- step += 1
- if buttons[pygame.K_d]:
- x -= speed
- if buttons[pygame.K_f]:
- if y_text == 100:
- y_text = -30
- else:
- y_text = 100
- if x >= x_toilet - 201 and x <= x_toilet - 0 and y >= y_toilet - 200 and y <= y_toilet - 0 and step == 1:
- if sitting_n == 0:
- str = "Добежал, красава! (X)"
- if buttons[pygame.K_x]:
- sitting_n = 1
- cur_lebedev = sitting
- str = "Любишь срать, люби убираться"
- if buttons[pygame.K_e]:
- sitting_n = 2
- str = "Вы смыли дизайн Лебедева. Пора кушать"
- step += 1
- 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]:
- sitting_n = 2
- str = "Вы не смыли. Game over"
- GO_x = 0
- 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:
- str = "Возьмите хлеб, сыр, колбасу для бутерброда (E)"
- if buttons[pygame.K_e]:
- kitchen_n = 1
- str = "Сыра нет, положить помидорку (yes - X, no - E)"
- if buttons[pygame.K_x]:
- str = "Помидор оказался не свежим, поэтому у Артемия пищевое отраление"
- time.sleep(3)
- GO_x = 0
- if buttons[pygame.K_e]:
- str = "Ок, тем более что она была не свежая. Чтобы выйти найдите ключ"
- step += 1
- if x >= x_chair - 189 and x <= x_chair - 0 and y >= y_chair - 40 and y <= y_chair - 0 and step == 3:
- str = "Сядьте за компьютер (X)"
- if buttons[pygame.K_x]:
- cur_lebedev = sitting
- str = "Запустите компьютер (Е)"
- if buttons[pygame.K_e]:
- str = "Hello world!"
- step += 1
- time.sleep(3)
- str = "Чтобы выйти найдите ключ"
- if x >= x_Key - 71 and x <= x_Key - 0 and y >= y_Key - 40 and y <= y_Key - 0 and step == 4:
- str = "Возьмите ключ (E)"
- if buttons[pygame.K_e]:
- x_Key = 100
- str = "Ключ взят"
- cur_Key = Key_True
- # рассположение вещей на экране
- game_display.blit(cur_Key, (0, 0), (x_Key, y_Key, display_x, display_y))
- game_display.blit(table, (0, 0), (x_table, y_table, display_x, display_y))
- game_display.blit(kitchen, (0, 0), (x_kitchen, y_kitchen, display_x, display_y))
- game_display.blit(chair, (0, 0), (x_chair, y_chair, display_x, display_y))
- game_display.blit(toilet, (0, 0), (x_toilet, y_toilet, display_x, display_y))
- if step == 0:
- game_display.blit(sleeping, (0, 0), (x_bed, y_bed, display_x, display_y))
- else:
- game_display.blit(bed, (0, 0), (x_bed, y_bed, display_x, display_y))
- game_display.blit(lebedev, (0, 0), (x, y, display_x, display_y))
- text = font.render(str, True, (0, 0, 0))
- game_display.blit(text, (0, 0), (-40, y_text, display_x, display_y))
- game_display.blit(Game_Over, (0, 0), (GO_x, 0, display_x, display_y))
- pygame.display.update()
- pygame.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement