Пример #1
0
    def __init__(self, player):
        """ Create level 1. """

        # Call the parent constructor
        Level.__init__(self, player)

        self.background = utils.load_png_bg("BG.png")
        self.background.set_colorkey(constants.WHITE)
        self.level_limit = -2000
        self.next_city = 0
        self.preced_city = 0

        # Array with type of platform, and x, y location of the platform.
        level_surroungings, level_platforms = utils.load_level("level02")

        # Go through the array above and add platforms
        for platform in level_platforms:
            block = platforms.Platform(platforms.plat_dict[platform[0]])
            block.rect.x = int(platform[1])
            block.rect.y = int(platform[2])
            self.platform_list.add(block)

        for surrounding in level_surroungings:
            block = platforms.Platform(platforms.plat_dict.get(surrounding[0]))
            block.rect.x = int(surrounding[1])
            block.rect.y = int(surrounding[2])
            self.surroundings_list.add(block)
Пример #2
0
    def __init__(self, player):
        """ Create level 1. """

        # Call the parent constructor
        Level.__init__(self, player)

        #self.background = pygame.image.load("../background_01.png").convert()
        self.background = pygame.image.load(
            "../resources/empty_dungeon_01.png").convert()
        self.background.set_colorkey(constants.WHITE)
        self.level_limit = -2500

        # Array with type of platform, and x, y location of the platform.
        level = []
        #         level = [ [platforms.GRASS_LEFT, 500, 500],
        #                   [platforms.GRASS_MIDDLE, 570, 500],
        #                   [platforms.GRASS_RIGHT, 640, 500],
        #                   [platforms.GRASS_LEFT, 800, 400],
        #                   [platforms.GRASS_MIDDLE, 870, 400],
        #                   [platforms.GRASS_RIGHT, 940, 400],
        #                   [platforms.GRASS_LEFT, 1000, 500],
        #                   [platforms.GRASS_MIDDLE, 1070, 500],
        #                   [platforms.GRASS_RIGHT, 1140, 500],
        #                   [platforms.STONE_PLATFORM_LEFT, 1120, 280],
        #                   [platforms.STONE_PLATFORM_MIDDLE, 1190, 280],
        #                   [platforms.STONE_PLATFORM_RIGHT, 1260, 280],
        #                   ]

        # Go through the array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)
Пример #3
0
    def __init__(self, player):
        """ Create level 1. """

        # Call the parent constructor
        Level.__init__(self, player)

        sprite_sheet = SpriteSheet("backgrounds.png")
        self.background = sprite_sheet.get_image(0, 63, 231, 63)
        self.background = pygame.transform.scale(self.background, (constants.SCREEN_WIDTH,
                                                                 constants.SCREEN_HEIGHT))
        self.background.set_colorkey(constants.WHITE)
        self.level_limit = -2500

        # Array with type of platform, and x, y location of the platform.
        level = [ [platforms.STONE_WALL, 30, 650]
                  ]

        

        # Go through the array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)
Пример #4
0
    def __init__(self, player):
        # Call the parent constructor
        Level.__init__(self, player)
        W, H = pygame.display.Info().current_w, pygame.display.Info().current_h
        self.background = pygame.image.load(
            os.path.join('Images', 'combinedHallway.png')).convert()

        self.background.set_colorkey(constants.WHITE)
        self.background = pygame.transform.scale(self.background, (W * 4, H))
        self.level_limit = 0

        # Array with type of platform, and x, y location of the platform.
        # desk = pygame.image.load(os.path.join('Images','Desk.png'))
        # level = [[platforms.Desk, 500,500]
        level = [[platforms.desk3, 400, 500], [platforms.desk, 0, 500],
                 [platforms.desk, 0, 400], [platforms.desk, 0, 300],
                 [platforms.desk, 0, 200], [platforms.desk, 3150, 500],
                 [platforms.desk, 3150, 400], [platforms.desk, 3150, 300]]
        for i in range(0, 70):
            level.append([platforms.desk, 100 * i, 100])

        # Go through the array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)
Пример #5
0
    def __init__(self, player):
        """ Create level 1."""

        # Call the parent constructor
        Level.__init__(self, player)

        self.background = pygame.image.load(
            "graphics/planet_background.jpg").convert()
        self.midground = pygame.image.load(
            "graphics/planet_mid_background1.png").convert_alpha()
        self.foreground = pygame.image.load(
            "graphics/planet_foreground1.png").convert_alpha()

        self.background.scroll(-110, -110)
        self.background.set_colorkey(constants.WHITE)
        self.level_limit = -1000

        # Array with width, height, x and y of platform
        level = [[210, 40, 500, 470], [210, 40, 200, 400], [210, 40, 600, 300],
                 [210, 40, 900, 300], [210, 40, 1200, 400],
                 [80, 40, 1000, 470]]

        # Go through the array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0], platform[1])
            block.rect.x = platform[2]
            block.rect.y = platform[3]
            block.player = self.player
            self.platform_list.add(block)
Пример #6
0
    def __init__(self, player):
        """ Create level 1. """

        # Call the parent constructor
        Level.__init__(self, player)

        self.background = pygame.image.load(
            "imagenes/background_02.png").convert()
        self.background.set_colorkey(constantes.BLANCO)
        self.level_limit = -1000

        # Array with type of platform, and x, y location of the platform.
        level = []

        #Artefactos
        botellas = pygame.image.load("imagenes/botellas.png").convert()
        botellas.set_colorkey(constantes.BLANCO)
        borracho = pygame.image.load("imagenes/borracho.png").convert()
        borracho.set_colorkey(constantes.BLANCO)
        farol = pygame.image.load("imagenes/farol.png").convert()
        farol.set_colorkey(constantes.BLANCO)
        self.background.blit(botellas, (700, 550))
        self.background.blit(borracho, (800, 450))
        self.background.blit(farol, (1000, 460))

        # Go through the array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)
Пример #7
0
    def __init__(self, player):

        Level.__init__(self, player)

        directory_name = (sys.path[0] + "\Assets")
        self.background = pygame.image.load(
            os.path.join(directory_name, "Background_Level_2.png")).convert()
        self.background.set_colorkey(Constants.white)
        self.level_limit = -6050
        self.enemy = enemies.create_fire_enemy()
        self.enemy.rect.x = 300
        self.enemy.rect.y = 301
        self.enemy.level = self
        self.enemy_list.add(self.enemy)
        self.enemy = enemies.create_fire_enemy()
        self.enemy.rect.x = 400
        self.enemy.rect.y = 451
        self.enemy.level = self
        self.enemy_list.add(self.enemy)

        level = [[platforms.cracked_wall, 300, 300],
                 [platforms.grey_crack, 400, 450]]

        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)
Пример #8
0
    def __init__(self, player, bullet, drag):
        Level.__init__(self, player, bullet, drag)

        self.background = pygame.image.load('pokeclouds.png').convert()
        self.background.set_colorkey(constants.white)
        self.level_limit = -1000

        level = [[platforms.METAL_BLOCK3,0, 550 ],
                [platforms.METAL_BLOCK1, 132, 550],
                [platforms.METAL_BLOCK2, 264, 550],
                ]


        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)

        # moving
        block = platforms.MovingPlatform(platforms.METAL_RECT_THIN1)
        block.rect.x = 1500
        block.rect.y = 300
        block.boundary_top = 100
        block.boundary_bottom = 550
        block.change_y = -1
        block.player = self.player
        block.level = self
        self.platform_list.add(block)
Пример #9
0
    def __init__(self, player):
        # create level 1

        # call the constructor
        Level.__init__(self, player)

        self.background = pygame.image.load('jetman.png').convert()
        self.background.set_colorkey(constants.white)
        self.level_limit = -5500

        # Array with type of platform, and x, y location of the platform
        level = [
            [platforms.BLUE_PLATFORM_END, 535, 500],
            [platforms.BLUE_PLATFORM_MIDDLE, 570, 500],
            [platforms.BLUE_PLATFORM_END, 610, 500],
            [platforms.BLUE_PLATFORM_END, 800, 400],
            [platforms.BLUE_PLATFORM_END, 835, 400],
            [platforms.BLUE_PLATFORM_MIDDLE, 870, 400],
            [platforms.BLUE_PLATFORM_END, 910, 400],
            [platforms.BLUE_PLATFORM_END, 945, 400],
            [platforms.BLUE_PLATFORM_END, 1035, 500],
            [platforms.BLUE_PLATFORM_MIDDLE, 1070, 500],
            [platforms.BLUE_PLATFORM_END, 1105, 500],
            [platforms.YELLOW_BRICK, 1120, 280],
            [platforms.YELLOW_BRICK, 1152, 280],
            [platforms.YELLOW_BRICK, 1184, 280],
            [platforms.GRASS_LEFT, 1700, 240],
            [platforms.GRASS_MIDDLE, 1730, 240],
            [platforms.GRASS_MIDDLE, 1760, 240],
            [platforms.GRASS_MIDDLE, 1790, 240],
            [platforms.GRASS_RIGHT, 1820, 240],
            [platforms.YELLOW_BRICK, 1718, 425],
            [platforms.YELLOW_BRICK, 1750, 425],
            [platforms.YELLOW_BRICK, 1782, 425],
            [platforms.BLUE_PLATFORM_END, 1915, 185],
            [platforms.BLUE_PLATFORM_END, 1950, 185],
            [platforms.BLUE_PLATFORM_END, 1985, 185],
            [platforms.STONE, 1891, 380],
            [platforms.STONE, 1922, 380],
        ]

        # Go through array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)

        # Add a custom moving platform
        block = platforms.MovingPlatform(platforms.STONE_PLATFORM_MIDDLE)
        block.rect.x = 1350
        block.rect.y = 280
        block.boundary_left = 1350
        block.boundary_right = 1600
        block.change_x = 1
        block.player = self.player
        block.level = self
        self.platform_list.add(block)
Пример #10
0
 def add_platform(self):
     # Go through the array above and add platforms
     for platform in self.level:
         block = platforms.Platform(platform[0])
         block.rect.x = platform[1]
         block.rect.y = platform[2]
         block.player = self.player
         self.platform_list.add(block)
Пример #11
0
def enter():
    print("GameState Enter")
    global target, target_pos
    target_pos = 0, 0
    target = gfw.load_image('res/target.png')
    #--------------------------------------------------------------------------#
    gfw.world.init(
        ['plat', 'potal', 'grass', 'obj_dead', 'en', 'player', 'b', 'p',
         'ui'])  #월드 init
    global grass, player, platform, bg, count, en, plat, obj_dead, bg_last
    bg = gfw.load_image('res/background_grass.png')
    bg_last = gfw.load_image('res/background_wall.png')
    grass = platforms.Grass()
    gfw.world.add(gfw.layer.grass, grass)
    player = Player()
    gfw.world.add(gfw.layer.player, player)
    count = 4

    for x, y in STAGE_LIST[count]:
        plat = platforms.Platform(count, x, y)
        gfw.world.add(gfw.layer.plat, plat)

    for x in PLNAT_MONSTER_LIST[count]:
        en = enemy.Enemy((x, 400), 1)
        gfw.world.add(gfw.layer.en, en)

    for x in TREE_MONSTER_LIST[count]:
        en = enemy.Enemy((x, 400), 2)
        gfw.world.add(gfw.layer.en, en)

    for x in BOMB_MONSTER_LIST[count]:
        en = enemy.Enemy((x, 800), 3)
        gfw.world.add(gfw.layer.en, en)
    #--------------------------------------------------------------------------#
    global gameover_img, gameover, entershow
    gameover = False
    gameover_img = gfw.image.load('res/gameover.png')
    entershow = load_image('res/enter2.png')
    #--------------------------------------------------------------------------#
    global music_bg, wav_attack, wav_bomb, wav_shield_sound, wav_bullet, wav_hit1, wav_hit2, wav_hit3, wav_die, hit
    wav_attack = load_wav('res/shoot.ogg')
    wav_bomb = load_wav('res/bomb.wav')
    wav_bullet = load_wav('res/bullet.ogg')
    wav_hit1 = load_wav('res/pain1.wav')
    wav_hit2 = load_wav('res/pain2.wav')
    wav_hit3 = load_wav('res/pain3.wav')
    hit = [wav_hit1, wav_hit2, wav_hit3]
    wav_die = load_wav('res/die.wav')
    wav_shield_sound = load_wav('res/shield_sound.wav')
    music_bg = load_music('res/map.wav')
    #--------------------------------------------------------------------------#
    global font_a, score
    #font_a = load_font('res/Pixel.ttf', 38)
    font_a = load_font('res/Pixel.ttf', 38)
    score = 0
    #--------------------------------------------------------------------------#
    highscore.load()
    music_bg.repeat_play()
Пример #12
0
    def __init__(self, player):
        """ Create level 1. """

        # call the parent constructor
        Level.__init__(self, player)

        self.background = pygame.image.load("background_01.png").convert()
        self.background.set_colorkey(constants.WHITE)
        self.level_limit = -2500

        # Array with type of platform, and x, y location of the platform.
        level = [ [platforms.GRASS_LEFT, 500, 500],
                  [platforms.GRASS_MIDDLE, 570, 500],
                  [platforms.GRASS_RIGHT, 640, 500],
                  [platforms.GRASS_LEFT, 800, 400],
                  [platforms.GRASS_MIDDLE, 870, 400],
                  [platforms.GRASS_RIGHT, 940, 400],
                  [platforms.GRASS_LEFT, 1000, 500],
                  [platforms.GRASS_MIDDLE, 1070, 500],
                  [platforms.GRASS_RIGHT, 1140, 500],
                  [platforms.STONE_PLATFORM_LEFT, 1120, 280],
                  [platforms.STONE_PLATFORM_MIDDLE, 1190, 280],
                  [platforms.STONE_PLATFORM_RIGHT, 1260, 280],
                  ]


        # Go through the array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)

        # add array of features that can't cause collisions
        level = [ [platforms.DOOR_BASE, 870, 330],
                  [platforms.DOOR_TOP, 870, 290],
                  ]
        
        for feature in level:
            block = platforms.Feature(feature[0])
            block.rect.x = feature[1]
            block.rect.y = feature[2]
            block.player = self.player
            self.feature_list.add(block)

        # Add a custom moving platform
        block = platforms.MovingPlatform(platforms.STONE_PLATFORM_MIDDLE)
        block.rect.x = 1350
        block.rect.y = 280
        block.boundary_left = 1350
        block.boundary_right = 1600
        block.change_x = 1
        block.player = self.player
        block.level = self
        self.platform_list.add(block)
    def __init__(self, player):
        """ Create level 1. """

        # Call the parent constructor
        Level.__init__(self, player)

        self.background = pygame.image.load("Space(level1).png").convert()
        self.background.set_colorkey(constants.BLACK)
        self.level_limit = -800
        
        level = [ [platforms.STONE_PLATFORM_MIDDLE, 70, 200],
                  [platforms.STONE_PLATFORM_MIDDLE, 200, 500],
                  [platforms.STONE_PLATFORM_MIDDLE, 470, 300],
                  [platforms.STONE_PLATFORM_MIDDLE, 1200, 600],
                  [platforms.STONE_PLATFORM_MIDDLE, 1270, 600],
                  [platforms.STONE_PLATFORM_MIDDLE, 1340, 600],
                  [platforms.EXIT_SIGN, 1410, 530],
                  [platforms.STONE_PLATFORM_MIDDLE, 1410, 600],
                  [platforms.STONE_PLATFORM_MIDDLE, 1480, 600],
                  [platforms.STONE_PLATFORM_MIDDLE, 1550, 600],
                  [platforms.STONE_PLATFORM_MIDDLE, 1620, 600],
                  [platforms.STONE_PLATFORM_MIDDLE, 1690, 600],
                  [platforms.STONE_PLATFORM_MIDDLE, 1740, 600],
                  [platforms.STONE_PLATFORM_MIDDLE, 1750, 560],
                  [platforms.STONE_PLATFORM_MIDDLE, 1750, 520],
                  [platforms.STONE_PLATFORM_MIDDLE, 1750, 480]
                  ]
        
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)
            
        block = platforms.MovingPlatform(platforms.STONE_PLATFORM_MIDDLE)
        block.rect.x = 290
        block.rect.y = 101
        block.boundary_top = 100
        block.boundary_bottom = 649
        block.change_y = -1
        block.player = self.player
        block.level = self
        self.platform_list.add(block)        
        
        block = platforms.MovingPlatform(platforms.STONE_PLATFORM_MIDDLE)
        block.rect.x = 550
        block.rect.y = 400
        block.boundary_left = 551
        block.boundary_right = 1100
        block.change_x = 1
        block.player = self.player
        block.level = self
        self.platform_list.add(block)      
Пример #14
0
    def __init__(self, player, screen):

        """

        :param player: Player object
        :param screen: Display window

        Creates skeleton boss level

        """

        Level.__init__(self, player, screen)

        level = [[platforms.SAND_GROUND, -1, 670],
                 [platforms.SAND_GROUND, 259, 670],
                 [platforms.SAND_GROUND, 519, 670],
                 [platforms.SAND_GROUND, 779, 670],

                 [platforms.SAND_GROUND, -1, -81],
                 [platforms.SAND_GROUND, 259, -81],
                 [platforms.SAND_GROUND, 519, -81],
                 [platforms.SAND_GROUND, 779, -81],

                 [platforms.SAND_BIG, -231, 29],
                 [platforms.SAND_BIG, constants.SCREEN_WIDTH -30, 29],


                 [platforms.SAND_FLOAT, 140, 400],
                 [platforms.SAND_FLOAT, 599, 400],
                 [platforms.SAND_FLOAT, 140, 120],
                 [platforms.SAND_FLOAT, 599, 120],
                 ]

        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)

        background = platforms.backgroundSand()
        background.rect.x = 0
        background.rect.y = 0
        self.decor.add(background)

        ske = Skeleton.Skeleton();
        ske.rect.x = 375
        ske.rect.y = 0
        ske.player = self.player
        ske.screen = screen
        ske.quick_sand = self.platform_quicksand
        self.attacks = ske.attacks
        ske.boss = self.behind_boss_man
        self.behind_boss_man.add(ske)
Пример #15
0
    def __init__(self, player, enemy):
 
        Level.__init__(self, player, enemy)
 
        self.background = pygame.image.load("images/castle.png").convert() #101,5,48,150
        self.background.set_colorkey(constants.WHITE)
        self.level_limit = -2500
 
        # Array com o tipo de plataforma e coordenadas (x,y) para localização
        level = [ [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-48, constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*2), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*3), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*4), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*5), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*6), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*7), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*8), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*9), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*10), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*11), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*12), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*13), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*14), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*15), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*16), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*17), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*18), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*19), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*20), constants.SCREEN_HEIGHT-12],
                  [platforms.STONE_PLATFORM_MIDDLE, constants.SCREEN_WIDTH-(48*21), constants.SCREEN_HEIGHT-12],
                  ]
 
 
        # Passa pelo array e adiciona plataformas
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            block.enemy = self.enemy
            self.platform_list.add(block)
 
        # Adiciona uma plataforma móvel
        block = platforms.MovingPlatform(platforms.STONE_PLATFORM_MIDDLE)
        block.rect.x = 1350
        block.rect.y = 280
        block.boundary_left = 1350
        block.boundary_right = 1600
        block.change_x = 1
        block.player = self.player
        block.enemy = self.enemy
        block.level = self
        self.platform_list.add(block)
Пример #16
0
    def __init__(self, player):
        """ Create level 1. """

        # Call the parent constructor
        Level.__init__(self, player)

        self.background = pygame.image.load("background_01.png").convert()
        self.background.set_colorkey(constants.WHITE)
        self.level_limit = -2500

        # Array with type of platform, and x, y location of the platform.
        level = [
            #Main platforms ingame
            [platforms.GRASS_LEFT, 500, 530],
            [platforms.GRASS_MIDDLE, 570, 530],
            [platforms.GRASS_RIGHT, 640, 530],
            [platforms.GRASS_LEFT, 800, 400],
            [platforms.GRASS_MIDDLE, 870, 400],
            [platforms.GRASS_MIDDLE, 940, 400],
            [platforms.GRASS_RIGHT, 1010, 400],
            [platforms.GRASS_LEFT, 1000, 530],
            [platforms.GRASS_MIDDLE, 1070, 530],
            [platforms.GRASS_RIGHT, 1140, 530],
            #[platforms.STONE_PLATFORM_LEFT, 1120, 280],
            #[platforms.STONE_PLATFORM_MIDDLE, 1190, 280],
            #[platforms.STONE_PLATFORM_RIGHT, 1260, 280],

            #Other ones i'm adding as a test

            #[platforms.GRASS_MIDDLE, 0, 550],
            #[platforms.GRASS_MIDDLE, 0, 400],
            #[platforms.STONE_PLATFORM_LEFT, 1800, 300],
            #[platforms.STONE_PLATFORM_MIDDLE, 1970, 300],
        ]

        # Go through the array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)

        # Add a custom moving platform
        block = platforms.MovingPlatform(platforms.STONE_PLATFORM_MIDDLE)
        block.rect.x = 1350
        block.rect.y = 280
        block.boundary_left = 1350
        block.boundary_right = 1600
        block.change_x = 10
        block.player = self.player
        block.level = self
        self.platform_list.add(block)
Пример #17
0
    def __init__(self, player):

        # Call the parent constructor
        Level.__init__(self, player)

        background_path = directory_info.base_directory + \
                "/images/green-hill-zone/result/background.png"
        self.background = pygame.image.load(background_path).convert()

        size = [constants.SCREEN_WIDTH + 3000, constants.SCREEN_HEIGHT]
        self.background = pygame.transform.scale(self.background, size)

        self.background.set_colorkey(constants.WHITE)
        self.level_limit = -2500

        # Array with type of platform, and x, y location of the platform.
        '''level = [ [platforms.GRASS_LEFT, 500, 500],
                  [platforms.GRASS_MIDDLE, 570, 500],
                  [platforms.GRASS_RIGHT, 640, 500],
                  [platforms.GRASS_LEFT, 800, 400],
                  [platforms.GRASS_MIDDLE, 870, 400],
                  [platforms.GRASS_RIGHT, 940, 400],
                  [platforms.GRASS_LEFT, 1000, 500],
                  [platforms.GRASS_MIDDLE, 1070, 500],
                  [platforms.GRASS_RIGHT, 1140, 500],
                  [platforms.STONE_PLATFORM_LEFT, 1120, 280],
                  [platforms.STONE_PLATFORM_MIDDLE, 1190, 280],
                  [platforms.STONE_PLATFORM_RIGHT, 1260, 280],
                  [platforms.FLOOR, 300, 520],
                  ]'''

        level = [[platforms.FLOOR_1, 200, 485, 15],
                 [platforms.FLOOR_1, 1000, 200, 1]]

        # Go through the array above and add platforms
        for platform in level:
            for i in range(0, platform[3]):
                block = platforms.Platform(platform[0])
                block.rect.x = platform[1] + 4.2 * i * block.x0
                block.rect.y = platform[2]
                block.player = self.player
                self.platform_list.add(block)

        # Add a custom moving platform
        block = platforms.MovingPlatform(platforms.FLOOR_1)
        block.rect.x = 1350
        block.rect.y = 340
        block.boundary_left = 1350
        block.boundary_right = 1600
        block.change_x = 1
        block.player = self.player
        block.level = self
        self.platform_list.add(block)
Пример #18
0
    def __init__(self, player):
        """ Create level 1. """

        # Call the parent constructor
        Level.__init__(self, player)

        self.background = pygame.image.load("background_04.png").convert()
        self.background.set_colorkey(constants.WHITE)
        self.level_limit = -9000
        counter = 500
        cookies =[]
        level = []
        for i in range(10):
            self.insert_up_down(counter,random.randrange(450,500))
            if (i % 2) == 0:
                cookies.append([self.random_treat(),counter,random.randrange(250,500)])
            counter += self.block_size * 2
        level += self.stone_platform(counter,self.low,2)
        counter += self.block_size * 4
        level += self.stone_platform(counter,self.medium,2)
        counter += self.block_size * 4
        level += self.stone_platform(counter,self.high,2)
        counter += self.block_size * 4

        prev = self.low
        for i in range(10):
            plat = self.random_platform(prev)
            prev = plat
            level += self.stone_platform(counter,plat,1)
            if (i % 2) == 0:
                cookies.append([self.random_treat(),counter,plat - 61])
            counter += self.gap
        
        for i in range(20):
            self.insert_up_down(counter,random.randrange(450,500))
            if (i % 2) == 0:
                cookies.append([self.random_treat(),counter,random.randrange(250,500)])
            counter += self.block_size * 2
        
        
        for cookieobj in cookies:
            block = cookie.Treat(cookieobj[0])
            block.rect.x = cookieobj[1]
            block.rect.y = cookieobj[2]
            block.player = self.player
            self.cookie_list.add(block)
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)
Пример #19
0
    def __init__(self, player):
        """ Create level 1. """

        # Call the parent constructor
        Level.__init__(self, player)

        self.background = pygame.image.load("background_02.png").convert()
        self.background.set_colorkey(constants.WHITE)
        self.level_limit = -1000

        # Array with type of platform, and x, y location of the platform.
        level = [ [platforms.STONE_PLATFORM_LEFT, 500, 550],
                  [platforms.STONE_PLATFORM_MIDDLE, 570, 550],
                  [platforms.STONE_PLATFORM_RIGHT, 640, 550],
                  [platforms.STONE_PLATFORM_LEFT, 1120, 280],
                  [platforms.STONE_PLATFORM_MIDDLE, 1190, 280],
                  [platforms.STONE_PLATFORM_MIDDLE, 1190, 350],
                  [platforms.STONE_PLATFORM_MIDDLE, 1190, 450],
                  [platforms.STONE_PLATFORM_MIDDLE, 1190, 550],
                  [platforms.STONE_PLATFORM_RIGHT, 1260, 280],
                  ]


        # Go through the array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)

        # Add a custom moving platform
        block = platforms.MovingPlatform(platforms.STONE_PLATFORM_MIDDLE)
        block.rect.x = 1500
        block.rect.y = 300
        block.boundary_top = 100
        block.boundary_bottom = 550
        block.change_y = -1
        block.player = self.player
        block.level = self
        self.platform_list.add(block)

                # Add a custom moving platform
        block = platforms.MovingPlatform(platforms.STONE_PLATFORM_MIDDLE)
        block.rect.x = 900
        block.rect.y = 300
        block.boundary_top = 100
        block.boundary_bottom = 550
        block.change_y = -1
        block.player = self.player
        block.level = self
        self.platform_list.add(block)
Пример #20
0
    def __init__(self, player):

        Level.__init__(self, player)
        self.level_limit = -1000

        level = [[platforms.FLOOR_TL, -75, 600],
                 [platforms.FLOOR_TM, 131, 600],
                 [platforms.FLOOR_ML, 340, 600],
                 [platforms.FLOOR_TL, 340, 437],
                 [platforms.FLOOR_BM, 548, 600],
                 [platforms.FLOOR_ML, 548, 437],
                 [platforms.FLOOR_TL, 548, 274],
                 [platforms.FLOOR_TR, 754, 274],
                 [platforms.FLOOR_BR, 754, 437],
                 [platforms.FLOOR_MR, 754, 600],
                 [platforms.FLOOR_TM, 962, 600],
                 [platforms.FLOOR_TR, 1170, 600],
                 [platforms.CLOUD_MOVE, 1000, 120],
                 [platforms.CLOUD_L, 1280, -10],
                 [platforms.CLOUD_M, 1400, -10],
                 [platforms.CLOUD_R, 1590, -10]
                 ]
                
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)
        
            """block = Platform(platform[0], platform[1])
            block.rect.x = platform[2]
            block.rect.y = platform[3]
            block.player = self.player
            self.platform_list.add(block)"""
            
        block = platforms.MovingPlat(platforms.CLOUD_MOVE)
        block.rect.x = 1800
        block.rect.y = -40
        block.bound_left = 1800
        block.bound_right = 2100
        block.change_x = 6
        block.player = self.player
        block.level = self
        self.platform_list.add(block)

        """bat1 = Bat(40,40)
        bat1.rect.x = 700
        bat1.rect.y = 400
        self.platform_list.add(bat1)"""
                
Пример #21
0
    def __init__(self, player):
        """ Create level 1. """

        # Call the parent constructor
        Level.__init__(self, player)

        self.background = pygame.image.load("mountains1_longer.png").convert()
        # self.background = pygame.image.load("background_01.png").convert()
        self.background.set_colorkey(constants.WHITE)
        self.level_limit = -2000

        # Array with type of platform, and x, y location of the platform.
        level = [
            [platforms.SNOW_LEFT, 500, 400],
            [platforms.SNOW_MIDDLE, 570, 400],
            [platforms.SNOW_RIGHT, 640, 400],

            [platforms.SNOW_LEFT, 800, 270],
            [platforms.SNOW_MIDDLE, 870, 270],
            [platforms.SNOW_RIGHT, 940, 270],

            # [platforms.SNOW_LEFT, 1000, 500],
            # [platforms.SNOW_MIDDLE, 1070, 500],
            # [platforms.SNOW_RIGHT, 1140, 500],

            [platforms.STONE_PLATFORM_LEFT, 1750, 270],
            [platforms.STONE_PLATFORM_MIDDLE, 1820, 270],
            # [platforms.STONE_PLATFORM_RIGHT, 1790, 450],
        ]


        # Go through the array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)

        # Add a custom moving platform
        block = platforms.MovingPlatform(platforms.STONE_PLATFORM_MIDDLE)
        block.rect.x = 1180
        block.rect.y = 280
        block.boundary_left = 1180
        block.boundary_right = 1600
        block.change_x = 3
        block.player = self.player
        block.level = self
        self.platform_list.add(block)
Пример #22
0
    def __init__(self, player):
        """ Create level 1. """

        # Call the parent constructor
        Level.__init__(self, player)

        self.background = pygame.image.load( \
                "images/old-textures/background_01.png").convert()

        #size = [constants.SCREEN_WIDTH, constants.SCREEN_HEIGHT]
        #self.background = pygame.transform.scale(self.background, size)

        self.background.set_colorkey(constants.WHITE)
        self.level_limit = -2500

        # Array with type of platform, and x, y location of the platform.
        level = [
            [platforms.GRASS_LEFT, 500, 500],
            [platforms.GRASS_MIDDLE, 570, 500],
            [platforms.GRASS_RIGHT, 640, 500],
            [platforms.GRASS_LEFT, 800, 400],
            [platforms.GRASS_MIDDLE, 870, 400],
            [platforms.GRASS_RIGHT, 940, 400],
            [platforms.GRASS_LEFT, 1000, 500],
            [platforms.GRASS_MIDDLE, 1070, 500],
            [platforms.GRASS_RIGHT, 1140, 500],
            [platforms.STONE_PLATFORM_LEFT, 1120, 280],
            [platforms.STONE_PLATFORM_MIDDLE, 1190, 280],
            [platforms.STONE_PLATFORM_RIGHT, 1260, 280],
        ]

        # Go through the array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)

        # Add a custom moving platform
        block = platforms.MovingPlatform(platforms.STONE_PLATFORM_MIDDLE)
        block.rect.x = 1350
        block.rect.y = 280
        block.boundary_left = 1350
        block.boundary_right = 1600
        block.change_x = 1
        block.player = self.player
        block.level = self
        self.platform_list.add(block)
Пример #23
0
    def __init__(self, player):
        """ Create level 1. """

        # Call the parent constructor
        Level.__init__(self, player)

        self.background = pygame.image.load("background_01.png").convert()
        self.background = pygame.transform.scale(self.background,
                                                 (3840, HEIGHT))
        self.background.set_colorkey(constants.WHITE)
        self.level_limit = -6200

        # Array with type of platform, and x, y location of the platform.
        level = [
            [platforms.GRASS, 570, 500 * 2],
            [platforms.GRASS, 870, 400 * 2],
            [platforms.GRASS, 1070, 500 * 2],
            [platforms.STONE_PLATFORM, 1190, 280 * 2],
        ]

        # Go through the array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)

        # Add a custom moving platform
        block = platforms.MovingPlatform(platforms.STONE_PLATFORM_MOVE)
        block.rect.x = 1350
        block.rect.y = int(280 * 1.64)
        block.boundary_left = 1350
        block.boundary_right = 1600
        block.change_x = 1
        block.player = self.player
        block.level = self
        self.platform_list.add(block)

        # Add a custom moving mob
        block = mobs.MovingMob(mobs.MOB1)
        block.rect.x = 1250
        block.rect.y = 530
        block.boundary_left = 1250
        block.boundary_right = 1500
        block.change_x = 1
        block.player = self.player
        block.level = self
        self.platform_list.add(block)
Пример #24
0
    def __init__(self, worms):
        self.platform_list = pygame.sprite.Group()
        self.worms = worms

        level = [[platforms.BIG_ISLAND_RIGHT, 630, 720 - 432],
                 [platforms.BIG_ISLAND_LEFT, 0, 720 - 529],
                 [platforms.SMALL_ISLAND, 988, 135]]

        # Go through the array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.players = self.worms
            self.platform_list.add(block)
Пример #25
0
    def __init__(self):
        super().__init__()
        self.background = pygame.image.load("colored_desert.png")

        level = [
            "/////////////////", "/e             /", "/              /",
            "/              /", "/              /", "/              /",
            "/              /", "/              /", "/              /",
            "/              /", "BBBBBBBBBBBBBBBB", "dddddddddddddddd"
        ]

        for y, row in enumerate(level):
            for x, item in enumerate(row):
                # ------------------------------------- Regular blocks
                if item == 'B':
                    block = platforms.Platform(
                        "sand", 1, 50)  # 100% no cactus fluffy sand
                    block.rect.x = 50 * x
                    block.rect.y = 50 * y
                    self.platformList.add(block)
                elif item == 'd':
                    block = platforms.Platform("sand", 16,
                                               50)  # Sand without fluffy sand
                    block.rect.x = 50 * x
                    block.rect.y = 50 * y
                    self.platformList.add(block)
                elif item == '/':
                    block = platforms.Platform("misc", 190,
                                               50)  # Invisible block
                    block.rect.x = 50 * x
                    block.rect.y = 50 * y
                    self.platformList.add(block)
                # -------------------------------------- Enemies
                elif item == 'e':
                    block = enemies.Pinchy()  # Boss
                    self.enemyList.add(block)
Пример #26
0
    def __init__(self, player):
        # Call the parent constructor
        Level.__init__(self, player)

        self.background = pygame.image.load("Images/background.png").convert()
        self.background.set_colorkey(globalvars.WHITE)

        Level = []

        # Go through the array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)
Пример #27
0
    def load_level(self):
        world_map = tmxreader.TileMapParser().parse_decode(
            f'levels/{self.level_now}.tmx')
        resources = helperspygame.ResourceLoaderPygame()
        resources.load(world_map)

        self.sprite_layers = helperspygame.get_layers_from_map(resources)

        platforms_layer = self.sprite_layers[0]
        spike_layer = self.sprite_layers[1]

        for row in range(0, platforms_layer.num_tiles_x):
            for col in range(0, platforms_layer.num_tiles_y):
                if platforms_layer.content2D[col][row] is not None:
                    p = platforms.Platform(row * 32, col * 32)
                    self.platforms_group.add(p)

                if spike_layer.content2D[col][row] is not None:
                    s = platforms.Spike(row * 32, col * 32)
                    self.spikes.add(s)
        exit_layer = self.sprite_layers[3]

        for exit in exit_layer.objects:
            try:
                x = exit.x
                y = exit.y
            except:
                pass
            else:
                self.exit = platforms.Exit(x, y)
                self.all_objects.add(self.exit)

        player_layer = self.sprite_layers[2]
        for pl in player_layer.objects:
            try:
                self.start_x = pl.x
                self.start_y = pl.y - 64
            except:
                pass
            else:
                self.player = player.Player(self.start_x, self.start_y)
                self.all_objects.add(self.player)

        self.total_x = platforms_layer.num_tiles_x * 32
        self.total_y = platforms_layer.num_tiles_y * 32
        self.camera = camera.Camera(self.camera_configure, self.total_x,
                                    self.total_y)
Пример #28
0
    def __init__(self, player):
        """ Create level 1. """

        # Call the parent constructor
        Level.__init__(self, player)

        self.background = pygame.image.load("img/background_01.png").convert()
        #self.background.set_colorkey(constants.WHITE)
        self.level_limit = -2500

        # Array with type of platform, and x, y location of the platform.
        level = [ [platforms.TRS_PLATFORM, 250, 500],
                  [platforms.TRS_PLATFORM, 250, 400],
                  [platforms.STD_PLATFORM, 500, 500],
                  [platforms.STD_PLATFORM, 570, 500],
                  [platforms.STD_PLATFORM, 640, 500],
                  [platforms.STD_PLATFORM, 800, 400],
                  [platforms.STD_PLATFORM, 870, 400],
                  [platforms.STD_PLATFORM, 940, 400],
                  [platforms.STD_PLATFORM, 1000, 500],
                  [platforms.STD_PLATFORM, 1070, 500],
                  [platforms.STD_PLATFORM, 1140, 500],
                  [platforms.STD_PLATFORM, 1120, 280],
                  [platforms.STD_PLATFORM, 1190, 280],
                  [platforms.STD_PLATFORM, 1260, 280],
                  ]


        # Go through the array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)

        # Add a custom moving platform
        block = platforms.MovingPlatform(platforms.STD_PLATFORM)
        block.rect.x = 1350
        block.rect.y = 280
        block.boundary_left = 1350
        block.boundary_right = 1600
        block.change_x = 1
        block.player = self.player
        block.level = self
        self.platform_list.add(block)
Пример #29
0
    def __init__(self, player):
        """ Create level 1. """

        # Call the parent constructor
        Level.__init__(self, player)

        self.background = pygame.image.load("background_1.png").convert()
        self.background.set_colorkey(constants.WHITE)
        self.level_limit = -2500

        # Array with type of platform, and x, y location of the platform.
        ## SHOULD REPLACE WITH STUFF OURSELVES
        level = [
            [platforms.GRASS_LEFT, 500, 500],
            [platforms.GRASS_MIDDLE, 570, 500],
            [platforms.GRASS_RIGHT, 640, 500],
            [platforms.GRASS_LEFT, 800, 400],
            [platforms.GRASS_MIDDLE, 870, 400],
            [platforms.GRASS_RIGHT, 940, 400],
            [platforms.GRASS_LEFT, 1000, 500],
            [platforms.GRASS_MIDDLE, 1070, 500],
            [platforms.GRASS_RIGHT, 1140, 500],
            [platforms.STONE_PLATFORM_LEFT, 1120, 280],
            [platforms.STONE_PLATFORM_MIDDLE, 1190, 280],
            [platforms.STONE_PLATFORM_RIGHT, 1260, 280],
        ]

        # Go through the array above and add platforms
        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            self.platform_list.add(block)

        # Add a custom moving platform
        block = platforms.MovingPlatform(platforms.STONE_PLATFORM_MIDDLE)
        block.rect.x = 1350
        block.rect.y = 280
        block.boundary_left = 1350
        block.boundary_right = 1600
        block.change_x = 1
        block.player = self.player
        block.level = self
        self.platform_list.add(block)
        '''setup_enemies(self)
Пример #30
0
    def __init__(self, player, buho, enemigo):

        # Call the parent constructor
        Level.__init__(self, player, buho, enemigo)

        self.background = pygame.image.load("background_01.png").convert()
        self.background.set_colorkey(constants.WHITE)
        self.level_limit = -2500

        # Aqui tenemos las plataformas del background
        level = [
            [platforms.GRASS_LEFT, 500, 500],
            [platforms.GRASS_MIDDLE, 570, 500],
            [platforms.GRASS_RIGHT, 640, 500],
            [platforms.GRASS_LEFT, 800, 400],
            [platforms.GRASS_MIDDLE, 870, 400],
            [platforms.GRASS_RIGHT, 940, 400],
            [platforms.GRASS_LEFT, 1000, 500],
            [platforms.GRASS_MIDDLE, 1070, 500],
            [platforms.GRASS_RIGHT, 1140, 500],
            [platforms.STONE_PLATFORM_LEFT, 1120, 280],
            [platforms.STONE_PLATFORM_MIDDLE, 1190, 280],
            [platforms.STONE_PLATFORM_RIGHT, 1260, 280],
        ]

        for platform in level:
            block = platforms.Platform(platform[0])
            block.rect.x = platform[1]
            block.rect.y = platform[2]
            block.player = self.player
            block.buho = self.buho
            block.enemigo = self.enemigo

            self.platform_list.add(block)

        # Se agrega el bloque pequeño que se mueve
        block = platforms.MovingPlatform(platforms.STONE_PLATFORM_MIDDLE)
        block.rect.x = 1350
        block.rect.y = 280
        block.boundary_left = 1350
        block.boundary_right = 1600
        block.change_x = 1
        block.player = self.player
        block.level = self
        self.platform_list.add(block)