public override void onEnter() { base.onEnter(); m_background.parent.removeChild(m_background, true); m_background = null; CCParallaxNode p = CCParallaxNode.node(); addChild(p, 5); CCSprite p1 = CCSprite.spriteWithFile(TestResource.s_back3); CCSprite p2 = CCSprite.spriteWithFile(TestResource.s_back3); p.addChild(p1, 1, new CCPoint(0.5f, 1), new CCPoint(0, 0)); p.addChild(p2, 2, new CCPoint(1.5f, 1), new CCPoint(0, 0)); m_emitter = CCParticleFlower.node(); m_emitter.Texture = CCTextureCache.sharedTextureCache().addImage(TestResource.s_fire); p1.addChild(m_emitter, 10); m_emitter.position = new CCPoint(250, 200); CCParticleSun par = CCParticleSun.node(); p2.addChild(par, 10); par.Texture = CCTextureCache.sharedTextureCache().addImage(TestResource.s_fire); CCActionInterval move = CCMoveBy.actionWithDuration(4, new CCPoint(300, 0)); CCFiniteTimeAction move_back = move.reverse(); CCFiniteTimeAction seq = CCSequence.actions(move, move_back); p.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq)); }
public override void OnEnter() { base.OnEnter(); TouchEnabled = true; var sun = new CCParticleSun(); sun.Position = CCDirector.SharedDirector.WinSize.Center; AddChild(sun); }
void AddSun() { circleNode = new CCDrawNode(); circleNode.DrawCircle(CCPoint.Zero, 30.0f, CCColor4B.Yellow); AddChild(circleNode); sun = new CCParticleSun(CCPoint.Zero); sun.StartColor = new CCColor4F(CCColor3B.Red); sun.EndColor = new CCColor4F(CCColor4B.Yellow); AddChild(sun); }
public override void onEnter() { base.onEnter(); m_emitter = CCParticleSun.node(); m_background.addChild(m_emitter, 10); m_emitter.Texture = CCTextureCache.sharedTextureCache().addImage(TestResource.s_fire); setEmitterPosition(); }
void AddSun() { var pos = VisibleBoundsWorldspace.Center; //var circleNode = new CCDrawNode(); //circleNode.DrawSolidCircle(pos, 30.0f, CCColor4B.Yellow); //AddChild(circleNode); var sun = new CCParticleSun(pos); sun.StartColor = new CCColor4F(CCColor3B.Blue); sun.EndColor = new CCColor4F(CCColor3B.Yellow); AddChild(sun); }
protected override void AddedToScene() { base.AddedToScene(); // Use the bounds to layout the positioning of our drawable assets _bounds = VisibleBoundsWorldspace; //var background = new CCSprite("background"); //AddChild(background); _targetZone = new CCDrawNode(); _targetZone.Position = new CCPoint(_bounds.MaxX - 100, _bounds.MaxY - 100); _targetZone.DrawRect(new CCPoint(0, 0), 50, CCColor4B.Transparent); AddChild(_targetZone); var coinSprite = new CCSprite("coin"); _targetZone.AddChild(coinSprite); _line = new CCDrawNode(); AddChild(_line); _ball = new CCDrawNode(); _ball.Position = new CCPoint(100, 100); _ball.DrawCircle(new CCPoint(0, 0), 50, CCColor4B.Transparent); AddChild(_ball); ReorderChild(_ball, 2); var ballSprite = new CCSprite("ball"); _ball.AddChild(ballSprite); //ballSprite.Scale = 0.15f; _ball.ReorderChild(ballSprite, 2); _glow = new CCParticleSun(new CCPoint(0, 0), CCEmitterMode.Radius); _glow.StartColor = new CCColor4F(CCColor3B.Orange); _glow.EndColor = new CCColor4F(CCColor3B.Yellow); _glow.StartRadius = _ball.ContentSize.Width * 0.4f; _glow.EndRadius = _ball.ContentSize.Width * 0.5f; Schedule(RunGameLogic); // Register for touch events var touchListener = new CCEventListenerTouchAllAtOnce(); touchListener.OnTouchesBegan = OnTouchesBegan; touchListener.OnTouchesEnded = OnTouchesEnded; touchListener.OnTouchesMoved = HandleTouchesMoved; AddEventListener(touchListener, _ball); }
void AddSun() { CCParticleSun sunParticle; sunSprite = new CCSprite("Sun"); sunSprite.PositionX = 0; sunSprite.PositionY = layerHeight; sunParticle = new CCParticleSun(CCPoint.Zero, CCEmitterMode.Gravity); sunParticle.StartColor = new CCColor4F(CCColor4B.Red); sunParticle.EndColor = new CCColor4F(CCColor4B.Yellow); sunParticle.Position = new CCPoint(5, layerHeight - 5); AddChild(sunSprite); AddChild(sunParticle); }
public override void TouchesBegan(List <CCTouch> touches) { foreach (CCTouch t in touches) { // ask director the the window size CCSize size = CCDirector.SharedDirector.WinSize; CCPoint center = new CCPoint(size.Width / 2, size.Height / 2); CCPoint end = t.Location; float fadeTime = CCMacros.CCRandomBetween0And1() * 5f; CCLightningStreak s = new CCLightningStreak(center, end, fadeTime, 15f, 4.0f, new CCColor3B(0, 0, 255), TestResource.s_fire); s.Duration = .5f; AddChild(s); var target = new CCParticleSun(); target.Scale = 0.2f; target.Position = end; AddChild(target); target.RunAction(new CCSequence(new CCFadeOut(fadeTime), new CCRemoveSelf())); } }
private void shouldNotCrash(float dt) { Unschedule(shouldNotCrash); CCSize s = Layer.VisibleBoundsWorldspace.Size; // if the node has timers, it crashes CCParticleSun explosion = new CCParticleSun(s.Center); explosion.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire"); // if it doesn't, it works Ok. // CocosNode *explosion = [Sprite create:@"grossinis_sister2.png"); explosion.Position = s.Center; RunActions(new CCRotateBy(2, 360), new CCCallFuncN(removeMe)); AddChild(explosion); }
private void shouldNotCrash(float dt) { Unschedule((shouldNotCrash)); CCSize s = CCDirector.SharedDirector.WinSize; // if the node has timers, it crashes CCParticleSun explosion = new CCParticleSun(); explosion.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire"); // if it doesn't, it works Ok. // CocosNode *explosion = [Sprite create:@"grossinis_sister2.png"); explosion.Position = new CCPoint(s.Width / 2, s.Height / 2); RunAction(CCSequence.FromActions( new CCRotateBy(2, 360), new CCCallFuncN((removeMe)) )); AddChild(explosion); }
void shouldNotCrash(float dt) { unschedule((shouldNotCrash)); CCSize s = CCDirector.sharedDirector().getWinSize(); // if the node has timers, it crashes CCNode explosion = CCParticleSun.node(); ((CCParticleSun)explosion).Texture = (CCTextureCache.sharedTextureCache().addImage("Images/fire")); // if it doesn't, it works Ok. // CocosNode *explosion = [Sprite spriteWithFile:@"grossinis_sister2.png"); explosion.position = new CCPoint(s.width / 2, s.height / 2); runAction(CCSequence.actions( CCRotateBy.actionWithDuration(2, 360), CCCallFuncN.actionWithTarget(this, (removeMe)) )); addChild(explosion); }
public IntervalLayer() { m_time0 = m_time1 = m_time2 = m_time3 = m_time4 = 0.0f; CCSize s = Layer.VisibleBoundsWorldspace.Size; // sun var sun = new CCParticleSun(new CCPoint(s.Width / 2, s.Height / 2)); sun.Texture = CCTextureCache.SharedTextureCache.AddImage("Images/fire"); sun.Position = (new CCPoint(s.Width - 32, s.Height - 32)); sun.TotalParticles = 130; sun.Life = (0.6f); AddChild(sun); // timers m_label0 = new CCLabel("0", "fonts/bitmapFontTest4.fnt"); m_label1 = new CCLabel("0", "fonts/bitmapFontTest4.fnt"); m_label2 = new CCLabel("0", "fonts/bitmapFontTest4.fnt"); m_label3 = new CCLabel("0", "fonts/bitmapFontTest4.fnt"); m_label4 = new CCLabel("0", "fonts/bitmapFontTest4.fnt"); Schedule(); Schedule(step1); Schedule(step2, 0); Schedule(step3, 1.0f); Schedule(step4, 2.0f); m_label0.Position = new CCPoint(s.Width * 1 / 6, s.Height / 2); m_label1.Position = new CCPoint(s.Width * 2 / 6, s.Height / 2); m_label2.Position = new CCPoint(s.Width * 3 / 6, s.Height / 2); m_label3.Position = new CCPoint(s.Width * 4 / 6, s.Height / 2); m_label4.Position = new CCPoint(s.Width * 5 / 6, s.Height / 2); AddChild(m_label0); AddChild(m_label1); AddChild(m_label2); AddChild(m_label3); AddChild(m_label4); // Sprite CCSprite sprite = new CCSprite(s_pPathGrossini); sprite.Position = new CCPoint(40, 50); CCJumpBy jump = new CCJumpBy(3, new CCPoint(s.Width - 80, 0), 50, 4); AddChild(sprite); sprite.RunAction(new CCRepeatForever( (CCFiniteTimeAction)(new CCSequence(jump, jump.Reverse()))) ); // pause button CCMenuItem item1 = new CCMenuItemFont("Pause", onPause); CCMenu menu = new CCMenu(item1); menu.Position = new CCPoint(s.Width / 2, s.Height - 50); AddChild(menu); }
public static new CCParticleSun Create() { var ret = new CCParticleSun(); ret.InitWithTotalParticles(350); return ret; }
public static new CCParticleSun Create(int num) { var ret = new CCParticleSun(); ret.InitWithTotalParticles(num); return ret; }