예제 #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
파일: 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)
예제 #3
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)
예제 #4
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)
예제 #5
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)
예제 #6
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)
예제 #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 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)
예제 #9
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)
예제 #10
0
def player_hit_by_enemy(player):

    gl = mopy.monkey.engine.data.globals
    if gl.invincible:
        return
    gl.invincible = True
    if gl.player_mode > 0:
        gl.player_mode -= 1
        player.setModel(gl.player_modes[gl.player_mode]['model'])
        s = Script()
        s.seq([
            act.Blink(duration=gl.invincible_time, blink_duration=0.2, entity_id=player.id),
            act.SetVariable(name='globals.invincible', value=False)])
        example.play(s)
    else:
        player.setState('dead', {})
        s = Script()
        s.seq([
            act.Delay(0.5),
            act.MoveAccelerated(v0=(0, 250), a=(0, -gl.gravity), yStop=0, entity_id=player.id),
            act.CallFunc(restartMario)
        ])
        example.play(s)
예제 #11
0
def init_score(id, x, y):
    s = Script()
    s.seq([
        act.Move(speed=50, by=(0, 48), entity_id=id),
        act.RemoveEntity(entity_id=id)])
    example.play(s)
예제 #12
0
파일: scripts.py 프로젝트: fabr1z10/glib3
def pane():
    aa = mopy.monkey.engine.read('$msg/1')
    print(aa)
    id = example.get('main').add(Text(font='sprites.mario_font', size=8, text=aa, color=[0,0,0,0], maxwidth=160,align=TextAlignment.center, pos=[96, 132,1.01 ]))
    text_size = example.getById(id).getTextSize()
    # s.add_action(Msg(
    #     font=gl.msg_font,
    #     color=(127, 83, 30, 255),
    #     align=TextAlignment.center,
    #     text=mopy.monkey.engine.read(text),
    #     pos=(gl.sci_viewport[2] * 0.5, gl.sci_viewport[3] * 0.5, 1),
    #     inner_texture=gl.msg_inner_texture,
    #     border_texture=gl.msg_border_texture,
    #     eoc=True,
    #     timeout=1000,
    #     box=True,
    #     padding=(4, 5)))
    # s.add_action(sierra_enable_controls(True))
    # return s
    #s = Script()
    #
    #
    # print ('fottimilcazzzzo!!!!')
    #s.seq([
    #    act.AddEntity(entity_id='entities.textbg', pos=[0.5, 7, 1])
    #])
    import math
    tw = (text_size[2] - text_size[0])
    th = (text_size[3] - text_size[1])
    width = math.ceil(tw / 8.0)
    height = math.ceil(th / 8.0)
    data = [22, 8]
    data.extend([23, 8] * width)
    data.extend([24, 8])
    md = [22, 7]
    md.extend([23, 7] * width)
    md.extend([24, 7])
    data.extend(md * height)
    data.extend([22, 6])
    data.extend([23, 6] * width)
    data.extend([24, 6])
    e = Entity()
    e.model = {
            'type': 'model.tiled',
            'tex': 'gfx/wbml.png',
            'img_tile_size': [8, 8],
            'tile_size': [8, 8],
            'size': [width + 2, height + 2],
            'data': data}
    e.pos=[96 - 0.5 * tw - 8, 132 - 0.5*th - 8, 1]
    example.get('main').add(e)
    s = Script()
    acts=[]
    print('positioned ' + str(text_size))
    id1 = example.get('main').add(Text(tag='ciaone', font='sprites.mario_font', size=8, text=aa,
                                      color=[255,255,255,255], maxwidth=160,align=TextAlignment.top_left, pos=[96-0.5*tw, 132+0.5*th, 1.02]))
    for n in range(1, len(aa)+1):
        acts.append(act.SetText(tag='ciaone', text=aa[0:n]))
        acts.append(act.Delay(0.05))
    s.seq(acts)
    example.play(s)