コード例 #1
0
ファイル: end.py プロジェクト: ghk01214/2D_Game_Programming
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()
コード例 #2
0
ファイル: main.py プロジェクト: ghk01214/2D_Game_Programming
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()
コード例 #3
0
ファイル: main.py プロジェクト: ghk01214/2D_Game_Programming
def load():
    global background, tile, player, stage_num, bgm

    temp_stage = stage_num

    try:
        with open(FILENAME, "rb") as file:
            stage_num = pickle.load(file)
            background.pos = pickle.load(file)
            tile.scroll_x = pickle.load(file)
            player.pos = pickle.load(file)
            player.state = pickle.load(file)
            player.action = pickle.load(file)
            player.width = pickle.load(file)
            player.imageType = pickle.load(file)

        player.delta = 0
        player.frame = 0
    except:
        print("No save file")

    if temp_stage != stage_num:
        stage_gen.remove()
        bgm = music.mp3(resSE('stage_%d.mp3' % stage_num), True)
        stage_gen.load(resBM('../stage_%d.txt' % stage_num))

    if stage_num == 3:
        bgm.set_volume(80)
コード例 #4
0
ファイル: main.py プロジェクト: ghk01214/2D_Game_Programming
def enter():
    gfw.world.init([
        'background', 'tile', 'bullet', 'save', 'platform', 'spike', 'player'
    ])

    global background, tile, player, stage_num, bgm
    stage_num = 1
    bgm = music.mp3(resSE('stage_%d.mp3' % stage_num), True)

    player = Player()
    gfw.world.add(gfw.layer.player, player)

    background = Background('background.png', player)
    gfw.world.add(gfw.layer.background, background)

    tile = Tile('res/tile_background.json', 'res/bitmap/tileset.png', player)
    gfw.world.add(gfw.layer.tile, tile)

    stage_gen.load(resBM('../stage_%d.txt' % stage_num), False)
    save()
コード例 #5
0
ファイル: title.py プロジェクト: ghk01214/2D_Game_Programming
def enter():
    global image, bgm
    image = gfw.image.load(resBM('title.png'))
    bgm = music.mp3(resSE('title.mp3'), True)
コード例 #6
0
def enter():
    global image, logo_time, bgm

    image = gfw.image.load(resBM('logo.png'))
    logo_time = 0
    bgm = music.mp3(resSE('logo.mp3'), False)