public override void OnEnter() { base.OnEnter(); Color = CCTypes.CCBlack; RemoveChild(m_background, true); m_background = null; //adds the texture inside the plist to the texture cache m_pBatchNode = CCParticleBatchNode.Create("Images/fire", 16000); AddChild(m_pBatchNode, 1, 2); for (int i = 0; i < 6; i++) { CCParticleSystemQuad particleSystem = CCParticleSystemQuad.Create("Particles/Spiral"); particleSystem.Texture = m_pBatchNode.Texture; particleSystem.PositionType = CCPositionType.kCCPositionTypeGrouped; particleSystem.TotalParticles = (200); particleSystem.Position = (new CCPoint(i * 15 + 100, i * 15 + 100)); int randZ = Random.Next(100); m_pBatchNode.AddChild(particleSystem, randZ, -1); } Schedule(removeSystem, 0.5f); m_emitter = null; }
public override void OnEnter() { base.OnEnter(); Color = CCTypes.CCBlack; RemoveChild(m_background, true); m_background = null; m_pBatchNode = CCParticleBatchNode.Create("Images/stars-grayscale", 3000); AddChild(m_pBatchNode, 1, 2); for (int i = 0; i < 3; i++) { var particleSystem = new CCParticleSystemQuad(); particleSystem.InitWithTotalParticles(200); particleSystem.Texture = (m_pBatchNode.Texture); // duration particleSystem.Duration = CCParticleSystem.kCCParticleDurationInfinity; // radius mode particleSystem.EmitterMode = CCEmitterMode.kCCParticleModeRadius; // radius mode: 100 pixels from center particleSystem.StartRadius = (100); particleSystem.StartRadiusVar = (0); particleSystem.EndRadius = (CCParticleSystem.kCCParticleStartRadiusEqualToEndRadius); particleSystem.EndRadiusVar = (0); // not used when start == end // radius mode: degrees per second // 45 * 4 seconds of life = 180 degrees particleSystem.RotatePerSecond = (45); particleSystem.RotatePerSecondVar = (0); // angle particleSystem.Angle = (90); particleSystem.AngleVar = (0); // emitter position particleSystem.PosVar = (CCPoint.Zero); // life of particles particleSystem.Life = (4); particleSystem.LifeVar = (0); // spin of particles particleSystem.StartSpin = (0); particleSystem.StartSpinVar = (0); particleSystem.EndSpin = (0); particleSystem.EndSpinVar = (0); // color of particles var color = new float[3] {0, 0, 0}; color[i] = 1; var startColor = new CCColor4F(color[0], color[1], color[2], 1.0f); particleSystem.StartColor = (startColor); var startColorVar = new CCColor4F(0, 0, 0, 0); particleSystem.StartColorVar = (startColorVar); CCColor4F endColor = startColor; particleSystem.EndColor = (endColor); CCColor4F endColorVar = startColorVar; particleSystem.EndColorVar = (endColorVar); // size, in pixels particleSystem.StartSize = (32); particleSystem.StartSizeVar = (0); particleSystem.EndSize = CCParticleSystem.kCCParticleStartSizeEqualToEndSize; // emits per second particleSystem.EmissionRate = (particleSystem.TotalParticles / particleSystem.Life); // additive particleSystem.Position = (new CCPoint(i * 10 + 120, 200)); m_pBatchNode.AddChild(particleSystem); particleSystem.PositionType = CCPositionType.kCCPositionTypeFree; //[pBNode addChild:particleSystem z:10 tag:0); } Schedule(reorderSystem, 2.0f); m_emitter = null; }
public override void OnEnter() { base.OnEnter(); Color = CCTypes.CCBlack; RemoveChild(m_background, true); m_background = null; CCParticleBatchNode batchNode = new CCParticleBatchNode("Images/fire", 3000); AddChild(batchNode, 1, 2); for (int i = 0; i < 5; i++) { CCParticleSystemQuad particleSystem = new CCParticleSystemQuad("Particles/SpinningPeas"); particleSystem.PositionType = CCPositionType.kCCPositionTypeGrouped; particleSystem.Position = (new CCPoint(i * 50, i * 50)); particleSystem.Texture = batchNode.Texture; batchNode.AddChild(particleSystem); } m_emitter = null; }
public override void OnEnter() { base.OnEnter(); m_nOrder = 0; Color = CCTypes.CCBlack; RemoveChild(m_background, true); m_background = null; CCParticleSystemQuad ignore = new CCParticleSystemQuad("Particles/SmallSun"); //ignore.TotalParticles = 200; CCNode parent1 = new CCNode (); CCParticleBatchNode parent2 = new CCParticleBatchNode(ignore.Texture); ignore.UnscheduleUpdate(); for (int i = 0; i < 2; i++) { CCNode parent = (i == 0 ? parent1 : parent2); CCParticleSystemQuad emitter1 = new CCParticleSystemQuad("Particles/SmallSun"); //emitter1.TotalParticles = 200; emitter1.StartColor = (new CCColor4F(1, 0, 0, 1)); emitter1.BlendAdditive = (false); CCParticleSystemQuad emitter2 = new CCParticleSystemQuad("Particles/SmallSun"); //emitter2.TotalParticles = 200; emitter2.StartColor = (new CCColor4F(0, 1, 0, 1)); emitter2.BlendAdditive = (false); CCParticleSystemQuad emitter3 = new CCParticleSystemQuad("Particles/SmallSun"); //emitter3.TotalParticles = 200; emitter3.StartColor = (new CCColor4F(0, 0, 1, 1)); emitter3.BlendAdditive = (false); CCSize s = CCDirector.SharedDirector.WinSize; int neg = (i == 0 ? 1 : -1); emitter1.Position = (new CCPoint(s.Width / 2 - 30, s.Height / 2 + 60 * neg)); emitter2.Position = (new CCPoint(s.Width / 2, s.Height / 2 + 60 * neg)); emitter3.Position = (new CCPoint(s.Width / 2 + 30, s.Height / 2 + 60 * neg)); parent.AddChild(emitter1, 0, 1); parent.AddChild(emitter2, 0, 2); parent.AddChild(emitter3, 0, 3); AddChild(parent, 10, 1000 + i); } Schedule(reorderParticles, 1.0f); }
public override void OnEnter() { base.OnEnter(); Color = CCTypes.CCBlack; RemoveChild(m_background, true); m_background = null; CCParticleSystemQuad emitter1 = new CCParticleSystemQuad("Particles/LavaFlow"); emitter1.StartColor = (new CCColor4F(1, 0, 0, 1)); CCParticleSystemQuad emitter2 = new CCParticleSystemQuad("Particles/LavaFlow"); emitter2.StartColor = (new CCColor4F(0, 1, 0, 1)); CCParticleSystemQuad emitter3 = new CCParticleSystemQuad("Particles/LavaFlow"); emitter3.StartColor = (new CCColor4F(0, 0, 1, 1)); CCSize s = CCDirector.SharedDirector.WinSize; emitter1.Position = (new CCPoint(s.Width / 1.25f, s.Height / 1.25f)); emitter2.Position = (new CCPoint(s.Width / 2, s.Height / 2)); emitter3.Position = (new CCPoint(s.Width / 4, s.Height / 4)); emitter1.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire"); emitter2.Texture = emitter1.Texture; emitter3.Texture = emitter1.Texture; CCParticleBatchNode batch = new CCParticleBatchNode(emitter1.Texture); batch.AddChild(emitter1, 0); batch.AddChild(emitter2, 0); batch.AddChild(emitter3, 0); AddChild(batch, 10); }
public override void OnEnter() { base.OnEnter(); Color = CCTypes.CCBlack; RemoveChild(m_background, true); m_background = null; m_emitter = new CCParticleSystemQuad("Particles/LavaFlow"); m_emitter.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire"); CCParticleBatchNode batch = new CCParticleBatchNode(m_emitter.Texture); batch.AddChild(m_emitter); AddChild(batch, 10); Schedule(switchRender, 2.0f); CCLayer node = new CCLayer(); AddChild(node); m_pParent1 = batch; m_pParent2 = node; }
/* * creation with File Image */ public static CCParticleBatchNode Create(string imageFile, int capacity /* = kCCParticleDefaultCapacity*/) { var p = new CCParticleBatchNode(); p.InitWithFile(imageFile, capacity); return p; }
public static CCParticleBatchNode Create(CCTexture2D tex, int capacity /* = kCCParticleDefaultCapacity*/) { var p = new CCParticleBatchNode(); p.InitWithTexture(tex, capacity); return p; }