コード例 #1
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    global balls
    balls = [Ball() for i in range(10)]
    game_world.add_objects(balls, 1)

    background.set_center_object(boy)
    boy.set_background(background)
    balls[0].set_background(background)
    balls[1].set_background(background)
    balls[2].set_background(background)
    balls[3].set_background(background)
    balls[4].set_background(background)
    balls[5].set_background(background)
    balls[6].set_background(background)
    balls[7].set_background(background)
    balls[8].set_background(background)
    balls[9].set_background(background)
コード例 #2
0
ファイル: scroll_state.py プロジェクト: SuniAnice/2DGP
def create_world():
    global boy, background
    boy = Boy()
    background = Background()

    background.set_center_object(boy)
    boy.set_background(background)
コード例 #3
0
def create_world():
    global boy, background,ui
    ui = UI.UI()
    boy = Boy()
    background = Background()
    background.set_center_object(boy)
    boy.set_background(background)
コード例 #4
0
ファイル: scroll_state.py プロジェクト: wonsub/2d_pg
def create_world():
    global hero, background, bgm
    hero = Hero()
    background = Background()

    bgm = load_music('bgm.ogg')
    bgm.set_volume(1)
    bgm.repeat_play()

    background.set_center_object(hero)
    hero.set_background(background)
コード例 #5
0
ファイル: main_state.py プロジェクト: ljs5261/2DGP
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    background.set_center_object(boy)  # 백그라운드에 boy를 알려줌
    boy.set_background(background)  # boy에 백그라운드를 알려줌
コード例 #6
0
def create_world():
    global boy, background, balls
    boy = Boy()
    background = Background()
    balls = [Ball() for i in range(100)]

    background.set_center_object(boy)
    boy.set_background(background)

    for ball in balls:
        ball.set_background(background)
コード例 #7
0
ファイル: scroll_state.py プロジェクト: kosongji/PROGRAMMING
def create_world():
    global character,background,enemy,bullet
   
    character = Character()
    background = Background()
    enemy = Enemy()
    bullet= []
  

    background.set_center_object(character)
    character.set_background(background)
コード例 #8
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    background.set_center_object(boy)
    boy.set_background(background)
コード例 #9
0
def create_world():
    global boy, background, button, button2
    boy = Boy()
    button = ui.Button('시작버튼.png', '종료버튼.png', 200, 300)
    button.onClick = onBtnInsta
    button.text = "OK"
    button2 = ui.Button('종료버튼.png', '시작버튼.png', 600, 300)
    button2.onClick = onBtnTwt
    button2.text = "CANCEL"
    background = Background()

    background.set_center_object(boy)
    boy.set_background(background)
コード例 #10
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global back
    back = FixedBackground()
    back.set_center_object(boy)
    boy.set_background(back)
    game_world.add_object(back, 0)

    global balls
    balls = [Ball(back) for i in range(100)]
    game_world.add_objects(balls, 1)
コード例 #11
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    background.set_center_object(boy)
    boy.set_background(background)

    global balls
    balls = [Ball() for i in range(100)]
    game_world.add_objects(balls, 1)
コード例 #12
0
ファイル: main_state.py プロジェクト: kimduuukbae/2DGP
def enter():
    global boy, ball_list
    ball_list = [BigBall() for i in range(100)]

    boy = Boy()
    game_world.add_object(boy, 1)
    for i in ball_list:
        game_world.add_object(i, 1)
    global background
    background = Background()
    game_world.add_object(background, 0)

    background.set_center_object(boy)
    boy.set_background(background)
    ball_list[0].set_background(background)
コード例 #13
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    for i in range(100):
        ball = Ball()
        game_world.add_object(ball, 1)
        ball.set_center_object(boy)

    background.set_center_object(boy)
    boy.set_background(background)
コード例 #14
0
ファイル: main_state.py プロジェクト: minlinea/2DGP
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    global balls
    balls = [Ball() for i in range(ball_num)]
    game_world.add_objects(balls, 1)

    background.set_center_object(boy)  #상호참조
    boy.set_background(background)
    for i in range(ball_num):
        balls[i].set_background(background)
コード例 #15
0
ファイル: main_state.py プロジェクト: ljs5261/2DGP
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    global balls
    balls = [FixedBall() for i in range(100)]
    game_world.add_objects(balls, 1)

    background.set_center_object(boy)  # 백그라운드에 boy를 알려줌
    boy.set_background(background)  # boy에 백그라운드를 알려줌

    for ball in balls:
        ball.set_background(background)
コード例 #16
0
def enter():
    global Sound2
    Sound2 = load_wav('pickup.wav')
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    global ba
    ba = [Ball() for i in range(100)]

    game_world.add_objects(ba, 1)

    background.set_center_object(boy)
    boy.set_background(background)
コード例 #17
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    global balls;
    balls = [Ball() for i in range(0, 100)];
    game_world.add_objects(balls, 1)

    for ball in balls:
        ball.set_background(background);

    # fill here
    background.set_center_object(boy);
    boy.set_background(background);
コード例 #18
0
def enter():

    # global grass
    # grass = Grass()
    #  #game_world.add_object(grass, 0)

    global background
    background = Background()
    game_world.add_object(background, 0)

    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global balls
    balls = [Ball() for i in range(100)]
    for ball in balls:
        ball.set_background(background)
    game_world.add_objects(balls, 1)

    # fill here
    background.set_center_object(boy)
    boy.set_background(background)
コード例 #19
0
ファイル: main_state.py プロジェクト: ryng-un-kim/2DGP
def enter():

    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)

    global balls
    balls = [Ball() for i in range(100)]
    game_world.add_objects(balls, 0)

    #  global ball
    # ball = Ball()
    # game_world.add_object(ball, 0)
    # fill here

    background.set_center_object(boy)
    # background.set_center_object(ball)
    boy.set_background(background)
    for ball in balls:
        ball.set_background(background)
コード例 #20
0
def enter():

    global background
    background = Background()
    game_world.add_object(background, 0)

    global items

    with open('./data/item_data.json', 'r') as f:
        item_data_list = json.load(f)
    for data in item_data_list:
        item = Item(data['x'], data['y'], data['type'])
        game_world.add_object(item, 1)

    global penguin
    penguin = Penguin()
    game_world.add_object(penguin, 1)

    with open('./data/human_data.json', 'r') as f:
        human_data_list = json.load(f)
    for data in human_data_list:
        human = Human(data['x'], data['y'], data['type'])
        game_world.add_object(human, 1)

    global walls
    # column
    walls = [Wall((i + 1) * 200, 0, (i + 1) * 200, 150) for i in range(7)]
    walls += [Wall((i + 1) * 200, 300, (i + 1) * 200, 450) for i in range(5)]
    walls += [Wall((i + 1) * 200, 750, (i + 1) * 200, 900) for i in range(5)]
    walls += [Wall((i + 1) * 200, 1050, (i + 1) * 200, 1200) for i in range(7)]
    walls += [Wall(0, 0, 0, 1200), Wall(1600, 0, 1600, 1200)]

    # row
    walls += [
        Wall(0, i * 150, 1600, i * 150) for i in range(9) if i == 0 or i == 8
    ]
    walls += [
        Wall(0, i * 150, 1200, i * 150) for i in range(9) if i == 3 or i == 5
    ]
    walls += [
        Wall(1400, i * 150, 1600, i * 150) for i in range(9)
        if i == 3 or i == 5
    ]

    # inter wall
    walls += [Wall(-100 + 400 * i, 150, 100 + 400 * i, 150) for i in range(5)]
    walls += [
        Wall(-100 + 400 * i, 300, 100 + 400 * i, 300) for i in range(5)
        if not i == 3
    ]
    walls += [Wall(-100 + 400 * 3, 300, 100 + 400 * 3 - 100, 300)]
    walls += [
        Wall(-100 + 400 * i, 900, 100 + 400 * i, 900) for i in range(5)
        if not i == 3
    ]
    walls += [Wall(-100 + 400 * 3, 900, 100 + 400 * 3 - 100, 900)]
    walls += [
        Wall(-100 + 400 * i, 1050, 100 + 400 * i, 1050) for i in range(5)
    ]

    # inter & main Door
    walls += [Wall(1200, 300, 1200, 500), Wall(1200, 700, 1200, 900)]
    walls += [Wall(1400, 300, 1400, 500), Wall(1400, 600, 1400, 900)]
    walls += [Wall(1200, 500, 1200, 700, True)]
    game_world.add_objects(walls, 0)

    global map
    map = Map()
    game_world.add_object(map, 1)

    background.set_center_object(penguin)
    penguin.set_background(background)

    global bgm
    bgm = load_wav('./sound/main_state.wav')
    bgm.set_volume(64)
    bgm.repeat_play()
コード例 #21
0
def enter():
    global stone_damage, water_items, pause_button, support_button, max_hp, player_exp, main_music, mouse_right_click_image, build_bar, ui, \
        cave_door, light, bonfire, darkness, material_woods, material_stones,  player_fear, player_water, \
        player_food, player_temperature, player, background, \
        mousecursor, items, skeletons, start_timer, player_health, map, renew_hp, food_gauge, water_gauge, fear_gauge, temp_gauge
    light = None
    player = Player((VIEW_WIDTH / 2), (VIEW_HEIGHT / 2))
    player_health = PlayerHealth(player.hp)
    player_fear = Fear(player_health.x, player_health.y)
    player_temperature = Temperature(player_health.x, player_health.y)
    player_food = Food(player_health.x, player_health.y)
    player_water = Water(player_health.x, player_health.y)
    player_exp = Exp(player_health.x, player_health.y)
    mousecursor = MouseCursor(100, 100)
    material_stones = [MaterialStone() for i in range(1, random.randint(2, 4))]
    material_woods = [MaterialWood() for i in range(0, random.randint(0, 2))]
    skeletons = [Skeleton(0, 0.1 * 100, 0.01 * 100) for i in range(1, random.randint(3, 5))]
    if loading_state.day_count > 10:
        skeletons = [Skeleton(0, 0.1 * 100, 0.01 * 100) for i in range(1, 8 + 1)]
    with open('skeleton_data_list.pickle', 'rb') as f:
        skeleton_data_list = pickle.load(f)
    for i in range(1, 20+1):
        if loading_state.day_count == i:
            for skeleton in skeletons:
                skeleton.__dict__.update(skeleton_data_list[i])
        if loading_state.day_count > 20:
            for skeleton in skeletons:
                skeleton.__dict__.update(skeleton_data_list[20])
        elif loading_state.day_count > 30:
            for skeleton in skeletons:
                skeleton.__dict__.update(skeleton_data_list[21])

    items = [Item() for i in range(random.randint(1, 5))]
    water_items = [WaterItem() for i in range(random.randint(1, 3))]

    background = Background()
    map = Map()
    darkness = Darkness()
    cave_door = CaveDoor(background.w - 50, random.randint(210, background.h - 50))
    ui = UI()
    mouse_right_click_image = MouseClickImage(903, 46)
    pause_button = PauseImage(970, 710)
    support_button = SupportImage(970, 650)
    stone_damage = StoneDamage(55, 145)



    game_world.add_object(stone_damage, 4)
    game_world.add_object(pause_button, 4)
    game_world.add_object(support_button, 4)
    game_world.add_object(cave_door, 1)
    game_world.add_object(mouse_right_click_image, 4)
    game_world.add_object(ui, 4)
    game_world.add_objects(material_woods, 1)
    game_world.add_objects(material_stones, 1)
    game_world.add_object(mousecursor, 4)
    game_world.add_objects(items, 1)
    game_world.add_objects(water_items, 1)
    game_world.add_object(player, 1)
    game_world.add_objects(skeletons, 1)
    game_world.add_object(player_health, 3)
    game_world.add_object(player_fear, 3)
    game_world.add_object(player_water, 3)
    game_world.add_object(player_food, 3)
    game_world.add_object(player_exp, 3)
    game_world.add_object(player_temperature, 3)
    game_world.add_object(background, 0)
    game_world.add_object(map, 2)
    game_world.add_object(darkness, 2)

    darkness.set_background(background)
    player_fear.set_background(background)
    player.set_background(background)
    background.set_center_object(player)
    player_fear.set_position(player)
    cave_door.set_background(background)


    for material_stone in material_stones:
        material_stone.set_background(background)
    for material_wood in material_woods:
        material_wood.set_background(background)
    for skeleton in skeletons:
        skeleton.set_background(background)
    for item in items:
        item.set_background(background)
    for water_item in water_items:
        water_item.set_background(background)

    main_music = load_music('resource\main_music.mp3')
    main_music.set_volume(100)
    main_music.repeat_play()