Пример #1
0
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()
Пример #2
0
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)
Пример #3
0
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)