def createGoonExplosion(parent, explosionPoint, scale):
    BattleParticles.loadParticles()
    deathNode = NodePath('goonDeath')
    deathNode.setPos(explosionPoint)
    explosion = createExplosionTrack(parent, deathNode, scale)
    smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10)
    bigGearExplosion = BattleParticles.createParticleEffect('WideGearExplosion', numParticles=30)
    deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')
    return Parallel(explosion, SoundInterval(deathSound), ParticleInterval(smallGearExplosion, deathNode, worldRelative=0, duration=4.3, cleanup=True), ParticleInterval(bigGearExplosion, deathNode, worldRelative=0, duration=1.0, cleanup=True), name='gears2MTrack')
    def doDeathTrack(self):

        def removeDeathSuit(suit, deathSuit):
            if not deathSuit.isEmpty():
                deathSuit.detachNode()
                suit.cleanupLoseActor()

        self.deathSuit.reparentTo(self.suit.getParent())
        self.deathSuit.setScale(self.suit.getScale())
        self.deathSuit.setPos(render, self.suit.getPos(render))
        self.deathSuit.setHpr(render, self.suit.getHpr(render))
        self.suit.hide()
        self.collNodePath.reparentTo(self.deathSuit)
        gearPoint = Point3(0, 0, self.suit.height / 2.0 + 2.0)
        smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall')
        singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1)
        smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10)
        bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles=30)
        smallGears.setPos(gearPoint)
        singleGear.setPos(gearPoint)
        smallGearExplosion.setPos(gearPoint)
        bigGearExplosion.setPos(gearPoint)
        smallGears.setDepthWrite(False)
        singleGear.setDepthWrite(False)
        smallGearExplosion.setDepthWrite(False)
        bigGearExplosion.setDepthWrite(False)
        suitTrack = Sequence(Func(self.collNodePath.stash), ActorInterval(self.deathSuit, 'lose', startFrame=80, endFrame=140), Func(removeDeathSuit, self.suit, self.deathSuit, name='remove-death-suit'))
        explosionTrack = Sequence(Wait(1.5), MovieUtil.createKapowExplosionTrack(self.deathSuit, explosionPoint=gearPoint))
        gears1Track = Sequence(ParticleInterval(smallGears, self.deathSuit, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track')
        gears2MTrack = Track((0.0, explosionTrack), (0.7, ParticleInterval(singleGear, self.deathSuit, worldRelative=0, duration=5.7, cleanup=True)), (5.2, ParticleInterval(smallGearExplosion, self.deathSuit, worldRelative=0, duration=1.2, cleanup=True)), (5.4, ParticleInterval(bigGearExplosion, self.deathSuit, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack')

        def removeParticle(particle):
            if particle and hasattr(particle, 'renderParent'):
                particle.cleanup()
                del particle

        removeParticles = Sequence(Func(removeParticle, smallGears), Func(removeParticle, singleGear), Func(removeParticle, smallGearExplosion), Func(removeParticle, bigGearExplosion))
        self.deathTrack = Sequence(Parallel(suitTrack, gears2MTrack, gears1Track, self._deathSoundIval), removeParticles)
        self.deathTrack.start()
 def setHillType(self, type):
     if self.isUp and (self.hillType == MoleFieldBase.HILL_MOLE and type == MoleFieldBase.HILL_BOMB or self.hillType == MoleFieldBase.HILL_BOMB and type == MoleFieldBase.HILL_MOLE):
         return
     self.hillType = type
     self.moleHead.removeNode()
     if type == MoleFieldBase.HILL_MOLE:
         self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_norm')
         self.moleColNodePath.setScale(3.0)
         self.moleHead.setH(0)
         self.mole.setBillboardAxis(localAvatar, 0)
     if type == MoleFieldBase.HILL_BOMB or type == MoleFieldBase.HILL_COGWHACKED:
         self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_cog')
         self.moleColNodePath.setScale(1.0)
         self.mole.setBillboardAxis(localAvatar, 0)
         if type == MoleFieldBase.HILL_COGWHACKED:
             self.doMoleDown()
             BattleParticles.loadParticles()
             singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1)
             smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10)
             bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles=30)
             gears2MTrack = Track((0.0, ParticleInterval(singleGear, self.hill, worldRelative=1, duration=5.7, cleanup=True)), (0.0, ParticleInterval(smallGearExplosion, self.hill, worldRelative=0, duration=1.2, cleanup=True)), (0.3, ParticleInterval(bigGearExplosion, self.hill, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack')
             gears2MTrack.start()
             self.popIval = Sequence(Parallel(Sequence(LerpPosInterval(self.moleHead, 0.05, Point3(0.28, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, -0.23, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, 0.0, 0.28)), LerpPosInterval(self.moleHead, 0.05, Point3(-0.35, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, 0.28, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.31, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, -0.32, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, 0.0, 0.48)), LerpPosInterval(self.moleHead, 0.05, Point3(-0.28, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, 0.29, 0.0)))), LerpPosInterval(self.mole, 0.5, Point3(0, 0, -2.5)), Func(self.setHillType, MoleFieldBase.HILL_BOMB))
             self.popIval.start()
         else:
             self.moleHead.setH(0)
     if type == MoleFieldBase.HILL_WHACKED:
         self.moleHead = loader.loadModel('phase_12/models/bossbotHQ/mole_hit')
         self.mole.setBillboardAxis(0)
         self.moleColNodePath.setScale(0.0)
         if self.popIval:
             self.popIval.finish()
         if self.downIval:
             self.downIval.finish()
         self.mole.setPos(0.0, 0.0, 0.0)
         self.popIval = Sequence(Parallel(Sequence(LerpPosInterval(self.moleHead, 0.05, Point3(0.18, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, -0.13, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, 0.0, 0.18)), LerpPosInterval(self.moleHead, 0.05, Point3(-0.15, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, 0.18, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.11, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, -0.12, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, 0.0, 0.18)), LerpPosInterval(self.moleHead, 0.05, Point3(-0.18, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, 0.13, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.18, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, -0.15, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, 0.0, 0.18)), LerpPosInterval(self.moleHead, 0.05, Point3(-0.16, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, 0.18, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.11, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, -0.18, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, 0.0, 0.17)), LerpPosInterval(self.moleHead, 0.05, Point3(-0.18, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.05, Point3(0.0, 0.0, 0.0))), Sequence(LerpScaleInterval(self.moleHead, 0.5, 3.5), LerpScaleInterval(self.moleHead, 0.5, 1.0))), LerpPosInterval(self.mole, 0.5, Point3(0, 0, -2.5)), Func(self.setHillType, MoleFieldBase.HILL_MOLE))
         self.popIval.start()
     self.moleHead.reparentTo(self.mole)
Ejemplo n.º 4
0
def createGoonExplosion(parent, explosionPoint, scale):
    BattleParticles.loadParticles()
    deathNode = NodePath('goonDeath')
    deathNode.setPos(explosionPoint)
    explosion = createExplosionTrack(parent, deathNode, scale)
    smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion',
                                                              numParticles=10)
    bigGearExplosion = BattleParticles.createParticleEffect(
        'WideGearExplosion', numParticles=30)
    deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')
    return Parallel(explosion,
                    SoundInterval(deathSound),
                    ParticleInterval(smallGearExplosion,
                                     deathNode,
                                     worldRelative=0,
                                     duration=4.3,
                                     cleanup=True),
                    ParticleInterval(bigGearExplosion,
                                     deathNode,
                                     worldRelative=0,
                                     duration=1.0,
                                     cleanup=True),
                    name='gears2MTrack')
Ejemplo n.º 5
0
 def __init__(self, model, pos, serialNum, gameId, penalty=False):
     self.serialNum = serialNum
     self.penalty = penalty
     center = model.getBounds().getCenter()
     center = Point3(0, 0, 0)
     self.nodePath = model.copyTo(render)
     self.nodePath.setPos(pos[0] - center[0], pos[1] - center[1],
                          pos[2] - center[2])
     self.nodePath.setZ(0)
     self.notify.debug('newPos = %s' % self.nodePath.getPos())
     if self.penalty:
         self.sphereName = 'penaltySphere-%s-%s' % (gameId, self.serialNum)
     else:
         self.sphereName = 'treasureSphere-%s-%s' % (gameId, self.serialNum)
     self.collSphere = CollisionSphere(center[0], center[1], center[2],
                                       self.RADIUS)
     self.collSphere.setTangible(0)
     self.collNode = CollisionNode(self.sphereName)
     self.collNode.setIntoCollideMask(ToontownGlobals.PieBitmask)
     self.collNode.addSolid(self.collSphere)
     self.collNodePath = render.attachNewNode(self.collNode)
     self.collNodePath.setPos(pos[0] - center[0], pos[1] - center[1],
                              pos[2] - center[2])
     self.collNodePath.hide()
     self.track = None
     if self.penalty:
         self.tip = self.nodePath.find('**/fusetip')
         sparks = BattleParticles.createParticleEffect(file='icetnt')
         self.sparksEffect = sparks
         sparks.start(self.tip)
         self.penaltyGrabSound = loader.loadSfx(
             'phase_4/audio/sfx/MG_cannon_fire_alt.ogg')
         self.penaltyGrabSound.setVolume(0.75)
         kaboomAttachPoint = self.nodePath.attachNewNode('kaboomAttach')
         kaboomAttachPoint.setZ(3)
         self.kaboom = loader.loadModel(
             'phase_4/models/minigames/ice_game_kaboom')
         self.kaboom.reparentTo(kaboomAttachPoint)
         self.kaboom.setScale(2.0)
         self.kaboom.setBillboardPointEye()
     return
Ejemplo n.º 6
0
 def __init__(self, parent = hidden, wantParticles = 1):
     NodePath.__init__(self, parent)
     self.assign(parent.attachNewNode('splash'))
     self.splashdown = globalPropPool.getProp('splashdown')
     self.splashdown.reparentTo(self)
     self.splashdown.setZ(-0.01)
     self.splashdown.setScale(0.4)
     ta = TransparencyAttrib.make(TransparencyAttrib.MBinary)
     self.splashdown.node().setAttrib(ta, 1)
     self.splashdown.setBin('fixed', 130, 1)
     self.ripples = Ripples(self)
     self.ripples.setBin('fixed', 120, 1)
     self.wantParticles = 1
     if self.wantParticles:
         self.pSystem = BattleParticles.createParticleEffect('SplashLines')
         self.pSystem.setScale(0.4)
         self.pSystem.setBin('fixed', 150, 1)
         self.particles = self.pSystem.particlesDict.get('particles-1')
     self.track = None
     self.trackId = Splash.splashCount
     Splash.splashCount += 1
     self.setBin('fixed', 100, 1)
     self.hide()
     return
 def __init__(self, model, pos, serialNum, gameId, penalty = False):
     self.serialNum = serialNum
     self.penalty = penalty
     center = model.getBounds().getCenter()
     center = Point3(0, 0, 0)
     self.nodePath = model.copyTo(render)
     self.nodePath.setPos(pos[0] - center[0], pos[1] - center[1], pos[2] - center[2])
     self.nodePath.setZ(0)
     self.notify.debug('newPos = %s' % self.nodePath.getPos())
     if self.penalty:
         self.sphereName = 'penaltySphere-%s-%s' % (gameId, self.serialNum)
     else:
         self.sphereName = 'treasureSphere-%s-%s' % (gameId, self.serialNum)
     self.collSphere = CollisionSphere(center[0], center[1], center[2], self.RADIUS)
     self.collSphere.setTangible(0)
     self.collNode = CollisionNode(self.sphereName)
     self.collNode.setIntoCollideMask(ToontownGlobals.PieBitmask)
     self.collNode.addSolid(self.collSphere)
     self.collNodePath = render.attachNewNode(self.collNode)
     self.collNodePath.setPos(pos[0] - center[0], pos[1] - center[1], pos[2] - center[2])
     self.collNodePath.hide()
     self.track = None
     if self.penalty:
         self.tip = self.nodePath.find('**/fusetip')
         sparks = BattleParticles.createParticleEffect(file='icetnt')
         self.sparksEffect = sparks
         sparks.start(self.tip)
         self.penaltyGrabSound = loader.loadSfx('phase_4/audio/sfx/MG_cannon_fire_alt.ogg')
         self.penaltyGrabSound.setVolume(0.75)
         kaboomAttachPoint = self.nodePath.attachNewNode('kaboomAttach')
         kaboomAttachPoint.setZ(3)
         self.kaboom = loader.loadModel('phase_4/models/minigames/ice_game_kaboom')
         self.kaboom.reparentTo(kaboomAttachPoint)
         self.kaboom.setScale(2.0)
         self.kaboom.setBillboardPointEye()
     return
Ejemplo n.º 8
0
    def doDeathTrack(self):

        def removeDeathSuit(suit, deathSuit):
            if not deathSuit.isEmpty():
                deathSuit.detachNode()
                suit.cleanupLoseActor()

        if self.suitSound:
            self.suitSound.stop()
        self.deathSuit = self.suit.getLoseActor()
        self.deathSuit.reparentTo(self.enemyMgr.enemiesNP)
        self.deathSuit.setPos(render, self.suit.getPos(render))
        self.deathSuit.setHpr(render, self.suit.getHpr(render))
        self.suit.hide()
        self.collNodePath.reparentTo(self.deathSuit)
        treasureSpawnPoint = Point3(self.suit.getX(), self.suit.getY(), self.suit.getZ() + self.suit.height / 2.0)
        gearPoint = Point3(0, 0, self.suit.height / 2.0 + 2.0)
        spinningSound = base.loadSfx('phase_3.5/audio/sfx/Cog_Death.ogg')
        deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg')
        smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall')
        singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1)
        smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10)
        bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles=30)
        smallGears.setPos(gearPoint)
        singleGear.setPos(gearPoint)
        smallGearExplosion.setPos(gearPoint)
        bigGearExplosion.setPos(gearPoint)
        smallGears.setDepthWrite(False)
        singleGear.setDepthWrite(False)
        smallGearExplosion.setDepthWrite(False)
        bigGearExplosion.setDepthWrite(False)
        if self.isMovingLeftRight:
            self.enterPause()
            suitTrack = Sequence(Func(self.collNodePath.stash), ActorInterval(self.deathSuit, 'lose', startFrame=80, endFrame=140), Func(removeDeathSuit, self.suit, self.deathSuit, name='remove-death-suit'))
            explosionTrack = Sequence(Wait(1.5), MovieUtil.createKapowExplosionTrack(self.deathSuit, explosionPoint=gearPoint))
            soundTrack = Sequence(SoundInterval(spinningSound, duration=1.6, startTime=0.6, volume=0.8, node=self.deathSuit), SoundInterval(deathSound, volume=0.32, node=self.deathSuit))
            gears1Track = Sequence(ParticleInterval(smallGears, self.deathSuit, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track')
            gears2MTrack = Track((0.0, explosionTrack), (0.7, ParticleInterval(singleGear, self.deathSuit, worldRelative=0, duration=5.7, cleanup=True)), (5.2, ParticleInterval(smallGearExplosion, self.deathSuit, worldRelative=0, duration=1.2, cleanup=True)), (5.4, ParticleInterval(bigGearExplosion, self.deathSuit, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack')
        elif self.isMovingUpDown:

            def getFinalPos():
                if self.isGoingUp:
                    direction = 1.0
                else:
                    direction = -1.0
                pos = Point3(self.deathSuit.getX(), self.deathSuit.getY(), self.deathSuit.getZ() + 2.0 * direction)
                return pos

            deathMoveIval = LerpPosInterval(self.deathSuit, 1.5, pos=getFinalPos(), name='%s-deathSuitMove' % self.suitName, blendType='easeInOut', fluid=1)
            suitTrack = Sequence(Func(self.collNodePath.stash), Parallel(ActorInterval(self.deathSuit, 'lose', startFrame=80, endFrame=140), deathMoveIval), Func(removeDeathSuit, self.suit, self.deathSuit, name='remove-death-suit'))
            explosionTrack = Sequence(Wait(1.5), MovieUtil.createKapowExplosionTrack(self.deathSuit, explosionPoint=gearPoint))
            soundTrack = Sequence(SoundInterval(spinningSound, duration=1.6, startTime=0.6, volume=0.8, node=self.deathSuit), SoundInterval(deathSound, volume=0.32, node=self.deathSuit))
            gears1Track = Sequence(ParticleInterval(smallGears, self.deathSuit, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track')
            gears2MTrack = Track((0.0, explosionTrack), (0.0, ParticleInterval(singleGear, self.deathSuit, worldRelative=0, duration=5.7, cleanup=True)), (2.7, ParticleInterval(smallGearExplosion, self.deathSuit, worldRelative=0, duration=1.2, cleanup=True)), (2.9, ParticleInterval(bigGearExplosion, self.deathSuit, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack')

        def removeParticle(particle):
            if particle and hasattr(particle, 'renderParent'):
                particle.cleanup()
                del particle

        removeParticles = Parallel(Func(removeParticle, smallGears), Func(removeParticle, singleGear), Func(removeParticle, smallGearExplosion), Func(removeParticle, bigGearExplosion))
        self.deathTrack = Sequence(Parallel(suitTrack, gears2MTrack, gears1Track, soundTrack), removeParticles, Func(self.destroy))
        self.deathTrack.start()
Ejemplo n.º 9
0
 def setHillType(self, type):
     if self.isUp and (self.hillType == MoleFieldBase.HILL_MOLE
                       and type == MoleFieldBase.HILL_BOMB
                       or self.hillType == MoleFieldBase.HILL_BOMB
                       and type == MoleFieldBase.HILL_MOLE):
         return
     self.hillType = type
     self.moleHead.removeNode()
     if type == MoleFieldBase.HILL_MOLE:
         self.moleHead = loader.loadModel(
             'phase_12/models/bossbotHQ/mole_norm')
         self.moleColNodePath.setScale(3.0)
         self.moleHead.setH(0)
         self.mole.setBillboardAxis(localAvatar, 0)
     if type == MoleFieldBase.HILL_BOMB or type == MoleFieldBase.HILL_COGWHACKED:
         self.moleHead = loader.loadModel(
             'phase_12/models/bossbotHQ/mole_cog')
         self.moleColNodePath.setScale(1.0)
         self.mole.setBillboardAxis(localAvatar, 0)
         if type == MoleFieldBase.HILL_COGWHACKED:
             self.doMoleDown()
             BattleParticles.loadParticles()
             singleGear = BattleParticles.createParticleEffect(
                 'GearExplosion', numParticles=1)
             smallGearExplosion = BattleParticles.createParticleEffect(
                 'GearExplosion', numParticles=10)
             bigGearExplosion = BattleParticles.createParticleEffect(
                 'BigGearExplosion', numParticles=30)
             gears2MTrack = Track((0.0,
                                   ParticleInterval(singleGear,
                                                    self.hill,
                                                    worldRelative=1,
                                                    duration=5.7,
                                                    cleanup=True)),
                                  (0.0,
                                   ParticleInterval(smallGearExplosion,
                                                    self.hill,
                                                    worldRelative=0,
                                                    duration=1.2,
                                                    cleanup=True)),
                                  (0.3,
                                   ParticleInterval(bigGearExplosion,
                                                    self.hill,
                                                    worldRelative=0,
                                                    duration=1.0,
                                                    cleanup=True)),
                                  name='gears2MTrack')
             gears2MTrack.start()
             self.popIval = Sequence(
                 Parallel(
                     Sequence(
                         LerpPosInterval(self.moleHead, 0.05,
                                         Point3(0.28, 0.0, 0.0)),
                         LerpPosInterval(self.moleHead, 0.05,
                                         Point3(0.0, -0.23, 0.0)),
                         LerpPosInterval(self.moleHead, 0.05,
                                         Point3(0.0, 0.0, 0.28)),
                         LerpPosInterval(self.moleHead, 0.05,
                                         Point3(-0.35, 0.0, 0.0)),
                         LerpPosInterval(self.moleHead, 0.05,
                                         Point3(0.0, 0.28, 0.0)),
                         LerpPosInterval(self.moleHead, 0.05,
                                         Point3(0.31, 0.0, 0.0)),
                         LerpPosInterval(self.moleHead, 0.05,
                                         Point3(0.0, -0.32, 0.0)),
                         LerpPosInterval(self.moleHead, 0.05,
                                         Point3(0.0, 0.0, 0.48)),
                         LerpPosInterval(self.moleHead, 0.05,
                                         Point3(-0.28, 0.0, 0.0)),
                         LerpPosInterval(self.moleHead, 0.05,
                                         Point3(0.0, 0.29, 0.0)))),
                 LerpPosInterval(self.mole, 0.5, Point3(0, 0, -2.5)),
                 Func(self.setHillType, MoleFieldBase.HILL_BOMB))
             self.popIval.start()
         else:
             self.moleHead.setH(0)
     if type == MoleFieldBase.HILL_WHACKED:
         self.moleHead = loader.loadModel(
             'phase_12/models/bossbotHQ/mole_hit')
         self.mole.setBillboardAxis(0)
         self.moleColNodePath.setScale(0.0)
         if self.popIval:
             self.popIval.finish()
         if self.downIval:
             self.downIval.finish()
         self.mole.setPos(0.0, 0.0, 0.0)
         self.popIval = Sequence(
             Parallel(
                 Sequence(
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.18, 0.0, 0.0)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.0, -0.13, 0.0)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.0, 0.0, 0.18)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(-0.15, 0.0, 0.0)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.0, 0.18, 0.0)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.11, 0.0, 0.0)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.0, -0.12, 0.0)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.0, 0.0, 0.18)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(-0.18, 0.0, 0.0)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.0, 0.13, 0.0)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.18, 0.0, 0.0)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.0, -0.15, 0.0)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.0, 0.0, 0.18)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(-0.16, 0.0, 0.0)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.0, 0.18, 0.0)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.11, 0.0, 0.0)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.0, -0.18, 0.0)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.0, 0.0, 0.17)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(-0.18, 0.0, 0.0)),
                     LerpPosInterval(self.moleHead, 0.05,
                                     Point3(0.0, 0.0, 0.0))),
                 Sequence(LerpScaleInterval(self.moleHead, 0.5, 3.5),
                          LerpScaleInterval(self.moleHead, 0.5, 1.0))),
             LerpPosInterval(self.mole, 0.5, Point3(0, 0, -2.5)),
             Func(self.setHillType, MoleFieldBase.HILL_MOLE))
         self.popIval.start()
     self.moleHead.reparentTo(self.mole)
Ejemplo n.º 10
0
    def doDeathTrack(self):
        def removeDeathSuit(suit, deathSuit):
            if not deathSuit.isEmpty():
                deathSuit.detachNode()
                suit.cleanupLoseActor()

        self.deathSuit.reparentTo(self.suit.getParent())
        self.deathSuit.setScale(self.suit.getScale())
        self.deathSuit.setPos(render, self.suit.getPos(render))
        self.deathSuit.setHpr(render, self.suit.getHpr(render))
        self.suit.hide()
        self.collNodePath.reparentTo(self.deathSuit)
        gearPoint = Point3(0, 0, self.suit.height / 2.0 + 2.0)
        smallGears = BattleParticles.createParticleEffect(
            file='gearExplosionSmall')
        singleGear = BattleParticles.createParticleEffect('GearExplosion',
                                                          numParticles=1)
        smallGearExplosion = BattleParticles.createParticleEffect(
            'GearExplosion', numParticles=10)
        bigGearExplosion = BattleParticles.createParticleEffect(
            'BigGearExplosion', numParticles=30)
        smallGears.setPos(gearPoint)
        singleGear.setPos(gearPoint)
        smallGearExplosion.setPos(gearPoint)
        bigGearExplosion.setPos(gearPoint)
        smallGears.setDepthWrite(False)
        singleGear.setDepthWrite(False)
        smallGearExplosion.setDepthWrite(False)
        bigGearExplosion.setDepthWrite(False)
        suitTrack = Sequence(
            Func(self.collNodePath.stash),
            ActorInterval(self.deathSuit, 'lose', startFrame=80, endFrame=140),
            Func(removeDeathSuit,
                 self.suit,
                 self.deathSuit,
                 name='remove-death-suit'))
        explosionTrack = Sequence(
            Wait(1.5),
            MovieUtil.createKapowExplosionTrack(self.deathSuit,
                                                explosionPoint=gearPoint))
        gears1Track = Sequence(ParticleInterval(smallGears,
                                                self.deathSuit,
                                                worldRelative=0,
                                                duration=4.3,
                                                cleanup=True),
                               name='gears1Track')
        gears2MTrack = Track((0.0, explosionTrack),
                             (0.7,
                              ParticleInterval(singleGear,
                                               self.deathSuit,
                                               worldRelative=0,
                                               duration=5.7,
                                               cleanup=True)),
                             (5.2,
                              ParticleInterval(smallGearExplosion,
                                               self.deathSuit,
                                               worldRelative=0,
                                               duration=1.2,
                                               cleanup=True)),
                             (5.4,
                              ParticleInterval(bigGearExplosion,
                                               self.deathSuit,
                                               worldRelative=0,
                                               duration=1.0,
                                               cleanup=True)),
                             name='gears2MTrack')

        def removeParticle(particle):
            if particle and hasattr(particle, 'renderParent'):
                particle.cleanup()
                del particle

        removeParticles = Sequence(Func(removeParticle, smallGears),
                                   Func(removeParticle, singleGear),
                                   Func(removeParticle, smallGearExplosion),
                                   Func(removeParticle, bigGearExplosion))
        self.deathTrack = Sequence(
            Parallel(suitTrack, gears2MTrack, gears1Track,
                     self._deathSoundIval), removeParticles)
        self.deathTrack.start()