Example #1
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)
Example #2
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)
Example #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)
Example #4
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.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
Example #5
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)
Example #6
0
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)
Example #7
0
def on_create_mushroom(nid, x, y, z):
    s = Script()
    s.add_action(act.Move(speed=10, by=[0, 16.1], entity_id=nid))
    s.add_action(act.SetState(entity_id=nid, state='walk'))
    example.play(s)