Exemple #1
0
def make_level(render):
    cube = NodePath(makeCube(inverse=True, hide=set([5])))
    for i in range(0,10):
        for j in range(0,10):
            c = render.attachNewNode("c")
            c.setPos((i-5)*3, (j-5)*3, -10 )
            cube.instanceTo(c)
Exemple #2
0
def make_level(render):
    map = make_map()

    for i in range(0,22,1):
        x = i * 2.0
        for j in range(0,22,1):
            y = j * 2.0

            hideset = set()
            hideset.add(5)
            cell = map[i][j]
            if cell.north == OPEN: hideset.add(2)
            if cell.west == OPEN: hideset.add(3)
            if cell.south == OPEN: hideset.add(0)
            if cell.east == OPEN: hideset.add(1)

            cube = NodePath(makeCube(inverse=True, hide=hideset))
            cube.reparentTo(render)
            cube.setPos(x, y, 0 )
Exemple #3
0
Fichier : bt.py Projet : btdevel/bt
def render_level(map):
    from direct.showbase.Loader import Loader
    tex=Loader("foo").loadTexture("BrickOldSharp0215_2_thumbhuge.jpg")

    nor=Loader("foo").loadTexture("BrickOldSharp0215_2_thumbhuge-n.jpg")
    ts = TextureStage('ts')
    ts.setMode(TextureStage.MNormal)

    myMaterial = Material()
    myMaterial.setShininess(0.0)
    myMaterial.setAmbient(Vec4(0,0,0,1))
    myMaterial.setEmission(Vec4(0.0,0.0,0.0,1))
    myMaterial.setDiffuse(Vec4(0.2,0.2,0.2,1))
    myMaterial.setSpecular(Vec4(0.5,0.5,0.5,1))

    level_node = NodePath("level")
    for i in range(0,22,1):
        x = i * 2.0
        for j in range(0,22,1):
            y = j * 2.0

            hideset = set()
            cell = map[i][j]
            if cell.north == OPEN: hideset.add(2)
            if cell.west == OPEN: hideset.add(3)
            if cell.south == OPEN: hideset.add(0)
            if cell.east == OPEN: hideset.add(1)

            xcube = makeCube(inverse=True, hide=hideset)
            cube = NodePath(xcube)
            cube.setTexture(tex)
            cube.setTexture(ts,nor)
            cube.reparentTo(level_node)
            cube.setPos(x, y, 0 )
            #cube.setMaterial(myMaterial)
    return level_node