예제 #1
0
    def test_ctor(self):
        s = draw.Sprite3D()
        self.assertEqual(s.z, 0)

        # rendering does not crash
        self.perspective()
        s.render()
예제 #2
0
    def test_moveTo(self):
        s = draw.Sprite3D()
        s.moveTo(400, 300, 250)
        self.assertEqual(s.z, 250)

        # rendering does not crash
        self.perspective()
        s.render()
예제 #3
0
    def test_moveBy(self):
        s = draw.Sprite3D()
        s.moveBy(400, 300, 250)
        s.moveBy(-200, -180, 50)
        self.assertEqual(s.x, 200)
        self.assertEqual(s.y, 120)
        self.assertEqual(s.z, 300)

        # rendering does not crash
        self.perspective()
        s.render()
예제 #4
0
 def test_centerTo(self):
     s = draw.Sprite3D()
     s.centerTo(0.5, 0.5, 0.5)
     self.assertEqual(s.origin, (0.5, 0.5, 0.5))
예제 #5
0
    weapon.texture = sword

    weapon.animator = draw.FrameAnimator(weapon, 4, 8)

    # demo terrain
    d = dungeon.Dungeon()
    d.loadFromFile('demo.txt')
    renderer.loadDungeon(d)

    vb = dungeon.VertexBuilder()
    #vb.no_walls()
    vb.loadFromDungeon(d)

    next_fps_update = 0

    sprite1 = draw.Sprite3D()
    sprite1.moveTo(4.5, 0.0, 4.5)
    sprite1.centerTo(0.5, 0.0, 0.5)
    sprite1.texture = goblin
    sprite1.animator = draw.FrameAnimator(sprite1, 4, 8)
    sprite1.animator.start(loop=True)

    sprite2 = draw.Sprite3D()
    sprite2.resize(0.5, 0.5)
    sprite2.moveTo(5.0, 0.0, 4.0)
    sprite2.centerTo(0.5, 0.0, 0.5)
    sprite2.texture = bag

    sprite3 = draw.Sprite3D()
    sprite3.moveTo(4.0, 0.0, 4.0)
    sprite3.centerTo(0.5, 0.0, 0.5)