def __init__(self, type=None): PooledEffect.__init__(self) EffectController.__init__(self) self.rotDummy = self.attachNewNode('rotDummy') self.knifeModel = loader.loadModel('models/handheld/dagger_high') self.knifeModel.reparentTo(self.rotDummy) self.knifeModel.setY(-0.6) self.knifeModel.setR(180) self.motion_color = [ Vec4(0.5, 0.6, 0.8, 1.0), Vec4(0.5, 0.6, 0.8, 1.0) ] vertex_list = [Vec4(0.0, 1.0, 0.0, 1.0), Vec4(0.0, -1.0, 0.0, 1.0)] self.motion_trail = PolyTrail.PolyTrail(None, vertex_list, self.motion_color) self.motion_trail.reparentTo(self) vertex_list = [Vec4(0.3, 0.0, 0.0, 1.0), Vec4(-0.3, 0.0, 0.0, 1.0)] self.motion_trail2 = PolyTrail.PolyTrail(None, vertex_list, self.motion_color) self.motion_trail2.reparentTo(self) self.motion_trail.node().setAttrib( ColorBlendAttrib.make(ColorBlendAttrib.MAdd, ColorBlendAttrib.OIncomingAlpha, ColorBlendAttrib.OOne)) self.motion_trail2.node().setAttrib( ColorBlendAttrib.make(ColorBlendAttrib.MAdd, ColorBlendAttrib.OIncomingAlpha, ColorBlendAttrib.OOne)) return
def __init__(self): PooledEffect.__init__(self) EffectController.__init__(self) self.target = None self.initialVelocity = Vec3(1, 1, 1) self.targetOffset = Vec3(0, 0, 0) self.duration = 3.0 self.wantTrail = 1 self.particleEffect = None self.motion_color = [ Vec4(0.5, 0.59999999999999998, 0.80000000000000004, 1.0), Vec4(0.5, 0.59999999999999998, 0.80000000000000004, 1.0) ] vertex_list = [Vec4(0.0, 1.0, 0.0, 1.0), Vec4(0.0, -1.0, 0.0, 1.0)] self.motion_trail = PolyTrail.PolyTrail(None, vertex_list, self.motion_color, 1.5) self.motion_trail.reparentTo(self) vertex_list = [Vec4(1.0, 0.0, 0.0, 1.0), Vec4(-1.0, 0.0, 0.0, 1.0)] self.motion_trail2 = PolyTrail.PolyTrail(None, vertex_list, self.motion_color, 1.5) self.motion_trail2.reparentTo(self) self.motion_trail.node().setAttrib( ColorBlendAttrib.make(ColorBlendAttrib.MAdd, ColorBlendAttrib.OIncomingColor, ColorBlendAttrib.OOneMinusIncomingAlpha)) self.motion_trail2.node().setAttrib( ColorBlendAttrib.make(ColorBlendAttrib.MAdd, ColorBlendAttrib.OIncomingColor, ColorBlendAttrib.OOneMinusIncomingAlpha))
def __init__(self, type=None): PooledEffect.__init__(self) EffectController.__init__(self) self.motion_color = [ Vec4(0.5, 0.6, 0.8, 1.0), Vec4(0.5, 0.6, 0.8, 1.0), Vec4(0.5, 0.6, 0.8, 1.0), Vec4(0.5, 0.6, 0.8, 1.0), Vec4(0.5, 0.6, 0.8, 1.0) ] r = 0.2 vertex_list = [ Vec4(r, 0.0, r, 1.0), Vec4(r, 0.0, -r, 1.0), Vec4(-r, 0.0, -r, 1.0), Vec4(-r, 0.0, r, 1.0), Vec4(r, 0.0, r, 1.0) ] self.motion_trail = PolyTrail.PolyTrail(None, vertex_list, self.motion_color) self.motion_trail.reparentTo(self) self.motion_trail.node().setAttrib( ColorBlendAttrib.make(ColorBlendAttrib.MAdd, ColorBlendAttrib.OIncomingAlpha, ColorBlendAttrib.OOne)) return
def createTrail(self, target): if not self.motion_trail: self.motion_trail = PolyTrail.PolyTrail(target, self.vertex_list, self.motion_color) self.motion_trail.reparentTo(self) self.motion_trail.setUseNurbs(1) card = loader.loadModel('models/effects/swordtrail_effects') tex = card.find('**/swordtrail_lines').findTexture('*') self.motion_trail.setTexture(tex) card.removeNode()
def __init__(self): NodePath.__init__(self, 'RoundshotProjectile') EffectController.__init__(self) self.shot = loader.loadModel('models/ammunition/cannonball') self.shot.reparentTo(self) self.shot.setScale(0.35) self.motion_trail = PolyTrail.PolyTrail(None, self.vertex_list, self.motion_color) self.motion_trail.setUnmodifiedVertexColors(self.motion_color) self.motion_trail.motion_trail.geom_node_path.setTwoSided(False) self.motion_trail.reparentTo(self) self.motion_trail.node().setAttrib(ColorBlendAttrib.make(ColorBlendAttrib.MAdd, ColorBlendAttrib.OIncomingAlpha, ColorBlendAttrib.OOne)) return
def createTrail(self, target): if self.isEmpty(): return if not self.motion_trail: self.motion_trail = PolyTrail.PolyTrail( target, self.vertex_list, self.motion_color.get(self.itemId)) self.motion_trail.reparentTo(self) self.motion_trail.setUseNurbs(1) card = loader.loadModel('models/effects/swordtrail_effects') tex = card.find('**/swordtrail_lines').findTexture('*') self.motion_trail.setTexture(tex) self.motion_trail.setBlendModeOn() if self.itemId == InventoryType.CutlassWeaponL6: self.motion_trail.setBlendModeOff() card.removeNode()
def createTrail(self, target): if self.isEmpty(): return if not self.motion_trail: colorId = ItemGlobals.getVfxType1(self.itemId) motion_trail_color = self.motion_color.get(colorId) if not motion_trail_color: motion_trail_color = self.motion_color.get(ItemGlobals.MotionBlurDefault) self.motion_trail = PolyTrail.PolyTrail(target, self.vertex_list, motion_trail_color) self.motion_trail.reparentTo(self) self.motion_trail.setUseNurbs(1) card = loader.loadModel('models/effects/swordtrail_effects') tex = card.find('**/swordtrail_lines').findTexture('*') self.motion_trail.setTexture(tex) self.motion_trail.setBlendModeOn() if colorId == ItemGlobals.MotionBlurDark: self.motion_trail.setBlendModeOff() card.removeNode()
def __init__(self, type=None): PooledEffect.__init__(self) EffectController.__init__(self) model = loader.loadModel('models/effects/particleMaps') self.card = model.find('**/particleDarkSmoke') if not VoodooProjectile.particleDummy: VoodooProjectile.particleDummy = render.attachNewNode( ModelNode('VoodooProjectileParticleDummy')) VoodooProjectile.particleDummy.setDepthWrite(0) VoodooProjectile.particleDummy.setLightOff() VoodooProjectile.particleDummy.setColorScaleOff() VoodooProjectile.particleDummy.setFogOff() self.effectColor = Vec4(0.5, 0.2, 1, 1) self.f = ParticleEffect.ParticleEffect('VoodooProjectile') self.f.reparentTo(self) self.p0 = Particles.Particles('particles-1') self.p0.setFactory('ZSpinParticleFactory') self.p0.setRenderer('SpriteParticleRenderer') self.p0.setEmitter('DiscEmitter') self.f.addParticles(self.p0) self.motion_color = [ Vec4(0.5, 0.2, 1.0, 1.0), Vec4(0.5, 0.2, 1.0, 1.0), Vec4(0.5, 0.2, 1.0, 1.0), Vec4(0.5, 0.2, 1.0, 1.0), Vec4(0.5, 0.2, 1.0, 1.0) ] r = 0.2 vertex_list = [ Vec4(r, 0.0, r, 1.0), Vec4(r, 0.0, -r, 1.0), Vec4(-r, 0.0, -r, 1.0), Vec4(-r, 0.0, r, 1.0), Vec4(r, 0.0, r, 1.0) ] self.motion_trail = PolyTrail.PolyTrail(None, vertex_list, self.motion_color) self.motion_trail.reparentTo(self) self.motion_trail.node().setAttrib( ColorBlendAttrib.make(ColorBlendAttrib.MAdd, ColorBlendAttrib.OIncomingAlpha, ColorBlendAttrib.OOne)) self.p0.setPoolSize(256) self.p0.setBirthRate(0.01) self.p0.setLitterSize(1) self.p0.setLitterSpread(0) self.p0.setSystemLifespan(0.0) self.p0.setLocalVelocityFlag(1) self.p0.setSystemGrowsOlderFlag(0) self.p0.factory.setLifespanBase(0.5) self.p0.factory.setLifespanSpread(0.15) self.p0.factory.setMassBase(1.0) self.p0.factory.setMassSpread(0.0) self.p0.factory.setTerminalVelocityBase(400.0) self.p0.factory.setTerminalVelocitySpread(0.0) self.p0.factory.setInitialAngle(0.0) self.p0.factory.setInitialAngleSpread(90.0) self.p0.factory.enableAngularVelocity(1) self.p0.factory.setFinalAngle(1080.0) self.p0.factory.setFinalAngleSpread(0.0) self.p0.factory.setAngularVelocity(500.0) self.p0.factory.setAngularVelocitySpread(100.0) self.p0.renderer.setAlphaMode(BaseParticleRenderer.PRALPHAINOUT) self.p0.renderer.setUserAlpha(1.0) self.p0.renderer.setFromNode(self.card) self.p0.renderer.setColor(Vec4(1.0, 1.0, 1.0, 1.0)) self.p0.renderer.setXScaleFlag(1) self.p0.renderer.setYScaleFlag(1) self.p0.renderer.setAnimAngleFlag(1) self.p0.renderer.setInitialXScale(0.01 * self.cardScale) self.p0.renderer.setInitialYScale(0.01 * self.cardScale) self.p0.renderer.setFinalXScale(0.025 * self.cardScale) self.p0.renderer.setFinalYScale(0.025 * self.cardScale) self.p0.renderer.setNonanimatedTheta(0.0) self.p0.renderer.setAlphaBlendMethod( BaseParticleRenderer.PPBLENDLINEAR) self.p0.renderer.setAlphaDisable(0) self.p0.renderer.setColorBlendMode(ColorBlendAttrib.MAdd, ColorBlendAttrib.OIncomingAlpha, ColorBlendAttrib.OOne) self.p0.renderer.getColorInterpolationManager().addLinear( 0.0, 1.0, Vec4(1.0, 1.0, 1.0, 1.0), Vec4(0.5, 0.2, 1.0, 0.25), 1) self.p0.emitter.setEmissionType(BaseParticleEmitter.ETRADIATE) self.p0.emitter.setAmplitude(-0.25) self.p0.emitter.setAmplitudeSpread(0.25) self.p0.emitter.setOffsetForce(Vec3(0.0, 0.0, -2.0)) self.p0.emitter.setExplicitLaunchVector(Vec3(1.0, 0.0, 0.0)) self.p0.emitter.setRadiateOrigin(Point3(0.0, 0.0, 0.0)) self.p0.emitter.setRadius(0.1) return