예제 #1
0
파일: builder.py 프로젝트: fabr1z10/glib3
    def f():
        s = Script()
        for item in dialogue:
            print ('tag = ' + item[0])
            ist = [dialogueId[a] for a in item[1:]]
            print ('tag = ' + str(ist))

            s.addAction (Say(lines=ist, tag=item[0], font='monkey'))
        return s
예제 #2
0
파일: builder.py 프로젝트: fabr1z10/glib3
 def g():
     s = Script()
     color_player = Data.items[State.player]['text_color']
     color_other = Data.items[other_id]['text_color']
     for item in dialogue:
         tag = item[0]            
         pos = pos_player if tag == 'player' else pos_other
         color = color_player if tag =='player' else color_other
         for line in item[1:]:
             print ('adding action msg ' + str(pos) + '  ' + dialogueLines[line])
             s.addAction (Msg(text=dialogueLines[line], font='monkey', pos=pos, color = color))
     return s
예제 #3
0
파일: funcs.py 프로젝트: yasminsadi/games
def flag(p, h):
    p.vx = 0
    p.vy = 0
    example.remove(h.id())
    flag = example.get('flag')
    s = Script()
    s.addAction(act.SetState (state = 'warp', tag='player', args = {'anim': 'slide'}), id = 0)
    s.addAction (act.Move (speed = 80, by = [0, -(flag.y()-h.y())], tag='flag'), after= [0])
    s.addAction (act.Move (speed = 80, to = [p.x(), h.y()], tag='player'), after= [0])
    s.addAction (act.SetState(tag='player', state='demo', args = { 'left': 0 })),
    #s.addAction (act.SetState (state='walk', tag='player'))
    example.play(s)
예제 #4
0
파일: funcs.py 프로젝트: yasminsadi/games
def goombaResponse (player : example.Wrap1, goomba : example.Wrap1, x, y):
    if vars.invincibility:
        return
    print ('qui')
    if (player.getState() == 'jump' and y > 0 and abs(x) < 0.01):
        s = Script()
        player.vy = 300
        s.addAction (act.SetState (state = 'dead', id = goomba.id() ))
        example.play(s)
        print ('ciao')
    else:
        playerHitByEnemy(player)
예제 #5
0
def playerIsHit(player: example.Wrap1, foe: example.Wrap1, x, y):
    # decrease foe energy
    #info = player.getInfo()
    #info['energy'] -= 1
    vars.energy -= 1
    func.updateEnergy()

    if vars.energy <= 0:
        x = player.x()
        y = player.y()
        vars.lives -= 1
        func.updateLives()
        example.remove(player.id())
        s = Script()
        s.addAction(act.Delay(sec=1))
        s.addAction(act.CallFunc(f=createPlayer(x, y)))
        s.addAction(act.CallFunc(f=restart))
        example.play(s)
    else:
        player.setState('ishit', {})
        vx = 200 if foe.x() < player.x() else -200
        if player.flipx:
            vx *= -1
        player.vx = vx
        print('ciao')
예제 #6
0
def collide_with_kitchen_trap():
    print('ciappo')
    s = Script()
    s.addAction(AddEntity(buildItem(id='seagull'), 'main'))
    s.addAction(Animate(anim='fly', tag='seagull', sync=True))
    s.addAction(Animate(anim='eat', tag='seagull'))
    example.play(s)
예제 #7
0
파일: funcs.py 프로젝트: fabr1z10/glib3
 def f():
     print ('CIAO +'+ worldId  + ';;;' + str(startLocation))
     vars.invincibility = False
     
     # Don't reset energy! This only should be done after player dies!
     #vars.energy = vars.init_energy
     
     # Important! Reset these or otherwise you will get runtime errors!
     vars.currentWarp = -1
     
     vars.start_pos = startLocation
     
     s = Script()
     s.addAction (act.ChangeRoom (worldId))
     example.play(s)
예제 #8
0
파일: scripts.py 프로젝트: fabr1z10/glib3
def cippo():
    print('ciappo')
    example.get('w1').setActive(False)
    s = Script()
    s.addAction(SetState(tag='player', state='pipe'))
    s.addAction(Move(tag='player', speed=50, by=[0, 64]))
    s.addAction(SetState(tag='player', state='walk'))
    example.play(s)
예제 #9
0
파일: funcs.py 프로젝트: yasminsadi/games
def brickResponse (player : example.Wrap1, brick : example.Wrap1, x, y):
    b = brick.parent()
    brick_id = b.id()
    if vars.state == 0:
        s = Script()
        ystop = b.y()
        s.addAction (act.MoveAccelerated (v0 = [0, 50], a = [0, 0.5 * vars.gravity], yStop = ystop, id = brick_id))
        example.play(s)
    else:
        print ('removing ' + str(brick_id))
        example.remove(brick_id)
        m = example.get('main')
        makePiece(pos = [b.x(), b.y(), 1], vx = 60, vy = 180, model ='brickpiece', parent=m)
        makePiece(pos = [b.x(), b.y(), 1], vx = -60, vy = 180, model ='brickpiece', parent=m)
        makePiece(pos = [b.x(), b.y(), 1], vx = 120, vy = 120, model ='brickpiece', parent=m)
        makePiece(pos = [b.x(), b.y(), 1], vx = -120, vy = 120, model ='brickpiece', parent=m)
예제 #10
0
파일: funcs.py 프로젝트: fabr1z10/glib3
def goombaResponse (player : example.Wrap1, goomba : example.Wrap1, x, y):
    if (player.getState() == 'jump' and y > 0 and abs(x) < 0.01):
        s = Script()
        player.vy = 300
        s.addAction (act.SetState (state = 'dead', id = goomba.id ))
        s.addAction (act.Delay (sec = 2))
        s.addAction (act.RemoveEntity (id=goomba.id))
        example.play(s)        
    else:
        playerHitByEnemy(player)
예제 #11
0
def talkToCitizen():
    s = Script()
    s.addAction(EnableControls(False))
    lines = ('_', 27, 28) if var.knows_map == 1 else ((
        '_', 1) if not var.talked_to_citizen else ('_', 8, 9))
    s.addAction(
        RunScript(
            d3(st['dialogues']['citizen'],
               ['citizen', 'a:talk_s', lines, 'a:idle_s'])()))
    s.addAction(RunScript(ssc.startDialogue('citizen')()))
    var.talked_to_citizen = 1
    return s
예제 #12
0
파일: funcs.py 프로젝트: fabr1z10/glib3
def fireHitsFoe(foe: example.Wrap1, fire: example.Wrap1, x, y):
    example.remove(fire.id)
    foe.setState ('dead2', {})
    s = Script()
    s.addAction (MoveAccelerated(v0=[50 if fire.x < foe.x else -50, 150], a=[0,vars.gravity], yStop = -32, id=foe.id))
    s.addAction (RemoveEntity (id=foe.id))
    example.play(s)
예제 #13
0
파일: room.py 프로젝트: fabr1z10/glib3
    def f(x, y, obj = None):
        dial = example.get('dialogue')
        dial.clearText()
        # check if there's any script to run
        a = Script()
        node = s
        node.said = True
        for cn in node.closeNodes:
            s.dialogue.nodes[cn].status = 2
        for an in node.activateNodes:
            n = s.dialogue.nodes[an]
            if n.status != 2:
                n.status = 1
        #for id, d in s.dialogue.nodes.items():
        #    print (str(d.id) + ' ' + str(d.active))

        #if s.node.nextStatus != NodeStatus.SAME:
        #   s.node.status = s.node.nextStatus
        #s.node.dialogue.openNode(s.node)
        # check if I have a script associated to this line
        func = s.dialogue.id + '_'+node.id
        print ('check if ' + func)
        addCustomScript (engine.scripts.dialogues, func, a)
        #ds = s.script()
        #if ds:
        #    a.addAction(act.RunScript(s = ds))
        if s.nextId == None:
            print ('ending')
            a.addAction(scact.EndDialogue(s.dialogue.id))
        else:
            print ('next is ' + s.nextId)
            s.dialogue.current = s.nextId
            a.addAction(scact.ResumeDialogue(s.dialogue.id))
        example.play(a)
예제 #14
0
def citi3():
    s = Script()
    s.addAction(
        RunScript(
            d3(sl, ['player', ('a', 11)],
               ['citizen', 'a:talk_e', ('_', 33), 'a:idle_e'])()))
    s.addAction(RunScript(citi_01()))
    return s
예제 #15
0
def m1(x: float, y: float):
    a = mushroom(x, y)
    main = example.get('main')
    id = main.add(a)
    s = Script()
    s.addAction(Move(id=id, speed=10, by=[0, 16]))
    s.addAction(SetState(id=id, state='walk'))
    example.play(s)
예제 #16
0
파일: scripts.py 프로젝트: fabr1z10/glib3
def winSlide(p: example.Wrap1, k, x, y):
    example.remove(k.id)
    p.setState('slide', {})
    s = Script()
    p.vy = 0
    s.addAction(Move(speed=50, to=[p.x, 48], tag='player'))
    s.addAction(SetState(tag='player', state='demo', args={'left': 0}))
    example.play(s)
예제 #17
0
파일: scripts.py 프로젝트: fabr1z10/glib3
def pipe_out(p: example.Wrap1, k, x, y):
    p.setState('demo', {'left': 0})
    addInfo = k.getInfo()['info']
    s = Script()
    from smb_py.funcs import gotoWorld
    s.addAction(Delay(sec=0.5))
    s.addAction(CallFunc(gotoWorld(addInfo['world'], addInfo['pos'])))
    example.play(s)
예제 #18
0
파일: scripts.py 프로젝트: fabr1z10/glib3
def enterPipe(a: example.Wrap1):
    if not vars.paused and vars.currentWarp != -1:
        a.setState('pipe', {})
        info = example.getById(vars.currentWarp).getInfo()
        s = Script()
        s.addAction(Move(speed=100, by=[0, -64], tag='player'))
        s.addAction(CallFunc(f=func.gotoWorld(info['world'], info['start'])))
        example.play(s)
예제 #19
0
파일: funcs.py 프로젝트: yasminsadi/games
def makePiece(pos, vx, vy, model, parent : example.Wrap1):
    a = Sprite(model = model, pos = pos)
    id = parent.add(a)
    s = Script()
    s.addAction (act.MoveAccelerated (id = id, v0 = [vx, vy], a = [0, 0.5*vars.gravity], yStop=0))
    s.addAction (act.RemoveEntity (id = id))
    #		type = action.remove_object, args = { id = id1}
    example.play(s)
예제 #20
0
def m3(x: float, y: float):
    a = spr('score100', x, y)
    main = example.get('main')
    id = main.add(a)
    s = Script()
    s.addAction(act.Move(speed=100, by=[0, 64], id=id))
    s.addAction(act.RemoveEntity(id=id))
    example.play(s)
예제 #21
0
def m3(x: float, y: float):
    a = Sprite('score100', pos=[x * vars.tileSize, (y + 1) * vars.tileSize, 0])
    main = example.get('main')
    id = main.add(a)
    s = Script()
    s.addAction(Move(speed=100, by=[0, 64], id=id))
    s.addAction(RemoveEntity(id=id))
    example.play(s)
예제 #22
0
 def f():
     s = Script()
     s.addAction(
         RunScript(
             d3(sl, ['player', ('a', n)],
                ['citizen', 'a:talk_e',
                 ('_', 29, 30, 31, 32), 'a:idle_e'])()))
     s.addAction(RunScript(citi_01()))
     return s
예제 #23
0
파일: funcs.py 프로젝트: yasminsadi/games
def koopaResponse (player : example.Wrap1, koopa : example.Wrap1, x, y):
    if koopa.getState() == 'hide':
        if (player.getState() == 'jump' and y > 0 and abs(x) < 0.01):
            player.vy = 300
        koopa.move(-10 * x, 0, 0)		
        left = 0 if (player.x() <koopa.x()) else 1
        s = Script()
        s.addAction (act.SetState(state='walk2', id=koopa.id(), args = {'left': left}))
        example.play(s)
    else:
        if (player.getState() == "jump" and y > 0 and abs(x) < 0.01):
            player.vy = 300
            s = Script()
            s.addAction (act.SetState(state='hide', id=koopa.id()))
            example.play(s)     
        else:
            playerHitByEnemy(player)
예제 #24
0
def m2(x: float, y: float):
    def score():
        m3(x, y + 1)

    a = spr('flyingcoin', x, y + 1)
    main = example.get('main')
    id = main.add(a)
    s = Script()
    s.addAction(
        act.MoveAccelerated(v0=[0, 100],
                            a=[0, -100],
                            yStop=(y * vars.tileSize) + 16,
                            id=id))
    s.addAction(act.RemoveEntity(id=id))
    s.addAction(act.CallFunc(f=score))
    #s.addAction(act.SetState (id = id, state='walk'))
    example.play(s)
예제 #25
0
파일: funcs.py 프로젝트: yasminsadi/games
def bonusBrickResponse (player: example.Wrap1, brick: example.Wrap1, x, y):
    b = brick.parent()
    info = b.getInfo()
    hitsLeft = info['hitsLeft']
    brick_id = b.id()
    if hitsLeft > 0:
        info['hitsLeft'] -= 1
        s = Script()
        ystop = b.y()
        s.addAction (act.MoveAccelerated (v0 = [0, 50], a = [0, 0.5 * vars.gravity], yStop = ystop, id = brick_id))
        if hitsLeft == 1:
           s.addAction (act.Animate (anim='taken', id=brick_id)) 
        # release the bonus
        def p():
            info['callback'](b.x()/ vars.tileSize + 0.5, b.y() / vars.tileSize)
        s.addAction (act.CallFunc (f = p))
        example.play(s)
예제 #26
0
 def f():
     print('ciao' + itemId)
     s = Script()
     status = 'open' if open else 'closed'
     s.addAction(CallFunc(f=setvar(Data.items[itemId]['anim'], status)))
     # set corresponding variables
     #sv(Data.items[itemId]['anim'], status)
     print('set to ' + status)
     s.addAction(Animate(anim=status, tag=itemId))
     return s
예제 #27
0
파일: scripts.py 프로젝트: fabr1z10/glib3
def gotoNext(p: example.Wrap1, k: example.Wrap1, x, y):
    #print (k.getInfo())
    addInfo = k.getInfo()['info']
    #print('world is ' + ['world'])
    example.remove(k.id)
    p.setActive(False)
    s = Script()
    from smb_py.funcs import gotoWorld
    s.addAction(Delay(sec=0.5))
    s.addAction(CallFunc(gotoWorld(addInfo['world'], addInfo['pos'])))
    example.play(s)
예제 #28
0
def handler2_do(sc : script.Script):
    item2 : s.Item = s.Data.items[s.Config.item2] # s.State.items[s.Config.item1]
    walkto = helper.gdd(item2, 'walkto', None)
    wdir = helper.gdd (item2, 'wdir', None)
    if walkto is not None:
        sc.addAction( sa.Walk(pos = walkto, tag = 'player'))    
    if wdir is not None:
        sc.addAction( sa.Turn(dir = wdir, tag = 'player'))
    asc = get_action_script (s.Config.verb + '_' + s.Config.item1 + '_' + s.Config.item2, s.Config.verb +'_')
    if asc:
        sc.addAction (actions.RunScript (s = asc))
예제 #29
0
파일: funcs.py 프로젝트: fabr1z10/glib3
def downgradePlayer():
    vars.state -= 1
    if vars.state < 0:
        playerDead()
    else:
        vars.invincibility = True
        pl = example.get('player')
        pl.setModel(vars.stateInfo[vars.state])
        s = Script()
        s.addAction (act.Blink (duration=5, blink_duration=0.2, id=pl.id))
        s.addAction (act.CallFunc (f = resetInvincible))
        example.play(s)
예제 #30
0
def m2(x: float, y: float):
    print('x=' + str(x))

    def score():
        m3(x, y + 1)

    a = Sprite('flyingcoin',
               pos=[x * vars.tileSize, (y + 1) * vars.tileSize, 0])
    main = example.get('main')
    id = main.add(a)
    s = Script()
    s.addAction(
        MoveAccelerated(v0=[0, 100],
                        a=[0, -100],
                        yStop=(y * vars.tileSize) + 16,
                        id=id))
    s.addAction(RemoveEntity(id=id))
    s.addAction(CallFunc(f=score))
    example.play(s)