本文整理汇总了Python中toontown.battle.BattleParticles.createParticleEffect方法的典型用法代码示例。如果您正苦于以下问题:Python BattleParticles.createParticleEffect方法的具体用法?Python BattleParticles.createParticleEffect怎么用?Python BattleParticles.createParticleEffect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.battle.BattleParticles
的用法示例。
在下文中一共展示了BattleParticles.createParticleEffect方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createGoonExplosion
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import createParticleEffect [as 别名]
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')
示例2: createExplosionTrack
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import createParticleEffect [as 别名]
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()
示例3: enterFinaleBrainstormAttack
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import createParticleEffect [as 别名]
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')
示例4: __init__
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import createParticleEffect [as 别名]
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()
示例5: enterExplode
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import createParticleEffect [as 别名]
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)
示例6: setHillType
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import createParticleEffect [as 别名]
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)
示例7: doDeathTrack
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import createParticleEffect [as 别名]
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()
示例8: makeSynergyTrack
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import createParticleEffect [as 别名]
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
示例9: __init__
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import createParticleEffect [as 别名]
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()
示例10: doDeathTrack
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import createParticleEffect [as 别名]
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()
示例11: makeCrunchTrack
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import createParticleEffect [as 别名]
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),
),
#.........这里部分代码省略.........