瀏覽代碼

entrancePoint entity places toons sensibly

Darren Ranalli 22 年之前
父節點
當前提交
ca04158482
共有 2 個文件被更改,包括 11 次插入1 次删除
  1. 2 0
      direct/src/level/EntityTypes.py
  2. 9 1
      direct/src/level/EntrancePoint.py

+ 2 - 0
direct/src/level/EntityTypes.py

@@ -70,6 +70,8 @@ class EntrancePoint(Nodepath):
     type = 'entrancePoint'
     attribs = (
         ('entranceId', -1, 'int'),
+        ('radius', 15, 'float', {'min':0}),
+        ('theta', 20, 'float', {'min':0}),
         )
 
 class LogicGate(Entity):

+ 9 - 1
direct/src/level/EntrancePoint.py

@@ -6,14 +6,22 @@ import NodePath
 class EntrancePoint(BasicEntities.NodePathEntity):
     def __init__(self, level, entId):
         BasicEntities.NodePathEntity.__init__(self, level, entId)
+        self.rotator = self.attachNewNode('rotator')
+        self.placer = self.rotator.attachNewNode('placer')
         self.initEntrancePoint()
 
     def destroy(self):
         self.destroyEntrancePoint()
+        self.placer.removeNode()
+        self.rotator.removeNode()
+        del self.placer, self.rotator
         BasicEntities.NodePathEntity.destroy(self)
 
     def placeToon(self, toon, toonIndex, numToons):
-        toon.setPosHpr(self, 0,0,0, 0,0,0)
+        self.placer.setY(-self.radius)
+        self.rotator.setH((-self.theta*(numToons-1)*.5) +
+                          (toonIndex*self.theta))
+        toon.setPosHpr(self.placer, 0,0,0, 0,0,0)
 
     def initEntrancePoint(self):
         if self.entranceId >= 0: