コード例 #1
0
ファイル: item.py プロジェクト: fabr1z10/glib3
def basicItem(id: str):
    desc = Data.items[id]
    # create the entity
    tag = read(desc, 'tag', default_value=id)  # desc.get ('tag', id)

    pos = read(desc, 'pos', default_value=[0, 0, 0])
    e = Entity(tag, pos)

    # if the item has model
    model = read(desc, 'model', default_value=None)
    if model is not None:
        e.type = 'sprite'
        e.model = model
        if 'anim' in desc:
            e.anim = read(desc, 'anim')

    # check if hotspot is to be added
    text = read(desc, 'text', default_value=None)
    if text is not None:
        width = desc.get('width', None)
        height = desc.get('height', None)
        offset = desc.get('offset', (0, 0))
        priority = desc.get('priority', 1)
        if width is None or height is None:
            raise BaseException(
                'you need to specify width & height for hotspots!')
        e.addComponent(
            HotSpot(shape=Rect(width=width, height=height, offset=offset),
                    priority=priority,
                    onenter=hoverOn(id),
                    onleave=hoverOff,
                    onclick=run_action))

    # if speed is set --> item is a character
    speed = desc.get('speed', None)
    # add the character stuff
    if speed is not None:
        direction = desc.get('dir')
        state = desc.get('state', 'idle')
        text_color = desc.get('text_color')
        text_offset = desc.get('text_offset')
        e.addComponent(Character(speed, direction, state))
        e.addComponent(Info(text_color=text_color, text_offset=text_offset))
        # check if this is the current player
        # if so, I tag it as player, and make the camera follow him
        if State.player == id:
            e.tag = 'player'
            e.addComponent(Follow())

    if State.collision_enabled and 'collision' in desc:
        coll = desc['collision']
        box = read(coll, 'size')
        offset = read(coll, 'offset', default_value=[0, 0])
        flag = read(coll, 'flag')
        mask = read(coll, 'mask')
        tag = read(coll, 'tag')
        e.addComponent(
            Collider(flag, mask, tag, Rect(box[0], box[1], offset=offset)))

    return e
コード例 #2
0
 def f(args):
     shape = None
     tm = getattr(tiles, props[1])
     x = args[0]
     y = args[1]
     z = args[2] if len(args) > 2 else 0
     width = tm[0]
     height = tm[1]
     collision = tm[2]
     data = tm[3]
     if collision:
         shape = sh.Rect(width=width * vars.tileSize,
                         height=height * vars.tileSize)
     e = Entity(pos=[x * vars.tileSize, y * vars.tileSize, z])
     e.addComponent(
         TiledGfx(tilesheet='gfx/smb1.png',
                  sheetSize=[16, 16],
                  tileData=data,
                  width=width,
                  height=height,
                  size=vars.tileSize))
     if collision:
         e.addComponent(
             Collider(flag=vars.flags.platform, mask=1, tag=1, shape=shape))
     return e
コード例 #3
0
def tiled(x: float,
          y: float,
          tileSheet: str,
          sheetSize,
          tileData: list,
          width: int,
          height: int,
          size: float,
          z: float = 0,
          shape: sh.Shape = None):
    e = Entity(pos=[x * vars.tileSize, y * vars.tileSize, z])
    e.addComponent(
        compo.TiledGfx(tilesheet=tileSheet,
                       sheetSize=sheetSize,
                       tileData=tileData,
                       width=width,
                       height=height,
                       size=size))
    if shape:
        e.addComponent(
            compo.Collider(flag=vars.flags.platform,
                           mask=1,
                           tag=1,
                           shape=shape))

#if (args.collide) then
#	table.insert(components, { type = "collider", flag = variables.collision.flags.platform, mask = 1, tag=1, shape = { type="rect", width = args.width*engine.tilesize, height =
#		args.height*engine.tilesize }})
#end
    return e
コード例 #4
0
 def f(args):
     p = props[1]
     print (p)
     a = Entity(pos=[args[0],args[1],args[2]])
     a.addComponent (Gfx(image=p['image'], repeat=p['repeat']))
     a.addComponent (Parallax(cam='maincam', factor=p['parallax'], campos0=[128,112], pos0=[0,64]))
     return a
コード例 #5
0
def line(x: float, y: float, A, B):
    e = Entity(pos=[x, y])
    e.addComponent(
        compo.Collider(flag=vars.flags.platform,
                       mask=1,
                       tag=1,
                       shape=sh.Line(A, B)))
    return e
コード例 #6
0
def hotspot(x: float, y: float, warpTo, newCamBounds):
    e = Entity(pos=[x * vars.tileSize, y * vars.tileSize])
    e.addComponent(
        compo.Collider(flag=vars.flags.foe,
                       mask=vars.flags.player,
                       tag=vars.tags.hotspot,
                       shape=sh.Rect(16, 2)))
    e.addComponent(compo.Info(func=func.warpUp(warpTo, newCamBounds)))
    return e
コード例 #7
0
 def f(args):
     spawn = Entity(pos=[args[0] * vars.tileSize, args[1] * vars.tileSize])
     spawn.addComponent(
         Collider(flag=vars.flags.foe,
                  mask=vars.flags.player,
                  tag=vars.tags.spawn,
                  shape=sh.Rect(1, 256)))
     spawn.addComponent(Info(info=prop[1], delta=[args[2], args[3]]))
     return spawn
コード例 #8
0
def makeSpawn(x: float, y: float, f: callable, *args):
    print(args)
    e = Entity(pos=[x * vars.tileSize, y * vars.tileSize])
    e.addComponent(
        compo.Collider(flag=vars.flags.foe,
                       mask=vars.flags.player,
                       tag=vars.tags.hotspot,
                       shape=sh.Rect(1, 100)))
    e.addComponent(compo.Info(func=func.createItem(f, *args)))
    return e
コード例 #9
0
def hotspot2(x: float, y: float, width: float, height: float, f: callable):
    e = Entity(pos=[x * vars.tileSize, y * vars.tileSize])
    e.addComponent(
        compo.Collider(flag=vars.flags.foe,
                       mask=vars.flags.player,
                       tag=vars.tags.hotspot,
                       shape=sh.Rect(width * vars.tileSize,
                                     height * vars.tileSize)))
    e.addComponent(compo.Info(func=f))
    return e
コード例 #10
0
def makePlatform(img: str, x: float, y: float, width: int, height: int):
    a = Entity()
    a.addComponent(compo.Gfx(image=img, repeat=[width, height]))
    a.addComponent(
        compo.Collider(flag=vars.flags.platform,
                       mask=vars.flags.player,
                       tag=1,
                       shape=sh.Rect(width=width * vars.tileSize,
                                     height=height * vars.tileSize)))
    a.pos = [x * vars.tileSize, y * vars.tileSize]
    return a
コード例 #11
0
 def f(args):
     ps = prop[1] if len(prop) > 0 else {}
     pin = Entity(pos=[args[0] * vars.tileSize, args[1] * vars.tileSize],
                  tag=ps.get('tag', None))
     pin.addComponent(
         Collider(flag=vars.flags.foe,
                  mask=vars.flags.player,
                  tag=vars.tags.warp,
                  shape=sh.Rect(4, 2)))
     pin.addComponent(Info(world=args[2], start=args[3]))
     return pin
コード例 #12
0
 def f(args):
     a = Entity(pos=[args[0], args[1], args[2]])
     a.addComponent(
         ShapeGfxColor(shape=sh.Rect(256, 256),
                       fill=sh.SolidFill(r=props[1], g=props[2],
                                         b=props[3])))
     a.addComponent(
         Parallax(cam='maincam',
                  factor=[1, 1],
                  campos0=[128, 128],
                  pos0=[0, 0]))
     return a
コード例 #13
0
ファイル: funcs.py プロジェクト: fabr1z10/glib3
def togglePause():
    if vars.paused:
        example.get('main').enableUpdate(True)
        example.removeByTag('shader')
    else:
        example.get('main').enableUpdate(False)
        a = Entity(pos=[0, 0, 1], tag='shader')
        a.addComponent(
            compo.ShapeGfxColor(shape=sh.Rect(256, 256),
                                fill=sh.SolidFill(r=0, g=0, b=0, a=64)))
        example.get('diag').add(a)
    vars.paused = not vars.paused
コード例 #14
0
ファイル: world1_1.py プロジェクト: yasminsadi/games
def builder():
    r = PlatformerRoom(
        id = 'world1_1', 
        width = 256, 
        height = 256, 
        worldWidth = 224, 
        worldHeight = 16, 
        playerModel = 'cody', 
        startPos = [32, 32])
    
    # r.main.add (b.line(x=0,y=0,A=[128,0],B=[128,50]))
    # r.main.add (b.line(x=0,y=0,A=[128,50],B=[256,100]))
    # r.main.add (b.line(x=0,y=0,A=[256,100],B=[256,200]))
    # r.main.add (b.line(x=0,y=0,A=[0,200],B=[256,200]))
    # r.main.add (b.line(x=0,y=0,A=[0,200],B=[0,0]))
    shape = Polygon([0, 0, 512, 0, 512, 100, 0, 100])
    r.main.add (b.poly(0, 0, shape))
    e = Entity()
    e.pos = [0,0,-5]
    e.addComponent (ShapeGfx(shape = shape, texture = 'gfx/floor1.png', x0=2, repx=25, repy=25,slantx = 0.4 ))
    r.main.add(e)
    r.main.add (b.makeFoe('andore', 80, 32, 0.5, 5))
    
    wall = Entity()
    wall.pos=[0,100,-0.01*100]
    wall.addComponent (ShapeGfx(shape = Polygon([0,0,100,0,100,100,0,100]), texture='gfx/wall1.png', repx=32, repy=32))
    r.main.add(wall)
    r.main.add(b.makeStaticItem (ti.tree1, 50, 80))

    #ba=Entity()
    #ba.addComponent(compo.ShapeGfxColor(shape=sh.Rect(200,100), color=[255,255,255,255]))
    #r.main.add(ba)

    # with open(example.dir+ '/rooms/world1_1.yaml') as f:
    #     rooms = yaml.load(f, Loader=yaml.FullLoader)
    #     for a in rooms['room']:
    #         f = a['template'][0]
    #         args = a['template'][1:]
    #         print (args)
    #         method_to_call = getattr(fact, f, None)
    #         if method_to_call:
    #             template = method_to_call(*args)
    #             print (f + ' found')
    #             for im in a['d']:
    #                 print (im)
    #                 e = template(*im)
    #                 r.addToDynamicWorld(e)
    #         else:
    #             print (f + ' not found')

    return r
コード例 #15
0
 def f(args):
     # the first argument is the callback function
     # the second, if present, is the model
     model = prop[1].get('model', None)
     func = prop[1].get('func')
     info = prop[1].get('info', None)
     pos = [args[0] * vars.tileSize, args[1] * vars.tileSize]
     if model is None:
         a = Entity(pos=pos)
         #size = prop[1].get('size')
         size = [args[2], args[3]]
         a.addComponent(
             Collider(flag=vars.flags.foe,
                      mask=vars.flags.player,
                      tag=vars.tags.key,
                      shape=sh.Rect(width=size[0], height=size[1])))
         a.addComponent(
             Info(func=func, info=info, bounds=[0, 0, size[0], size[1]]))
     else:
         a = Sprite(model=model, pos=pos)
         a.addComponent(
             SmartCollider(flag=vars.flags.foe,
                           mask=vars.flags.player,
                           tag=vars.tags.key))
         a.addComponent(Info(func=func, info=info))
     return a
コード例 #16
0
 def f(args):
     P = [args[0] * vars.tileSize, args[1] * vars.tileSize]
     e = Entity(pos=P)
     e.addComponent(
         TiledGfx(tilesheet='gfx/smb1.png',
                  sheetSize=[16, 16],
                  tileData=[15, 5],
                  width=1,
                  height=1,
                  size=vars.tileSize,
                  repx=args[2],
                  repy=1))
     e.addComponent(
         Collider(flag=vars.flags.platform_passthrough,
                  mask=vars.flags.player,
                  tag=0,
                  shape=sh.Line(
                      A=[0, vars.tileSize, 0],
                      B=[args[2] * vars.tileSize, vars.tileSize, 0])))
     e.addComponent(
         PolygonalMover(origin=P,
                        loop=args[5],
                        pct=args[3],
                        moves=[{
                            'delta': [0, args[4] * vars.tileSize],
                            'speed': args[6],
                            'hold': 0
                        }]))
     e.addComponent(Platform())
     return e
コード例 #17
0
 def f(args):
     x = args[0]
     y = args[1]
     a = Entity()
     a.addComponent(
         Collider(
             flag=vars.flags.platform,
             mask=vars.flags.player,
             tag=1,
             shape=sh.Line(
                 A=[args[2] * vars.tileSize, args[3] * vars.tileSize, 0],
                 B=[args[4] * vars.tileSize, args[5] * vars.tileSize, 0])))
     a.pos = (x * vars.tileSize, y * vars.tileSize, 0)
     return a
コード例 #18
0
 def f(args):
     x = args[0]
     y = args[1]
     w = args[2]
     h = args[3]
     rx = args[4]
     ry = args[5]
     a = Entity()
     #print ('image = ' + props[1])
     if len(props) > 1:
         a.addComponent (Gfx(image = props[1], repeat = [rx, ry]))
     a.addComponent (Collider(flag = vars.flags.platform, mask = vars.flags.player, tag = 1, 
         shape = sh.Rect(width = w * vars.tileSize, height = h * vars.tileSize)))
     a.pos = (x * vars.tileSize, y * vars.tileSize, 0)
     return a
コード例 #19
0
ファイル: funcs.py プロジェクト: fabr1z10/glib3
def togglePause():
    if vars.paused:
        example.get('main').enableUpdate(True)
        example.removeByTag('shader')
        #msg : example.Wrap1 = example.get('msg')
        #if msg.valid:
        #    example.killScript('msgscript')
        #    example.removeByTag('msg')
        #    example.removeByTag('msgbox')
        #    example.get('player').setState('walk', {})    
    else:
        example.get('main').enableUpdate(False)
        a = Entity(pos=[0,0,1], tag='shader')
        a.addComponent (compo.ShapeGfxColor(shape = sh.Rect(256, 256), fill = sh.SolidFill(r=0, g=0, b=0, a=64)))
        example.get('diag').add(a)
    vars.paused = not vars.paused
コード例 #20
0
 def f(args):
     x = args[0]
     y = args[1]
     z = args[2]
     w = args[3]
     h = args[4]
     a = Entity()
     a.addComponent(Gfx(image=props[1], repeat=[w, h]))
     #f = Fader()
     ##f.addColor (0, [255,255,255,255])
     #f.addColor (1, [255,255,255,0])
     #f.addColor (2, [255,255,255,255])
     #a.addComponent (f)
     a.addComponent(TexAnim(period=[0, -1]))
     a.pos = (x * vars.tileSize, y * vars.tileSize, z)
     return a
コード例 #21
0
def _brick(x, y, model, hits, callback):
    a = Sprite(model=model, pos=[x * vars.tileSize, y * vars.tileSize, 0])
    a.addComponent(
        Collider(flag=vars.flags.platform,
                 mask=0,
                 tag=0,
                 shape=sh.Rect(width=vars.tileSize, height=vars.tileSize)))
    a.addComponent(Info(hitsLeft=hits, callback=callback))
    b = Entity()
    b.pos = [2, -0.5, 0]
    b.addComponent(
        Collider(flag=vars.flags.foe,
                 mask=vars.flags.player,
                 tag=vars.tags.bonus_brick_sensor,
                 shape=sh.Rect(width=vars.tileSize - 4, height=1.0)))
    a.add(b)
    return a
コード例 #22
0
 def f(args):
     model = props[1]
     x = args[0]
     y = args[1]
     a = Sprite(model = model)
     a.addComponent (Collider (flag = vars.flags.platform, mask = 0, tag = 0, shape = sh.Rect(width=vars.tileSize, height=vars.tileSize)))
     a.pos = [x * vars.tileSize, y * vars.tileSize, 0]
     a.addComponent (Info(piece = props[2]))
     b = Entity()
     b.pos = [2, -0.5, 0]
     b.addComponent (Collider (
         flag=vars.flags.foe,
         mask=vars.flags.player,
         tag = vars.tags.brick_sensor,
         shape = sh.Rect(width = vars.tileSize-4, height = 1.0)
     ))
     a.add(b)
     return a    
コード例 #23
0
 def f(args):
     print ('xxx')
     x = args[0] * vars.tileSize
     y = args[1] * vars.tileSize
     Ax = args[2] * vars.tileSize
     Ay = args[3] * vars.tileSize
     Bx = args[4] * vars.tileSize
     By = args[5] * vars.tileSize
     minx = min(Ax, Bx)
     maxx = max(Ax, Bx)
     miny = min(Ay, By)
     maxy = max(Ay, By)
     a = Entity()
     print ('xxx')
     a.addComponent (Collider(flag = vars.flags.platform, mask = vars.flags.player, tag = 1, 
         shape = sh.Line(A=[Ax,Ay,0], B=[Bx,By,0])))
     a.addComponent (Info (bounds = [minx,miny,maxx,maxy]))
     a.pos = (x,y,0)
     return a
コード例 #24
0
def makeBrick(model: str, x: float, y: float):
    a = Sprite(model=model)
    a.addComponent(
        compo.Collider(flag=vars.flags.platform,
                       mask=0,
                       tag=0,
                       shape=sh.Rect(width=vars.tileSize,
                                     height=vars.tileSize)))
    a.pos = [x * vars.tileSize, y * vars.tileSize]

    b = Entity()
    b.pos = [2, -0.5, 0]
    b.addComponent(
        compo.Collider(flag=vars.flags.foe,
                       mask=vars.flags.player,
                       tag=vars.tags.brick_sensor,
                       shape=sh.Rect(width=vars.tileSize - 4, height=1.0)))
    a.add(b)
    return a
コード例 #25
0
ファイル: item.py プロジェクト: fabr1z10/glib3
def mapHotSpotItem(id: str):
    desc = Data.items[id]
    tag = desc.get('tag', id)
    pos = desc.get('pos', [0, 0, 0])
    e = Entity(tag, pos)
    width = desc.get('width', 10)
    height = desc.get('height', 10)
    textid = desc['text']
    from lib_py.engine import data
    text = data['strings']['objects'][textid]
    e.addComponent(
        HotSpot(shape=Rect(width=width,
                           height=height,
                           offset=(-width / 2, -height / 2)),
                priority=0,
                onenter=updateText(text),
                onleave=clearText,
                onclick=gotohotspot(id)))
    return e
コード例 #26
0
def makePlayer(model: str, x: float, y: float):
    player = Sprite(model=model, pos=[x, 0], tag='player')
    player.scale = 0.5
    player.addComponent(
        compo.SmartCollider(flag=vars.flags.player,
                            mask=vars.flags.foe | vars.flags.foe_attack,
                            tag=vars.tags.player,
                            castTag=vars.tags.player_attack,
                            castMask=vars.flags.foe))
    player.addComponent(
        compo.Controller25(mask=vars.flags.platform, depth=y, elevation=256))
    player.addComponent(compo.Info(energy=5))
    #     maskDown = vars.flags.platform | vars.flags.platform_passthrough,
    #     maxClimbAngle = 80,
    #     maxDescendAngle = 80))
    # speed = 75
    player.addComponent(compo.Dynamics2D(gravity=vars.gravity))
    stateMachine = compo.StateMachine(initialState='walk')
    # stateMachine.states.append (compo.SimpleState (id='warp', anim='idle'))
    stateMachine.states.append(
        compo.Walk25(id='walk',
                     speed=200,
                     acceleration=0.05,
                     flipHorizontal=True,
                     jumpvelocity=vars.jump_velocity))
    stateMachine.states.append(compo.Hit25(id='attack', anim='attack'))
    stateMachine.states.append(
        compo.IsHit25(id='ishit', acceleration=0.5, anim='idle'))
    # stateMachine.states.append (pc.Jump(id='jump', speed=200, acceleration=0.10, flipHorizontal=True, animUp='jump', animDown='jump'))
    # stateMachine.states.append (pc.FoeWalk(id='demo', anim='walk', speed = 75,
    #     acceleration=0.05, flipHorizontal=True, flipWhenPlatformEnds = False, left=1))
    player.addComponent(stateMachine)
    player.addComponent(compo.KeyInput())
    player.addComponent(compo.Follow())
    baa = Entity(tag='pane')
    baa.addComponent(
        compo.ShapeGfxColor(shape=sh.Ellipse(20, 10), color=[0, 0, 0, 64]))
    player.add(baa)

    return player
コード例 #27
0
def bonusBrick(model: str,
               x: float,
               y: float,
               callback: callable,
               hits: int = 1):
    a = Sprite(model=model, pos=[x * vars.tileSize, y * vars.tileSize, 0])
    a.addComponent(
        compo.Collider(flag=vars.flags.platform,
                       mask=0,
                       tag=0,
                       shape=sh.Rect(width=vars.tileSize,
                                     height=vars.tileSize)))
    a.addComponent(compo.Info(hitsLeft=hits, callback=callback))
    b = Entity()
    b.pos = [2, -0.5, 0]
    b.addComponent(
        compo.Collider(flag=vars.flags.foe,
                       mask=vars.flags.player,
                       tag=vars.tags.bonus_brick_sensor,
                       shape=sh.Rect(width=vars.tileSize - 4, height=1.0)))
    a.add(b)
    return a
コード例 #28
0
ファイル: test1.py プロジェクト: fabr1z10/glib3
def builder():
    r = Phy2DRoom(id='test1', width=256, height=256,worldWidth= 256,worldHeight= 256)
    
    # add player
    p = Entity( pos = [160, 100])
    shape_player = Rect (10, 20, offset=[-5,-10])
    p.addComponent (ShapeGfxOutline(shape_player, color=[255, 255, 255, 255]))
    p.addComponent (Collider(flag=var.Flags.player, mask = var.Flags.wall, tag = var.Tags.player, shape = shape_player))
    sm = StateMachine('walk')
    sm.states.append(Walk3D('walk', 5))
    p.addComponent(sm)
    p.addComponent(KeyInput())
    r.add (p, 'main')

    # add object
    o1 = Entity (pos= [200,170])
    o_shape = Rect(20,10)
    o1.addComponent (ShapeGfxOutline(o_shape, color=[255,255,255,255]))
    o1.addComponent (Collider(flag=var.Flags.wall, mask = var.Flags.player, tag= var.Tags.wall, shape=o_shape))
    r.add(o1, 'main')

    r.add (s(10,80,Line(A=[0,0],B=[50,25])), 'main')
    r.add (s(30,130,PolygonSimple(outline=[0, 0, 10, 0, 5, 20])), 'main')
    r.add (s(150,30,Circle(20)), 'main')
    r.add (s(190,20,PolygonTri(outline=[0,0,10,10,10,20,20,20,20,0,30,0,30,40,20,40,20,30,0,30])), 'main')
    #r.add (s(-150,80,Line(A=[0,0],B=[50,25])), 'main')
    return r
コード例 #29
0
ファイル: roomui.py プロジェクト: fabr1z10/glib3
    def __init__(self,
                 id: str,
                 width,
                 height,
                 collide=False,
                 addui: bool = True,
                 verbSetId: int = 0):
        super().__init__(id, width, height)
        self.collide = collide
        scumm.State.collision_enabled = collide
        uisize = scumm.Config.ui_height
        camWidth = engine.device_size[0]
        camHeight = engine.device_size[1] - uisize

        # get the verbset used in this room
        verbset: scumm.VerbSet = scumm.Config.verbSets[verbSetId]
        defv: scumm.Verb = scumm.Config.getVerb(verbset.defaultVerb)
        scumm.Config.verb = verbset.defaultVerb
        #verbs = settings.monkey.config['verbs']
        default_verb = scumm.Config.getVerb

        # add the main node
        main = Entity(tag='main')
        main.camera = OrthoCamera(width,
                                  height,
                                  camWidth,
                                  camHeight, [0, uisize, camWidth, camHeight],
                                  tag='maincam')

        # add the ui node
        if addui:
            main.addComponent(compo.HotSpotManager(lmbclick=func.walkto))

            ui = entity.Entity(tag='ui')
            ui.camera = cam.OrthoCamera(camWidth,
                                        uisize,
                                        camWidth,
                                        uisize, [0, 0, camWidth, uisize],
                                        tag='uicam')
            ui.add(
                entity.Text(font='ui',
                            text=defv.text,
                            color=scumm.Config.Colors.current_action,
                            align=entity.TextAlignment.bottom,
                            tag='current_verb',
                            pos=[camWidth / 2, 48, 0]))
            ui.addComponent(compo.HotSpotManager())
            inventory_node = entity.TextView(factory=makeInventoryButton,
                                             pos=(160, 0),
                                             size=(140, 48),
                                             fontSize=8,
                                             lines=6,
                                             deltax=26,
                                             tag='inventory')
            inventory_node.addComponent(compo.HotSpotManager())

            row = 2
            count = 0
            for a in verbset.verbs:
                col = 1 + count // 4
                x = 2 + (col - 1) * 46
                verb: scumm.Verb = scumm.Config.getVerb(a)
                print('here ' + a + ' ' + verb.text)
                ui.add(
                    se.VerbButton(
                        font='ui',
                        verbId=a,
                        colorInactive=scumm.Config.Colors.verb_unselected,
                        colorActive=scumm.Config.Colors.verb_selected,
                        align=entity.TextAlignment.bottomleft,
                        pos=[x, uisize - row * 8, 0]))
                count += 1
                row += 1
                if (row > 5):
                    row = 2
            self.scene.append(ui)
            self.scene.append(inventory_node)

            scumm.Config.resetVerb()

        # add the dialogue node
        dialogue_node = entity.TextView(factory=makeDialogueButton,
                                        size=[320, 56],
                                        fontSize=8,
                                        lines=6,
                                        deltax=26,
                                        tag='dialogue')
        dialogue_node.addComponent(compo.HotSpotManager())

        #ui.add (VerbButton (font='ui', text='Open', colorInactive = ScummConfig.Colors.verb_unselected, colorActive = ScummConfig.Colors.verb_selected, align = e.TextAlignment.bottomleft, pos = [0,0,0]))
        # ui.add (e.Text(font='ui', text=verbs[verbset[1]].text, color = [255, 255, 255, 255], align = e.TextAlignment.topleft, pos = [0, 56, 0]))
        # ui.add (e.Text(font='ui', text=verbs[verbset[1]].text, color = [255, 255, 255, 255], align = e.TextAlignment.bottomleft, pos = [0, 0, 0]))
        # ui.add (e.Text(font='ui', text=verbs[verbset[1]].text, color = [255, 255, 255, 255], align = e.TextAlignment.topright, pos = [320, 56, 0]))
        # ui.add (e.Text(font='ui', text=verbs[verbset[1]].text, color = [255, 255, 255, 255], align = e.TextAlignment.bottomright, pos = [320, 0, 0]))

        self.ref['main'] = main.children

        self.scene.append(main)
        self.scene.append(dialogue_node)

        # create a hotspot manager
        #self.engines.append(runner.HotSpotManager(lmbclick=func.walkto))
        self.engines.append(runner.Scheduler())
        if collide:
            #self.engines.append (runner.CollisionEngine(128, 128))
            ce = runner.CollisionEngine(128, 128)
            ce.addResponse(0, 1, runner.CollisionResponse(onenter=ciao))
            self.engines.append(ce)
        self.init.append(startupRoomUI(id))
コード例 #30
0
ファイル: test1.py プロジェクト: fabr1z10/glib3
def s(x: float, y: float, shape):
    o1 = Entity (pos = [x, y])
    o1.addComponent (ShapeGfxOutline(shape, color=[255,255,255,255]))
    o1.addComponent (Collider(flag=var.Flags.wall, mask = var.Flags.player, tag= var.Tags.wall, shape=shape))
    return o1