def makeSynergyTrack(self): particleEffect = BattleParticles.createParticleEffect('Synergy') waterfallEffect = BattleParticles.createParticleEffect( file='synergyWaterfall') soundTrack = Sequence( Wait(0.9), SoundInterval(self.synergySfx, node=self.virtualSuit)) track = Sequence( Parallel( ActorInterval(self.virtualSuit, 'magic3'), Track( (0.0, Func(self.sayFaceoffTaunt)), (0.1, ParticleInterval(waterfallEffect, self.virtualSuit, worldRelative=0, duration=1.9, cleanup=True)), (0.2, ParticleInterval(particleEffect, self.virtualSuit, worldRelative=0, duration=1.9, cleanup=True)), (0.5, Func(self.synergyColl.unstash)), ), soundTrack), Func(self.synergyColl.stash), Func(self.virtualSuit.setHpr, 0, 0, 0), Func(self.virtualSuit.loop, 'walk', 0), ) return track
def __healSprinkle(heal, hasInteractivePropHealBonus): toon = heal['toon'] target = heal['target']['toon'] hp = heal['target']['hp'] ineffective = heal['sidestep'] level = heal['level'] track = Sequence(__runToHealSpot(heal)) sprayEffect = BattleParticles.createParticleEffect(file='pixieSpray') dropEffect = BattleParticles.createParticleEffect(file='pixieDrop') explodeEffect = BattleParticles.createParticleEffect(file='pixieExplode') poofEffect = BattleParticles.createParticleEffect(file='pixiePoof') wallEffect = BattleParticles.createParticleEffect(file='pixieWall') def face90(toon = toon, target = target): vec = Point3(target.getPos() - toon.getPos()) vec.setZ(0) temp = vec[0] vec.setX(-vec[1]) vec.setY(temp) targetPoint = Point3(toon.getPos() + vec) toon.headsUp(render, targetPoint) delay = 2.5 mtrack = Parallel(__getPartTrack(sprayEffect, 1.5, 0.5, [sprayEffect, toon, 0]), __getPartTrack(dropEffect, 1.9, 2.0, [dropEffect, target, 0]), __getPartTrack(explodeEffect, 2.7, 1.0, [explodeEffect, toon, 0]), __getPartTrack(poofEffect, 3.4, 1.0, [poofEffect, target, 0]), __getPartTrack(wallEffect, 4.05, 1.2, [wallEffect, toon, 0]), __getSoundTrack(level, 2, duration=4.1, node=toon), Sequence(Func(face90), ActorInterval(toon, 'sprinkle-dust')), Sequence(Wait(delay), Func(__healToon, target, hp, ineffective, hasInteractivePropHealBonus))) track.append(mtrack) track.append(__returnToBase(heal)) track.append(Func(target.clearChat)) return track
def __doSprinkle(attack, recipients, hp = 0): toon = NPCToons.createLocalNPC(attack['npcId']) if toon == None: return targets = attack[recipients] level = 4 battle = attack['battle'] track = Sequence(teleportIn(attack, toon)) def face90(target, toon, battle): vec = Point3(target.getPos(battle) - toon.getPos(battle)) vec.setZ(0) temp = vec[0] vec.setX(-vec[1]) vec.setY(temp) targetPoint = Point3(toon.getPos(battle) + vec) toon.headsUp(battle, targetPoint) delay = 2.5 effectTrack = Sequence() for target in targets: sprayEffect = BattleParticles.createParticleEffect(file='pixieSpray') dropEffect = BattleParticles.createParticleEffect(file='pixieDrop') explodeEffect = BattleParticles.createParticleEffect(file='pixieExplode') poofEffect = BattleParticles.createParticleEffect(file='pixiePoof') wallEffect = BattleParticles.createParticleEffect(file='pixieWall') mtrack = Parallel(__getPartTrack(sprayEffect, 1.5, 0.5, [sprayEffect, toon, 0]), __getPartTrack(dropEffect, 1.9, 2.0, [dropEffect, target, 0]), __getPartTrack(explodeEffect, 2.7, 1.0, [explodeEffect, toon, 0]), __getPartTrack(poofEffect, 3.4, 1.0, [poofEffect, target, 0]), __getPartTrack(wallEffect, 4.05, 1.2, [wallEffect, toon, 0]), __getSoundTrack(level, 2, duration=3.1, node=toon), Sequence(Func(face90, target, toon, battle), ActorInterval(toon, 'sprinkle-dust')), Sequence(Wait(delay), Func(__healToon, target, hp))) effectTrack.append(mtrack) track.append(effectTrack) track.append(Func(toon.setHpr, Vec3(180.0, 0.0, 0.0))) track.append(teleportOut(attack, toon)) return track
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.mp3") 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 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 shortCircuitTrack(suit, battle): if suit.isHidden(): return Sequence() else: suitTrack = Sequence() suitPos, suitHpr = battle.getActorPosHpr(suit) suitTrack.append(Wait(0.15)) suitTrack.append(Func(MovieUtil.avatarHide, suit)) deathSound = base.loader.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg') deathSoundTrack = Sequence(Wait(0.5), SoundInterval(deathSound, volume=0.8)) BattleParticles.loadParticles() smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall') singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1) smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10) bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles=30) gearPoint = Point3(suitPos.getX(), suitPos.getY(), suitPos.getZ() + suit.height - 0.2) smallGears.setPos(gearPoint) singleGear.setPos(gearPoint) smallGears.setDepthWrite(False) singleGear.setDepthWrite(False) smallGearExplosion.setPos(gearPoint) bigGearExplosion.setPos(gearPoint) smallGearExplosion.setDepthWrite(False) bigGearExplosion.setDepthWrite(False) explosionTrack = Sequence() explosionTrack.append(MovieUtil.createKapowExplosionTrack(battle, explosionPoint=gearPoint)) gears1Track = Sequence(Wait(0.5), ParticleInterval(smallGears, battle, worldRelative=0, duration=1.0, cleanup=True), name='gears1Track') gears2MTrack = Track((0.1, ParticleInterval(singleGear, battle, worldRelative=0, duration=0.4, cleanup=True)), (0.5, ParticleInterval(smallGearExplosion, battle, worldRelative=0, duration=0.5, cleanup=True)), (0.9, ParticleInterval(bigGearExplosion, battle, worldRelative=0, duration=2.0, cleanup=True)), name='gears2MTrack') return Parallel(suitTrack, explosionTrack, deathSoundTrack, gears1Track, gears2MTrack)
def createExplosionTrack(self): if self.explodeTrack and self.explodeTrack.isPlaying(): self.explodeTrack.finish() # Our real actor is going to head back and get ready for the next time he is needed, # so we need to spawn a "LoseActor" in his place. loseActor = self.suit.getLoseActor() loseActor.reparentTo(render) spinningSound = base.loadSfx('phase_3.5/audio/sfx/Cog_Death.ogg') deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg') # Now for our main interval and soundtrack explosionInterval = ActorInterval(loseActor, 'lose', startFrame=0, endFrame=150) deathSoundTrack = Sequence(Wait(0.6), SoundInterval(spinningSound, duration=1.2, startTime=1.5, volume=0.2, node=loseActor), SoundInterval(spinningSound, duration=3.0, startTime=0.6, volume=0.8, node=loseActor), SoundInterval(deathSound, volume=0.32, node=loseActor)) # Next, load the particle effects BattleParticles.loadParticles() smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall') singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1) smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10) bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles=30) gearPoint = Point3(loseActor.getX(), loseActor.getY(), loseActor.getZ()) smallGears.setDepthWrite(False) singleGear.setDepthWrite(False) smallGearExplosion.setDepthWrite(False) bigGearExplosion.setDepthWrite(False) cleanupTrack = Track((6.5, Func(self.suit.cleanupLoseActor))) # Now for the big KAPOW def createKapowExplosionTrack(parent): explosionTrack = Sequence() explosion = loader.loadModel('phase_3.5/models/props/explosion') explosion.setBillboardPointEye() explosion.setDepthWrite(False) explosionPoint = Point3(0, 0, 4.1) explosionTrack.append(Func(explosion.reparentTo, parent)) explosionTrack.append(Func(explosion.setPos, explosionPoint)) explosionTrack.append(Func(explosion.setScale, 0.4)) explosionTrack.append(Wait(0.6)) explosionTrack.append(Func(explosion.removeNode)) return explosionTrack explosionTrack = Sequence() explosionTrack.append(Wait(5.4)) explosionTrack.append(createKapowExplosionTrack(loseActor)) gears1Track = Sequence(Wait(2.0), ParticleInterval(smallGears, loseActor, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track') gears2MTrack = Track((0.0, explosionTrack), (0.7, ParticleInterval(singleGear, loseActor, worldRelative=0, duration=5.7, cleanup=True)), (5.2, ParticleInterval(smallGearExplosion, loseActor, worldRelative=0, duration=1.2, cleanup=True)), (5.4, ParticleInterval(bigGearExplosion, loseActor, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack') # Let's tie it all together. self.explodeTrack = Sequence(Parallel(explosionInterval, deathSoundTrack, gears1Track, gears2MTrack, cleanupTrack)) self.explodeTrack.start()
def __init__(self, parent=hidden, wantParticles=1): """__init()""" # Initialize the superclass NodePath.__init__(self, parent) # Create a toplevel node to hold splash effects self.assign(parent.attachNewNode('splash')) # Load up a copy of the splash actor self.splashdown = globalPropPool.getProp('splashdown') self.splashdown.reparentTo(self) self.splashdown.setZ(-0.01) self.splashdown.setScale(0.4) # Adjust transparency of splash to use MBinary ta = TransparencyAttrib.make(TransparencyAttrib.MBinary) self.splashdown.node().setAttrib(ta, 1) self.splashdown.setBin('fixed', 130, 1) # Add in a ripple effect self.ripples = Ripples(self) self.ripples.setBin('fixed', 120, 1) # Add some particles self.wantParticles = wantParticles 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') # Track for playing back splash effect self.track = None self.trackId = Splash.splashCount Splash.splashCount += 1 self.setBin('fixed', 100, 1) # Start out hidden self.hide()
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.mp3') 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()
def enterFinaleBrainstormAttack(self, offset): if Vec3(base.localAvatar.getPos(self)).length() <= 40: # Currently, the cloud only forms over the local toon. # Preferably it would form over all toons in the area, but I'm not sure how to go about doing that. # That may not be good for performance either. braincloud = BattleProps.globalPropPool.getProp('stormcloud') braincloud.reparentTo(base.localAvatar) braincloud.setScale(0) braincloud.setZ(6) brainstorm = BattleParticles.createParticleEffect(name='BrainStorm') brainstorm.setDepthWrite(False) def __checkNearCloud(task): if Vec3(base.localAvatar.getPos(braincloud)).length() <= 5: self.applyShakeAttack(base.localAvatar, SafezoneInvasionGlobals.FinaleSuitAttackDamage) self.finaleBrainstormSequence = Sequence( braincloud.scaleInterval(3, (3.5, 3.5, 2.5)), Parallel( Func(base.playSfx, self.brainstormSfx), Func(braincloud.wrtReparentTo, render), ParticleInterval(brainstorm, braincloud, worldRelative=0, duration=4.3, cleanup=True) ), Wait(1), braincloud.scaleInterval(1, (0.0, 0.0, 0.0)), ) taskMgr.doMethodLater(4, __checkNearCloud, 'CheckNearBraincloud') self.finaleBrainstormSequence.setT(offset) self.finaleBrainstormSequence.start() self.play('effort')
def __createToonInterval(sound, delay, toon, operaInstrument = None): isNPC = 0 if sound.get('npc'): isNPC = 1 battle = sound['battle'] hasLuredSuits = __hasLuredSuits(sound) if not isNPC: oldPos, oldHpr = battle.getActorPosHpr(toon) newPos = Point3(oldPos) newPos.setY(newPos.getY() - DISTANCE_TO_WALK_BACK) retval = Sequence(Wait(delay)) if DISTANCE_TO_WALK_BACK and hasLuredSuits and not isNPC: retval.append(Parallel(ActorInterval(toon, 'walk', startTime=1, duration=TIME_TO_WALK_BACK, endTime=0.0001), LerpPosInterval(toon, TIME_TO_WALK_BACK, newPos, other=battle))) if operaInstrument: sprayEffect = BattleParticles.createParticleEffect(file='soundWave') sprayEffect.setDepthWrite(0) sprayEffect.setDepthTest(0) sprayEffect.setTwoSided(1) I1 = 2.8 retval.append(ActorInterval(toon, 'sound', playRate=1.0, startTime=0.0, endTime=I1)) retval.append(Func(setPosFromOther, sprayEffect, operaInstrument, Point3(0, 1.6, -0.18))) retval.append(__getPartTrack(sprayEffect, 0.0, 6.0, [sprayEffect, toon, 0], softStop=-3.5)) retval.append(ActorInterval(toon, 'sound', playRate=1.0, startTime=I1)) else: retval.append(ActorInterval(toon, 'sound')) if DISTANCE_TO_WALK_BACK and hasLuredSuits and not isNPC: retval.append(Parallel(ActorInterval(toon, 'walk', startTime=0.0001, duration=TIME_TO_WALK_BACK, endTime=1), LerpPosInterval(toon, TIME_TO_WALK_BACK, oldPos, other=battle))) retval.append(Func(toon.loop, 'neutral')) return retval
def enterExplode(self, time): # Are we exploding? self.exploding = True # Lets create a specific actor for the explosion and load the explosion stuff loseActor = self.getLoseActor() loseActor.reparentTo(render) spinningSound = base.loadSfx('phase_3.5/audio/sfx/Cog_Death.ogg') deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg') # We're done with this guy self.stash() # Oh boy, time to load all of our explosion effects! explosionInterval = ActorInterval(loseActor, 'lose', startFrame=0, endFrame=150) deathSoundTrack = Sequence(Wait(0.6), SoundInterval(spinningSound, duration=1.2, startTime=1.5, volume=0.2, node=loseActor), SoundInterval(spinningSound, duration=3.0, startTime=0.6, volume=0.8, node=loseActor), SoundInterval(deathSound, volume=0.32, node=loseActor)) # Load the particles for the explosion BattleParticles.loadParticles() smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall') singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1) smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10) bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles=30) gearPoint = Point3(loseActor.getX(), loseActor.getY(), loseActor.getZ()) smallGears.setDepthWrite(False) singleGear.setDepthWrite(False) smallGearExplosion.setDepthWrite(False) bigGearExplosion.setDepthWrite(False) # Create the explosion track explosionTrack = Sequence() explosionTrack.append(Wait(5.4)) explosionTrack.append(self.createKapowExplosionTrack(loseActor)) gears1Track = Sequence(Wait(2.0), ParticleInterval(smallGears, loseActor, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track') gears2MTrack = Track((0.0, explosionTrack), (0.7, ParticleInterval(singleGear, loseActor, worldRelative=0, duration=5.7, cleanup=True)), (5.2, ParticleInterval(smallGearExplosion, loseActor, worldRelative=0, duration=1.2, cleanup=True)), (5.4, ParticleInterval(bigGearExplosion, loseActor, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack') # Cleanup cleanupTrack = Track((6.5, Func(self.cleanupLoseActor))) # Better delete the poor guy when we're done # Blow the sucker up self.explodeTrack = Sequence(Parallel(explosionInterval, deathSoundTrack, gears1Track, gears2MTrack)) self.explodeTrack.delayDelete = DelayDelete(self, 'cleanupExplode') self.explodeTrack.append(Func(self.explodeTrack.delayDelete.destroy)) self.explodeTrack.start() self.explodeTrack.setT(time)
def setHillType(self, type): if self.isUp: if (self.hillType == MoleFieldBase.HILL_MOLE or type == MoleFieldBase.HILL_BOMB or self.hillType == MoleFieldBase.HILL_BOMB) and type == MoleFieldBase.HILL_MOLE: return None self.hillType = type self.moleHead.remove() 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.7000000000000002, cleanup = True)), (0.0, ParticleInterval(smallGearExplosion, self.hill, worldRelative = 0, duration = 1.2, cleanup = True)), (0.29999999999999999, ParticleInterval(bigGearExplosion, self.hill, worldRelative = 0, duration = 1.0, cleanup = True)), name = 'gears2MTrack') gears2MTrack.start() self.popIval = Sequence(Parallel(Sequence(LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.28000000000000003, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.23000000000000001, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.28000000000000003)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.34999999999999998, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.28000000000000003, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.31, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.32000000000000001, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.47999999999999998)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.28000000000000003, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.28999999999999998, 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.050000000000000003, Point3(0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.13, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17999999999999999)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.14999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.17999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.11, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.12, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17999999999999999)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.13, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.14999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17999999999999999)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.16, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.17999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.11, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, -0.17999999999999999, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(0.0, 0.0, 0.17000000000000001)), LerpPosInterval(self.moleHead, 0.050000000000000003, Point3(-0.17999999999999999, 0.0, 0.0)), LerpPosInterval(self.moleHead, 0.050000000000000003, 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)
def createSuitDeathTrack(suit, toon, battle, npcs = [], headless = False): suitTrack = Sequence() suitPos, suitHpr = battle.getActorPosHpr(suit) if hasattr(suit, 'battleTrapProp') and suit.battleTrapProp and suit.battleTrapProp.getName() == 'traintrack' and not suit.battleTrapProp.isHidden(): suitTrack.append(createTrainTrackAppearTrack(suit, toon, battle, npcs)) deathSuit = suit.getLoseActor(headless=headless) deathSuit.setBlend(frameBlend=base.wantSmoothAnims) suitTrack.append(Func(notify.debug, 'before insertDeathSuit')) suitTrack.append(Func(insertDeathSuit, suit, deathSuit, battle, suitPos, suitHpr)) suitTrack.append(Func(notify.debug, 'before actorInterval lose')) suitTrack.append(ActorInterval(deathSuit, 'lose', duration=SUIT_LOSE_DURATION)) suitTrack.append(Func(notify.debug, 'before removeDeathSuit')) suitTrack.append(Func(removeDeathSuit, suit, deathSuit, name='remove-death-suit')) suitTrack.append(Func(notify.debug, 'after removeDeathSuit')) spinningSound = base.loader.loadSfx('phase_3.5/audio/sfx/Cog_Death.ogg') deathSound = base.loader.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg') deathSoundTrack = Sequence(Wait(0.8), SoundInterval(spinningSound, duration=1.2, startTime=1.5, volume=0.2), SoundInterval(spinningSound, duration=3.0, startTime=0.6, volume=0.8), SoundInterval(deathSound, volume=0.32)) BattleParticles.loadParticles() smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall') singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1) smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10) bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles=30) gearPoint = Point3(suitPos.getX(), suitPos.getY(), suitPos.getZ() + suit.height - 0.2) smallGears.setPos(gearPoint) singleGear.setPos(gearPoint) smallGears.setDepthWrite(False) singleGear.setDepthWrite(False) smallGearExplosion.setPos(gearPoint) bigGearExplosion.setPos(gearPoint) smallGearExplosion.setDepthWrite(False) bigGearExplosion.setDepthWrite(False) explosionTrack = Sequence() explosionTrack.append(Wait(5.4)) explosionTrack.append(createKapowExplosionTrack(battle, explosionPoint=gearPoint)) gears1Track = Sequence(Wait(2.1), ParticleInterval(smallGears, battle, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track') gears2MTrack = Track((0.0, explosionTrack), (0.7, ParticleInterval(singleGear, battle, worldRelative=0, duration=5.7, cleanup=True)), (5.2, ParticleInterval(smallGearExplosion, battle, worldRelative=0, duration=1.2, cleanup=True)), (5.4, ParticleInterval(bigGearExplosion, battle, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack') toonMTrack = Parallel(name='toonMTrack') for mtoon in battle.toons: toonMTrack.append(Sequence(Wait(1.0), ActorInterval(mtoon, 'duck'), ActorInterval(mtoon, 'duck', startTime=1.8), Func(mtoon.loop, 'neutral'))) for mtoon in npcs: toonMTrack.append(Sequence(Wait(1.0), ActorInterval(mtoon, 'duck'), ActorInterval(mtoon, 'duck', startTime=1.8), Func(mtoon.loop, 'neutral'))) return Parallel(suitTrack, deathSoundTrack, gears1Track, gears2MTrack, toonMTrack)
def __getSuitTrack(sound, lastSoundThatHit, delay, hitCount, targets, totalDamage, hpbonus, toon, npcs): tracks = Parallel() attacks = 0 uberDelay = 0.0 isUber = 0 if sound['level'] >= ToontownBattleGlobals.UBER_GAG_LEVEL_INDEX: uberDelay = 3.0 isUber = 1 for target in targets: suit = target['suit'] if totalDamage > 0 and sound == lastSoundThatHit: hp = target['hp'] died = target['died'] battle = sound['battle'] kbbonus = target['kbbonus'] suitTrack = Sequence() showDamage = Func(suit.showHpText, -totalDamage, openEnded=0) updateHealthBar = Func(suit.updateHealthBar, totalDamage) if isUber: breakEffect = BattleParticles.createParticleEffect(file='soundBreak') breakEffect.setDepthWrite(0) breakEffect.setDepthTest(0) breakEffect.setTwoSided(1) soundEffect = globalBattleSoundCache.getSound(hitSoundFiles[0]) suitTrack.append(Wait(delay + tSuitReact)) if isUber: delayTime = random.random() suitTrack.append(Wait(delayTime + 2.0)) suitTrack.append(Func(setPosFromOther, breakEffect, suit, Point3(0, 0.0, suit.getHeight() - 1.0))) #suitTrack.append(Parallel(showDamage, updateHealthBar, SoundInterval(soundEffect, node=suit), __getPartTrack(breakEffect, 0.0, 1.0, [breakEffect, suit, 0], softStop=-0.5))) THIS CRASHES PANDA WITH A BOUNDING SPHERE ERROR suitTrack.append(Sequence(showDamage, updateHealthBar, SoundInterval(soundEffect, node=suit))) if died and not suit.getSkelecog(): suitTrack.append(headExplodeTrack(suit, battle)) else: suitTrack.append(showDamage) suitTrack.append(updateHealthBar) if hitCount == 1: suitTrack.append(Parallel(ActorInterval(suit, 'squirt-small-react'), MovieUtil.createSuitStunInterval(suit, 0.5, 1.8))) else: suitTrack.append(ActorInterval(suit, 'squirt-small-react')) if kbbonus == 0: suitTrack.append(__createSuitResetPosTrack(suit, battle)) suitTrack.append(Func(battle.unlureSuit, suit)) bonusTrack = None if hpbonus > 0: bonusTrack = Sequence(Wait(delay + tSuitReact + delay + 0.75 + uberDelay), Func(suit.showHpText, -hpbonus, 1, openEnded=0), Func(suit.updateHealthBar, hpbonus)) suitTrack.append(Func(suit.loop, 'neutral')) if bonusTrack == None: tracks.append(suitTrack) else: tracks.append(Parallel(suitTrack, bonusTrack)) elif totalDamage <= 0: tracks.append(Sequence(Wait(2.9), Func(MovieUtil.indicateMissed, suit, 1.0))) tracks.append(MovieUtil.createSuitTeaseMultiTrack(suit, delay + tSuitReact)) return tracks
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 enterExplode(self, time): self.exploding = True loseActor = self.getLoseActor() loseActor.reparentTo(render) spinningSound = base.loader.loadSfx('phase_3.5/audio/sfx/Cog_Death.ogg') deathSound = base.loader.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg') self.stashed = True self.stash() if base.localAvatar.yesmanTeaser == 1: explosionInterval = ActorInterval(loseActor, 'lose') else: explosionInterval = ActorInterval(loseActor, 'lose', startFrame=0, endFrame=150) deathSoundTrack = Sequence(Wait(0.6), SoundInterval(spinningSound, duration=1.2, startTime=1.5, volume=0.2), SoundInterval(spinningSound, duration=3.0, startTime=0.6, volume=0.8), SoundInterval(deathSound, volume=0.32)) BattleParticles.loadParticles() smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall') singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1) smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10) bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles=30) gearPoint = Point3(loseActor.getX(), loseActor.getY(), loseActor.getZ()) smallGears.setDepthWrite(False) singleGear.setDepthWrite(False) smallGearExplosion.setDepthWrite(False) bigGearExplosion.setDepthWrite(False) explosionTrack = Sequence() explosionTrack.append(Wait(5.4)) explosionTrack.append(self.createKapowExplosionTrack(loseActor)) gears1Track = Sequence(Wait(2.0), ParticleInterval(smallGears, loseActor, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track') gears2MTrack = Track((0.0, explosionTrack), (0.7, ParticleInterval(singleGear, loseActor, worldRelative=0, duration=5.7, cleanup=True)), (5.2, ParticleInterval(smallGearExplosion, loseActor, worldRelative=0, duration=1.2, cleanup=True)), (5.4, ParticleInterval(bigGearExplosion, loseActor, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack') if base.localAvatar.yesmanTeaser == 1: cleanupTrack = Track((8.5, Func(self.cleanupLoseActor))) else: cleanupTrack = Track((6.5, Func(self.cleanupLoseActor))) self.explodeTrack = Sequence(Parallel(explosionInterval, deathSoundTrack, gears1Track, gears2MTrack, cleanupTrack)) self.explodeTrack.delayDelete = DelayDelete(self, 'cleanupExplode') self.explodeTrack.append(Func(self.explodeTrack.delayDelete.destroy)) self.explodeTrack.start() self.explodeTrack.setT(time)
def makeSynergyTrack(self): particleEffect = BattleParticles.createParticleEffect('Synergy') waterfallEffect = BattleParticles.createParticleEffect(file='synergyWaterfall') soundTrack = Sequence( Wait(0.9), SoundInterval(self.synergySfx, node=self.virtualSuit) ) track = Sequence( Parallel( ActorInterval(self.virtualSuit, 'magic3'), Track( (0.0, Func(self.sayFaceoffTaunt)), (0.1, ParticleInterval(waterfallEffect, self.virtualSuit, worldRelative=0, duration=1.9, cleanup=True)), (0.2, ParticleInterval(particleEffect, self.virtualSuit, worldRelative=0, duration=1.9, cleanup=True)), (0.5, Func(self.synergyColl.unstash)), ), soundTrack ), Func(self.synergyColl.stash), Func(self.virtualSuit.setHpr, 0, 0, 0), Func(self.virtualSuit.loop, 'walk', 0), ) return track
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.mp3') 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
def enterFinaleBrainstormAttack(self, offset): if Vec3(base.localAvatar.getPos(self)).length() <= 40: braincloud = BattleProps.globalPropPool.getProp('stormcloud') braincloud.reparentTo(base.localAvatar) braincloud.setScale(0) braincloud.setZ(6) brainstorm = BattleParticles.createParticleEffect(name='BrainStorm') brainstorm.setDepthWrite(False) def __checkNearCloud(task): if Vec3(base.localAvatar.getPos(braincloud)).length() <= 5: self.applyShakeAttack(base.localAvatar, SafezoneInvasionGlobals.FinaleSuitAttackDamage) self.finaleBrainstormSequence = Sequence(braincloud.scaleInterval(3, (3.5, 3.5, 2.5)), Parallel(Func(base.playSfx, self.brainstormSfx), Func(braincloud.wrtReparentTo, render), ParticleInterval(brainstorm, braincloud, worldRelative=0, duration=4.3, cleanup=True)), Wait(1), braincloud.scaleInterval(1, (0.0, 0.0, 0.0))) taskMgr.doMethodLater(4, __checkNearCloud, 'CheckNearBraincloud') self.finaleBrainstormSequence.setT(offset) self.finaleBrainstormSequence.start() self.play('effort')
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()
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()
def __createThrownTrapMultiTrack(trap, propList, propName, propPos=None, propHpr=None, anim=0, explode=0): toon = trap['toon'] level = trap['level'] battle = trap['battle'] target = trap['target'] suit = target[0]['suit'] targetPos = suit.getPos(battle) thrownProp = propList[0] unthrownProp = propList[1] torso = toon.style.torso torso = torso[0] if torso == 'l': throwDelay = 2.3 elif torso == 'm': throwDelay = 2.3 else: throwDelay = 1.9 throwDuration = 0.9 animBreakPoint = throwDelay + throwDuration animDelay = 3.1 trapTrack = ToontownBattleGlobals.TRAP_TRACK trapTrackNames = ToontownBattleGlobals.AvProps[trapTrack] trapName = trapTrackNames[level] hands = toon.getRightHands() propTrack = Sequence() if propPos and propHpr: propTrack.append( Func(MovieUtil.showProps, propList, hands, propPos, propHpr)) else: propTrack.append(Func(MovieUtil.showProps, propList, hands)) if anim == 1: pTracks = Parallel() for prop in propList: pTracks.append( ActorInterval(prop, propName, duration=animBreakPoint)) propTrack.append(pTracks) throwTrack = Sequence() throwTrack.append(Wait(throwDelay)) throwTrack.append(Func(unthrownProp.reparentTo, hidden)) throwTrack.append(Func(toon.update)) if suit.battleTrap != NO_TRAP: notify.debug('trapSuit() - trap: %d destroyed existing trap: %d' % (level, suit.battleTrap)) battle.removeTrap(suit) if trapName == 'rake': trapProp = globalPropPool.getProp('rake-react') else: trapProp = MovieUtil.copyProp(thrownProp) suit.battleTrapProp = trapProp suit.battleTrap = level suit.battleTrapIsFresh = 1 if trapName == 'banana': trapPoint, trapHpr = battle.getActorPosHpr(suit) trapPoint.setY(MovieUtil.SUIT_TRAP_DISTANCE) slidePoint = Vec3(trapPoint.getX(), trapPoint.getY() - 2, trapPoint.getZ()) throwingTrack = createThrowingTrack(thrownProp, slidePoint, duration=0.9, parent=battle) moveTrack = LerpPosInterval(thrownProp, 0.8, pos=trapPoint, other=battle) animTrack = ActorInterval(thrownProp, propName, startTime=animBreakPoint) slideTrack = Parallel(moveTrack, animTrack) motionTrack = Sequence(throwingTrack, slideTrack) hprTrack = LerpHprInterval(thrownProp, 1.7, hpr=Point3(0, 0, 0)) soundTrack = getSoundTrack('TL_banana.ogg', node=toon) scaleTrack = LerpScaleInterval(thrownProp, 1.7, scale=MovieUtil.PNT3_ONE) throwTrack.append(Wait(0.25)) throwTrack.append(Func(thrownProp.wrtReparentTo, suit)) throwTrack.append( Parallel(motionTrack, hprTrack, scaleTrack, soundTrack)) elif trapName == 'tnt': trapPoint, trapHpr = battle.getActorPosHpr(suit) trapPoint.setY(MovieUtil.SUIT_TRAP_TNT_DISTANCE - 3.9) trapPoint.setZ(trapPoint.getZ() + 0.4) throwingTrack = createThrowingTrack(thrownProp, trapPoint, duration=throwDuration, parent=battle) hprTrack = LerpHprInterval(thrownProp, 0.9, hpr=Point3(0, 90, 0)) scaleTrack = LerpScaleInterval(thrownProp, 0.9, scale=MovieUtil.PNT3_ONE) soundTrack = getSoundTrack('TL_dynamite.ogg', delay=0.8, duration=0.7, node=suit) throwTrack.append(Wait(0.2)) throwTrack.append( Parallel(throwingTrack, hprTrack, scaleTrack, soundTrack)) elif trapName == 'marbles': trapPoint, trapHpr = battle.getActorPosHpr(suit) trapPoint.setY(MovieUtil.SUIT_TRAP_MARBLES_DISTANCE) flingDuration = 0.2 rollDuration = 1.0 throwDuration = flingDuration + rollDuration landPoint = Point3(0, trapPoint.getY() + 2, trapPoint.getZ()) throwPoint = Point3(0, trapPoint.getY(), trapPoint.getZ()) moveTrack = Sequence( Func(thrownProp.wrtReparentTo, suit), Func(thrownProp.setHpr, Point3(94, 0, 0)), LerpPosInterval(thrownProp, flingDuration, pos=landPoint, other=suit), LerpPosInterval(thrownProp, rollDuration, pos=throwPoint, other=suit)) animTrack = ActorInterval(thrownProp, propName, startTime=throwDelay + 0.9) scaleTrack = LerpScaleInterval(thrownProp, throwDuration, scale=MovieUtil.PNT3_ONE) soundTrack = getSoundTrack('TL_marbles.ogg', delay=0.1, node=toon) throwTrack.append(Wait(0.2)) throwTrack.append( Parallel(moveTrack, animTrack, scaleTrack, soundTrack)) elif trapName == 'rake': trapPoint, trapHpr = battle.getActorPosHpr(suit) trapPoint.setY(MovieUtil.SUIT_TRAP_RAKE_DISTANCE) throwDuration = 1.1 throwingTrack = createThrowingTrack(thrownProp, trapPoint, duration=throwDuration, parent=suit) hprTrack = LerpHprInterval(thrownProp, throwDuration, hpr=VBase3(63.43, -90.0, 63.43)) scaleTrack = LerpScaleInterval(thrownProp, 0.9, scale=Point3(0.7, 0.7, 0.7)) soundTrack = SoundInterval( globalBattleSoundCache.getSound('TL_rake_throw_only.ogg'), duration=1.1, node=suit) throwTrack.append(Wait(0.2)) throwTrack.append( Parallel(throwingTrack, hprTrack, scaleTrack, soundTrack)) else: notify.warning( '__createThrownTrapMultiTrack() - Incorrect trap: %s thrown from toon' % trapName) def placeTrap(trapProp, suit, battle=battle, trapName=trapName): if not trapProp or trapProp.isEmpty(): return trapProp.wrtReparentTo(suit) trapProp.show() if trapName == 'rake': trapProp.setPos(0, MovieUtil.SUIT_TRAP_RAKE_DISTANCE, 0) trapProp.setHpr(Point3(0, 270, 0)) trapProp.setScale(Point3(0.7, 0.7, 0.7)) rakeOffset = MovieUtil.getSuitRakeOffset(suit) trapProp.setY(trapProp.getY() + rakeOffset) elif trapName == 'banana': trapProp.setHpr(0, 0, 0) trapProp.setPos(0, MovieUtil.SUIT_TRAP_DISTANCE, -0.35) trapProp.pose(trapName, trapProp.getNumFrames(trapName) - 1) elif trapName == 'marbles': trapProp.setHpr(Point3(94, 0, 0)) trapProp.setPos(0, MovieUtil.SUIT_TRAP_MARBLES_DISTANCE, 0) trapProp.pose(trapName, trapProp.getNumFrames(trapName) - 1) elif trapName == 'tnt': trapProp.setHpr(0, 90, 0) trapProp.setPos(0, MovieUtil.SUIT_TRAP_TNT_DISTANCE, 0.4) else: notify.warning( 'placeTrap() - Incorrect trap: %s placed on a suit' % trapName) dustNode = hidden.attachNewNode('DustNode') def placeDustExplosion(dustNode=dustNode, thrownProp=thrownProp, battle=battle): dustNode.reparentTo(battle) dustNode.setPos(thrownProp.getPos(battle)) if explode == 1: throwTrack.append(Func(thrownProp.wrtReparentTo, hidden)) throwTrack.append(Func(placeDustExplosion)) throwTrack.append( createCartoonExplosionTrack(dustNode, 'dust', explosionPoint=Point3(0, 0, 0))) throwTrack.append(Func(battle.removeTrap, suit)) else: throwTrack.append(Func(placeTrap, trapProp, suit)) if trapName == 'tnt': tip = trapProp.find('**/joint_attachEmitter') sparks = BattleParticles.createParticleEffect(file='tnt') trapProp.sparksEffect = sparks throwTrack.append(Func(sparks.start, tip)) throwTrack.append(Func(MovieUtil.removeProps, propList)) toonTrack = Sequence(Func(toon.headsUp, battle, targetPos), ActorInterval(toon, 'toss'), Func(toon.loop, 'neutral')) return Parallel(propTrack, throwTrack, toonTrack)
def doDeathTrack(self): def removeDeathSuit(suit, deathSuit): if (not deathSuit.isEmpty()): deathSuit.detachNode() suit.cleanupLoseActor() # Stop the suit sound 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() # We don't need a collision for the suit, so we reparent it to the deathSuit self.collNodePath.reparentTo(self.deathSuit) treasureSpawnPoint = Point3(self.suit.getX(), self.suit.getY(), self.suit.getZ() + self.suit.height / 2.) gearPoint = Point3(0, 0, self.suit.height / 2. + 2.) spinningSound = base.loader.loadSfx( "phase_3.5/audio/sfx/Cog_Death.mp3") deathSound = base.loader.loadSfx( "phase_3.5/audio/sfx/ENC_cogfall_apart.mp3") 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. else: direction = -1. pos = Point3(self.deathSuit.getX(), self.deathSuit.getY(), self.deathSuit.getZ() + 2. * 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): # Adding a wrapper because I think a particle is trying to get cleaned up twice if particle and hasattr(particle, 'renderParent'): particle.cleanup() del particle removeParticles = Parallel(Func(removeParticle, smallGears), Func(removeParticle, singleGear), Func(removeParticle, smallGearExplosion), Func(removeParticle, bigGearExplosion)) # Spawning the treasure after 1.5 seconds was breaking with multiple clients # and heavy lag. So we are generating the treasure as soon as the cog starts # exploding and we do visual tricks to show it after 2.4 seconds. self.deathTrack = Sequence( Parallel(suitTrack, gears2MTrack, gears1Track, soundTrack), removeParticles, Func(self.destroy)) self.deathTrack.start()
def makeCrunchTrack(self): toonId = self.toon toon = base.cr.doId2do.get(toonId) if not toon: return self.virtualSuit.lookAt(toon) if self.virtualSuit.style.body in ['a', 'b']: throwDelay = 3 elif self.virtualSuit.style.body == 'c': throwDelay = 2.3 else: throwDelay = 2 numberNames = ['one', 'two', 'three', 'four', 'five', 'six'] BattleParticles.loadParticles() numberSpill1 = BattleParticles.createParticleEffect(file='numberSpill') numberSpill2 = BattleParticles.createParticleEffect(file='numberSpill') spillTexture1 = random.choice(numberNames) spillTexture2 = random.choice(numberNames) BattleParticles.setEffectTexture(numberSpill1, 'audit-' + spillTexture1) BattleParticles.setEffectTexture(numberSpill2, 'audit-' + spillTexture2) numberSpillTrack1 = getPartTrack(numberSpill1, 1.1, 2.2, [numberSpill1, self.virtualSuit, 0]) numberSpillTrack2 = getPartTrack(numberSpill2, 1.5, 1.0, [numberSpill2, self.virtualSuit, 0]) numberSprayTracks = Parallel() numOfNumbers = random.randint(5, 9) for i in xrange(0, numOfNumbers - 1): nextSpray = BattleParticles.createParticleEffect( file='numberSpray') nextTexture = random.choice(numberNames) BattleParticles.setEffectTexture(nextSpray, 'audit-' + nextTexture) nextStartTime = random.random() * 0.6 + 3.03 nextDuration = random.random() * 0.4 + 1.4 nextSprayTrack = getPartTrack(nextSpray, nextStartTime, nextDuration, [nextSpray, self.virtualSuit, 0]) numberSprayTracks.append(nextSprayTrack) def throwProp(prop): if not self.virtualSuit: return toon = self.cr.doId2do.get(toonId) if not toon: self.cleanupProp(prop, False) self.finishPropAttack() return self.virtualSuit.lookAt(toon) prop.wrtReparentTo(render) hitPos = toon.getPos() + Vec3(0, 0, 2.5) distance = (prop.getPos() - hitPos).length() speed = 50.0 throwSequence = Sequence( prop.posInterval(distance / speed, hitPos), Func(self.cleanupProp, prop, False)) throwSequence.start() numberTracks = Parallel() for i in xrange(0, numOfNumbers): texture = random.choice(numberNames) next = copyProp(BattleParticles.getParticle('audit-' + texture)) next.reparentTo(self.virtualSuit.getRightHand()) next.setScale(0.01, 0.01, 0.01) next.setColor(Vec4(0.0, 0.0, 0.0, 1.0)) next.setPos(random.random() * 0.6 - 0.3, random.random() * 0.6 - 0.3, random.random() * 0.6 - 0.3) next.setHpr(VBase3(-1.15, 86.58, -76.78)) # Make prop virtual: next.setColorScale(1.0, 0.0, 0.0, 0.8) next.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd)) # Prop collisions: colNode = CollisionNode(self.uniqueName('SuitAttack')) colNode.setTag('damage', str(self.attackInfo[1])) bounds = next.getBounds() center = bounds.getCenter() radius = bounds.getRadius() sphere = CollisionSphere(center.getX(), center.getY(), center.getZ(), radius) sphere.setTangible(0) colNode.addSolid(sphere) colNode.setIntoCollideMask(WallBitmask) next.attachNewNode(colNode) numberTrack = Sequence( Wait(throwDelay), Parallel( LerpScaleInterval(next, 0.6, Point3(1.0, 1.0, 1.0)), Func(throwProp, next), ), ) numberTracks.append(numberTrack) suitTrack = Parallel( Func(self.sayFaceoffTaunt), Sequence(ActorInterval(self.virtualSuit, 'throw-object'), ActorInterval(self.virtualSuit, 'neutral')), ) return Sequence( Parallel(suitTrack, numberSpillTrack1, numberSpillTrack2, numberTracks, numberSprayTracks), Func(self.virtualSuit.loop, 'walk', 0), Func(self.virtualSuit.setHpr, 0, 0, 0), )
def createExplosionTrack(self): if self.explodeTrack and self.explodeTrack.isPlaying(): self.explodeTrack.finish() # Our real actor is going to head back and get ready for the next time he is needed, # so we need to spawn a "LoseActor" in his place. loseActor = self.suit.getLoseActor() loseActor.reparentTo(render) spinningSound = base.loadSfx('phase_3.5/audio/sfx/Cog_Death.ogg') deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg') # Now for our main interval and soundtrack explosionInterval = ActorInterval(loseActor, 'lose', startFrame=0, endFrame=150) deathSoundTrack = Sequence( Wait(0.6), SoundInterval(spinningSound, duration=1.2, startTime=1.5, volume=0.2, node=loseActor), SoundInterval(spinningSound, duration=3.0, startTime=0.6, volume=0.8, node=loseActor), SoundInterval(deathSound, volume=0.32, node=loseActor)) # Next, load the particle effects BattleParticles.loadParticles() smallGears = BattleParticles.createParticleEffect( file='gearExplosionSmall') singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1) smallGearExplosion = BattleParticles.createParticleEffect( 'GearExplosion', numParticles=10) bigGearExplosion = BattleParticles.createParticleEffect( 'BigGearExplosion', numParticles=30) gearPoint = Point3(loseActor.getX(), loseActor.getY(), loseActor.getZ()) smallGears.setDepthWrite(False) singleGear.setDepthWrite(False) smallGearExplosion.setDepthWrite(False) bigGearExplosion.setDepthWrite(False) cleanupTrack = Track((6.5, Func(self.suit.cleanupLoseActor))) # Now for the big KAPOW def createKapowExplosionTrack(parent): explosionTrack = Sequence() explosion = loader.loadModel('phase_3.5/models/props/explosion') explosion.setBillboardPointEye() explosion.setDepthWrite(False) explosionPoint = Point3(0, 0, 4.1) explosionTrack.append(Func(explosion.reparentTo, parent)) explosionTrack.append(Func(explosion.setPos, explosionPoint)) explosionTrack.append(Func(explosion.setScale, 0.4)) explosionTrack.append(Wait(0.6)) explosionTrack.append(Func(explosion.removeNode)) return explosionTrack explosionTrack = Sequence() explosionTrack.append(Wait(5.4)) explosionTrack.append(createKapowExplosionTrack(loseActor)) gears1Track = Sequence(Wait(2.0), ParticleInterval(smallGears, loseActor, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track') gears2MTrack = Track((0.0, explosionTrack), (0.7, ParticleInterval(singleGear, loseActor, worldRelative=0, duration=5.7, cleanup=True)), (5.2, ParticleInterval(smallGearExplosion, loseActor, worldRelative=0, duration=1.2, cleanup=True)), (5.4, ParticleInterval(bigGearExplosion, loseActor, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack') # Let's tie it all together. self.explodeTrack = Sequence( Parallel(explosionInterval, deathSoundTrack, gears1Track, gears2MTrack, cleanupTrack)) self.explodeTrack.start()
def startSparksIval(tntProp): tip = tntProp.find('**/joint_attachEmitter') sparks = BattleParticles.createParticleEffect(file='tnt') return Func(sparks.start, tip)
def doFanfare(delay, toon, panel): fanfareNode = toon.attachNewNode('fanfareNode') partyBall = fanfareNode.attachNewNode('partyBall') headparts = toon.getHeadParts() pos = headparts[2].getPos(fanfareNode) partyBallLeft = globalPropPool.getProp('partyBall') partyBallLeft.reparentTo(partyBall) partyBallLeft.setScale(0.8) partyBallLeft.setH(90) partyBallLeft.setColorScale(1, 0, 0, 0) partyBallRight = globalPropPool.getProp('partyBall') partyBallRight.reparentTo(partyBall) partyBallRight.setScale(0.8) partyBallRight.setH(-90) partyBallRight.setColorScale(1, 1, 0, 0) partyBall.setZ(pos.getZ() + 3.2) ballShake1 = Sequence( Parallel( LerpHprInterval(partyBallLeft, duration=0.2, startHpr=Vec3(90, 0, 0), hpr=Vec3(90, 10, 0), blendType='easeInOut'), LerpHprInterval(partyBallRight, duration=0.2, startHpr=Vec3(-90, 0, 0), hpr=Vec3(-90, -10, 0), blendType='easeInOut')), Parallel( LerpHprInterval(partyBallLeft, duration=0.2, startHpr=Vec3(90, 10, 0), hpr=Vec3(90, -10, 0), blendType='easeInOut'), LerpHprInterval(partyBallRight, duration=0.2, startHpr=Vec3(-90, -10, 0), hpr=Vec3(-90, 10, 0), blendType='easeInOut')), Parallel( LerpHprInterval(partyBallLeft, duration=0.2, startHpr=Vec3(90, -10, 0), hpr=Vec3(90, 0, 0), blendType='easeInOut'), LerpHprInterval(partyBallRight, duration=0.2, startHpr=Vec3(-90, 10, 0), hpr=Vec3(-90, 0, 0), blendType='easeInOut'))) ballShake2 = Sequence( Parallel( LerpHprInterval(partyBallLeft, duration=0.2, startHpr=Vec3(90, 0, 0), hpr=Vec3(90, -10, 0), blendType='easeInOut'), LerpHprInterval(partyBallRight, duration=0.2, startHpr=Vec3(-90, 0, 0), hpr=Vec3(-90, 10, 0), blendType='easeInOut')), Parallel( LerpHprInterval(partyBallLeft, duration=0.2, startHpr=Vec3(90, -10, 0), hpr=Vec3(90, 10, 0), blendType='easeInOut'), LerpHprInterval(partyBallRight, duration=0.2, startHpr=Vec3(-90, 10, 0), hpr=Vec3(-90, -10, 0), blendType='easeInOut')), Parallel( LerpHprInterval(partyBallLeft, duration=0.2, startHpr=Vec3(90, 10, 0), hpr=Vec3(90, 0, 0), blendType='easeInOut'), LerpHprInterval(partyBallRight, duration=0.2, startHpr=Vec3(-90, -10, 0), hpr=Vec3(-90, 0, 0), blendType='easeInOut'))) openBall = Parallel( LerpHprInterval(partyBallLeft, duration=0.2, startHpr=Vec3(90, 0, 0), hpr=Vec3(90, 30, 0)), LerpHprInterval(partyBallRight, duration=0.2, startHpr=Vec3(-90, 0, 0), hpr=Vec3(-90, 30, 0))) confettiNode = fanfareNode.attachNewNode('confetti') confettiNode.setScale(3) confettiNode.setZ(pos.getZ() + 2.5) def longshake(models, num, duration): inShake = getScaleBlendIntervals(models, duration=duration, startScale=0.23, endScale=0.2, blendType='easeInOut') outShake = getScaleBlendIntervals(models, duration=duration, startScale=0.2, endScale=0.23, blendType='easeInOut') i = 1 seq = Sequence() while i < num: if i % 2 == 0: seq.append(inShake) else: seq.append(outShake) i += 1 return seq def getScaleBlendIntervals(props, duration, startScale, endScale, blendType): tracks = Parallel() for prop in props: tracks.append( LerpScaleInterval(prop, duration, endScale, startScale=startScale, blendType=blendType)) return tracks trumpetNode = fanfareNode.attachNewNode('trumpetNode') trumpet1 = globalPropPool.getProp('bugle') trumpet2 = MovieUtil.copyProp(trumpet1) trumpet1.reparentTo(trumpetNode) trumpet1.setScale(0.2) trumpet1.setPos(2, 2, 1) trumpet1.setHpr(120, 65, 0) trumpet2.reparentTo(trumpetNode) trumpet2.setScale(0.2) trumpet2.setPos(-2, 2, 1) trumpet2.setHpr(-120, 65, 0) trumpetNode.setTransparency(1) trumpetNode.setColor(1, 1, 1, 0) trumpturn1 = LerpHprInterval(trumpet1, duration=4, startHpr=Vec3(80, 15, 0), hpr=Vec3(150, 40, 0)) trumpturn2 = LerpHprInterval(trumpet2, duration=4, startHpr=Vec3(-80, 15, 0), hpr=Vec3(-150, 40, 0)) trumpetTurn = Parallel(trumpturn1, trumpturn2) BattleParticles.loadParticles() confettiBlue = BattleParticles.createParticleEffect('Confetti') confettiBlue.reparentTo(confettiNode) blue_p0 = confettiBlue.getParticlesNamed('particles-1') blue_p0.renderer.getColorInterpolationManager().addConstant( 0.0, 1.0, Vec4(0.0, 0.0, 1.0, 1.0), 1) confettiYellow = BattleParticles.createParticleEffect('Confetti') confettiYellow.reparentTo(confettiNode) yellow_p0 = confettiYellow.getParticlesNamed('particles-1') yellow_p0.renderer.getColorInterpolationManager().addConstant( 0.0, 1.0, Vec4(1.0, 1.0, 0.0, 1.0), 1) confettiRed = BattleParticles.createParticleEffect('Confetti') confettiRed.reparentTo(confettiNode) red_p0 = confettiRed.getParticlesNamed('particles-1') red_p0.renderer.getColorInterpolationManager().addConstant( 0.0, 1.0, Vec4(1.0, 0.0, 0.0, 1.0), 1) trumpetsAppear = LerpColorInterval(trumpetNode, 0.3, startColor=Vec4(1, 1, 0, 0), color=Vec4(1, 1, 0, 1)) trumpetsVanish = LerpColorInterval(trumpetNode, 0.3, startColor=Vec4(1, 1, 0, 1), color=Vec4(1, 1, 0, 0)) crabHorn = globalBattleSoundCache.getSound('King_Crab.ogg') drumroll = globalBattleSoundCache.getSound('SZ_MM_drumroll.ogg') fanfare = globalBattleSoundCache.getSound('SZ_MM_fanfare.ogg') crabHorn.setTime(1.5) partyBall.setTransparency(1) partyBall.setColorScale(1, 1, 1, 1) ballAppear = Parallel( LerpColorScaleInterval(partyBallLeft, 0.3, startColorScale=Vec4(1, 0, 0, 0), colorScale=Vec4(1, 0, 0, 1)), LerpColorScaleInterval(partyBallRight, 0.3, startColorScale=Vec4(1, 1, 0, 0), colorScale=Vec4(1, 1, 0, 1))) ballVanish = Parallel( LerpColorScaleInterval(partyBallLeft, 0.3, startColorScale=Vec4(1, 0, 0, 1), colorScale=Vec4(1, 0, 0, 0)), LerpColorScaleInterval(partyBallRight, 0.3, startColorScale=Vec4(1, 1, 0, 1), colorScale=Vec4(1, 1, 0, 0))) play = Parallel( SoundInterval(crabHorn, startTime=1.5, duration=4.0, node=toon), Sequence(Wait(0.25), longshake([trumpet1, trumpet2], 3, 0.2), Wait(0.5), longshake([trumpet1, trumpet2], 3, 0.2), Wait(0.5), longshake([trumpet1, trumpet2], 9, 0.1), longshake([trumpet1, trumpet2], 3, 0.2))) killParticles = Parallel(Func(blue_p0.setLitterSize, 0), Func(red_p0.setLitterSize, 0), Func(yellow_p0.setLitterSize, 0)) p = Parallel( ParticleInterval(confettiBlue, confettiNode, worldRelative=0, duration=3, cleanup=True), ParticleInterval(confettiRed, confettiNode, worldRelative=0, duration=3, cleanup=True), ParticleInterval(confettiYellow, confettiNode, worldRelative=0, duration=3, cleanup=True)) pOff = Parallel(Func(confettiBlue.remove), Func(confettiRed.remove), Func(confettiYellow.remove)) partInterval = Parallel( p, Sequence(Wait(1.7), killParticles, Wait(1.3), pOff, Func(p.finish)), Sequence(Wait(3), Parallel(ballVanish))) seq1 = Parallel( Sequence(Wait(delay + 4.1), SoundInterval(drumroll, node=toon), Wait(0.25), SoundInterval(fanfare, node=toon)), Sequence(Wait(delay), trumpetsAppear, Wait(3), ballAppear, Wait(0.5), ballShake1, Wait(0.1), ballShake2, Wait(0.2), Wait(0.1), Parallel(openBall, partInterval), Func(fanfareNode.remove))) seq = Parallel( seq1, Sequence(Wait(delay), Parallel(trumpetTurn, Sequence(Wait(0.5), play)), Wait(0.5), trumpetsVanish)) if panel != None: return (seq, panel) return (seq, None)
def __init__(self, model, pos, serialNum, gameId, penalty=False): # there are going to be MANY (~650) of these created and destroyed # all at once for 4-player games; make it lean self.serialNum = serialNum self.penalty = penalty # the fruit has a bit of height, lets recenter 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) # real assets have bottom at zero self.notify.debug('newPos = %s' % self.nodePath.getPos()) #self.nodePath.setScale(1.0) #if self.penalty: # self.nodePath.setColorScale(0.5,0.5,0.5,1.0) # Make a sphere, name it uniquely, and child it # to the nodepath. 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) # Make the sphere intangible 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 # Add a hook looking for collisions with localToon #self.accept('enter' + self.sphereName, self.__handleEnterSphere) # now that the treasure and sphere have been placed, flatten the # whole silly thing # self.nodePath.flattenLight() if self.penalty: #self.nodePath.setScale(1,1,0.5) self.tip = self.nodePath.find('**/fusetip') #self.tip.setX(2) #self.tip.setY(0.5) #self.tip.setZ(1.5) sparks = BattleParticles.createParticleEffect(file='icetnt') self.sparksEffect = sparks sparks.start(self.tip) self.penaltyGrabSound = loader.loadSfx( "phase_4/audio/sfx/MG_cannon_fire_alt.mp3") 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.hide() self.kaboom.setScale(2.0) self.kaboom.setBillboardPointEye()
def __doStormCloud(squirt, delay, fShowStun): toon = squirt['toon'] level = squirt['level'] hpbonus = squirt['hpbonus'] target = squirt['target'] suit = target['suit'] hp = target['hp'] kbbonus = target['kbbonus'] died = target['died'] revived = target['revived'] leftSuits = target['leftSuits'] rightSuits = target['rightSuits'] battle = squirt['battle'] suitPos = suit.getPos(battle) origHpr = toon.getHpr(battle) hitSuit = hp > 0 scale = sprayScales[level] tButton = 0.0 dButtonScale = 0.5 dButtonHold = 3.0 tContact = 2.9 tSpray = 1 tSuitDodges = 1.8 tracks = Parallel() soundTrack = __getSoundTrack(level, hitSuit, 2.3, toon) soundTrack2 = __getSoundTrack(level, hitSuit, 4.6, toon) tracks.append(soundTrack) tracks.append(soundTrack2) button = globalPropPool.getProp('button') button2 = MovieUtil.copyProp(button) buttons = [button, button2] hands = toon.getLeftHands() toonTrack = Sequence(Func(MovieUtil.showProps, buttons, hands), Func(toon.headsUp, battle, suitPos), ActorInterval(toon, 'pushbutton'), Func(MovieUtil.removeProps, buttons), Func(toon.loop, 'neutral'), Func(toon.setHpr, battle, origHpr)) tracks.append(toonTrack) cloud = globalPropPool.getProp('stormcloud') cloud2 = MovieUtil.copyProp(cloud) BattleParticles.loadParticles() trickleEffect = BattleParticles.createParticleEffect( file='trickleLiquidate') rainEffect = BattleParticles.createParticleEffect(file='liquidate') rainEffect2 = BattleParticles.createParticleEffect(file='liquidate') rainEffect3 = BattleParticles.createParticleEffect(file='liquidate') cloudHeight = suit.height + 3 cloudPosPoint = Point3(0, 0, cloudHeight) scaleUpPoint = Point3(3, 3, 3) rainEffects = [rainEffect, rainEffect2, rainEffect3] rainDelay = 1 effectDelay = 0.3 if hp > 0: cloudHold = 4.7 else: cloudHold = 1.7 def getCloudTrack(cloud, suit, cloudPosPoint, scaleUpPoint, rainEffects, rainDelay, effectDelay, cloudHold, useEffect, battle=battle, trickleEffect=trickleEffect): track = Sequence( Func(MovieUtil.showProp, cloud, suit, cloudPosPoint), Func(cloud.pose, 'stormcloud', 0), LerpScaleInterval(cloud, 1.5, scaleUpPoint, startScale=MovieUtil.PNT3_NEARZERO), Wait(rainDelay)) if useEffect == 1: ptrack = Parallel() delay = trickleDuration = cloudHold * 0.25 trickleTrack = Sequence( Func(battle.movie.needRestoreParticleEffect, trickleEffect), ParticleInterval(trickleEffect, cloud, worldRelative=0, duration=trickleDuration, cleanup=True), Func(battle.movie.clearRestoreParticleEffect, trickleEffect)) track.append(trickleTrack) for i in xrange(0, 3): dur = cloudHold - 2 * trickleDuration ptrack.append( Sequence( Func(battle.movie.needRestoreParticleEffect, rainEffects[i]), Wait(delay), ParticleInterval(rainEffects[i], cloud, worldRelative=0, duration=dur, cleanup=True), Func(battle.movie.clearRestoreParticleEffect, rainEffects[i]))) delay += effectDelay ptrack.append( Sequence( Wait(3 * effectDelay), ActorInterval(cloud, 'stormcloud', startTime=1, duration=cloudHold))) track.append(ptrack) else: track.append( ActorInterval(cloud, 'stormcloud', startTime=1, duration=cloudHold)) track.append(LerpScaleInterval(cloud, 0.5, MovieUtil.PNT3_NEARZERO)) track.append(Func(MovieUtil.removeProp, cloud)) return track tracks.append( getCloudTrack(cloud, suit, cloudPosPoint, scaleUpPoint, rainEffects, rainDelay, effectDelay, cloudHold, useEffect=1)) tracks.append( getCloudTrack(cloud2, suit, cloudPosPoint, scaleUpPoint, rainEffects, rainDelay, effectDelay, cloudHold, useEffect=0)) if hp > 0 or delay <= 0: tracks.append( __getSuitTrack(suit, tContact, tSuitDodges, hp, hpbonus, kbbonus, 'soak', died, leftSuits, rightSuits, battle, toon, fShowStun, beforeStun=2.6, afterStun=2.3, revived=revived)) return tracks
def getAnim(self, anim): ival = None if anim == None: partName = None if self.happy: animName = 'Ff_neutral' else: animName = 'Fb_neutral' if self.raised: ival = ActorInterval(self, animName) else: ival = Parallel(ActorInterval(self, animName, partName=['torso', 'head']), ActorInterval(self, 'Fb_downNeutral', partName='legs')) if not self.forward: ival = Sequence(Func(self.reverseBody), ival, Func(self.forwardBody)) else: if anim == 'down2Up': ival = Parallel(SoundInterval(self.upSfx, node=self), self.getAngryActorInterval('Fb_down2Up')) self.raised = 1 else: if anim == 'up2Down': ival = Parallel(SoundInterval(self.downSfx, node=self), self.getAngryActorInterval('Fb_down2Up', playRate=-1)) self.raised = 0 else: if anim == 'throw': self.doAnimate(None, raised=1, happy=0, queueNeutral=0) ival = Parallel(Sequence(SoundInterval(self.throwSfx, node=self), duration=0), self.getAngryActorInterval('Fb_UpThrow')) else: if anim == 'hit': if self.raised: self.raised = 0 ival = self.getAngryActorInterval('Fb_firstHit') else: ival = self.getAngryActorInterval('Fb_downHit') ival = Parallel(SoundInterval(self.reelSfx, node=self), ival) else: if anim == 'ltSwing' or anim == 'rtSwing': self.doAnimate(None, raised=0, happy=0, queueNeutral=0) if anim == 'ltSwing': ival = Sequence(Track((0, self.getAngryActorInterval('Fb_downLtSwing')), (0.9, SoundInterval(self.swingSfx, node=self)), (1, Func(self.bubbleL.unstash))), Func(self.bubbleL.stash)) else: ival = Sequence(Track((0, self.getAngryActorInterval('Fb_downRtSwing')), (0.9, SoundInterval(self.swingSfx, node=self)), (1, Func(self.bubbleR.unstash))), Func(self.bubbleR.stash)) else: if anim == 'frontAttack': self.doAnimate(None, raised=1, happy=0, queueNeutral=0) pe = BattleParticles.loadParticleFile('bossCogFrontAttack.ptf') ival = Sequence(Func(self.reverseHead), ActorInterval(self, 'Bb2Ff_spin'), Func(self.forwardHead)) if self.forward: ival = Sequence(Func(self.reverseBody), ParallelEndTogether(ival, self.pelvis.hprInterval(0.5, self.pelvisForwardHpr, blendType='easeInOut'))) ival = Sequence(Track((0, ival), (0, SoundInterval(self.spinSfx, node=self)), (0.9, Parallel(SoundInterval(self.rainGearsSfx, node=self), ParticleInterval(pe, self.frontAttack, worldRelative=0, duration=1.5, cleanup=True), duration=0)), (1.9, Func(self.bubbleF.unstash))), Func(self.bubbleF.stash)) self.forward = 1 self.happy = 0 self.raised = 1 else: if anim == 'areaAttack': if self.twoFaced: self.doAnimate(None, raised=1, happy=0, queueNeutral=0) else: self.doAnimate(None, raised=1, happy=1, queueNeutral=1) ival = Parallel(ActorInterval(self, 'Fb_jump'), Sequence(SoundInterval(self.swishSfx, duration=1.1), SoundInterval(self.boomSfx, duration=1.9)), Sequence(Wait(1.21), Func(self.announceAreaAttack))) if self.twoFaced: self.happy = 0 else: self.happy = 1 self.raised = 1 else: if anim == 'Fb_fall': ival = Parallel(ActorInterval(self, 'Fb_fall'), Sequence(SoundInterval(self.reelSfx, node=self), Wait(1.2), SoundInterval(self.deathSfx))) else: if anim == 'death': spinningSound = base.loader.loadSfx('phase_3.5/audio/sfx/Cog_Death.ogg') deathSound = base.loader.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.ogg') deathSoundTrack = Sequence(Wait(0.6), SoundInterval(spinningSound, duration=1.2, startTime=1.5, volume=0.2), SoundInterval(spinningSound, duration=3.0, startTime=0.6, volume=0.8), SoundInterval(deathSound, volume=0.32)) BattleParticles.loadParticles() smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall') singleGear = BattleParticles.createParticleEffect('GearExplosion', numParticles=1) smallGearExplosion = BattleParticles.createParticleEffect('GearExplosion', numParticles=10) bigGearExplosion = BattleParticles.createParticleEffect('BigGearExplosion', numParticles=30) smallGears.setDepthWrite(False) smallGears.setScale(5) singleGear.setDepthWrite(False) singleGear.setScale(5) smallGearExplosion.setDepthWrite(False) smallGearExplosion.setScale(5) bigGearExplosion.setDepthWrite(False) bigGearExplosion.setScale(5) explosionTrack = Sequence() explosionTrack.append(Wait(5.4)) explosionTrack.append(self.createKapowExplosionTrack(self)) gears1Track = Sequence(Wait(2.0), ParticleInterval(smallGears, self, worldRelative=0, duration=4.3, cleanup=True), name='gears1Track') gears2MTrack = Track((0.0, explosionTrack), ( 0.7, ParticleInterval(singleGear, self, worldRelative=0, duration=5.7, cleanup=True)), (5.2, ParticleInterval(smallGearExplosion, self, worldRelative=0, duration=1.2, cleanup=True)), ( 5.4, ParticleInterval(bigGearExplosion, self, worldRelative=0, duration=1.0, cleanup=True)), name='gears2MTrack') ival = Parallel(Func(self.forwardHead), Sequence(ActorInterval(self, 'death', playRate=1.125), Func(self.getGeomNode().hide)), deathSoundTrack, gears1Track, gears2MTrack) else: if isinstance(anim, types.StringType): ival = ActorInterval(self, anim) else: ival = anim return ival
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.mp3') deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.mp3') 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()
def makeCrunchTrack(self): toonId = self.toon toon = base.cr.doId2do.get(toonId) if not toon: return self.virtualSuit.lookAt(toon) if self.virtualSuit.style.body in ['a', 'b']: throwDelay = 3 elif self.virtualSuit.style.body == 'c': throwDelay = 2.3 else: throwDelay = 2 numberNames = ['one', 'two', 'three', 'four', 'five', 'six'] BattleParticles.loadParticles() numberSpill1 = BattleParticles.createParticleEffect(file='numberSpill') numberSpill2 = BattleParticles.createParticleEffect(file='numberSpill') spillTexture1 = random.choice(numberNames) spillTexture2 = random.choice(numberNames) BattleParticles.setEffectTexture(numberSpill1, 'audit-' + spillTexture1) BattleParticles.setEffectTexture(numberSpill2, 'audit-' + spillTexture2) numberSpillTrack1 = getPartTrack(numberSpill1, 1.1, 2.2, [numberSpill1, self.virtualSuit, 0]) numberSpillTrack2 = getPartTrack(numberSpill2, 1.5, 1.0, [numberSpill2, self.virtualSuit, 0]) numberSprayTracks = Parallel() numOfNumbers = random.randint(5, 9) for i in xrange(0, numOfNumbers - 1): nextSpray = BattleParticles.createParticleEffect(file='numberSpray') nextTexture = random.choice(numberNames) BattleParticles.setEffectTexture(nextSpray, 'audit-' + nextTexture) nextStartTime = random.random() * 0.6 + 3.03 nextDuration = random.random() * 0.4 + 1.4 nextSprayTrack = getPartTrack(nextSpray, nextStartTime, nextDuration, [nextSpray, self.virtualSuit, 0]) numberSprayTracks.append(nextSprayTrack) def throwProp(prop): if not self.virtualSuit: return toon = self.cr.doId2do.get(toonId) if not toon: self.cleanupProp(prop, False) self.finishPropAttack() return self.virtualSuit.lookAt(toon) prop.wrtReparentTo(render) hitPos = toon.getPos() + Vec3(0, 0, 2.5) distance = (prop.getPos() - hitPos).length() speed = 50.0 throwSequence = Sequence( prop.posInterval(distance / speed, hitPos), Func(self.cleanupProp, prop, False) ) throwSequence.start() numberTracks = Parallel() for i in xrange(0, numOfNumbers): texture = random.choice(numberNames) next = copyProp(BattleParticles.getParticle('audit-' + texture)) next.reparentTo(self.virtualSuit.getRightHand()) next.setScale(0.01, 0.01, 0.01) next.setColor(Vec4(0.0, 0.0, 0.0, 1.0)) next.setPos(random.random() * 0.6 - 0.3, random.random() * 0.6 - 0.3, random.random() * 0.6 - 0.3) next.setHpr(VBase3(-1.15, 86.58, -76.78)) # Make prop virtual: next.setColorScale(1.0, 0.0, 0.0, 0.8) next.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd)) # Prop collisions: colNode = CollisionNode(self.uniqueName('SuitAttack')) colNode.setTag('damage', str(self.attackInfo[1])) bounds = next.getBounds() center = bounds.getCenter() radius = bounds.getRadius() sphere = CollisionSphere(center.getX(), center.getY(), center.getZ(), radius) sphere.setTangible(0) colNode.addSolid(sphere) colNode.setIntoCollideMask(WallBitmask) next.attachNewNode(colNode) numberTrack = Sequence( Wait(throwDelay), Parallel( LerpScaleInterval(next, 0.6, Point3(1.0, 1.0, 1.0)), Func(throwProp, next), ), ) numberTracks.append(numberTrack) suitTrack = Parallel( Func(self.sayFaceoffTaunt), Sequence( ActorInterval(self.virtualSuit, 'throw-object'), ActorInterval(self.virtualSuit, 'neutral') ), ) return Sequence( Parallel( suitTrack, numberSpillTrack1, numberSpillTrack2, numberTracks, numberSprayTracks ), Func(self.virtualSuit.loop, 'walk', 0), Func(self.virtualSuit.setHpr, 0, 0, 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.mp3') deathSound = base.loadSfx('phase_3.5/audio/sfx/ENC_cogfall_apart.mp3') 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.6000000000000001, startTime=0.59999999999999998, volume=0.80000000000000004, node=self.deathSuit), SoundInterval(deathSound, volume=0.32000000000000001, node=self.deathSuit)) gears1Track = Sequence(ParticleInterval( smallGears, self.deathSuit, worldRelative=0, duration=4.2999999999999998, cleanup=True), name='gears1Track') gears2MTrack = Track((0.0, explosionTrack), (0.69999999999999996, ParticleInterval(singleGear, self.deathSuit, worldRelative=0, duration=5.7000000000000002, cleanup=True)), (5.2000000000000002, ParticleInterval(smallGearExplosion, self.deathSuit, worldRelative=0, duration=1.2, cleanup=True)), (5.4000000000000004, 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.6000000000000001, startTime=0.59999999999999998, volume=0.80000000000000004, node=self.deathSuit), SoundInterval(deathSound, volume=0.32000000000000001, node=self.deathSuit)) gears1Track = Sequence(ParticleInterval( smallGears, self.deathSuit, worldRelative=0, duration=4.2999999999999998, cleanup=True), name='gears1Track') gears2MTrack = Track((0.0, explosionTrack), (0.0, ParticleInterval(singleGear, self.deathSuit, worldRelative=0, duration=5.7000000000000002, cleanup=True)), (2.7000000000000002, ParticleInterval(smallGearExplosion, self.deathSuit, worldRelative=0, duration=1.2, cleanup=True)), (2.8999999999999999, 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()
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.remove() 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() #smallGears = BattleParticles.createParticleEffect(file='gearExplosionSmall') singleGear = BattleParticles.createParticleEffect( 'GearExplosion', numParticles=1) smallGearExplosion = BattleParticles.createParticleEffect( 'GearExplosion', numParticles=10) bigGearExplosion = BattleParticles.createParticleEffect( 'BigGearExplosion', numParticles=30) #gearPoint = Point3(self.hill.getX(render), self.hill.getY(render), self.hill.getZ(render)) #smallGears.setPos(gearPoint) #singleGear.setPos(gearPoint) #smallGears.setDepthWrite(False) #singleGear.setDepthWrite(False) #smallGearExplosion.setPos(gearPoint) #bigGearExplosion.setPos(gearPoint) #smallGearExplosion.setDepthWrite(False) #bigGearExplosion.setDepthWrite(False) 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') #gearTrack = Parallel(gears2MTrack) #gearTrack.start() 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)