예제 #1
0
def init_flying_coin(id, x, y):
    s = Script()
    s.seq([
        act.MoveAccelerated(v0=(0, 300), a=(0, -mopy.monkey.engine.data.globals.gravity), yStop=y+16, entity_id=id),
        act.RemoveEntity(entity_id=id),
        act.AddEntity(entity_id='entities.score_100', pos=[x/16, y/16+1, 1])])
    example.play(s)
예제 #2
0
파일: village.py 프로젝트: fabr1z10/glib3
def on_kitchen_trap(player, entity, x, y):
    example.remove(entity.id)
    s = Script()
    s.add_action(al.create_item('seagull'))
    s.add_action(actions.Animate(tag='seagull', anim='fly', sync=True))
    s.add_action(actions.Animate(tag='seagull', anim='eat'))
    s.add_action(actions.SetVariable("game.seagull_on_plank", True))
    example.play(s)
예제 #3
0
def warp_down(a):
    if data.globals.active_warp:
        s = Script()
        s.seq([
            act.SetState(tag='player', state='warp'),
            act.Move(speed=50, by=(0, -64), tag='player'),
            act.ChangeRoom(data.globals.active_warp)])
        example.play(s)
예제 #4
0
파일: scripts.py 프로젝트: fabr1z10/glib3
def ciaone2(player_attack, foe, x, y):
    foe.setState('dead', {})
    s = Script()
    s.seq([
        act.Delay(sec=1),
        act.RemoveEntity(entity_id=foe.id),
        act.AddEntity(entity_id='entities.flying_coin', pos=[foe.x / 16, foe.y / 16, 1])
    ])
    example.play(s)
예제 #5
0
파일: factories.py 프로젝트: fabr1z10/glib3
def ciappo(e):
    gl = mopy.monkey.engine.data.globals
    gl.invincible = True
    example.get('player').setState('walk', {})
    s = Script()
    s.seq([
        Blink(duration=gl.invincible_time, blink_duration=0.1, tag='player'),
        SetVariable(name='globals.invincible', value=False)
    ])
    example.play(s)
예제 #6
0
파일: store.py 프로젝트: fabr1z10/glib3
def pippolandia():
    s = Script()
    s.add_action(
        scumm.actions.Say(tag='player',
                          font='monkey',
                          lines=a.make_lines(['$dialogues/storekeeper/11'])))
    s.add_action(
        scumm.actions.Say(tag='storekeeper',
                          font='monkey',
                          lines=a.make_lines(['$dialogues/storekeeper/12'])))
    s.add_action(scumm.actions.ExitDialogue())
    s.add_action(actions.ResumeScript(s='_storekeeper'))
    example.play(s)
예제 #7
0
파일: scripts.py 프로젝트: fabr1z10/glib3
def setup2():
    #pass
    from wbml.data.actions import WBM

    s = Script()
    s.seq([WBM('$msg/1'),# WBM('$msg/2'), WBM('$msg/3'), WBM('$msg/4'),
           act.SetVariable('globals.player_mode', 1),
           act.SetVariable('globals.start_position', 1),
           act.SetVariable('globals.doors.0.open', 0),
           act.SetVariable('globals.room0', 1),
           act.ChangeRoom('citywl')])

    example.play(s)
예제 #8
0
def play_flag_scene(player, obj, x, y):
    player.vy = 0
    s = Script()
    s.add_action(act.SetState(tag='player', state='slide'))
    s.add_action(act.Move(tag='player', by=(0, obj.y - player.y), speed=50))
    s.add_action(act.SetState(tag='player', state='npcwalk', args={'direction': 1}))
    example.play(s)
예제 #9
0
파일: scripts.py 프로젝트: fabr1z10/glib3
def setup_bar():
    ra = mopy.monkey.engine.room_args
    gl = mopy.monkey.engine.data.globals
    bonus_left = Entity()
    bonus_left.model = gl.bonus_list[ra[0]]['gfx']
    bonus_left.pos = (2.5*16, 10.2*16, 0.11)
    example.get('main').add(bonus_left)
    bonus_right = Entity()
    bonus_right.model = gl.bonus_list[ra[2]]['gfx']
    bonus_right.pos = (9.5*16, 10.2*16, 0.11)
    example.get('main').add(bonus_right)




    from wbml.data.actions import WBM

    # check if player has enough gold to buy items
    min_cost = min(int(ra[1]), int(ra[3]))
    if gl.gold < min_cost:
        s = Script()
        s.seq([WBM('$msg/8'), act.ChangeRoom('citywl')])
        example.play(s)
    else:
        mopy.monkey.engine.data.globals.pos = [(2, 7.625, 0.1), (5.25, 7.625, 0.1), (9.5, 7.625, 0.1)]
        mopy.monkey.engine.data.globals.cpos = 1
        s = Script()
        s.seq([WBM('$msg/5')])
        example.play(s)
예제 #10
0
def on_enter_loom():
    s = Script()
    s.add_action(scumm.actions.EnableUI(False))
    l = ['$dialogues/loom/1']
    lines = [monkey.engine.read(x) for x in l]
    s.add_action(scumm.actions.Say(tag='loom', lines=lines, animate=False, font='monkey'))
    s.add_action(scumm.actions.StartDialogue('loom'))
    example.play(s)
예제 #11
0
파일: scripts.py 프로젝트: fabr1z10/glib3
def enter_door(x):
    if mopy.monkey.engine.data.globals.active_warp is not None:
        warp_id =mopy.monkey.engine.data.globals.active_warp
        mopy.monkey.engine.data.globals.active_warp = None
        door_info = mopy.monkey.engine.data.globals.doors[warp_id]
        s = Script()
        args = door_info.get('args',None)
        print('args=' +str(args))
        s.seq([
            act.SetState(tag='player', state='knock'),
            act.Delay(sec=0.1),
            act.Animate(tag='door_' + str(warp_id), anim='open'),
            act.ChangeRoom(room=door_info['room'], args=args)
        ])
        example.play(s)
예제 #12
0
def pappo():
    s = Script()
    s.add_action(scumm.actions.EnableUI(False))
    l = ['$dialogues/mancomb/1', '$dialogues/mancomb/2']
    lines = [monkey.engine.read(x) for x in l]
    s.add_action(scumm.actions.Say(tag='mancomb', lines=lines, animate=False, font='monkey'))
    s.add_action(scumm.actions.StartDialogue('mancomb'))
    example.play(s)
예제 #13
0
def end_level(player, warp, x, y):
    player.setActive(False)
    info = warp.getInfo()
    s = Script()
    s.add_action(act.Delay(sec=1))
    s.add_action(act.SetVariable('globals.start_position', info['start_position']))
    s.add_action(act.ChangeRoom(room=info['warp_to']))
    example.play(s)
예제 #14
0
def foe_hits_mario(player, foe, x, y):
    if player.getState() == 'jump' and player.vy < 0:
        s = Script()
        player.vy = data.globals.jump_velocity * 0.5
        s.seq([
            act.SetState(state='dead', entity_id=foe.id),
            act.Delay(2),
            act.RemoveEntity(entity_id=foe.id)
        ])
        #s.add_action(act.SetState(state='dead', entity_id=foe.id))
        #s.add_action(act.Delay(2))
        #s.add_action(act.RemoveEntity(entity_id=foe.id))
        example.play(s)
    else:
        player_hit_by_enemy(player)
예제 #15
0
파일: village.py 프로젝트: fabr1z10/glib3
def seagull_lands():
    s = Script()
    if 'fish' in mopy.monkey.engine.data.globals.inventory:
        s.add_action(actions.Animate(tag='seagull', anim='leave', sync=True))
        s.add_action(al.remove_item('seagull'))
    else:
        s.add_action(actions.Animate(tag='seagull', anim='eat'))
    example.play(s)
예제 #16
0
def on_kitchen_trap(trap):
    example.remove(trap.id)
    s = entity.Sprite(model='01/seagull', tag='seagull',pos=[0, 0, 1])
    id = example.get('main').add(s)
    script = Script()
    script.add_action(actions.Animate(entity_id=id, anim='fly', sync=True))
    script.add_action(actions.Animate(entity_id=id, anim='eat'))
    script.add_action(actions.CallFunc(f=a.Callbacks.set_var("@seagull_on_plank", True)))
    example.play(script)
예제 #17
0
def lookout_5(args):
    s = Script()
    s.add(Say(_a('squinky'), 'player'))
    if mopy.monkey.engine.data.dialogues['lookout']['lines'][4].get(
            'clicked', 0) == 0:
        s.add(Say(_a(41), 'main.lookout'))
    else:
        s.add(Say(_a(27), 'main.lookout'))
    return s
예제 #18
0
 def f(item_id, entity):
     print('HEY item = ' + item_id)
     s = Scripts.walk(item_id) if item_id else Script()
     s.add_action(
         actions.CallFunc(
             f=Callbacks.set_pos(data.current_player, room, pos, dir)))
     s.add_action(actions.ChangeRoom(room=room))
     example.play(s)
예제 #19
0
 def _start_dialogue():
     _enable_controls(False)()
     dialogue = mopy.monkey.engine.data.dialogues.get(dialogue_id)
     if not dialogue:
         print('## warning! dialogue ' + dialogue_id + ' does not exist')
         return
     s = Script()
     if (not continue_dialogue) and 'on_entry' in dialogue:
         s = getattr(mopy.monkey.engine.data.scripts,
                     dialogue['on_entry'])()
     s.add_action({
         'type':
         'action.callfunc',
         'func':
         _display_dialogue(dialogue_id, dialogue, start_node)
     })
     example.play(s)
예제 #20
0
def lookout_start_dialogue(args):
    s = Script()
    s.add(Say(_a(args[0]), 'player'))
    s.add_action(Turn('s', 'main.lookout'))
    l = [_b(5), (_b(43) + _b(53 + random.randint(0, 1)))
         ] if scumm.gl.talked_to_lookout == 1 else [
             _b(5), _b(6), _b(7), _b(8), _b(9)
         ]
    s.add(Sayd(l, 'main.lookout'))
    return s
예제 #21
0
파일: mario.py 프로젝트: fabr1z10/glib3
def foe_hits_mario(player, foe, x, y):
    if player.getState() == 'jump' and player.vy < 0:
        s = Script()
        player.vy = data.globals.jump_velocity * 0.5
        s.add_action(act.SetState(state='dead', entity_id=foe.id))
        s.add_action(act.Delay(211))
        s.add_action(act.RemoveEntity(foe.id))
        example.play(s)
    else:
        pass
예제 #22
0
def storekeeper_script(walk_to_pos,
                       next_room,
                       next_room_pos,
                       next_room_dir,
                       parent='walkarea_0'):
    if example.get('storekeeper').valid:
        s = Script()
        s.add_action(scumm.actions.Walk(tag='storekeeper', pos=walk_to_pos))
        s.add_action(actions.SetActive(tag='storekeeper', value=False))
        s.add_action(
            custom_actions.update_item(item_id='storekeeper',
                                       room=next_room,
                                       pos=next_room_pos,
                                       dir=next_room_dir,
                                       parent=parent,
                                       size=None))
        s.add_action(custom_actions.set_timestamp('@storekeeper_last_update'))
        example.play(s)
예제 #23
0
파일: store.py 프로젝트: fabr1z10/glib3
def say_random():
    s = Script(uid='_storekeeper')
    s.add_action(
        scumm.actions.Say(
            tag='storekeeper',
            font='monkey',
            lines=a.make_lines(
                ['$dialogues/storekeeper/' + str(random.randint(2, 9))])))
    s.add_action(actions.Delay(sec=5))
    s.add_action(actions.CallFunc(f=say_random))
    example.play(s)
예제 #24
0
파일: items.py 프로젝트: fabr1z10/glib3
def on_create_flying_coin(nid, x, y, z):
    s = Script()
    yt = y + data.globals.tile_size[1]
    s.add_action(
        act.MoveAccelerated(v0=[0, 100], a=[0, -100], yStop=yt, entity_id=nid))
    s.add_action(act.RemoveEntity(nid))
    s.add_action(
        act.CreateEntity('scripts.factories.score_100',
                         pos=(x, yt, z),
                         use_tile=False))
    example.play(s)
예제 #25
0
파일: interface.py 프로젝트: fabr1z10/glib3
def sierra_walk_to(x, y):
    gl = mopy.monkey.engine.data.globals
    if gl.current_action == 0:
        s = Script(uid='_main')
        s.add_action(Walk((x, y), 'player'))
        example.play(s)
    else:
        # check if we have a default script for given action
        sa = '_default_' + str(gl.current_action) + '_' + str(
            mopy.monkey.engine.room)
        script = mopy.monkey.engine.get_script(sa)
        if script:
            s = script.make()
            example.play(s)
        else:
            sa = '_default_' + str(gl.current_action)
            script = mopy.monkey.engine.get_script(sa)
            if script:
                s = script.make()
                example.play(s)
예제 #26
0
파일: store.py 프로젝트: fabr1z10/glib3
def init_store():
    # only if storekeeper in store
    if example.get('storekeeper').valid:
        s = Script(uid='_storekeeper')
        s.add_action(
            scumm.actions.Say(tag='storekeeper',
                              font='monkey',
                              lines=a.make_lines(['$dialogues/storekeeper/1'
                                                  ])))
        s.add_action(actions.Delay(sec=5))
        s.add_action(actions.CallFunc(f=say_random))
        s.add_action(actions.CallFunc(f=say_random))
        example.play(s)
예제 #27
0
파일: scripts.py 프로젝트: fabr1z10/glib3
def hand_select():
    from wbml.data.actions import WBM
    gl = mopy.monkey.engine.data.globals
    selected = mopy.monkey.engine.data.globals.cpos
    s = Script()
    if selected == 1:
        s.seq([act.SetActive(tag='hand', value=False),
            WBM('$msg/6'), act.SetVariable('globals.start_position', 2), act.ChangeRoom('citywl')])
    else:
        bonus_picked = None
        cost = 0
        msg = None
        if selected == 0:
            bonus_picked = mopy.monkey.engine.room_args[0]
            cost = int(mopy.monkey.engine.room_args[1])
            msg = mopy.monkey.engine.room_args[4]
        else:
            bonus_picked = mopy.monkey.engine.room_args[2]
            cost = int(mopy.monkey.engine.room_args[3])
            msg = mopy.monkey.engine.room_args[5]
        if mopy.monkey.engine.data.globals.gold >= cost:
            mopy.monkey.engine.data.globals.gold -= cost
            bonus =gl.bonus_list[bonus_picked]
            bonus['callback']()
            s.seq([
                act.SetActive(tag='hand', value=False),
                WBM(msg),
                act.SetVariable('globals.start_position', 2),
                act.ChangeRoom('citywl')])
    example.play(s)
예제 #28
0
파일: store.py 프로젝트: fabr1z10/glib3
def on_exit_storekeeper():
    s = Script()
    s.add_action(scumm.actions.ExitDialogue())
    # resume script unless storekeeper is away
    if vars.items['storekeeper']['room'] == 'store':
        s.add_action(actions.ResumeScript(s='_storekeeper'))
    example.play(s)
예제 #29
0
def rise():
    player = example.get('player')
    player.setState('warp', {})
    s = Script()
    s.add_action(act.Move(speed=50, by=(0, 64), tag='player'))
    s.add_action(act.SetState(tag='player', state='walk'))
    example.play(s)
예제 #30
0
파일: items.py 프로젝트: fabr1z10/glib3
 def f(nid, x, y, z):
     s = Script()
     s.add_action(
         act.MoveAccelerated(entity_id=nid,
                             v0=[vx, vy],
                             a=[0, -0.5 * data.globals.gravity],
                             yStop=0))
     s.add_action(act.RemoveEntity(entity_id=nid))
     example.play(s)