Пример #1
0
def update():
    global player, stage_num, bgm
    x, y = player.pos

    gfw.world.update()

    if x > get_canvas_width():
        x = 14
        player.pos = x, y
        stage_num += 1
        stage_gen.remove()
        bgm = music.mp3(resSE('stage_%d.mp3' % stage_num), True)
        stage_gen.load(resBM('../stage_%d.txt' % stage_num), True)

        if stage_num == 3:
            bgm.set_volume(128)
        else:
            bgm.set_volume(64)

    if player.saved:
        save()
        player.saved = False

    if y < -10:
        bgm.stop()
        gfw.change(end)

    stage_gen.update()
Пример #2
0
def update():
    global victory_time, victory, play_bgm, bgm, play_clear, player
    x, y = player.pos
    victory_time += gfw.delta_time

    if victory_time > 1.0:
        play_clear += 1

        if play_clear == 1:
            victory = music.mp3(game_object.resSE('game_clear.mp3'), True)

    if victory_time > 7.0:
        play_bgm += 1

        if play_bgm == 1:
            victory.stop()
            bgm = music.mp3(game_object.resSE('ending.mp3'), True)
        elif play_bgm == 50:
            gfw.world.add(gfw.layer.clear, clear)

    if x + 10 > get_canvas_width():
        x = get_canvas_width() - 10
        player.pos = x, y

    gfw.world.update()
    stage_gen.update()
Пример #3
0
def update():
    if paused:
        return
    gfw.world.update()

    global prito_cooldown, disabled
    if not disabled:
        prito_cooldown -= gfw.delta_time

    if prito_cooldown < 0 and not prito.is_gen:
        prito_cooldown = random.uniform(10, 15)
        prito.generate()

    if prito.is_timeover():
        player.die()

    dx = -250 * gfw.delta_time

    for layer in range(gfw.layer.platform, gfw.layer.spike + 1):
        for obj in gfw.world.objects_at(layer):
            obj.move(dx)

    check_spike()
    is_win()
    stage_gen.update(dx)

    if player.state == Player.DEAD:
        retry()
        return
Пример #4
0
def update():
    global speed, sound, END, check_start, play_speed, PAUSE_TILE, collision_count, title_font
    if Tile.start:
        if check_start == False:
            gfw.world.clear_at(gfw.layer.ui)
            sound.play()
            check_start = True
    if END:
        sound.stop()
        gfw.change(result)
    else:

        for obj in gfw.world.objects_at(gfw.layer.tile):
            if obj.miss_tile == True:
                obj.image = gfw.image.load(gobj.res('놓친타일.png'))
                END = True

        gfw.world.update()
        if Tile.start:
            if PAUSE_TILE == False:
                dy = -TILE_SPEED * gfw.delta_time
        else:
            dy = 0

        global last_mouse_pos
        last_mouse_pos = last_mouse_pos[0], last_mouse_pos[1] + dy

        for obj in gfw.world.objects_at(gfw.layer.tile):
            if PAUSE_TILE == False:
                obj.move(dy)

        for obj in gfw.world.objects_at(gfw.layer.tile):
            if obj.sound_time > gfw.delta_time * play_speed:
                sound.pause()

            if obj.success_tile:
                check_start = True
                obj.sound_time += gfw.delta_time

        for obj in gfw.world.objects_at(gfw.layer.tile):
            if obj.check_disappearing_tile(
            ) == True and obj.success_tile == True:
                gfw.world.remove(obj)
            if obj.check_disappearing_tile(
            ) == True and obj.success_tile == False:
                obj.image = gfw.image.load(gobj.res('놓친타일.png'))
                obj.miss_tile = True
                END = True

        if PAUSE_TILE == False:
            stage_gen.update(dy)
Пример #5
0
def load_stage_data():
    global entrance, exit

    load_count = 0
    map_x = 0
    map_y = 0
    while load_count < 16:
        if (map_x, map_y) in room_shape:
            file_fmt = 'stages/stage_type%d.txt'
            fn = file_fmt % room_shape[(map_x, map_y)]
            stage_gen.load(gobj.res(fn), map_x, map_y)
            stage_gen.update()
        else:
            file_fmt = 'stages/stage_type%d.txt'
            fn = file_fmt % random.randint(0, 3)
            stage_gen.load(gobj.res(fn), map_x, map_y)
            stage_gen.update()

        if (map_x, map_y) == entrance:
            fn = 'stages/entrance.txt'
            stage_gen.load_door(gobj.res(fn), map_x, map_y)
            stage_gen.update()
        elif (map_x, map_y) == exit:
            fn = 'stages/exit.txt'
            stage_gen.load_door(gobj.res(fn), map_x, map_y)
            stage_gen.update()

        map_x += 1
        map_x = map_x % 4
        load_count += 1
        map_y = load_count // 4
Пример #6
0
def enter(select=None):
    gfw.world.init(['bg', 'cloud', 'tile', 'spike', 'item', 'player', 'enemy'])

    global START_TIME, END_TIME
    START_TIME = get_time()
    END_TIME = START_TIME

    for n in range(1, 4):
        bg = Background('forest0%d.png' % n)
        gfw.world.add(gfw.layer.bg, bg)

    cloud = HorzScrollBackground('cloud.png', 20, 130)
    gfw.world.add(gfw.layer.cloud, cloud)

    global player, imageName
    if select == 1:
        imageName = 'soldier_animation_sheet.png'
    elif select == 2:
        imageName = 'princess_animation_sheet.png'
    player = Player(200, 200, imageName)
    gfw.world.add(gfw.layer.player, player)

    # tiles
    stage_gen.load(res('stage_01.txt'))

    # heart
    global heart
    heart = ImageObject('item/heart.png', (32, get_canvas_height() - 32), 64)

    color = [(255, 255, 255), (255, 0, 0), (0, 0, 0), (255, 255, 255)]
    init = [(140, -290, 100, "game over"), (140, -300, 110, "game over"),
            (50, -180, -75, "restart to enter"),
            (50, -185, -70, "restart to enter")]

    global MENU
    MENU = []
    for n, (size, pos_x, pos_y, sent) in zip(range(4), init):
        menu = Menu('ThaleahFat.ttf', size, color[n], sent, pos_x, pos_y)
        MENU.append(menu)

    global TIME_STR
    TIME_STR = [
        Menu('ThaleahFat.ttf', 50, (0, 0, 0), "", 425, -335),
        Menu('ThaleahFat.ttf', 50, (255, 255, 255), "", 420, -330)
    ]

    stage_gen.update(-250 * gfw.delta_time)

    global game_clear
    game_clear = False
Пример #7
0
def update():
    if paused:
        return
    gfw.world.update()

    dx = -300 * gfw.delta_time

    for layer in range(gfw.layer.platform, gfw.layer.item + 1):
        for obj in gfw.world.objects_at(layer):
            obj.move(dx)

    check_items()
    check_obstacles()

    stage_gen.update(dx)
Пример #8
0
def update():

    gfw.world.update()
    generator.update()

    # if not gfw.world.count_at(gfw.layer.enemy) == 0:
    #     for n in gfw.world.objects_at(gfw.layer.enemy):
    #         print(n)

    collision.check_collision()
    score.update()

    #print(gfw.world.count_at(gfw.layer.enemy))

    pattern.update()
    stage_gen.update()
Пример #9
0
def update():
    global paused
    if paused:
        return

    gfw.world.update()

    dx = -175 * gfw.delta_time
    for layer in range(gfw.layer.enemy, gfw.layer.item + 1):
        for obj in gfw.world.objects_at(layer):
            obj.move(dx)

    check_meso()
    check_enemy()
    check_item()

    stage_gen.update(dx)
Пример #10
0
def update():
    if paused:
        return
    gfw.world.update()

    dx = -250 * gfw.delta_time

    for layer in range(gfw.layer.platform, gfw.layer.item + 1):
        for obj in gfw.world.objects_at(layer):
            obj.move(dx)

    check_items()
    check_obstacles()

    stage_gen.update(dx)
    for item in gfw.world.objects_at(gfw.layer.item):
        item.check_player()

    global boss
    if gfw.world.count_at(gfw.layer.boss) > 0:
        boss = gfw.world.object(gfw.layer.boss, 0)
Пример #11
0
def update():
    global score, targetscore
    if player.state == 6:
        delay(0.05)
        player.update()
        if get_time() - die_time > 0.5:
            Scene_Result.set_score(score)
            gfw.change(Scene_Result, player.select)
        return
    gfw.world.update()

    dx = -300 * gfw.delta_time
    global runfast, fast_time
    for layer in range(gfw.layer.platform, gfw.layer.item + 1):
        for obj in gfw.world.objects_at(layer):
            if runfast:
                obj.move(dx * 2)
            elif player.select == 5:
                obj.move(dx * 1.5)
            else:
                obj.move(dx)
    if fast_time != None and get_time() - fast_time >= 3.5:
        runfast = False

    if score < targetscore:
        score += 9

    if player.magnet == True:
        magnet_activate(500, 0.05)
    if player.select == 14:
        magnet_activate(300, 0.01)

    check_items()
    check_obstacles()
    if runfast:
        stage_gen.update(dx * 2)
    elif player.select == 5:
        stage_gen.update(dx * 1.5)
    else:
        stage_gen.update(dx)
    check_game_over()
Пример #12
0
def update():
    global speed, sound, END, check_start, play_speed, PAUSE_TILE, collision_count, title_font, TILE_SPEED, sound2, sound3
    if Tile.start:
        if check_start == False:
            gfw.world.clear_at(gfw.layer.ui)
            sound.play()
            check_start = True
    if END:
        if stage_gen.get_map_index() < 200:
            sound.stop()
        elif stage_gen.get_map_index() < 380:
            sound2.stop()
        elif stage_gen.get_map_index() < 580:
            sound3.stop()

        gfw.change(result)
    else:

        for obj in gfw.world.objects_at(gfw.layer.tile):
            if obj.miss_tile == True:
                obj.image = gfw.image.load(gobj.res('놓친타일.png'))
                #END = True

        gfw.world.update()
        if Tile.start:
            if PAUSE_TILE == False:
                dy = -TILE_SPEED * gfw.delta_time
        else:
            dy = 0

        for obj in gfw.world.objects_at(gfw.layer.tile):
            if PAUSE_TILE == False:
                obj.move(dy)

        for obj in gfw.world.objects_at(gfw.layer.tile):
            if obj.sound_time > gfw.delta_time * play_speed:
                if stage_gen.get_map_index() < 190:
                    sound.pause()
                elif stage_gen.get_map_index() < 380:
                    sound2.pause()
                elif stage_gen.get_map_index() < 570:
                    sound3.pause()

            if obj.success_tile:
                check_start = True
                obj.sound_time += gfw.delta_time

        for obj in gfw.world.objects_at(gfw.layer.tile):
            if obj.check_disappearing_tile(
            ) == True and obj.success_tile == True:
                gfw.world.remove(obj)
            if obj.check_disappearing_tile(
            ) == True and obj.success_tile == False:
                obj.image = gfw.image.load(gobj.res('놓친타일.png'))
                obj.miss_tile = True
                END = True
            if stage_gen.get_map_index() == 570:
                END = True
            if stage_gen.get_map_index() == 193:
                TILE_SPEED = 650
                sound.stop()
            elif stage_gen.get_map_index() == 198:
                sound2.play()
            elif stage_gen.get_map_index() == 375:
                TILE_SPEED = 670
                sound2.stop()
            elif stage_gen.get_map_index() == 388:
                sound3.play()

        if PAUSE_TILE == False:
            stage_gen.update(dy)
Пример #13
0
def update():
    global STAGE_GEN
    gfw.world.update()
    dx = -250 * gfw.delta_time
    if STAGE_GEN:
        STAGE_GEN = stage_gen.update(dx)