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)
def create_world(): global boy, background boy = Boy() background = Background() background.set_center_object(boy) boy.set_background(background)
def create_world(): global boy, background,ui ui = UI.UI() boy = Boy() background = Background() background.set_center_object(boy) boy.set_background(background)
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)
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에 백그라운드를 알려줌
def __init__(self): if Ball.image == None: Ball.image = load_image('ball21x21.png') self.x, self.y, self.fall_speed = random.randint( 0, Background.get_instance().w - 1), random.randint( 0, Background.get_instance().h - 1), 0 self.bg = None self.canvas_width = get_canvas_width() self.canvas_height = get_canvas_height()
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)
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)
def create_world(): global character,background,enemy,bullet character = Character() background = Background() enemy = Enemy() bullet= [] background.set_center_object(character) character.set_background(background)
def enter(): gfw.world.init(['bg', 'enemy', 'player']) center = get_canvas_width() // 2, get_canvas_height() // 2 bg = FixedBackground('space.png') gfw.world.add(gfw.layer.bg, bg) global player player = Player() player.pos = bg.center player.bg = bg bg.target = player gfw.world.add(gfw.layer.player, player)
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)
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)
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)
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)
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)
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)
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)
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)
def enter(): gfw.world.init([ 'bg', 'player', 'hud', 'bullet', 'bullet1', 'bullet2', 'bullet3', 'bullet4', 'bullet5' ]) bg = FixedBackground('e1m1_over.png') gfw.world.add(gfw.layer.bg, bg) global player player = Player() global hud hud = Hud() player.pos = bg.center player.bg = bg bg.target = player gfw.world.add(gfw.layer.player, player) gfw.world.add(gfw.layer.hud, hud)
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);
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)
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)
def enter(): gfw.world.init(['bg_base', 'bg_back', 'bg_platform', 'platform', 'enemy', 'hornet', 'needle', 'knight', 'slash', 'bg_front', 'ui']) bg_base = FixedBackground('res/map/base.png') gfw.world.add(gfw.layer.bg_base, bg_base) bg_back = FixedBackground('res/map/back.png') gfw.world.add(gfw.layer.bg_back, bg_back) bg_platform = FixedBackground('res/map/platform.png') gfw.world.add(gfw.layer.bg_platform, bg_platform) bg_front = FixedBackground('res/map/front.png') gfw.world.add(gfw.layer.bg_front, bg_front) global platform platform = Platform('res/map/platform.json') for r in platform.rects: r.bg = bg_platform gfw.world.add(gfw.layer.platform, r) crawlid = Crawlid() crawlid.bg = bg_platform gfw.world.add(gfw.layer.enemy, crawlid) global knight knight = Knight() knight.bg = bg_platform bg_back.target = knight bg_platform.target_bg = bg_back bg_front.target_bg = bg_back bg_back.update() bg_platform.update() bg_front.update() gfw.world.add(gfw.layer.knight, knight) global frame frame = Frame(knight) gfw.world.add(gfw.layer.ui, frame) global hornet hornet = Hornet() hornet.bg = bg_platform hornet.target = knight gfw.world.add(gfw.layer.hornet, hornet) global bgm, opening_sting, enemy_damaged bgm = gfw.sound.load_m('res/Sound/cave_wind_loop.mp3') opening_sting = gfw.sound.load_w('res/Sound/S75 Opening Sting-08.wav') enemy_damaged = gfw.sound.load_w('res/Sound/enemy_damage.wav') opening_sting.set_volume(50) bgm.repeat_play() opening_sting.play()
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()
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()