Beispiel #1
0
    def enterPlay(self):
        self.notify.debug('enterPlay')
        for i in xrange(self.numPlayers):
            avId = self.avIdList[i]
            avName = self.getAvatarName(avId)
            scorePanel = MinigameAvatarScorePanel.MinigameAvatarScorePanel(avId, avName)
            scorePanel.reparentTo(base.a2dTopRight)
            scorePanel.setPos(-0.213, 0.0, -0.5 - 0.28 * i)
            self.scorePanels.append(scorePanel)

        self.goalBar.show()
        self.goalBar['value'] = 0.0
        base.setCellsActive(base.rightCells, 0)
        self.__spawnUpdateSuitsTask()
        orthoDrive = OrthoDrive(self.TOON_SPEED, maxFrameMove=self.MAX_FRAME_MOVE, customCollisionCallback=self.__doMazeCollisions, priority=1)
        self.orthoWalk = OrthoWalk(orthoDrive, broadcast=not self.isSinglePlayer())
        self.orthoWalk.start()
        self.accept(MazeSuit.COLLISION_EVENT_NAME, self.__hitBySuit)
        self.accept(self.TREASURE_GRAB_EVENT_NAME, self.__treasureGrabbed)
        self.timer = ToontownTimer.ToontownTimer()
        self.timer.posInTopRightCorner()
        self.timer.setTime(MazeGameGlobals.GAME_DURATION)
        self.timer.countdown(MazeGameGlobals.GAME_DURATION, self.timerExpired)
        self.accept('resetClock', self.__resetClock)
        base.playMusic(self.music, looping=0, volume=0.8)
    def initGameWalk(self):
        self.notify.debug('startOrthoWalk')
        if self.useOrthoWalk:

            def doCollisions(oldPos, newPos, self=self):
                x = bound(newPos[0], CTGG.StageHalfWidth,
                          -(CTGG.StageHalfWidth))
                y = bound(newPos[1], CTGG.StageHalfHeight,
                          -(CTGG.StageHalfHeight))
                newPos.setX(x)
                newPos.setY(y)
                return newPos

            orthoDrive = OrthoDrive(self.ToonSpeed,
                                    customCollisionCallback=doCollisions,
                                    instantTurn=True)
            self.gameWalk = OrthoWalk(orthoDrive,
                                      broadcast=not self.isSinglePlayer())
        else:
            self.gameWalk = CogThiefWalk.CogThiefWalk('walkDone')
            forwardSpeed = self.ToonSpeed / 2.0
            base.mouseInterfaceNode.setForwardSpeed(forwardSpeed)
            multiplier = forwardSpeed / ToontownGlobals.ToonForwardSpeed
            base.mouseInterfaceNode.setRotateSpeed(
                ToontownGlobals.ToonRotateSpeed * 4)
 def __init__(self, id, toon, game, guiMgr):
     CogdoMazePlayer.__init__(self, id, toon)
     self.disableGagCollision()
     self.game = game
     self.maze = self.game.maze
     self._guiMgr = guiMgr
     self.cameraMgr = CogdoMazeCameraManager(self.toon, self.maze, camera, render)
     self._proximityRadius = self.maze.cellWidth * Globals.CameraRemoteToonRadius
     orthoDrive = OrthoDrive(Globals.ToonRunSpeed, maxFrameMove=self.maze.cellWidth / 2, customCollisionCallback=self.maze.doOrthoCollisions, wantSound=True)
     self.orthoWalk = OrthoWalk(orthoDrive)
     self._audioMgr = base.cogdoGameAudioMgr
     self._getMemoSfx = self._audioMgr.createSfx('getMemo', source=self.toon)
     self._waterCoolerFillSfx = self._audioMgr.createSfx('waterCoolerFill', source=self.toon)
     self._hitByDropSfx = self._audioMgr.createSfx('toonHitByDrop', source=self.toon)
     self._winSfx = self._audioMgr.createSfx('win')
     self._loseSfx = self._audioMgr.createSfx('lose')
     self.enabled = False
     self.pickupCount = 0
     self.numEntered = 0
     self.throwPending = False
     self.coolDownAfterHitInterval = Sequence(Wait(Globals.HitCooldownTime), Func(self.setInvulnerable, False), name='coolDownAfterHitInterval-%i' % self.toon.doId)
     self.invulnerable = False
     self.gagHandler = CollisionHandlerEvent()
     self.gagHandler.addInPattern('%fn-into-%in')
     self.exited = False
     self.hints = {'find': False,
      'throw': False,
      'squashed': False,
      'boss': False,
      'minion': False}
     self.accept('control', self.controlKeyPressed)
Beispiel #4
0
    def _initOrthoWalk(self):
        orthoDrive = OrthoDrive(
            9.778,  # run speed = run frames (15) / fps (24fps) * avg. run speed (14.667 ft./s)
            customCollisionCallback=self.activity.view.checkOrthoDriveCollision
        )

        self.orthoWalk = OrthoWalk(orthoDrive, broadcast=True)
Beispiel #5
0
    def __initOrthoWalk(self):
        """
        Initializes ortho walk movement for the local toon.
        Orthowalk is movement where up is +y and right is +x in relation to the toon's parent
        """
        self.notify.debug("Initialize Ortho Walk")

        orthoDrive = OrthoDrive(
            9.778
        )  # run speed = run frames (15) / fps (24fps) * avg. run speed (14.667 ft./s)
        self.orthoWalk = OrthoWalk(orthoDrive, broadcast=True)
Beispiel #6
0
    def initOrthoWalk(self):
        DistributedPartyCatchActivity.notify.debug('startOrthoWalk')

        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

        orthoDrive = OrthoDrive(self.ToonSpeed, instantTurn=True)
        self.orthoWalk = OrthoWalk(orthoDrive, broadcast=True)
Beispiel #7
0
    def initGameWalk(self):
        self.notify.debug('startOrthoWalk')

        def doCollisions(oldPos, newPos, self=self):
            x = bound(newPos[0], CTGG.StageHalfWidth, -CTGG.StageHalfWidth)
            y = bound(newPos[1], CTGG.StageHalfHeight, -CTGG.StageHalfHeight)
            newPos.setX(x)
            newPos.setY(y)
            return newPos

        orthoDrive = OrthoDrive(self.ToonSpeed,
                                customCollisionCallback=doCollisions,
                                instantTurn=True)
        self.gameWalk = OrthoWalk(orthoDrive,
                                  broadcast=not self.isSinglePlayer())
Beispiel #8
0
    def enable(self):
        if self.enabled: return
        orthoDrive = OrthoDrive(
            CogdoMazeGameGlobals.ToonRunSpeed,
            maxFrameMove=(self.game.maze.cellWidth / 2),
            customCollisionCallback=self.game.doMazeCollisions
            )

        self.orthoWalk = OrthoWalk(
            orthoDrive,
            broadcast=not self.game.distGame.isSinglePlayer()
            )

        self.orthoWalk.start()

        self.guiMgr.showTimer(CogdoMazeGameGlobals.GameDuration, self.disable)
        self.enabled = True
Beispiel #9
0
 def _initOrthoWalk(self):
     orthoDrive = OrthoDrive(9.778,
                             customCollisionCallback=self.activity.view.
                             checkOrthoDriveCollision)
     self.orthoWalk = OrthoWalk(orthoDrive, broadcast=True)
Beispiel #10
0
 def __initOrthoWalk(self):
     self.notify.debug('Initialize Ortho Walk')
     orthoDrive = OrthoDrive(9.778)
     self.orthoWalk = OrthoWalk(orthoDrive, broadcast=True)
 def initOrthoWalker(self):
     orthoDrive = OrthoDrive(9.778, maxFrameMove=0.5, wantSound=True)
     self.orthoWalk = OrthoWalk(orthoDrive, broadcast=False, collisions=False, broadcastPeriod=Globals.AI.BroadcastPeriod)
 def _DistributedPartyDanceActivityBase__initOrthoWalk(self):
     self.notify.debug('Initialize Ortho Walk')
     orthoDrive = OrthoDrive(9.7780000000000005)
     self.orthoWalk = OrthoWalk(orthoDrive, broadcast = True)