예제 #1
0
파일: func.py 프로젝트: fabr1z10/glib3
def spawn(player, item, x, y):
    a = item.getInfo()['enemies']
    example.remove(item.id)
    main = example.get('main')
    for b in a:
        print('creating ' + str(b))
        main.add(fi.npc()(*b))
예제 #2
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)
예제 #3
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')
예제 #4
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)
예제 #5
0
def goto_stage(p: example.Wrap1, k: example.Wrap1, x, y):
    add_info = k.getInfo()['info']
    example.remove(k.id)
    p.setActive(False)
    s = Script()
    s.add_action(act.Delay(0.5))
    s.add_action(act.CallFunc(goto_world(add_info['world'], add_info['pos'])))
    example.play(s)
예제 #6
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)
예제 #7
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)
예제 #8
0
파일: funcs.py 프로젝트: fabr1z10/glib3
def onSpawn(player: example.Wrap1, spawn: example.Wrap1, x, y):
    # get the detail
    info = spawn.getInfo()
    fct = info['factory']
    func = data['factories']['items'][fct]
    props = info['info']
    delta = info['delta']
    foe = func ([None, props])([spawn.x/vars.tileSize + delta[0], spawn.y/vars.tileSize +delta[1]])
    example.get('main').add(foe)    
    example.remove(spawn.id)
예제 #9
0
def hit_basic_brick_sensor(player, sensor : example.Wrap1, x, y):
    brick = sensor.parent()
    if data.globals.player_mode == 0:
        brick.vy = 100
    else:
        player.vy = 0
        utils.create_entity("scripts.factories.brick_piece", (brick.x, brick.y, 1), use_tile=False, args={'model': 'brickpiece', 'vx': 60, 'vy': 180})
        utils.create_entity("scripts.factories.brick_piece", (brick.x, brick.y, 1), use_tile=False, args={'model': 'brickpiece', 'vx': -60, 'vy': 180})
        utils.create_entity("scripts.factories.brick_piece", (brick.x, brick.y, 1), use_tile=False, args={'model': 'brickpiece', 'vx': 120, 'vy': 120})
        utils.create_entity("scripts.factories.brick_piece", (brick.x, brick.y, 1), use_tile=False, args={'model': 'brickpiece', 'vx': -120, 'vy': 120})
        example.remove(brick.id)
예제 #10
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)
예제 #11
0
파일: room.py 프로젝트: fabr1z10/glib3
def ciao(player : example.Wrap1, other : example.Wrap1, x, y):
    f = 'collide_with_'+other.tag
    print ('check if exists func ' + f)
    if hasattr(engine.scripts.actions, f):
        print ('YES')
        a = getattr(engine.scripts.actions, f)()
        if a:
            a()     
    else:
        print ('no')   
    example.remove(other.id())
예제 #12
0
def on_spawn(player: example.Wrap1, spawn: example.Wrap1, x, y):
    # get the detail
    info = spawn.getInfo()
    fct = info['factory']
    func = monkey.engine.get_item_factory(fct)
    props = info['info']
    delta = info['delta']
    px = spawn.x / vars.tile_size + delta[0]
    py = spawn.y / vars.tile_size + delta[1]
    spawned = func(props)(px, py)
    example.get('main').add(spawned)
    example.remove(spawn.id)
예제 #13
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)
예제 #14
0
파일: funcs.py 프로젝트: yasminsadi/games
def foeIsHit(player : example.Wrap1, foe : example.Wrap1, x, y):
    # decrease foe energy
    info = foe.getInfo()
    info['energy'] -= 1
    if info['energy'] <= 0:
        example.remove(foe.id())
    else:
        foe.setState ('ishit', {})
        vx = 200 if player.x() < foe.x() else -200
        if foe.flipx: 
            vx *= -1
        foe.vx = vx
        print ('ciao')
예제 #15
0
def spawn(p, k, x, y):
    info = k.getInfo()
    detail = info['info']
    factory = detail['factory']
    args = detail['args']
    print(args)
    func = monkey.engine.get_item_factory(factory)(**args)
    positions = info['args'][4:]
    example.remove(k.id)
    for i in range(0, len(positions) // 2):
        ix = positions[i * 2]
        iy = positions[i * 2 + 1]
        foe = func(ix, iy)
        example.get('main').add(foe)
예제 #16
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)
예제 #17
0
def brick_response(player: example.Wrap1, brick: example.Wrap1, x, y):
    # get the actual brick
    b = brick.parent()
    brick_id = b.id
    player.vy = -abs(player.vy)
    if vars.state == 0:
        s = Script()
        ystop = b.y
        s.add_action(
            act.MoveAccelerated(v0=[0, 50],
                                a=[0, 0.5 * vars.gravity],
                                yStop=ystop,
                                entity_id=brick_id))
        example.play(s)
    else:
        # supermario
        piece = b.getInfo()['piece']
        example.remove(brick_id)
        m = example.get('main')
        make_piece(pos=[b.x, b.y, 1], vx=60, vy=180, model=piece, parent=m)
        make_piece(pos=[b.x, b.y, 1], vx=-60, vy=180, model=piece, parent=m)
        make_piece(pos=[b.x, b.y, 1], vx=120, vy=120, model=piece, parent=m)
        make_piece(pos=[b.x, b.y, 1], vx=-120, vy=120, model=piece, parent=m)
예제 #18
0
def player_gets_mushroom(player, mushroom, x, y):
    if data.globals.player_mode == 0:
        set_player_mode(1)
    example.remove(mushroom.id)
예제 #19
0
def remove_item(player, item, x, y):
    example.remove(item.id)
예제 #20
0
파일: funcs.py 프로젝트: yasminsadi/games
def coinResponse(player:example.Wrap1, coin:example.Wrap1, x, y):
    example.remove(coin.id())
예제 #21
0
 def f():
     example.remove(id)
예제 #22
0
파일: funcs.py 프로젝트: yasminsadi/games
def mushroomResponse (player: example.Wrap1, mushroom: example.Wrap1, x, y):
    example.remove(mushroom.id())
    upgradePlayer()
예제 #23
0
파일: funcs.py 프로젝트: yasminsadi/games
 def g(player: example.Wrap1, hotspot: example.Wrap1):
     example.remove(hotspot.id())
     m : example.Wrap1 = example.get('main')
     item = f(*args)
     m.add (item)
예제 #24
0
 def f():
     if entity_id is not None:
         example.remove(entity_id)
     else:
         example.removeByTag(tag)
예제 #25
0
 def f():
     if id is not None:
         example.remove(id)
     else:
         example.removeByTag(tag)
예제 #26
0
파일: shared.py 프로젝트: fabr1z10/glib3
 def f():
     example.remove(entity_id)
     vars.inventory[vars.current_player][id] = 1
     func.refresh_inventory()
예제 #27
0
def player_gets_flower(player, flower, x, y):
    if data.globals.player_mode < 2:
        set_player_mode(2)
    example.remove(flower.id)
예제 #28
0
파일: funcs.py 프로젝트: yasminsadi/games
def endlevel(p, h):
    example.remove(p.id())
예제 #29
0
def player_hits_hotspot(player, hotspot, x, y):
    info = hotspot.getInfo()
    callback = getattr(mopy.monkey.engine.data.scripts, info['callback'])
    args = info.get('args')
    callback(args)
    example.remove(hotspot.id)
예제 #30
0
파일: scripts.py 프로젝트: fabr1z10/glib3
def pickupCoin(p, k, x, y):
    example.remove(k.id)
    vars.coins += 1
    example.get('coin_label').setText('{:02d}'.format(vars.coins))