예제 #1
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

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

    global balls
    balls = [Ball() for i in range(10)]
    game_world.add_objects(balls, 1)
예제 #2
0
파일: main_state.py 프로젝트: alfj23/2DGP
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

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

    global balls
    balls = [Ball() for i in range(10)] + [BigBall() for i in range(10)] # 리스트 컴프리헨션
    game_world.add_objects(balls, 1)  # 게임월드에 집어넣음 add_objects() 함수가 추가됨 리스트에 있는 객체를 모두 게임월드에 집어넣음
예제 #3
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

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

    global bricks
    bricks = [Brick(300 + 300 * i, 100 + 50 * i) for i in range(5)]
    game_world.add_objects(bricks, 1)
예제 #4
0
def enter():
    global hit_sound
    game_framework.player.stage_init()
    game_world.add_object(Map('map1.txt'), 0)
    hit_sound = load_wav('sound_resources\\hit sound.ogg')
    hit_sound.set_volume(40)
    for i in range(10):
        if random.randint(0, 100) < 50:
            monsters.append(Golem())
        else:
            monsters.append(Ghost())
    game_world.add_objects(monsters, 1)
    pass
예제 #5
0
def enter():
    global rect
    rect = Rect()
    game_world.add_object(rect, 1)

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

    global crying_boss
    crying_boss = CryingBoss()
    game_world.add_object(crying_boss, 0)

    global long_tears
    long_tears = [LongTear() for i in range(1)]
    game_world.add_objects(long_tears, 0)

    global short_tears
    short_tears = [ShortTear() for j in range(1)]
    game_world.add_objects(short_tears, 0)

    global cogwheels
    cogwheels = [Cogwheel() for k in range(10)]
    game_world.add_objects(cogwheels, 0)

    global circles
    circles = [CircleEnemy() for w in range(15)]
    game_world.add_objects(circles, 0)
예제 #6
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)
예제 #7
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

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

    # fill here for balls
    global balls
    #balls = [Ball() for i in range(10)]
    balls = [Ball() for i in range(10)] + [BigBall() for i in range(10)]
    game_world.add_objects(balls, 1)
예제 #8
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

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

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

    brick.image = load_image('brick180x40.png')
예제 #9
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global zombie
    zombie = Zombie()
    game_world.add_object(zombie, 1)

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

    ground = Ground()
    game_world.add_object(ground, 0)
예제 #10
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)
예제 #11
0
def enter():
    global ground
    ground = Ground(0)
    game_world.add_object(ground, 0)

    global eru
    eru = Eru()
    game_world.add_object(eru, 1)

    global bullets
    game_world.add_objects(bullets, 1)

    global dragons
    dragons = [Dragon(i, eru.stage_level) for i in range(5)]
    game_world.add_objects(dragons, 1)
예제 #12
0
def enter():
    global background
    background = BackGround()
    game_world.add_object(background, 0)

    global hit_back_ground
    hit_back_ground = HitBackGround()
    game_world.add_object(hit_back_ground, 0)

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

    global monster_sans
    monster_sans = Sans()
    game_world.add_object(monster_sans, 1)
예제 #13
0
 def update(self):
     self.y -= self.velocity
     self.x = clamp(50, self.x, 800 - 50)
     self.y = clamp(30, self.y, 600 - 50)
     if self.y < 50 or self.y > 600 - 25:
         final_stage_state.boss_bullet_count += 1
         game_world.remove_object(self)
         final_stage_state.boss_bullet.remove(self)
         if final_stage_state.boss_bullet_count == 20:
             if final_stage_state.final_boss.hp > 0:
                 final_stage_state.boss_bullet.clear()
                 final_stage_state.boss_bullet = [
                     Boss_bullet(i) for i in range(20)
                 ]
                 game_world.add_objects(final_stage_state.boss_bullet, 1)
                 final_stage_state.boss_bullet_count = 0
def enter():
    global isaac, background, is_key_pressed, is_attack_key_pressing, bullet_dir, gushers, is_bullet_create
    global BackGround_Width, BackGround_Height, invincibility_time, shot_term, bullets, door, indoor, monster_count
    global flies, big_flies, enemy_bullets, is_enemy_bullet_create, needles, rocks

    game_world.objects = [[], []]
    BackGround_Width = 1280
    BackGround_Height = 960
    isaac = Isaac()
    isaac.x = 200
    isaac.y = BackGround_Height // 2
    isaac.body_x, isaac.body_y = isaac.x - 5, isaac.y - 50
    isaac.velocity_x = main_state.isaac.velocity_x
    isaac.velocity_y = main_state.isaac.velocity_y
    isaac.now_health = main_state.hp
    isaac.body_is_move = False
    monster_count = 12
    background = BackGround()
    needles = [
        Needle(400, 500),
        Needle(300, 700),
        Needle(600, 200),
        Needle(900, 700),
        Needle(750, 400)
    ]
    rocks = [Rock(850, 400), Rock(1000, 600), Rock(400, 300), Rock(600, 600)]
    door = Door()
    door.x = door_position[1]
    entrance_door = Door()
    entrance_door.x = door_position[0]
    indoor = InDoor()
    indoor.x = door_position[1]
    entrance_indoor = InDoor()
    entrance_indoor.x = door_position[0]
    flies = [Fly() for i in range(7)]
    big_flies = [BigFly() for i in range(5)]
    game_world.add_object(background, 0)
    game_world.add_objects(needles, 0)
    game_world.add_objects(rocks, 0)
    game_world.add_object(indoor, 1)
    game_world.add_object(door, 1)
    game_world.add_object(isaac, 1)
    game_world.add_object(entrance_door, 1)
    game_world.add_object(entrance_indoor, 1)
    game_world.add_objects(flies, 1)
    game_world.add_objects(big_flies, 1)
    is_key_pressed = 0
    is_attack_key_pressing = 0
    bullet_dir = 0
    is_bullet_create = False
    is_enemy_bullet_create = False
    invincibility_time = 100
    shot_term = 0

    bullets = []
    enemy_bullets = []
    pass
예제 #15
0
def update():
    global Monster_Spawn_time, grass

    if grass.castle_hp <= 0:
        game_world.clear()
        game_framework.change_state(pause_state)

    Monster_Spawn_time += game_framework.frame_time
    if Monster_Spawn_time >= 2:
        global monsters, SlimeHp
        SlimeHp += 5
        clamp(0, SlimeHp, 1000)
        monsters = [
            Slime(
                SlimeHp, random.randint(0, 3), grass,
                random.randint(int(SlimeHp / 10), clamp(0, int(SlimeHp), 130)))
            for i in range(int(SlimeHp / 10))
        ]
        game_world.add_objects(monsters, 3)
        Monster_Spawn_time = 0
        print(int(SlimeHp / 10))

    for game_object in game_world.all_objects():
        game_object.update()

    bullets = game_world.Return_layer2_obj()
    monster_corps = game_world.Return_layer3_obj()

    if len(bullets) != 0:
        global score
        for monster in monster_corps:
            for bullet in bullets:
                if collide(bullet, monster):
                    for monster in monster_corps:
                        if In_Collide_Range(bullet, monster):
                            monster.In_Collide_Range = True
                            if bullet.data == 'arrow' or bullet.data == 'sector_form_arrow':
                                bullet.data = 'arrow'
                            elif bullet.data == 'fire_arrow' or bullet.data == 'sector_form_fire_arrow':
                                bullet.data = 'fire_arrow'
                            elif bullet.data == 'ice_arrow' or bullet.data == 'sector_form_ice_arrow':
                                bullet.data = 'ice_arrow'
                            monster.Attacked(bullet.data, bullet.move_x,
                                             bullet.move_y)
                            score.total_Score += 1
                            bullet.explosion = True
예제 #16
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)
예제 #17
0
def enter():
    global background, score_title, player_life, plane, my_bullet, final_boss, boss_bullet, my_bullet, boss_hp_bar, death_plane_final_boss
    background = Background()
    score_title = Score_title()
    player_life = Player_life()
    plane = Plane()
    final_boss = Boss_enemy()
    boss_hp_bar = Boss_hp_bar()
    my_bullet = bullet_list
    boss_bullet = [Boss_bullet(i) for i in range(20)]
    game_world.add_object(background, 0)
    game_world.add_object(score_title, 1)
    game_world.add_object(player_life, 1)
    game_world.add_object(boss_hp_bar, 1)
    game_world.add_object(plane, 1)
    game_world.add_object(final_boss, 1)
    game_world.add_objects(boss_bullet, 1)
예제 #18
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

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

    #global bird
    #Birds = [Bird() for i in range(5)]
    #for bird in Birds:
    #    bird = Bird()
    #    game_world.add_object(bird,2)

    global balls
    balls=[Ball() for i in range(10)]+[BigBall() for i in range(10)]
    game_world.add_objects(balls,1)
예제 #19
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)
예제 #20
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)
예제 #21
0
def enter():
    global boy
    boy = Boy()
    game_world.add_object(boy, 1)

    global zombie
    zombie = Zombie()
    game_world.add_object(zombie, 1)

    global ball
    for i in range(5):
        ball.append(BigBall())
    for i in range(5):
        ball.append(SmallBall())

    game_world.add_objects(ball, 1)

    ground = Ground()
    game_world.add_object(ground, 0)
예제 #22
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);
예제 #23
0
def enter():
    global stage2_map, ingame_word, screen_timer, screen_timer_2, cursor, gameover_timer, bgm
    global bazzi, block, enemy
    global block_y, block_x

    screen_timer = 0
    screen_timer_2 = 0

    stage2_map = load_image('resource/stage2.png')
    ingame_word = load_image('resource/InGame_Image_Word.png')
    cursor = load_image('resource/hand_arrow.png')
    bgm = load_music('sound/piratebgm.mp3')
    bgm.set_volume(80)
    bgm.repeat_play()

    bazzi = Bazzi()
    bazzi.stage = 3
    bazzi.x, bazzi.y = 180, 140
    game_world.add_object(bazzi, 3)

    enemy = Boss()
    game_world.add_object(enemy, 2)

    block = []
    for i in range(195):
        if block_x > 610:
            block_y -= 40
            block_x = 39
        # no broken1
        if i == 82:
            box_color = 4
            box_broken = 1
        # no broken2
        elif i == 16 or i == 28 or i == 166 or i == 178:
            box_color = 5
            box_broken = 1
        else:
            box_color = 0
            box_broken = 0
        block.append(Block(block_x, block_y, box_color, box_broken))
        block_x += 40.2
    game_world.add_objects(block, 0)
    pass
def enter():
    global character, background, tiles, triangle_obstacles, finish_timer
    background = background_class.BACKGROUND()
    background.stage = 1
    triangle_obstacles = []
    tiles = []
    character = character_class.CHARACTER()
    character.GOAL_POINT = 7190
    global camera_moving_degree_x, stop, game_speed, map_stop
    game_speed = 350.0
    camera_moving_degree_x = 0
    map_stop = False
    ReadPos()
    character.tiles, character.obstacles = tiles, triangle_obstacles
    stop = 0
    game_world.add_object(background, 0)
    game_world.add_object(character, 1)
    game_world.add_objects(tiles, 1)
    game_world.add_objects(triangle_obstacles, 1)
    finish_timer = 0.5
예제 #25
0
def enter():
    global rect
    rect = Rect()
    game_world.add_object(rect, 1)

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

    global beat_up
    beat_up = BeatAttack_UP()
    game_world.add_object(beat_up, 1)

    global beat_down
    beat_down = BeatAttack_Down()
    game_world.add_object(beat_down, 1)

    global smallest_enemies, SmallestEnemy
    smallest_enemies = [SmallestEnemy() for i in range(15)]
    game_world.add_objects(smallest_enemies, 0)

    global small_enemies, SmallEnemy
    small_enemies = [SmallEnemy() for j in range(10)]
    game_world.add_objects(small_enemies, 0)

    global bouncing_enemies
    bouncing_enemies = [BouncingEnemy() for k in range(5)]
    game_world.add_objects(bouncing_enemies, 0)
예제 #26
0
def enter():
    global slime
    slime = Slime()
    game_world.add_object(slime, 1)

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

    global blocks
    blocks = [BLOCK() for i in range(100)]
    for i in range(8):
        blocks[i].pos(check[i])
    game_world.add_objects(blocks, 1)

    global g_blocks
    g_blocks = [G_BLOCK() for i in range(100)]
    for i in range(5):
        g_blocks[i].pos(check2[i])
    game_world.add_objects(g_blocks, 1)

    global b_blocks
    b_blocks = [B_BLOCK() for i in range(100)]
    for i in range(5):
        b_blocks[i].pos(check3[i])
    game_world.add_objects(b_blocks, 1)

    global background
    background = Background()
    game_world.add_object(background, 0)
예제 #27
0
def enter():
    global rect
    rect = Rect()
    game_world.add_object(rect, 1)

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

    global moving_boss
    moving_boss = MovingBoss()
    game_world.add_object(moving_boss, 0)

    global up_down_wall
    up_down_wall = UpDownWall()
    game_world.add_object(up_down_wall, 1)

    global left_right_wall
    left_right_wall = LeftRightWall()
    game_world.add_object(left_right_wall, 1)

    global bouncing_enemies
    bouncing_enemies = [BouncingEnemy() for k in range(5)]
    game_world.add_objects(bouncing_enemies, 0)

    global circles
    circles = [CircleEnemy() for w in range(7)]
    game_world.add_objects(circles, 0)

    global smallest_enemies
    smallest_enemies = [SmallestEnemy() for i in range(15)]
    game_world.add_objects(smallest_enemies, 0)
예제 #28
0
def enter():
    global background
    background = Background()
    game_world.add_object(background, 0)

    global rect
    rect = Rect()
    game_world.add_object(rect, 1)

    global boss_face
    boss_face = BossFace()
    game_world.add_object(boss_face, 0)

    global smallest_enemies, SmallestEnemy
    smallest_enemies = [SmallestEnemy() for i in range(25)]
    game_world.add_objects(smallest_enemies, 0)

    global small_enemies, SmallEnemy
    small_enemies = [SmallEnemy() for j in range(10)]
    game_world.add_objects(small_enemies, 0)

    pass
예제 #29
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)
예제 #30
0
def update():
    global dragons, boss, record, fire_timer, fireball

    if fire_timer >= 800 - eru.stage_level * 100:
        fireball = FireBall()
        game_world.add_object(fireball, 1)
        fire_timer = 0

    else:
        fire_timer += 1

    if len(dragons) <= 0 and eru.stage_level < 4:
        dragons = [Dragon(i, eru.stage_level) for i in range(5)]
        game_world.add_objects(dragons, 1)

    if eru.stage_level == 4 and boss is None:
        boss = Boss()
        game_world.add_object(boss, 1)

    if eru.remain_hp <= 0:
        record = eru.distance
        eru.death_sound.play(1)
        game_framework.change_state(ranking_state)

    if boss is not None and boss.hp <= 0:
        boss.ending_timer += 1

        if boss.ending_timer == 1:
            boss.win_sound.play(1)

    if boss is not None and boss.ending_timer >= 500:
        boss = None
        record = eru.distance
        game_framework.change_state(ranking_state)

    for game_object in game_world.all_objects():
        game_object.update()