Пример #1
0
    def __init__(self, scene, pos):
        Entity.__init__(self)
        self._destroyed = False
        self._closing = False

        self._scene = scene

        self.moveTo(pos)

        self._graphics = R.loadObject("targetpt.obj","diffuse")
        self._beacon = R.loadObject("beacon.obj","glow")

        self._anim_m = T.identity_matrix()
        self._rot= T.quaternion_about_axis(0, (0,0,1))
        self._rot_speed = T.quaternion_about_axis(0.01, (0,0,1))

        self._scale = 0.15

        self.moveTo(self.getPosition() + (0,0,-0.3))

        self._scale_m = T.scale_matrix(self._scale)

        bounds = self._graphics.getObj().getBounds() * self._scale

        Entity.setBounds(self,bounds)
Пример #2
0
    def __init__(self, map, position):

        print "New player"

        Entity.__init__(self)
        self._lock = None
        self._phys = Verlet(position)
        self._phys.setDamping((0.02, 0.02, 0.0002))
        self._phys.setGravity((0, 0, -0.00006))

        self._on_floor = False
        self._speed = 0

        self._map = map
        self._heading = 0
        self.reset()

        r = self._radius = 0.1

        self.setBounds(((-r, -r, -r), (r, r, r)))  # entity stuff
        Entity.moveTo(self, position)  # keep the entity updated

        self._scaling = T.scale_matrix(self._radius)

        self._last_pos = N.array((0, 0, 0), dtype="f")

        self._graphics = R.loadObject("sphere.obj", "diffuse")
Пример #3
0
    def __init__(self, scene, pos, dest, router):
        Entity.__init__(self)
        self._destroyed = False
        self._closing = False
        self._target_reached = False

        self._scene = scene
        self._map = scene.getMap()

        self._path = None

        self._dying_t = 0
        self._spin = 0

        self.moveTo(pos)

        self._scale = 1.0
        self._graphics = R.loadObject("enemy.obj","diffuse")
        self._orient_m= T.identity_matrix()

        self._xform_m = N.dot(T.rotation_matrix(math.pi/2,(0,0,1)),T.scale_matrix(self._scale))

        bounds = self._graphics.getObj().getBounds()

        router.requestJob(pos, dest, Enemy.OnRouteObtained, self)

        Entity.setBounds(self,bounds * self._scale)
        self._destroyed = False
        self._old_time = 0

        self._old_pos = None # At t-1
        self._old_pos2 = None # At t-2

        self._hc = HeadingController()
Пример #4
0
    def __init__(self, pos, particles):
        Entity.__init__(self)

        self._particles = particles

        self.moveTo(pos)

        self._graphics = R.loadObject("base.obj","diffuse")
        self._anim_m = T.identity_matrix()

        bounds = self._graphics.getObj().getBounds()

        Entity.setBounds(self,bounds)
Пример #5
0
    def __init__(self, scene, pos, direction, missile_type, follow):
        Entity.__init__(self)

        self._t0 = None
        self._follow = follow

        self._scene = scene

        self._map = scene.getMap()

        self.moveTo(pos)

        self._thrust = 0.01
        self._speed = 0.1

        self._destroyed = False

        self._graphics = R.loadObject(missile_type+".obj","diffuse")
        self._pos_m = T.translation_matrix(pos)


        axis = T.random_vector(3)

        self._d_rotation = T.quaternion_about_axis(0.01, axis)
        self._rotation = T.random_quaternion()

        self._dir = direction

        scale = 0.05

        self._scaling_m = T.scale_matrix(scale)

        bounds = self._graphics.getObj().getBounds() * scale

        Entity.setBounds(self,bounds)

        self._trail= ParticleGenerator("billboard","puff.jpg")
        self._trail.setEvolveTime(0.5)
        self._trail.setAcceleration(0)
        self._trail.setEasing(0.5, 0.5, 0.0, 0.05, 0.2)
        self._trail.setBrightness(0.5)

        pg = scene.getParticleManager()

        def em(t):
            while True:
                dx = 2.*random.random()-1.
                dy = 2.*random.random()-1.
                dz = 2.*random.random()-1.

                r = dx*dx+dy*dy+dz*dz

                if r < 1.0:
                    break

            return self._pos,(dx*0.2,dy*0.2,dz*0.2)

        self._trail.setEmitter(em)
        self._trail.setMode("DYNAMIC")

        pg.manageGenerator(self._trail)

        self._last_z = 0