示例#1
0
def add_enemies(game_board):
    '''normal enemies and boss enemy'''
    # here we loop and create the enemies objects using enemy list
    # and append created enemies to enemy_object_list
    for i in range(len(figures.ENEMY_LIST)):
        enem = people.Enemy(figures.ENEMY_LIST[i])
        ENEMY_OBJECT_LIST.append(enem)
    boss = people.EnemyBoss(POS_BOS, game_board)
    BOSS_ENEMY.append(boss)
示例#2
0
def generate_enemies():
    x = int(config.columns * 2 / 3)
    while x < (global_var.scenery.scene_length - 2 * config.columns):
        if x >= 500:
            offset = random.randint(10, 40)
        else:
            offset = random.randint(10, config.columns - 5)
        global_var.enemy_list.append(people.Enemy(x + offset, 1))
        direction = random.randint(0, 1)
        if direction:
            global_var.enemy_dir.append('right')
        else:
            global_var.enemy_dir.append('left')
        x += offset
        global_var.enemy_list[-1].render()
    for j in range(config.rows):
        for i in range(len(global_var.enemy_list)):
            global_var.enemy_list[i].gravity()
示例#3
0
def spawn(typ, total, board):
    '''# this attaches the enemies at random locations'''
    for _ in range(total):
        x, y = (1, 1)
        if typ == config._enemy:
            e = people.Enemy(x, y)
        elif typ == config._bricks:
            e = objects.Bricks(x, y)
        else:
            return False
        run_count = 0
        while True:
            new_x, new_y = random.choice(board.init_points)
            if e.update_location(board, new_x, new_y, True):
                break
            run_count += 1
        board.add_storage(e)

    return True
示例#4
0
def spawn_enemy():
    pos = np.arange(55, 399, 50)
    for i in pos:
        enemy = people.Enemy(35, i)
        people.Enemy.enemies.append(enemy)