def showArrow(self, arrowNum): arrows = self.arrows[arrowNum] cog = self.cogManager.cogs[arrowNum] points = [ self.arena.find('**/cog%d_start_locator' % (arrowNum + 1)), self.arena.find('**/cog%d_end_locator' % (arrowNum + 1)) ] Y = cog.root.getY() for point in points: point.setY(Y) for i in range(len(arrows)): arrow = arrows[i] arrow.draw(points[i].getPos(), cog.root.getPos(), animate=False) arrow.unstash() i = -1 length = PartyGlobals.CogActivityArenaLength for node, text in self.distanceLabels[arrowNum]: current = bound(i, 0, 1) node.setPos(cog.root.getPos(self.root) + Point3(i * 4, 2, 4)) dist = PartyCogUtils.getCogDistanceUnitsFromCenter(cog.currentT) dist = abs(dist - i * length / 2) if dist > length - dist: node.setScale(2.8) else: node.setScale(2.2) text.setText(TTLocalizer.PartyCogDistance % dist) if dist > 0: node.unstash() else: arrows[current].stash() i += 2
def setTime(self, time): time = bound(time, 0, 999) if time == self.currentTime: return self.currentTime = time timeStr = str(time) timeStrLen = len(timeStr) if timeStrLen == 1: if time <= 5 and self.highlightNearEnd: self.setTimeStr(timeStr, 0.34, (-0.025, -0.125), Vec4(1, 0, 0, 1)) else: self.setTimeStr(timeStr, 0.34, (-0.025, -0.125)) else: if timeStrLen == 2: self.setTimeStr(timeStr, 0.27, (-0.025, -0.1)) else: if timeStrLen == 3: self.setTimeStr(timeStr, 0.2, (-0.01, -0.08))
def __showSplat(self, position): if self.kaboomTrack is not None and self.kaboomTrack.isPlaying(): self.kaboomTrack.finish() if not self.pieHitSound: self.notify.warning('Trying to play hit sound on destroyed player') return splatName = 'splat-creampie' self.splat = globalPropPool.getProp(splatName) self.splat.setBillboardPointEye() self.splat.reparentTo(render) self.splat.setPos(self.toon, position) self.splat.setY(self.toon, bound(self.splat.getY(), self.toon.getHeight() / 2.0, position.getY())) self.splat.setAlphaScale(1.0) targetscale = 0.75 def setSplatAlpha(amount): self.splat.setAlphaScale(amount) self.kaboomTrack = Parallel(SoundInterval(self.pieHitSound, node=self.toon, volume=1.0, cutOff=PartyGlobals.PARTY_COG_CUTOFF), Sequence(Func(self.splat.showThrough), Parallel(Sequence(LerpScaleInterval(self.splat, duration=0.175, scale=targetscale, startScale=Point3(0.1, 0.1, 0.1), blendType='easeOut'), Wait(0.175)), Sequence(Wait(0.1), LerpFunc(setSplatAlpha, duration=1.0, fromData=1.0, toData=0.0, blendType='easeOut'))), Func(self.splat.cleanup), Func(self.splat.removeNode))) self.kaboomTrack.start() return
def setAngle(self, angle): self.__previousAngle = self._angle self._angle = bound(angle, CANNON_ANGLE_MIN, CANNON_ANGLE_MAX)
def setRotation(self, rotation): self.__previousRotation = self._rotation self._rotation = bound(rotation, CANNON_ROTATION_MIN, CANNON_ROTATION_MAX)
def doCollisions(oldPos, newPos, self=self): x = bound(newPos[0], self.StageHalfWidth, -self.StageHalfWidth) y = bound(newPos[1], self.StageHalfHeight, -self.StageHalfHeight) newPos.setX(x) newPos.setY(y) return newPos
def checkOrthoDriveCollision(self, oldPos, newPos): x = bound(newPos[0], -16.8, 16.8) y = bound(newPos[1], -17.25, -24.1) newPos.setX(x) newPos.setY(y) return newPos