Exemplo n.º 1
0
def captions(surf):
    intro_text = ["Код, дизайн - Марцинович Даниил",
                  "",
                  "Саундтрек, идея - Джасим Константин",
                  "",
                  "",
                  "",
                  "Для завершения нажмите на любую кнопку",
                  "",
                  "MartsinovichDanya",
                  "copyright 2019"]

    fon = pygame.transform.scale(load_image('background.jpg'), (surf.get_width(), surf.get_height()))
    surf.blit(fon, (0, 0))
    font = pygame.font.Font(None, 40)
    text_coord = 150
    for line in intro_text:
        string_rendered = font.render(line, 1, pygame.Color('white'))
        intro_rect = string_rendered.get_rect()
        text_coord += 10
        intro_rect.top = text_coord
        intro_rect.x = 50
        text_coord += intro_rect.height
        surf.blit(string_rendered, intro_rect)

    while True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                terminate()
            elif event.type == pygame.KEYDOWN or \
                    event.type == pygame.MOUSEBUTTONDOWN:
                terminate()
        pygame.display.flip()
def game_over_screen(surf):
    intro_text = [
        "Для продолжения нажмите на любую кнопку", "", "MartsinovichDanya",
        "copyright 2019"
    ]

    fon = pygame.transform.scale(load_image('gameover.png'),
                                 (surf.get_width(), surf.get_height()))
    surf.blit(fon, (0, 0))
    font = pygame.font.Font(None, 20)
    text_coord = 580
    for line in intro_text:
        string_rendered = font.render(line, 1, pygame.Color('white'))
        intro_rect = string_rendered.get_rect()
        text_coord += 10
        intro_rect.top = text_coord
        intro_rect.x = 10
        text_coord += intro_rect.height
        surf.blit(string_rendered, intro_rect)

    while True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                terminate()
            elif event.type == pygame.KEYDOWN or \
                    event.type == pygame.MOUSEBUTTONDOWN:
                captions(surf)
        pygame.display.flip()
Exemplo n.º 3
0
def secret(surf, player):
    if player.rect.left == 0 and player.rect.center[1] == exit_place:
        pygame.mixer.music.stop()
        intro_text = [
            "Для Продолжения нажмите на любую кнопку", "", "MartsinovichDanya",
            "copyright 2019"
        ]

        fon = pygame.transform.scale(load_image('vobhod.png'),
                                     (surf.get_width(), surf.get_height()))
        surf.blit(fon, (0, 0))
        font = pygame.font.Font(None, 20)
        text_coord = 590
        for line in intro_text:
            string_rendered = font.render(line, 1, pygame.Color('white'))
            intro_rect = string_rendered.get_rect()
            text_coord += 10
            intro_rect.top = text_coord
            intro_rect.x = 10
            text_coord += intro_rect.height
            surf.blit(string_rendered, intro_rect)

        while True:
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    terminate()
                elif event.type == pygame.KEYDOWN or \
                        event.type == pygame.MOUSEBUTTONDOWN:
                    captions(surf)
            pygame.display.flip()

    else:
        pass
Exemplo n.º 4
0
 def __init__(self, image_file, location):
     pygame.sprite.Sprite.__init__(self)
     self.image = load_image(image_file)
     self.rect = self.image.get_rect()
     self.rect.left, self.rect.top = location
Exemplo n.º 5
0
 def fire(self, player):
     start_pos = (self.rect.left, self.rect.center[1])
     diff_x = player.rect.center[0] - start_pos[0]
     diff_y = player.rect.center[1] - start_pos[1]
     FireBall(self.group, self.fireballs, load_image('fireball.png', -1),
              start_pos[0], start_pos[1], diff_x // 30, diff_y // 30)
Exemplo n.º 6
0
from StartScreen import start_screen
from GameOverScreen import game_over_screen
from WinScreen import win_screen
from EasterEgg import secret

pygame.init()

# настройка экрана и группы всех спрайтов
size = width, height = 700, 700
screen = pygame.display.set_mode(size)
all_sprites = pygame.sprite.Group()
bg = Background('background.jpg', [0, 0])

# спрайт игрока
wizard = Player(load_image("sorlowalk.png", (128, 128, 128, 255)),
                load_image("sorlowalkback.png", (128, 128, 128, 255)),
                load_image("sorlostand.png", (128, 128, 128, 255)),
                load_image("sorlofire.png", (128, 128, 128, 255)), 4, 1, 0,
                300, all_sprites)
# спрайт противника
enemi = Boss(load_image("enemi.png", -1), 400, 250, all_sprites)

# заставка
start_screen(screen)

# музыка
pygame.mixer.init()
pygame.mixer.music.load(os.path.join('data', 'danzhi.wav'))
pygame.mixer.music.set_volume(0.5)
pygame.mixer.music.play(-1)