本文整理汇总了Python中toontown.battle.BattleParticles.loadParticles方法的典型用法代码示例。如果您正苦于以下问题:Python BattleParticles.loadParticles方法的具体用法?Python BattleParticles.loadParticles怎么用?Python BattleParticles.loadParticles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类toontown.battle.BattleParticles
的用法示例。
在下文中一共展示了BattleParticles.loadParticles方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createGoonExplosion
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import loadParticles [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: __init__
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import loadParticles [as 别名]
def __init__(self, serialNum, maze, randomNumGen, difficulty, startTile, cogdoSuitType, walkAnimName = None):
data = Globals.SuitData[cogdoSuitType]
MazeSuit.__init__(self, serialNum, maze, randomNumGen, data['cellWalkPeriod'], difficulty, data['dnaName'], startTile=startTile, walkSameDirectionProb=Globals.SuitWalkSameDirectionProb, walkTurnAroundProb=Globals.SuitWalkTurnAroundProb, uniqueRandomNumGen=False, walkAnimName=walkAnimName)
FSM.__init__(self, 'CogdoMazeSuit')
CogdoMazeSplattable.__init__(self, self.suit, '%s-%i' % (Globals.SuitCollisionName, self.serialNum), 1.5)
if data.has_key('scale'):
self.suit.setScale(data['scale'])
self.hp = data['hp']
self.type = cogdoSuitType
self.memos = data['memos']
self.deathSuit = self.suit.getLoseActor()
self.deathSuit.pose('lose', 0)
BattleParticles.loadParticles()
self._initSfx()
示例3: createExplosionTrack
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import loadParticles [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()
示例4: enterExplode
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import loadParticles [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)
示例5: setHillType
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import loadParticles [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)
示例6: __init__
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import loadParticles [as 别名]
def __init__(self, enemyMgr, index, suitAttribs):
self.enemyMgr = enemyMgr
self.game = self.enemyMgr.section.sectionMgr.game
self.index = index
self.moveIval = None
self.propTrack = None
self.animTrack = None
self.shotTrack = None
self.deathTrack = None
self.deathSuit = None
self.suitSound = None
self.deleteMeCallback = None
self.isMovingUpDown = False
self.isMovingLeftRight = False
self.showCollSpheres = False
self.isDestroyed = False
self.isGoingUp = False
self.setupEnemy(suitAttribs)
BattleParticles.loadParticles()
示例7: makeCrunchTrack
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import loadParticles [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),
),
#.........这里部分代码省略.........
示例8: makeWriteOffTrack
# 需要导入模块: from toontown.battle import BattleParticles [as 别名]
# 或者: from toontown.battle.BattleParticles import loadParticles [as 别名]
def makeWriteOffTrack(self):
pad = BattleProps.globalPropPool.getProp('pad')
pad.setScale(1.89)
pencil = BattleProps.globalPropPool.getProp('pencil')
BattleParticles.loadParticles()
checkmark = copyProp(BattleParticles.getParticle('checkmark'))
checkmark.setBillboardPointEye()
# Make prop virtual:
pad.setColorScale(1.0, 0.0, 0.0, 0.8)
pad.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd))
pencil.setColorScale(1.0, 0.0, 0.0, 0.8)
pencil.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd))
checkmark.setColorScale(1.0, 0.0, 0.0, 0.8)
checkmark.setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd))
# Prop collisions:
colNode = CollisionNode(self.uniqueName('SuitAttack'))
colNode.setTag('damage', str(self.attackInfo[1]))
bounds = checkmark.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)
checkmark.attachNewNode(colNode)
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
def throwProp():
if not self.virtualSuit:
return
toon = self.cr.doId2do.get(toonId)
if not toon:
self.cleanupProp(checkmark, False)
self.finishPropAttack()
return
self.virtualSuit.lookAt(toon)
checkmark.wrtReparentTo(render)
hitPos = toon.getPos() + Vec3(0, 0, 2.5)
distance = (checkmark.getPos() - hitPos).length()
speed = 50.0
if self.attackProp == 'teeth':
throwSequence = Sequence(
Parallel(
checkmark.posInterval(distance / speed, hitPos),
ActorInterval(checkmark, 'teeth', duration=distance / speed),
),
Func(self.cleanupProp, checkmark, False),
)
else:
throwSequence = Sequence(
checkmark.posInterval(distance / speed, hitPos),
Func(self.cleanupProp, checkmark, False)
)
throwSequence.start()
pencilTrack = Sequence(
Wait(0.5),
Func(pencil.setPosHpr, -0.47, 1.08, 0.28, 21.045, 12.702, -176.374),
Func(pencil.reparentTo, self.virtualSuit.getRightHand()),
LerpScaleInterval(pencil, 0.5, Point3(1.5, 1.5, 1.5),
startScale=Point3(0.01)),
Wait(throwDelay),
Func(checkmark.reparentTo, render),
Func(checkmark.setScale, 1.6),
Func(checkmark.setPosHpr, pencil, 0, 0, 0, 0, 0, 0),
Func(checkmark.setP, 0),
Func(checkmark.setR, 0),
Func(throwProp),
Wait(0.3),
LerpScaleInterval(pencil, 0.5, Point3(0.01, 0.01, 0.01)),
Func(pencil.removeNode),
)
suitTrack = Sequence(
ActorInterval(self.virtualSuit, 'hold-pencil'),
Func(self.virtualSuit.loop, 'neutral', 0),
)
#.........这里部分代码省略.........