Ejemplo n.º 1
0
def start():
    image = load_image("first.jpg")
    image1 = pygame.transform.scale(image, (800, 800))
    screen.blit(image1, (0, 0))
    pygame.display.flip()
    time.sleep(1)
    image = load_image("menu.jpg")
    screen.blit(image, (0, 0))
    pygame.display.flip()

    running = True
    while running:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
            if event.type == pygame.MOUSEBUTTONDOWN:
                if pygame.mouse.get_pos()[0] >= 80 and pygame.mouse.get_pos()[1] >= 285:
                    if pygame.mouse.get_pos()[0] <= 515 and pygame.mouse.get_pos()[1] <= 370:
                        main(first_result)
                if pygame.mouse.get_pos()[0] >= 80 and pygame.mouse.get_pos()[1] >= 441:
                    if pygame.mouse.get_pos()[0] <= 565 and pygame.mouse.get_pos()[1] <= 515:
                        main(result)
                if pygame.mouse.get_pos()[0] >= 80 and pygame.mouse.get_pos()[1] >= 614:
                    if pygame.mouse.get_pos()[0] <= 330 and pygame.mouse.get_pos()[1] <= 685:
                        running = False
    pygame.quit()
Ejemplo n.º 2
0
 def __init__(self, filename, center, type_is):
     image = load_image(filename, -1)
     super().__init__(all_sprites)
     self.image = image
     if type_is == 'wall':
         width, height = self.image.get_size()
         self.image = pygame.transform.scale(self.image, (width * 2, height * 2))
         self.rect = self.image.get_rect(
             center=center)
         self.mask = pygame.mask.from_surface(self.image)
     elif type_is == 'floor':
         width, height = self.image.get_size()
         self.image = pygame.transform.scale(self.image, (width * 2, height * 2))
         self.rect = self.image.get_rect(
             center=center)
Ejemplo n.º 3
0
class Scroll(pygame.sprite.Sprite):
    image = load_image("scroll.png")

    def __init__(self, sprites, *words):
        super().__init__(sprites)
        self.image = Scroll.image
        self.rect = self.image.get_rect(center=(width // 2, height // 2))
        self.words = words

    def read(self):
        font = pygame.font.Font(None, 30)
        text_coord = 0
        for line in self.words:
            for word in line:
                string_rendered = font.render(word, False, pygame.Color('black'))
                intro_rect = string_rendered.get_rect()
                intro_rect.y = height // 2 + text_coord - 70
                intro_rect.x = width // 2 - 225
                text_coord += 20
                screen.blit(string_rendered, intro_rect)
Ejemplo n.º 4
0
def lvl1(lvl='lvl1',
         wall_1_x=850,
         wall_1_y=72,
         wall_2_x=850,
         wall_2_y=760,
         wall_3_x=610,
         wall_3_y=382,
         wall_4_x=1090,
         wall_4_y=382,
         floor_x=850,
         floor_y=450,
         npc_x=735,
         npc_y=105,
         chest_x=735,
         chest_y=105,
         gg_left_x=850,
         gg_left_y=450,
         gg_sprite_x=850,
         gg_sprite_y=450,
         gerl_x=600,
         gerl_y=50,
         el_x=799,
         el_y=20,
         npc_boss_x=None,
         npc_boss_y=None):
    walls = list()
    wall_1 = Tile('up_wall_new.png', (wall_1_x, wall_1_y), 'wall')
    wall_2 = Tile('dawn_wall.png', (wall_2_x, wall_2_y), 'wall')
    wall_3 = Tile('side_wall.png', (wall_3_x, wall_3_y), 'wall')
    wall_4 = Tile('side_wall.png', (wall_4_x, wall_4_y), 'wall')
    walls.extend([wall_1, wall_2, wall_3, wall_4])
    floor = Tile('floor_new.png', (floor_x, floor_y), 'floor')
    npc = AnimatedSprite(load_image("npc_mir.png"), 3, 1, npc_x, npc_y,
                         all_sprites, 35)
    walls.append(npc)
    gerl = AnimatedSprite(load_image("gerl.png"), 1, 7, gerl_x, gerl_y,
                          all_sprites, 15)
    el = AnimatedSprite(load_image('el.png'), 9, 1, el_x, el_y, all_sprites,
                        35)
    walls.append(el)
    chest = Tile('chest.png', (chest_x, chest_y), 'floor')
    gg_right = AnimatedSprite(load_image("right_player.png"), 8, 1, gg_left_x,
                              gg_left_y, sprites, 15)
    gg_left = AnimatedSprite(load_image("left_player.png"), 8, 1, gg_left_x,
                             gg_left_y, sprites, 15)
    gg_sprite = AnimatedSprite(load_image("right_player_stop.png"), 1, 1,
                               gg_sprite_x, gg_sprite_y, all_sprites, 15)
    gg_stop_r = AnimatedSprite(load_image("right_player_stop.png"), 1, 1,
                               gg_left_x, gg_left_y, sprites, 15)
    gg_stop_l = AnimatedSprite(load_image("left_player_stop.png"), 1, 1,
                               gg_sprite_x, gg_sprite_y, sprites, 15)
    game(walls,
         floor,
         wall_1,
         wall_2,
         wall_3,
         wall_4,
         chest,
         gg_right,
         gg_left,
         gg_sprite,
         gg_stop_r,
         gg_stop_l,
         'lvl1',
         el=el,
         gerl=gerl,
         npc=npc,
         npc_boss=None)
Ejemplo n.º 5
0
def lvl3(lvl='lvl3',
         wall_1_x=850,
         wall_1_y=72,
         wall_2_x=850,
         wall_2_y=760,
         wall_3_x=382,
         wall_3_y=382,
         wall_4_x=1318,
         wall_4_y=382,
         floor_x=850,
         floor_y=450,
         npc_x=None,
         npc_y=None,
         chest_x=550,
         chest_y=350,
         gg_left_x=650,
         gg_left_y=450,
         gg_sprite_x=650,
         gg_sprite_y=450,
         gerl_x=None,
         gerl_y=None,
         el_x=None,
         el_y=None,
         npc_boss_x=750,
         npc_boss_y=100):
    walls = list()
    wall_1 = Tile('up_wall_lvl1.png', (wall_1_x, wall_1_y), 'wall')
    wall_2 = Tile('dawn_wall_lvl1.png', (wall_2_x, wall_2_y), 'wall')
    wall_3 = Tile('side_wall.png', (wall_3_x, wall_3_y), 'wall')
    wall_4 = Tile('side_wall.png', (wall_4_x, wall_4_y), 'wall')
    walls.extend([wall_1, wall_2, wall_3, wall_4])
    floor = Tile('floorLvl1.png', (floor_x, floor_y), 'floor')
    npc_boss = AnimatedSprite(load_image("npc.png"), 11, 1, npc_boss_x,
                              npc_boss_y, all_sprites, 25)
    walls.append(npc_boss)
    chest = Tile('chest.png', (chest_x, chest_y), 'floor')
    gg_right = AnimatedSprite(load_image("right_player.png"), 8, 1, gg_left_x,
                              gg_left_y, sprites, 15)
    gg_left = AnimatedSprite(load_image("left_player.png"), 8, 1, gg_left_x,
                             gg_left_y, sprites, 15)
    gg_sprite = AnimatedSprite(load_image("right_player_stop.png"), 1, 1,
                               gg_sprite_x, gg_sprite_y, all_sprites, 15)
    gg_stop_r = AnimatedSprite(load_image("right_player_stop.png"), 1, 1,
                               gg_left_x, gg_left_y, sprites, 15)
    gg_stop_l = AnimatedSprite(load_image("left_player_stop.png"), 1, 1,
                               gg_sprite_x, gg_sprite_y, sprites, 15)
    game(walls,
         floor,
         wall_1,
         wall_2,
         wall_3,
         wall_4,
         chest,
         gg_right,
         gg_left,
         gg_sprite,
         gg_stop_r,
         gg_stop_l,
         'lvl3',
         el=None,
         gerl=None,
         npc=None,
         npc_boss=npc_boss)
Ejemplo n.º 6
0
def lvl2(lvl='lvl2',
         wall_1_x=850,
         wall_1_y=224,
         wall_2_x=850,
         wall_2_y=610,
         wall_3_x=155,
         wall_3_y=384,
         wall_4_x=1545,
         wall_4_y=384,
         floor_x=850,
         floor_y=450,
         npc_x=750,
         npc_y=500,
         chest_x=350,
         chest_y=325,
         gg_left_x=350,
         gg_left_y=450,
         gg_sprite_x=350,
         gg_sprite_y=450,
         gerl_x=None,
         gerl_y=None,
         el_x=None,
         el_y=None,
         npc_boss_x=None,
         npc_boss_y=None):
    walls = list()
    wall_1 = Tile('up_wall_lvl2.png', (wall_1_x, wall_1_y), 'wall')
    wall_2 = Tile('dawn_wall_lvl2.png', (wall_2_x, wall_2_y), 'wall')
    wall_3 = Tile('side_wall_lvl2.png', (wall_3_x, wall_3_y), 'wall')
    wall_4 = Tile('side_wall_lvl2.png', (wall_4_x, wall_4_y), 'wall')
    walls.extend([wall_1, wall_2, wall_3, wall_4])
    floor = Tile('floorLvl2.png', (floor_x, floor_y), 'floor')
    npc = AnimatedSprite(load_image("npc_mir.png"), 3, 1, npc_x, npc_y,
                         all_sprites, 30)
    walls.append(npc)
    chest = Tile('chest.png', (chest_x, chest_y), 'floor')
    gg_right = AnimatedSprite(load_image("right_player.png"), 8, 1, gg_left_x,
                              gg_left_y, sprites, 15)
    gg_left = AnimatedSprite(load_image("left_player.png"), 8, 1, gg_left_x,
                             gg_left_y, sprites, 15)
    gg_sprite = AnimatedSprite(load_image("right_player_stop.png"), 1, 1,
                               gg_sprite_x, gg_sprite_y, all_sprites, 15)
    gg_stop_r = AnimatedSprite(load_image("right_player_stop.png"), 1, 1,
                               gg_left_x, gg_left_y, sprites, 15)
    gg_stop_l = AnimatedSprite(load_image("left_player_stop.png"), 1, 1,
                               gg_sprite_x, gg_sprite_y, sprites, 15)
    game(walls,
         floor,
         wall_1,
         wall_2,
         wall_3,
         wall_4,
         chest,
         gg_right,
         gg_left,
         gg_sprite,
         gg_stop_r,
         gg_stop_l,
         'lvl2',
         el=None,
         gerl=None,
         npc=npc,
         npc_boss=None)