public IntervalLayer() { m_time0 = m_time1 = m_time2 = m_time3 = m_time4 = 0.0f; CCSize s = CCDirector.SharedDirector.WinSize; // sun CCParticleSystem sun = new CCParticleSun(); 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 CCLabelBMFont("0", "fonts/bitmapFontTest4.fnt"); m_label1 = new CCLabelBMFont("0", "fonts/bitmapFontTest4.fnt"); m_label2 = new CCLabelBMFont("0", "fonts/bitmapFontTest4.fnt"); m_label3 = new CCLabelBMFont("0", "fonts/bitmapFontTest4.fnt"); m_label4 = new CCLabelBMFont("0", "fonts/bitmapFontTest4.fnt"); ScheduleUpdate(); 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 ( (CCActionInterval) (CCSequence.FromActions(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 CCParticleSun node() { CCParticleSun pRet = new CCParticleSun(); if (pRet.init()) { return(pRet); } return(null); }
public static new CCParticleSun node() { CCParticleSun cCParticleSun = new CCParticleSun(); if (cCParticleSun.init()) { return(cCParticleSun); } return(null); }
public IntroLayer() { //// create and initialize a Label //var label = new CCLabelTTF("Hello Cocos2D-XNA", "MarkerFelt", 22); //// position the label on the center of the screen //label.Position = CCDirector.SharedDirector.WinSize.Center; //// add the label as a child to this Layer //AddChild(label); //// setup our color for the background //Color = new CCColor3B(Microsoft.Xna.Framework.Color.Blue); //Opacity = 255; CCLayerColor layer = new CCLayerColor(); layer.initWithColorWidthHeight(new ccColor4B(0xff, 0xff, 0, 0xff), 100, 100); this.addChild(layer); CCParticleSun sun = new CCParticleSun(); this.addChild(sun); }
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); }
public static CCParticleSun node() { CCParticleSun pRet = new CCParticleSun(); if (pRet.init()) { return pRet; } return null; }
public override void OnEnter() { base.OnEnter(); m_emitter = new CCParticleSun(); m_background.AddChild(m_emitter, 10); m_emitter.Texture = CCTextureCache.SharedTextureCache.AddImage(TestResource.s_fire); setEmitterPosition(); }
public override void OnEnter() { base.OnEnter(); m_background.Parent.RemoveChild(m_background, true); m_background = null; CCParallaxNode p = new CCParallaxNode(); AddChild(p, 5); CCSprite p1 = new CCSprite(TestResource.s_back3); CCSprite p2 = new CCSprite(TestResource.s_back3); p.AddChild(p1, 1, new CCPoint(0.5f, 1), new CCPoint(0, 250)); p.AddChild(p2, 2, new CCPoint(1.5f, 1), new CCPoint(0, 50)); m_emitter = new CCParticleFlower(); m_emitter.Texture = CCTextureCache.SharedTextureCache.AddImage(TestResource.s_fire); p1.AddChild(m_emitter, 10); m_emitter.Position = new CCPoint(250, 200); CCParticleSun par = new CCParticleSun(); p2.AddChild(par, 10); par.Texture = CCTextureCache.SharedTextureCache.AddImage(TestResource.s_fire); CCActionInterval move = new CCMoveBy (4, new CCPoint(300, 0)); CCFiniteTimeAction move_back = move.Reverse(); CCFiniteTimeAction seq = CCSequence.FromActions(move, move_back); p.RunAction(new CCRepeatForever ((CCActionInterval) seq)); }