public override CCObject copyWithZone(CCZone zone) { CCZone tmpZone = zone; CCJumpBy ret = null; if (tmpZone != null && tmpZone.m_pCopyObject != null) { ret = tmpZone.m_pCopyObject as CCJumpBy; if (ret == null) { return(null); } } else { ret = new CCJumpBy(); tmpZone = new CCZone(ret); } base.copyWithZone(tmpZone); ret.initWithDuration(m_fDuration, m_delta, m_height, m_nJumps); return(ret); }
public override void onEnter() { base.onEnter(); // rotate and jump CCActionInterval jump1 = CCJumpBy.actionWithDuration(4, new CCPoint(-400, 0), 100, 4); CCActionInterval jump2 = jump1.reverse() as CCActionInterval; CCActionInterval rot1 = CCRotateBy.actionWithDuration(4, 360 * 2); CCActionInterval rot2 = rot1.reverse() as CCActionInterval; CCFiniteTimeAction seq3_1 = CCSequence.actions(jump2, jump1); CCFiniteTimeAction seq3_2 = CCSequence.actions(rot1, rot2); CCFiniteTimeAction spawn = CCSpawn.actions(seq3_1, seq3_2); CCFiniteTimeAction action = CCRepeatForever.actionWithAction((CCActionInterval)spawn); CCRepeatForever action2 = (CCRepeatForever)(action.copy()); CCRepeatForever action3 = (CCRepeatForever)(action.copy()); m_grossini.runAction(CCSpeed.actionWithAction((CCActionInterval)action, 0.5f)); m_tamara.runAction(CCSpeed.actionWithAction((CCActionInterval)action2, 1.5f)); m_kathia.runAction(CCSpeed.actionWithAction((CCActionInterval)action3, 1.0f)); CCParticleSystem emitter = CCParticleFireworks.node(); emitter.Texture = CCTextureCache.sharedTextureCache().addImage("Images/fire"); addChild(emitter); }
public override void OnEnter() { base.OnEnter(); CCSize s = CCDirector.SharedDirector.WinSize; m_pInScene.Scale = 0.5f; m_pInScene.Position = new CCPoint(s.Width, 0); m_pInScene.AnchorPoint = new CCPoint(0.5f, 0.5f); m_pOutScene.AnchorPoint = new CCPoint(0.5f, 0.5f); CCActionInterval jump = new CCJumpBy(m_fDuration / 4, new CCPoint(-s.Width, 0), s.Width / 4, 2); CCActionInterval scaleIn = new CCScaleTo(m_fDuration / 4, 1.0f); CCActionInterval scaleOut = new CCScaleTo(m_fDuration / 4, 0.5f); CCSequence jumpZoomOut = (CCSequence.FromActions(scaleOut, jump)); CCSequence jumpZoomIn = (CCSequence.FromActions((CCActionInterval)jump.Copy(), scaleIn)); CCActionInterval delay = new CCDelayTime(m_fDuration / 2); m_pOutScene.RunAction(jumpZoomOut); m_pInScene.RunAction ( CCSequence.FromActions ( delay, jumpZoomIn, new CCCallFunc(Finish) ) ); }
public override void onEnter() { base.onEnter(); // rotate and jump CCActionInterval jump1 = CCJumpBy.actionWithDuration(4, new CCPoint(-400, 0), 100, 4); CCActionInterval jump2 = (CCActionInterval)jump1.reverse(); CCActionInterval rot1 = CCRotateBy.actionWithDuration(4, 360 * 2); CCActionInterval rot2 = (CCActionInterval)rot1.reverse(); CCFiniteTimeAction seq3_1 = CCSequence.actions(jump2, jump1); CCFiniteTimeAction seq3_2 = CCSequence.actions(rot1, rot2); CCFiniteTimeAction spawn = CCSpawn.actions(seq3_1, seq3_2); CCSpeed action = CCSpeed.actionWithAction(CCRepeatForever.actionWithAction((CCActionInterval)spawn), 1.0f); action.tag = EaseTest.kTagAction1; CCAction action2 = (CCAction)(action.copy()); CCAction action3 = (CCAction)(action.copy()); action2.tag = EaseTest.kTagAction1; action3.tag = EaseTest.kTagAction1; m_grossini.runAction(action2); //m_grossini.runAction(CCRepeat.actionWithAction(CCSequence.actions(jump2, jump1), 5)); m_tamara.runAction(action3); m_kathia.runAction(action); this.schedule(new SEL_SCHEDULE(altertime), 1.0f);//:@selector(altertime:) interval:1.0f]; }
public override void OnEnter() { base.OnEnter(); CCSize s = CCDirector.SharedDirector.WinSize; m_pInScene.Scale = 0.5f; m_pInScene.Position = new CCPoint(s.Width, 0); m_pInScene.AnchorPoint = new CCPoint(0.5f, 0.5f); m_pOutScene.AnchorPoint = new CCPoint(0.5f, 0.5f); CCActionInterval jump = new CCJumpBy (m_fDuration / 4, new CCPoint(-s.Width, 0), s.Width / 4, 2); CCActionInterval scaleIn = new CCScaleTo(m_fDuration / 4, 1.0f); CCActionInterval scaleOut = new CCScaleTo(m_fDuration / 4, 0.5f); CCSequence jumpZoomOut = (CCSequence.FromActions(scaleOut, jump)); CCSequence jumpZoomIn = (CCSequence.FromActions((CCActionInterval) jump.Copy(), scaleIn)); CCActionInterval delay = new CCDelayTime (m_fDuration / 2); m_pOutScene.RunAction(jumpZoomOut); m_pInScene.RunAction ( CCSequence.FromActions ( delay, jumpZoomIn, new CCCallFunc(Finish) ) ); }
public static CCJumpBy actionWithDuration(float duration, CCPoint position, float height, uint jumps) { CCJumpBy ret = new CCJumpBy(); ret.initWithDuration(duration, position, height, jumps); return ret; }
public override CCObject copyWithZone(CCZone zone) { CCZone tmpZone = zone; CCJumpBy ret = null; if (tmpZone != null && tmpZone.m_pCopyObject != null) { ret = tmpZone.m_pCopyObject as CCJumpBy; if (ret == null) { return null; } } else { ret = new CCJumpBy(); tmpZone = new CCZone(ret); } base.copyWithZone(tmpZone); ret.initWithDuration(m_fDuration, m_delta, m_height, m_nJumps); return ret; }
public override void OnEnter() { base.OnEnter(); CCRect visibleBounds = VisibleBoundsWorldspace; CCCamera contentCamera = contentLayer.Camera; contentCamera.Projection = CCCameraProjection.Projection3D; contentCamera.PerspectiveAspectRatio = 1.0f; CCPoint3 cameraCenter = contentCamera.CenterInWorldspace; CCPoint3 cameraTarget = contentCamera.TargetInWorldspace; float targeCenterLength = (cameraTarget - cameraCenter).Length; contentCamera.NearAndFarPerspectiveClipping = new CCPoint(0.15f, 100.0f); contentCamera.PerspectiveFieldOfView = (float)Math.Atan(visibleBounds.Size.Height / (2.0f * targeCenterLength)); var lens = new CCLens3D(10, new CCGridSize(64, 48), new CCPoint(100, 180), 80); var move = new CCJumpBy(5, new CCPoint(600, 0), 100, 5); var move_back = move.Reverse(); CCLens3DState lensState = bgNode.RunAction(lens) as CCLens3DState; var target = new Lens3DTarget(lensState); // Please make sure the target has been added to its parent. AddChild(target); target.AddActions(false, move, move_back); }
public override void OnEnter() { base.OnEnter(); var s = CCDirector.SharedDirector.WinSize; // rotate and jump var jump1 = new CCJumpBy(4, new CCPoint(-s.Width + 80, 0), 100, 4); var jump2 = jump1.Reverse(); var rot1 = new CCRotateBy(4, 360 * 2); var rot2 = rot1.Reverse(); var seq3_1 = CCSequence.FromActions(jump2, jump1); var seq3_2 = CCSequence.FromActions(rot1, rot2); var spawn = CCSpawn.FromActions(seq3_1, seq3_2); var action = new CCSpeed(new CCRepeatForever(spawn), 1.0f); action.Tag = EaseTest.kTagAction1; var action2 = (CCAction)(action.Copy()); var action3 = (CCAction)(action.Copy()); action2.Tag = EaseTest.kTagAction1; action3.Tag = EaseTest.kTagAction1; m_grossini.RunAction(action2); m_tamara.RunAction(action3); m_kathia.RunAction(action); Schedule(altertime, 1.0f); }
public IntervalLayer() { m_time0 = m_time1 = m_time2 = m_time3 = m_time4 = 0.0f; CCSize s = CCDirector.sharedDirector().getWinSize(); // sun //CCParticleSystem sun = CCParticleSun.node(); //sun.Texture = CCTextureCache.sharedTextureCache().addImage("Images/fire"); //sun.position = (new CCPoint(s.width - 32, s.height - 32)); ////sun.setTotalParticles(130); //sun.Life = (0.6f); //this.addChild(sun); // timers m_label0 = CCLabelBMFont.labelWithString("0", "fonts/fnt/bitmapFontTest4"); m_label1 = CCLabelBMFont.labelWithString("0", "fonts/fnt/bitmapFontTest4"); m_label2 = CCLabelBMFont.labelWithString("0", "fonts/fnt/bitmapFontTest4"); m_label3 = CCLabelBMFont.labelWithString("0", "fonts/fnt/bitmapFontTest4"); m_label4 = CCLabelBMFont.labelWithString("0", "fonts/fnt/bitmapFontTest4"); base.scheduleUpdate(); schedule(step1); schedule(step2, 0); schedule(step3, 1.0f); schedule(step4, 2.0f); 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 = CCSprite.spriteWithFile(s_pPathGrossini); sprite.position = new CCPoint(40, 50); CCJumpBy jump = CCJumpBy.actionWithDuration(3, new CCPoint(s.width - 80, 0), 50, 4); addChild(sprite); sprite.runAction(CCRepeatForever.actionWithAction( (CCActionInterval)(CCSequence.actions(jump, jump.reverse())) ) ); // pause button CCMenuItem item1 = CCMenuItemFont.itemFromString("Pause", this, onPause); CCMenu menu = CCMenu.menuWithItems(item1); menu.position = new CCPoint(s.width / 2, s.height - 50); addChild(menu); }
public CCJumpByState (CCJumpBy action, CCNode target) : base (action, target) { Delta = action.Position; Height = action.Height; Jumps = action.Jumps; P = StartPosition = target.Position; }
public CCJumpByState(CCJumpBy action, CCNode target) : base(action, target) { Delta = action.Position; Height = action.Height; Jumps = action.Jumps; P = StartPosition = target.Position; }
public static CCJumpBy actionWithDuration(float duration, CCPoint position, float height, uint jumps) { CCJumpBy ret = new CCJumpBy(); ret.initWithDuration(duration, position, height, jumps); return(ret); }
public Atlas4() { m_time = 0; // Upper Label CCLabelBMFont label = CCLabelBMFont.labelWithString("Bitmap Font Atlas", "fonts/fnt/bitmapFontTest"); addChild(label); CCSize s = CCDirector.sharedDirector().getWinSize(); label.position = new CCPoint(s.width / 2, s.height / 2); label.anchorPoint = new CCPoint(0.5f, 0.5f); CCSprite BChar = (CCSprite)label.getChildByTag(0); CCSprite FChar = (CCSprite)label.getChildByTag(7); CCSprite AChar = (CCSprite)label.getChildByTag(12); CCActionInterval rotate = CCRotateBy.actionWithDuration(2, 360); CCAction rot_4ever = CCRepeatForever.actionWithAction(rotate); CCActionInterval scale = CCScaleBy.actionWithDuration(2, 1.5f); CCFiniteTimeAction scale_back = scale.reverse(); CCFiniteTimeAction scale_seq = CCSequence.actions(scale, scale_back); CCAction scale_4ever = CCRepeatForever.actionWithAction((CCActionInterval)scale_seq); CCActionInterval jump = CCJumpBy.actionWithDuration(0.5f, new CCPoint(), 60, 1); CCAction jump_4ever = CCRepeatForever.actionWithAction(jump); CCActionInterval fade_out = CCFadeOut.actionWithDuration(1); CCActionInterval fade_in = CCFadeIn.actionWithDuration(1); CCFiniteTimeAction seq = CCSequence.actions(fade_out, fade_in); CCAction fade_4ever = CCRepeatForever.actionWithAction((CCActionInterval)seq); BChar.runAction(rot_4ever); BChar.runAction(scale_4ever); FChar.runAction(jump_4ever); AChar.runAction(fade_4ever); // Bottom Label CCLabelBMFont label2 = CCLabelBMFont.labelWithString("00.0", "fonts/fnt/bitmapFontTest"); addChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2); label2.position = new CCPoint(s.width / 2.0f, 80); CCSprite lastChar = (CCSprite)label2.getChildByTag(3); lastChar.runAction((CCAction)(rot_4ever.copy())); //schedule( schedule_selector(Atlas4::step), 0.1f); base.schedule(step, 0.1f); }
public Atlas4() { m_time = 0; // Upper Label CCLabelBMFont label = new CCLabelBMFont("Bitmap Font Atlas", "fonts/bitmapFontTest.fnt"); AddChild(label); CCSize s = CCDirector.SharedDirector.WinSize; label.Position = new CCPoint(s.Width / 2, s.Height / 2); label.AnchorPoint = new CCPoint(0.5f, 0.5f); CCSprite BChar = (CCSprite)label.GetChildByTag(0); CCSprite FChar = (CCSprite)label.GetChildByTag(7); CCSprite AChar = (CCSprite)label.GetChildByTag(12); CCActionInterval rotate = new CCRotateBy(2, 360); CCAction rot_4ever = new CCRepeatForever(rotate); CCActionInterval scale = new CCScaleBy(2, 1.5f); CCFiniteTimeAction scale_back = scale.Reverse(); CCFiniteTimeAction scale_seq = new CCSequence(scale, scale_back); CCAction scale_4ever = new CCRepeatForever((CCActionInterval)scale_seq); CCActionInterval jump = new CCJumpBy(0.5f, new CCPoint(), 60, 1); CCAction jump_4ever = new CCRepeatForever(jump); CCActionInterval fade_out = new CCFadeOut(1); CCActionInterval fade_in = new CCFadeIn(1); CCFiniteTimeAction seq = new CCSequence(fade_out, fade_in); CCAction fade_4ever = new CCRepeatForever((CCActionInterval)seq); BChar.RunAction(rot_4ever); BChar.RunAction(scale_4ever); FChar.RunAction(jump_4ever); AChar.RunAction(fade_4ever); // Bottom Label CCLabelBMFont label2 = new CCLabelBMFont("00.0", "fonts/bitmapFontTest.fnt"); AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2); label2.Position = new CCPoint(s.Width / 2.0f, 80); CCSprite lastChar = (CCSprite)label2.GetChildByTag(3); lastChar.RunAction((CCAction)(rot_4ever.Copy())); //schedule( schedule_selector(Atlas4::step), 0.1f); base.Schedule(step, 0.1f); }
public override void OnEnter() { base.OnEnter(); alignSpritesLeft(1); var jump = new CCJumpBy(2, new CCPoint(300, 0), 50, 4); var action = CCSequence.FromActions(jump, jump.Reverse()); m_grossini.RunAction(action); }
public override void onEnter() { base.onEnter(); alignSpritesLeft(1); CCActionInterval jump = CCJumpBy.actionWithDuration(2, new CCPoint(300, 0), 50, 4); CCFiniteTimeAction action = CCSequence.actions(jump, jump.reverse()); m_grossini.runAction(action); }
public override void onEnter() { base.onEnter(); alignSpritesLeft(1); CCAction action = CCSpawn.actions( CCJumpBy.actionWithDuration(2, new CCPoint(300, 0), 50, 4), CCRotateBy.actionWithDuration(2, 720)); m_grossini.runAction(action); }
public Atlas4() { m_time = 0; // Upper Label label = new CCLabelBMFont("Bitmap Font Atlas", "fonts/bitmapFontTest.fnt"); AddChild(label); label.AnchorPoint = CCPoint.AnchorMiddle; var BChar = (CCSprite)label[0]; var FChar = (CCSprite)label[7]; var AChar = (CCSprite)label[12]; var rotate = new CCRotateBy(2, 360); var rot_4ever = new CCRepeatForever(rotate); var scale = new CCScaleBy(2, 1.5f); var scale_back = scale.Reverse(); var scale_seq = new CCSequence(scale, scale_back); var scale_4ever = new CCRepeatForever(scale_seq); var jump = new CCJumpBy(0.5f, new CCPoint(), 60, 1); var jump_4ever = new CCRepeatForever(jump); var fade_out = new CCFadeOut(1); var fade_in = new CCFadeIn(1); var seq = new CCSequence(fade_out, fade_in); var fade_4ever = new CCRepeatForever(seq); BChar.RunAction(rot_4ever); BChar.RunAction(scale_4ever); FChar.RunAction(jump_4ever); AChar.RunAction(fade_4ever); // Bottom Label label2 = new CCLabelBMFont("00.0", "fonts/bitmapFontTest.fnt"); AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2); var lastChar = (CCSprite)label2[3]; lastChar.RunAction(rot_4ever); //schedule( schedule_selector(Atlas4::step), 0.1f); base.Schedule(step, 0.1f); }
public override void onEnter() { base.onEnter(); centerSprites(3); CCActionInterval actionTo = CCJumpTo.actionWithDuration(2, new CCPoint(300, 300), 50, 4); CCActionInterval actionBy = CCJumpBy.actionWithDuration(2, new CCPoint(300, 0), 50, 4); CCActionInterval actionUp = CCJumpBy.actionWithDuration(2, new CCPoint(0, 0), 80, 4); CCFiniteTimeAction actionByBack = actionBy.reverse(); m_tamara.runAction(actionTo); m_grossini.runAction(CCSequence.actions(actionBy, actionByBack)); m_kathia.runAction(CCRepeatForever.actionWithAction(actionUp)); }
public override void OnEnter() { base.OnEnter(); centerSprites(3); var actionTo = new CCJumpTo(2, new CCPoint(300, 300), 50, 4); var actionBy = new CCJumpBy(2, new CCPoint(300, 0), 50, 4); var actionUp = new CCJumpBy(2, new CCPoint(0, 0), 80, 4); var actionByBack = actionBy.Reverse(); m_tamara.RunAction(actionTo); m_grossini.RunAction(CCSequence.FromActions(actionBy, actionByBack)); m_kathia.RunAction(new CCRepeatForever(actionUp)); }
protected override void AddedToScene() { base.AddedToScene(); var label = new CCLabelBMFont("Enable AtlasItem", "fonts/bitmapFontTest3.fnt"); var item1 = new CCMenuItemLabelBMFont(label, this.menuCallback2); CCMenuItemFont.FontSize = 28; CCMenuItemFont.FontName = "arial"; var item2 = new CCMenuItemFont("--- Go Back ---", this.menuCallback); // We do not have an HD version of the menuitemsprite so internally CocosSharp tries to convert our // rectangle coordinates passed to work with HD images so the coordinates are off. We will just // modify this here to make sure we have the correct sizes when they are passed. var spriteNormal = new CCSprite(s_MenuItem, new CCRect(0, 23 * 2, 115, 23)); var spriteSelected = new CCSprite(s_MenuItem, new CCRect(0, 23 * 1, 115, 23)); var spriteDisabled = new CCSprite(s_MenuItem, new CCRect(0, 23 * 0, 115, 23)); var item3 = new CCMenuItemImage(spriteNormal, spriteSelected, spriteDisabled, this.menuCallback3); m_disabledItem = item3; m_disabledItem.Enabled = false; var menu = new CCMenu(item1, item2, item3); menu.Position = new CCPoint(0, 0); var s = Layer.VisibleBoundsWorldspace.Size; item1.Position = new CCPoint(s.Width / 2 - 150, s.Height / 2); item2.Position = new CCPoint(s.Width / 2 - 200, s.Height / 2); item3.Position = new CCPoint(s.Width / 2, s.Height / 2 - 100); var jump = new CCJumpBy(3, new CCPoint(400, 0), 50, 4); item2.RepeatForever(jump, jump.Reverse()); var spin1 = new CCRotateBy(3, 360); item1.RepeatForever(spin1); item2.RepeatForever(spin1); item3.RepeatForever(spin1); AddChild(menu); }
public MenuLayer3() { CCMenuItemFont.FontName = "Arial"; CCMenuItemFont.FontSize = 28; CCLabelBMFont label = CCLabelBMFont.labelWithString("Enable AtlasItem", "fonts/fnt/bitmapFontTest3"); CCMenuItemLabel item1 = CCMenuItemLabel.itemWithLabel(label, this, this.menuCallback2); CCMenuItemFont item2 = CCMenuItemFont.itemFromString("--- Go Back ---", this, this.menuCallback); m_item2 = item2; m_item1 = item1; CCSprite spriteNormal = CCSprite.spriteWithFile(s_MenuItem, new CCRect(0, 23 * 2, 115, 23)); CCSprite spriteSelected = CCSprite.spriteWithFile(s_MenuItem, new CCRect(0, 23 * 1, 115, 23)); CCSprite spriteDisabled = CCSprite.spriteWithFile(s_MenuItem, new CCRect(0, 23 * 0, 115, 23)); CCMenuItemSprite item3 = CCMenuItemSprite.itemFromNormalSprite(spriteNormal, spriteSelected, spriteDisabled, this, this.menuCallback3); m_disabledItem = item3; m_disabledItem.Enabled = false; m_item3 = item3; CCMenu menu = CCMenu.menuWithItems(item1, item2, item3); menu.position = new CCPoint(0, 0); addChild(menu); CCSize s = CCDirector.sharedDirector().getWinSize(); m_item1.position = new CCPoint(s.width / 2 - 150, s.height / 2); m_item2.position = new CCPoint(s.width / 2 - 200, s.height / 2); m_item3.position = new CCPoint(s.width / 2, s.height / 2 - 100); CCJumpBy jump = CCJumpBy.actionWithDuration(3, new CCPoint(400, 0), 50, 4); CCActionInterval spin1 = CCRotateBy.actionWithDuration(3, 360); CCActionInterval spin2 = (CCActionInterval)(spin1.copy()); CCActionInterval spin3 = (CCActionInterval)(spin1.copy()); m_item1.runAction(CCRepeatForever.actionWithAction(spin1)); m_item2.runAction(CCRepeatForever.actionWithAction( (CCActionInterval)(CCSequence.actions(jump, jump.reverse())) ) ); m_item2.runAction(CCRepeatForever.actionWithAction(spin2)); // Augments the jump m_item3.runAction(CCRepeatForever.actionWithAction(spin3)); }
public MenuLayer3() { CCMenuItemFont.FontName = "arial"; CCMenuItemFont.FontSize = 28; CCLabelBMFont label = new CCLabelBMFont("Enable AtlasItem", "fonts/bitmapFontTest3.fnt"); CCMenuItemLabel item1 = new CCMenuItemLabel(label, this.menuCallback2); CCMenuItemFont item2 = new CCMenuItemFont("--- Go Back ---", this.menuCallback); CCSprite spriteNormal = new CCSprite(s_MenuItem, new CCRect(0, 23 * 2, 115, 23)); CCSprite spriteSelected = new CCSprite(s_MenuItem, new CCRect(0, 23 * 1, 115, 23)); CCSprite spriteDisabled = new CCSprite(s_MenuItem, new CCRect(0, 23 * 0, 115, 23)); CCMenuItemSprite item3 = new CCMenuItemSprite(spriteNormal, spriteSelected, spriteDisabled, this.menuCallback3); m_disabledItem = item3; m_disabledItem.Enabled = false; CCMenu menu = new CCMenu(item1, item2, item3); menu.Position = new CCPoint(0, 0); CCSize s = CCDirector.SharedDirector.WinSize; item1.Position = new CCPoint(s.Width / 2 - 150, s.Height / 2); item2.Position = new CCPoint(s.Width / 2 - 200, s.Height / 2); item3.Position = new CCPoint(s.Width / 2, s.Height / 2 - 100); CCJumpBy jump = new CCJumpBy(3, new CCPoint(400, 0), 50, 4); item2.RunAction(new CCRepeatForever( (CCActionInterval)(new CCSequence(jump, jump.Reverse())) ) ); CCActionInterval spin1 = new CCRotateBy(3, 360); CCActionInterval spin2 = (CCActionInterval)(spin1.Copy()); CCActionInterval spin3 = (CCActionInterval)(spin1.Copy()); item1.RunAction(new CCRepeatForever(spin1)); item2.RunAction(new CCRepeatForever(spin2)); item3.RunAction(new CCRepeatForever(spin3)); AddChild(menu); }
public override void OnEnter() { base.OnEnter(); CCRect visibleBounds = VisibleBoundsWorldspace; var radius = 150; var lens = new CCLens3D(10, new CCGridSize(64, 48), new CCPoint(100, visibleBounds.Center.Y - radius / 2), radius); var jumpBy = new CCJumpBy(5, new CCPoint(600, 0), 100, 5); CCLens3DState lensState = bgNode.RunAction(lens) as CCLens3DState; var target = new Lens3DTarget(lensState); // Please make sure the target has been added to its parent. AddChild(target); target.AddActions(false, jumpBy, jumpBy.Reverse()); }
public override void OnEnter() { base.OnEnter(); CCRect visibleBounds = VisibleBoundsWorldspace; var lens = new CCLens3D(10, new CCGridSize(64, 48), new CCPoint(100, 180), 80); var move = new CCJumpBy(5, new CCPoint(600, 0), 100, 5); var move_back = move.Reverse(); CCLens3DState lensState = bgNode.RunAction(lens) as CCLens3DState; var target = new Lens3DTarget(lensState); // Please make sure the target has been added to its parent. AddChild(target); target.AddActions(false, move, move_back); }
public override void onEnter() { base.onEnter(); float x, y; CCSize size = CCDirector.sharedDirector().getWinSize(); x = size.width; y = size.height; CCSprite sprite = CCSprite.spriteWithFile(s_pPathGrossini); CCSprite spriteSister1 = CCSprite.spriteWithFile(s_pPathSister1); CCSprite spriteSister2 = CCSprite.spriteWithFile(s_pPathSister2); sprite.scale = (1.5f); spriteSister1.scale = (1.5f); spriteSister2.scale = (1.5f); sprite.position = (new CCPoint(x / 2, y / 2)); spriteSister1.position = (new CCPoint(40, y / 2)); spriteSister2.position = (new CCPoint(x - 40, y / 2)); CCAction rot = CCRotateBy.actionWithDuration(16, -3600); addChild(sprite); addChild(spriteSister1); addChild(spriteSister2); sprite.runAction(rot); CCActionInterval jump1 = CCJumpBy.actionWithDuration(4, new CCPoint(-400, 0), 100, 4); CCActionInterval jump2 = (CCActionInterval)jump1.reverse(); CCActionInterval rot1 = CCRotateBy.actionWithDuration(4, 360 * 2); CCActionInterval rot2 = (CCActionInterval)rot1.reverse(); spriteSister1.runAction(CCRepeat.actionWithAction(CCSequence.actions(jump2, jump1), 5)); spriteSister2.runAction(CCRepeat.actionWithAction(CCSequence.actions((CCFiniteTimeAction)(jump1.copy()), (CCFiniteTimeAction)(jump2.copy())), 5)); spriteSister1.runAction(CCRepeat.actionWithAction(CCSequence.actions(rot1, rot2), 5)); spriteSister2.runAction(CCRepeat.actionWithAction(CCSequence.actions((CCFiniteTimeAction)(rot2.copy()), (CCFiniteTimeAction)(rot1.copy())), 5)); }
public override void OnEnter() { base.OnEnter(); float x, y; CCSize size = CCDirector.SharedDirector.WinSize; x = size.Width; y = size.Height; CCSprite sprite = new CCSprite(s_pPathGrossini); CCSprite spriteSister1 = new CCSprite(s_pPathSister1); CCSprite spriteSister2 = new CCSprite(s_pPathSister2); sprite.Scale = (1.5f); spriteSister1.Scale = (1.5f); spriteSister2.Scale = (1.5f); sprite.Position = (new CCPoint(x / 2, y / 2)); spriteSister1.Position = (new CCPoint(40, y / 2)); spriteSister2.Position = (new CCPoint(x - 40, y / 2)); CCAction rot = new CCRotateBy(16, -3600); AddChild(sprite); AddChild(spriteSister1); AddChild(spriteSister2); sprite.RunAction(rot); CCActionInterval jump1 = new CCJumpBy(4, new CCPoint(-400, 0), 100, 4); CCActionInterval jump2 = (CCActionInterval)jump1.Reverse(); CCActionInterval rot1 = new CCRotateBy(4, 360 * 2); CCActionInterval rot2 = (CCActionInterval)rot1.Reverse(); spriteSister1.RunAction(new CCRepeat(new CCSequence(jump2, jump1), 5)); spriteSister2.RunAction(new CCRepeat(new CCSequence((CCFiniteTimeAction)(jump1.Copy()), (CCFiniteTimeAction)(jump2.Copy())), 5)); spriteSister1.RunAction(new CCRepeat(new CCSequence(rot1, rot2), 5)); spriteSister2.RunAction(new CCRepeat(new CCSequence((CCFiniteTimeAction)(rot2.Copy()), (CCFiniteTimeAction)(rot1.Copy())), 5)); }
public override void OnEnter() { base.OnEnter(); centerSprites(2); var jump1 = new CCJumpBy(2, CCPoint.Zero, 100, 3); var jump2 = (CCJumpBy)jump1.Copy(); var rot1 = new CCRotateBy(1, 360); var rot2 = (CCRotateBy)rot1.Copy(); var t1 = new CCTargetedAction(m_kathia, jump2); var t2 = new CCTargetedAction(m_kathia, rot2); var seq = CCSequence.FromActions(jump1, t1, rot1, t2); var always = new CCRepeatForever(seq); m_tamara.RunAction(always); }
protected override void InitialiseScenes() { base.InitialiseScenes(); var bounds = Layer.VisibleBoundsWorldspace; InSceneNodeContainer.Scale = 0.5f; InSceneNodeContainer.Position = new CCPoint(bounds.Origin.X + bounds.Size.Width, bounds.Origin.Y); InSceneNodeContainer.AnchorPoint = new CCPoint(0.5f, 0.5f); OutSceneNodeContainer.AnchorPoint = new CCPoint(0.5f, 0.5f); InSceneNodeContainer.IgnoreAnchorPointForPosition = true; OutSceneNodeContainer.IgnoreAnchorPointForPosition = true; CCJumpBy jump = new CCJumpBy (Duration / 4, new CCPoint(-bounds.Size.Width, 0), bounds.Size.Width / 4, 2); CCFiniteTimeAction scaleIn = new CCScaleTo(Duration / 4, 1.0f); CCFiniteTimeAction scaleOut = new CCScaleTo(Duration / 4, 0.5f); jumpZoomOut = (new CCSequence(scaleOut, jump)); jumpZoomIn = (new CCSequence(jump, scaleIn)); delay = new CCDelayTime (Duration / 2); }
public Layer3() { CCMenuItemFont.DefaultFontName = "Marker Felt"; CCMenuItemFont.DefaultFontSize = 28; CCLabelBMFont label = new CCLabelBMFont("Enable AtlasItem", "bitmapFontTest3.fnt"); CCMenuItemLabel item1 = new CCMenuItemLabel(label, this, new MonoMac.ObjCRuntime.Selector("menuCallback2:")); CCMenuItemFont item2 = new CCMenuItemFont("--- Go Back ---", this, new MonoMac.ObjCRuntime.Selector("menuCallback:")); CCSprite spriteNormal = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 2, 115, 23)); CCSprite spriteSelected = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 1, 115, 23)); CCSprite spriteDisabled = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 0, 115, 23)); CCMenuItemSprite item3 = new CCMenuItemSprite (spriteNormal, spriteSelected, spriteDisabled, this, new MonoMac.ObjCRuntime.Selector("menuCallback3:")); disabledItem = item3; disabledItem.Enabled = false; NSArray arrayOfItems = NSArray.FromObjects(item1, item2, item3); CCMenu menu = new CCMenu(arrayOfItems); CGSize s = CCDirector.SharedDirector().WinSize (); item1.Position = new CCPoint(s.Width/2 - 150, s.Height/2); item2.Position = new CCPoint(s.Width/2 - 200, s.Height/2); item3.Position = new CCPoint(s.Width/2, s.Height/2 - 100); var jump = new CCJumpBy(3, new CCPoint(400,0), 50, 4); item2.RunAction (new CCRepeatForever ((CCActionInterval)CCSequence.Actions (jump, jump.Reverse ()))); var spin1 = new CCRotateBy (3, 360); var spin2 = (CCRotateBy)spin1.Copy (); var spin3 = (CCRotateBy)spin1.Copy (); item1.RunAction (new CCRepeatForever (spin1)); item2.RunAction (new CCRepeatForever (spin2)); item3.RunAction (new CCRepeatForever (spin3)); this.AddChild (menu); menu.Position = new CCPoint(0, 0); }
protected override void InitialiseScenes() { base.InitialiseScenes(); var bounds = Layer.VisibleBoundsWorldspace; InSceneNodeContainer.Scale = 0.5f; InSceneNodeContainer.Position = new CCPoint(bounds.Origin.X + bounds.Size.Width, bounds.Origin.Y); InSceneNodeContainer.AnchorPoint = new CCPoint(0.5f, 0.5f); OutSceneNodeContainer.AnchorPoint = new CCPoint(0.5f, 0.5f); InSceneNodeContainer.IgnoreAnchorPointForPosition = true; OutSceneNodeContainer.IgnoreAnchorPointForPosition = true; CCJumpBy jump = new CCJumpBy(Duration / 4, new CCPoint(-bounds.Size.Width, 0), bounds.Size.Width / 4, 2); CCFiniteTimeAction scaleIn = new CCScaleTo(Duration / 4, 1.0f); CCFiniteTimeAction scaleOut = new CCScaleTo(Duration / 4, 0.5f); jumpZoomOut = (new CCSequence(scaleOut, jump)); jumpZoomIn = (new CCSequence(jump, scaleIn)); delay = new CCDelayTime(Duration / 2); }
public override void OnEnter() { base.OnEnter(); CCLens3D lens = new CCLens3D(10, new CCGridSize(32, 24), new CCPoint(100, 180), 150); CCJumpBy move = new CCJumpBy(5, new CCPoint(380, 0), 100, 4); var move_back = (CCActionInterval)move.Reverse(); CCSequence seq = new CCSequence(move, move_back); /* In cocos2d-iphone, the type of action's target is 'id', so it supports using the instance of 'CCLens3D' as its target. * While in cocos2d-x, the target of action only supports CCNode or its subclass, * so we make an encapsulation for CCLens3D to achieve that. */ CCDirector director = CCDirector.SharedDirector; CCNode target = Lens3DTarget.Create(lens); // Please make sure the target been added to its parent. AddChild(target); director.ActionManager.AddAction(seq, target, false); RunAction(lens); }
public override void OnEnter() { base.OnEnter(); var s = Layer.VisibleBoundsWorldspace.Size; // rotate and jump var jump1 = new CCJumpBy(4, new CCPoint(-s.Width + 80, 0), 100, 4); var jump2 = jump1.Reverse(); var rot1 = new CCRotateBy(4, 360 * 2); var rot2 = rot1.Reverse(); var seq3_1 = new CCSequence(jump2, jump1); var seq3_2 = new CCSequence(rot1, rot2); var spawn = new CCSpawn(seq3_1, seq3_2); speedAction1 = new CCSpeed(new CCRepeatForever(spawn), 1.0f); speedAction2 = new CCSpeed(new CCRepeatForever(spawn), 2.0f); speedAction3 = new CCSpeed(new CCRepeatForever(spawn), 0.5f); m_grossini.RunAction(speedAction1); m_tamara.RunAction(speedAction2); m_kathia.RunAction(speedAction3); }
protected CCJumpBy(CCJumpBy jumpBy) : base(jumpBy) { InitWithDuration(jumpBy.m_fDuration, jumpBy.m_delta, jumpBy.m_height, jumpBy.m_nJumps); }
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 CCJumpToState (CCJumpBy action, CCNode target) : base (action, target) { Delta = new CCPoint (Delta.X - StartPosition.X, Delta.Y - StartPosition.Y); }