public override void onEnter() { base.onEnter(); CCNode target = getChildByTag(EffectAdvanceScene.kTagBackground); // To reuse a grid the grid size and the grid type must be the same. // in this case: // ShakyTiles is TiledGrid3D and it's size is (15,10) // Shuffletiles is TiledGrid3D and it's size is (15,10) // TurnOfftiles is TiledGrid3D and it's size is (15,10) CCActionInterval shaky = CCShakyTiles3D.actionWithRange(4, false, new ccGridSize(15, 10), 5); CCActionInterval shuffle = CCShuffleTiles.actionWithSeed(0, new ccGridSize(15, 10), 3); CCActionInterval turnoff = CCTurnOffTiles.actionWithSeed(0, new ccGridSize(15, 10), 3); CCFiniteTimeAction turnon = turnoff.reverse(); // reuse 2 times: // 1 for shuffle // 2 for turn off // turnon tiles will use a new grid CCFiniteTimeAction reuse = CCReuseGrid.actionWithTimes(2); CCActionInterval delay = CCDelayTime.actionWithDuration(1); // id orbit = [OrbitCamera::actionWithDuration:5 radius:1 deltaRadius:2 angleZ:0 deltaAngleZ:180 angleX:0 deltaAngleX:-90]; // id orbit_back = [orbit reverse]; // // [target runAction: [RepeatForever::actionWithAction: [Sequence actions: orbit, orbit_back, nil]]]; target.runAction((CCActionInterval)(CCSequence.actions(shaky, delay, reuse, shuffle, delay, turnoff, turnon))); }
public TMXIsoVertexZ() { CCTMXTiledMap map = CCTMXTiledMap.tiledMapWithTMXFile("TileMaps/iso-test-vertexz"); addChild(map, 0, 1); CCSize s = map.contentSize; map.position = new CCPoint(-s.width / 2, 0); ////----UXLOG("ContentSize: %f, %f", s.width,s.height); // because I'm lazy, I'm reusing a tile as an sprite, but since this method uses vertexZ, you // can use any CCSprite and it will work OK. CCTMXLayer layer = map.layerNamed("Trees"); m_tamara = layer.tileAt(new CCPoint(29, 29)); CCActionInterval move = CCMoveBy.actionWithDuration(10, new CCPoint(300 * 1 / CCDirector.sharedDirector().ContentScaleFactor, 250 * 1 / CCDirector.sharedDirector().ContentScaleFactor)); CCActionInterval back = (CCActionInterval)move.reverse(); CCFiniteTimeAction seq = CCSequence.actions(move, back); m_tamara.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq)); schedule(repositionSprite); }
public override void onEnter() { base.onEnter(); CCActionInterval move = CCMoveBy.actionWithDuration(3, new CCPoint(350, 0)); CCActionInterval move_back = (CCActionInterval)move.reverse(); CCActionInterval move_ease_in = CCEaseIn.actionWithAction(move.copy() as CCActionInterval, 3); CCActionInterval move_ease_in_back = move_ease_in.reverse() as CCActionInterval; CCActionInterval move_ease_out = CCEaseOut.actionWithAction(move.copy() as CCActionInterval, 3); CCActionInterval move_ease_out_back = move_ease_out.reverse() as CCActionInterval; CCFiniteTimeAction seq1 = CCSequence.actions(move, move_back); CCFiniteTimeAction seq2 = CCSequence.actions(move_ease_in, move_ease_in_back); CCFiniteTimeAction seq3 = CCSequence.actions(move_ease_out, move_ease_out_back); CCAction a2 = m_grossini.runAction(CCRepeatForever.actionWithAction(seq1 as CCActionInterval)); a2.tag = 1; CCAction a1 = m_tamara.runAction(CCRepeatForever.actionWithAction(seq2 as CCActionInterval)); a1.tag = 1; CCAction a = m_kathia.runAction(CCRepeatForever.actionWithAction(seq3 as CCActionInterval)); a.tag = 1; schedule(new SEL_SCHEDULE(testStopAction), 6.0f); }
public override void onEnter() { base.onEnter(); float x, y; CCSize size = CCDirector.sharedDirector().getWinSize(); x = size.width; y = size.height; CCSprite bg = CCSprite.spriteWithFile("Images/background3"); addChild(bg, 0, EffectAdvanceScene.kTagBackground); bg.position = new CCPoint(x / 2, y / 2); grossini = CCSprite.spriteWithFile("Images/grossinis_sister2"); bg.addChild(grossini, 1, EffectAdvanceScene.kTagSprite1); grossini.position = new CCPoint(x / 3.0f, 200); CCActionInterval sc = CCScaleBy.actionWithDuration(2, 5); CCFiniteTimeAction sc_back = sc.reverse(); grossini.runAction(CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(sc, sc_back)))); tamara = CCSprite.spriteWithFile("Images/grossinis_sister1"); bg.addChild(tamara, 1, EffectAdvanceScene.kTagSprite2); tamara.position = new CCPoint(2 * x / 3.0f, 200); CCActionInterval sc2 = CCScaleBy.actionWithDuration(2, 5); CCFiniteTimeAction sc2_back = sc2.reverse(); tamara.runAction(CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(sc2, sc2_back)))); CCLabelTTF label = CCLabelTTF.labelWithString(title(), "Arial", 28); label.position = new CCPoint(x / 2, y - 80); addChild(label); label.tag = EffectAdvanceScene.kTagLabel; string strSubtitle = subtitle(); if (strSubtitle != null) { CCLabelTTF l = CCLabelTTF.labelWithString(strSubtitle, "Arial", 16); addChild(l, 101); l.position = new CCPoint(size.width / 2, size.height - 80); } CCMenuItemImage item1 = CCMenuItemImage.itemFromNormalImage("Images/b1", "Images/b2", this, backCallback); CCMenuItemImage item2 = CCMenuItemImage.itemFromNormalImage("Images/r1", "Images/r2", this, restartCallback); CCMenuItemImage item3 = CCMenuItemImage.itemFromNormalImage("Images/f1", "Images/f2", this, nextCallback); CCMenu menu = CCMenu.menuWithItems(item1, item2, item3); menu.position = new CCPoint(0, 0); item1.position = new CCPoint(size.width / 2 - 100, 30); item2.position = new CCPoint(size.width / 2, 30); item3.position = new CCPoint(size.width / 2 + 100, 30); addChild(menu, 1); }
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(); // 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 TMXIsoZorder() { CCTMXTiledMap map = CCTMXTiledMap.tiledMapWithTMXFile("TileMaps/iso-test-zorder"); addChild(map, 0, 1); CCSize s = map.contentSize; ////----UXLOG("ContentSize: %f, %f", s.width,s.height); map.position = (new CCPoint(-s.width / 2, 0)); m_tamara = CCSprite.spriteWithFile(s_pPathSister1); map.addChild(m_tamara, map.children.Count); int mapWidth = (int)(map.MapSize.width * map.TileSize.width); m_tamara.positionInPixels = new CCPoint(mapWidth / 2, 0); m_tamara.anchorPoint = new CCPoint(0.5f, 0); CCActionInterval move = CCMoveBy.actionWithDuration(10, new CCPoint(300 * 1 / CCDirector.sharedDirector().ContentScaleFactor, 250 * 1 / CCDirector.sharedDirector().ContentScaleFactor)); CCActionInterval back = (CCActionInterval)move.reverse(); CCFiniteTimeAction seq = CCSequence.actions(move, back); m_tamara.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq)); schedule((this.repositionSprite)); }
public override void onEnter() { base.onEnter(); CCActionInterval move = CCMoveBy.actionWithDuration(3, new CCPoint(350, 0)); CCActionInterval move_ease_inout1 = CCEaseInOut.actionWithAction(move.copy() as CCActionInterval, 2.0f); CCActionInterval move_ease_inout_back1 = move_ease_inout1.reverse() as CCActionInterval; CCActionInterval move_ease_inout2 = CCEaseInOut.actionWithAction(move.copy() as CCActionInterval, 3.0f); CCActionInterval move_ease_inout_back2 = move_ease_inout2.reverse() as CCActionInterval; CCActionInterval move_ease_inout3 = CCEaseInOut.actionWithAction(move.copy() as CCActionInterval, 4.0f); CCActionInterval move_ease_inout_back3 = move_ease_inout3.reverse() as CCActionInterval; CCFiniteTimeAction seq1 = CCSequence.actions(move_ease_inout1, move_ease_inout_back1); CCFiniteTimeAction seq2 = CCSequence.actions(move_ease_inout2, move_ease_inout_back2); CCFiniteTimeAction seq3 = CCSequence.actions(move_ease_inout3, move_ease_inout_back3); m_tamara.runAction(CCRepeatForever.actionWithAction(seq1 as CCActionInterval)); m_kathia.runAction(CCRepeatForever.actionWithAction(seq2 as CCActionInterval)); m_grossini.runAction(CCRepeatForever.actionWithAction(seq3 as CCActionInterval)); }
public NodeToWorld() { // // This code tests that nodeToParent works OK: // - It tests different anchor Points // - It tests different children anchor points CCSprite back = CCSprite.spriteWithFile(TestResource.s_back3); addChild(back, -10); back.anchorPoint = (new CCPoint(0, 0)); CCSize backSize = back.contentSize; CCMenuItem item = CCMenuItemImage.itemFromNormalImage(TestResource.s_PlayNormal, TestResource.s_PlaySelect); CCMenu menu = CCMenu.menuWithItems(item); menu.alignItemsVertically(); menu.position = (new CCPoint(backSize.width / 2, backSize.height / 2)); back.addChild(menu); CCActionInterval rot = CCRotateBy.actionWithDuration(5, 360); CCAction fe = CCRepeatForever.actionWithAction(rot); item.runAction(fe); CCActionInterval move = CCMoveBy.actionWithDuration(3, new CCPoint(200, 0)); CCActionInterval move_back = (CCActionInterval)move.reverse(); CCFiniteTimeAction seq = CCSequence.actions(move, move_back); CCAction fe2 = CCRepeatForever.actionWithAction((CCActionInterval)seq); back.runAction(fe2); }
public override void onEnter() { base.onEnter(); CCSize s = CCDirector.sharedDirector().getWinSize(); CCLayerColor layer1 = CCLayerColor.layerWithColorWidthHeight(new ccColor4B(255, 255, 0, 80), 100, 300); layer1.position = (new CCPoint(s.width / 3, s.height / 2)); layer1.isRelativeAnchorPoint = true; addChild(layer1, 1); CCLayerColor layer2 = CCLayerColor.layerWithColorWidthHeight(new ccColor4B(0, 0, 255, 255), 100, 300); layer2.position = (new CCPoint((s.width / 3) * 2, s.height / 2)); layer2.isRelativeAnchorPoint = true; addChild(layer2, 1); CCActionInterval actionTint = CCTintBy.actionWithDuration(2, -255, -127, 0); CCActionInterval actionTintBack = (CCActionInterval)actionTint.reverse(); CCActionInterval seq1 = (CCActionInterval)CCSequence.actions(actionTint, actionTintBack); layer1.runAction(seq1); CCActionInterval actionFade = CCFadeOut.actionWithDuration(2.0f); CCActionInterval actionFadeBack = (CCActionInterval)actionFade.reverse(); CCActionInterval seq2 = (CCActionInterval)CCSequence.actions(actionFade, actionFadeBack); layer2.runAction(seq2); }
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(); CCSize s = CCDirector.SharedDirector.WinSize; CCLayerColor layer1 = new CCLayerColor(new CCColor4B(255, 255, 0, 80), 100, 300); layer1.Position = (new CCPoint(s.Width / 3, s.Height / 2)); layer1.IgnoreAnchorPointForPosition = false; AddChild(layer1, 1); CCLayerColor layer2 = new CCLayerColor(new CCColor4B(0, 0, 255, 255), 100, 300); layer2.Position = (new CCPoint((s.Width / 3) * 2, s.Height / 2)); layer2.IgnoreAnchorPointForPosition = false; AddChild(layer2, 1); CCActionInterval actionTint = new CCTintBy(2, -255, -127, 0); CCActionInterval actionTintBack = (CCActionInterval)actionTint.Reverse(); CCActionInterval seq1 = (CCActionInterval)CCSequence.FromActions(actionTint, actionTintBack); layer1.RunAction(seq1); CCActionInterval actionFade = new CCFadeOut(2.0f); CCActionInterval actionFadeBack = (CCActionInterval)actionFade.Reverse(); CCActionInterval seq2 = (CCActionInterval)CCSequence.FromActions(actionFade, actionFadeBack); layer2.RunAction(seq2); }
public override void onEnter() { base.onEnter(); CCSize s = CCDirector.sharedDirector().getWinSize(); // the root object just rotates around m_root = CCSprite.spriteWithFile(s_pPathR1); addChild(m_root, 1); m_root.position = (new CCPoint(s.width / 2, s.height / 2)); // the target object is offset from root, and the streak is moved to follow it m_target = CCSprite.spriteWithFile(s_pPathR1); m_root.addChild(m_target); m_target.position = (new CCPoint(100, 0)); // create the streak object and add it to the scene //m_streak = CCMotionStreak.streakWithFade(2, 3, s_streak, 32, 32, new ccColor4B(0,255,0,255) ); addChild(m_streak); // schedule an update on each frame so we can syncronize the streak with the target schedule(onUpdate); CCActionInterval a1 = CCRotateBy.actionWithDuration(2, 360); CCAction action1 = CCRepeatForever.actionWithAction(a1); CCActionInterval motion = CCMoveBy.actionWithDuration(2, new CCPoint(100, 0)); m_root.runAction(CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(motion, motion.reverse())))); m_root.runAction(action1); }
public SceneTestLayer2() { m_timeCounter = 0; CCMenuItemFont item1 = CCMenuItemFont.itemFromString("replaceScene", this, onReplaceScene); CCMenuItemFont item2 = CCMenuItemFont.itemFromString("replaceScene w/transition", this, onReplaceSceneTran); CCMenuItemFont item3 = CCMenuItemFont.itemFromString("Go Back", this, onGoBack); CCMenu menu = CCMenu.menuWithItems(item1, item2, item3); menu.alignItemsVertically(); addChild(menu); CCSize s = CCDirector.sharedDirector().getWinSize(); CCSprite sprite = CCSprite.spriteWithFile(s_pPathGrossini); addChild(sprite); sprite.position = new CCPoint(s.width - 40, s.height / 2); CCActionInterval rotate = CCRotateBy.actionWithDuration(2, 360); CCAction repeat = CCRepeatForever.actionWithAction(rotate); sprite.runAction(repeat); schedule(testDealloc); }
public override void OnEnter() { base.OnEnter(); m_pInScene.Scale = 0.001f; m_pOutScene.Scale = 1.0f; m_pInScene.AnchorPoint = new CCPoint(0.5f, 0.5f); m_pOutScene.AnchorPoint = new CCPoint(0.5f, 0.5f); CCActionInterval rotozoom = CCSequence.FromActions ( CCSpawn.FromActions ( new CCScaleBy(m_fDuration / 2, 0.001f), new CCRotateBy(m_fDuration / 2, 360 * 2) ), new CCDelayTime(m_fDuration / 2) ); m_pOutScene.RunAction(rotozoom); m_pInScene.RunAction ( CCSequence.FromActions ( rotozoom.Reverse(), new CCCallFunc((Finish)) ) ); }
public override void onEnter() { base.onEnter(); alignSpritesLeft(2); // Test: // Sequence should work both with IntervalAction and InstantActions CCActionInterval move1 = CCMoveBy.actionWithDuration(1, new CCPoint(250, 0)); CCActionInterval move2 = CCMoveBy.actionWithDuration(1, new CCPoint(0, 50)); CCToggleVisibility tog1 = new CCToggleVisibility(); CCToggleVisibility tog2 = new CCToggleVisibility(); CCFiniteTimeAction seq = CCSequence.actions(move1, tog1, move2, tog2, move1.reverse()); CCActionInterval action = CCRepeat.actionWithAction((CCActionInterval)(CCSequence.actions(seq, seq.reverse())), 3); // Test: // Also test that the reverse of Hide is Show, and vice-versa m_kathia.runAction(action); CCActionInterval move_tamara = CCMoveBy.actionWithDuration(1, new CCPoint(100, 0)); CCActionInterval move_tamara2 = CCMoveBy.actionWithDuration(1, new CCPoint(50, 0)); CCActionInstant hide = new CCHide(); CCFiniteTimeAction seq_tamara = CCSequence.actions(move_tamara, hide, move_tamara2); CCFiniteTimeAction seq_back = seq_tamara.reverse(); m_tamara.runAction(CCSequence.actions(seq_tamara, seq_back)); }
public SpriteBatchNodeAliased() { CCSpriteBatchNode batch = new CCSpriteBatchNode("Images/grossini_dance_atlas", 10); AddChild(batch, 0, (int)kTags.kTagSpriteBatchNode); CCSize s = CCDirector.SharedDirector.WinSize; CCSprite sprite1 = new CCSprite(batch.Texture, new CCRect(85 * 1, 121 * 1, 85, 121)); sprite1.Position = (new CCPoint(s.Width / 2 - 100, s.Height / 2)); batch.AddChild(sprite1, 0, (int)kTagSprite.kTagSprite1); CCSprite sprite2 = new CCSprite(batch.Texture, new CCRect(85 * 1, 121 * 1, 85, 121)); sprite2.Position = (new CCPoint(s.Width / 2 + 100, s.Height / 2)); batch.AddChild(sprite2, 0, (int)kTagSprite.kTagSprite2); CCActionInterval scale = new CCScaleBy(2, 5); CCActionInterval scale_back = (CCActionInterval)scale.Reverse(); CCActionInterval seq = (CCActionInterval)(CCSequence.FromActions(scale, scale_back)); CCAction repeat = new CCRepeatForever(seq); CCAction repeat2 = (CCAction)(repeat.Copy()); sprite1.RunAction(repeat); sprite2.RunAction(repeat2); }
public LabelAtlasColorTest() { CCLabelAtlas label1 = CCLabelAtlas.labelWithString("123 Test", "fonts/fnt/images/tuffy_bold_italic-charmap", 48, 64, ' '); addChild(label1, 0, (int)TagSprite.kTagSprite1); label1.position = new CCPoint(10, 100); label1.Opacity = 200; CCLabelAtlas label2 = CCLabelAtlas.labelWithString("0123456789", "fonts/fnt/images/tuffy_bold_italic-charmap", 48, 64, ' '); addChild(label2, 0, (int)TagSprite.kTagSprite2); label2.position = new CCPoint(10, 200); label2.Color = ccRED; CCActionInterval fade = CCFadeOut.actionWithDuration(1.0f); CCFiniteTimeAction fade_in = fade.reverse(); CCFiniteTimeAction seq = CCSequence.actions(fade, fade_in); CCAction repeat = CCRepeatForever.actionWithAction((CCActionInterval)seq); label2.runAction(repeat); m_time = 0; schedule(step); //:@selector(step:)]; }
private void performanceActions20(CCSprite pSprite) { Random random = new Random(); CCSize size = CCDirector.sharedDirector().getWinSize(); if (random.Next() < 0.2f) { pSprite.position = new CCPoint((random.Next() % (int)size.width), (random.Next() % (int)size.height)); } else { pSprite.position = new CCPoint(-1000, -1000); } float period = 0.5f + (random.Next() % 1000) / 500.0f; CCRotateBy rot = CCRotateBy.actionWithDuration(period, 360.0f * random.Next()); CCActionInterval rot_back = null; CCAction permanentRotation = CCRepeatForever.actionWithAction((CCActionInterval)CCSequence.actions(rot, rot_back)); pSprite.runAction(permanentRotation); float growDuration = 0.5f + (random.Next() % 1000) / 500.0f; CCActionInterval grow = CCScaleBy.actionWithDuration(growDuration, 0.5f, 0.5f); CCAction permanentScaleLoop = CCRepeatForever.actionWithAction(CCSequence.actionOneTwo(grow, grow.reverse())); pSprite.runAction(permanentScaleLoop); }
public override void onEnter() { base.onEnter(); CCActionInterval effect = (CCActionInterval)(CCSequence.actions(CCDelayTime.actionWithDuration(2.0f), CCShaky3D.actionWithRange(16, false, new ccGridSize(5, 5), 5.0f))); // cleanup CCNode bg = getChildByTag(EffectAdvanceScene.kTagBackground); removeChild(bg, true); // background CCLayerColor layer = CCLayerColor.layerWithColor(new ccColor4B(255, 0, 0, 255)); addChild(layer, -10); CCSprite sprite = CCSprite.spriteWithFile("Images/grossini"); sprite.position = new CCPoint(50, 80); layer.addChild(sprite, 10); // foreground CCLayerColor layer2 = CCLayerColor.layerWithColor(new ccColor4B(0, 255, 0, 255)); CCSprite fog = CCSprite.spriteWithFile("Images/Fog"); ccBlendFunc bf = new ccBlendFunc { src = 0x0302, dst = 0x0303 }; fog.BlendFunc = bf; layer2.addChild(fog, 1); addChild(layer2, 1); layer2.runAction(CCRepeatForever.actionWithAction(effect)); }
public override void onEnter() { base.onEnter(); centerSprites(1); CCAnimation animation = CCAnimation.animation(); string frameName; for (int i = 1; i < 15; i++) { if (i < 10) { frameName = string.Format("Images/grossini_dance_0{0}", i); } else { frameName = string.Format("Images/grossini_dance_{0}", i); } animation.addFrameWithFileName(frameName); } CCActionInterval action = CCAnimate.actionWithDuration(3.0f, animation, false); CCFiniteTimeAction action_back = action.reverse(); m_grossini.runAction(CCSequence.actions(action, action_back)); }
public Test5() { CCSprite sp1 = CCSprite.spriteWithFile(TestResource.s_pPathSister1); CCSprite sp2 = CCSprite.spriteWithFile(TestResource.s_pPathSister2); sp1.position = (new CCPoint(100, 160)); sp2.position = (new CCPoint(380, 160)); CCRotateBy rot = CCRotateBy.actionWithDuration(2, 360); CCActionInterval rot_back = rot.reverse() as CCActionInterval; CCAction forever = CCRepeatForever.actionWithAction( (CCActionInterval)(CCSequence.actions(rot, rot_back)) ); CCAction forever2 = (CCAction)(forever.copy()); forever.tag = (101); forever2.tag = (102); addChild(sp1, 0, CocosNodeTestStaticLibrary.kTagSprite1); addChild(sp2, 0, CocosNodeTestStaticLibrary.kTagSprite2); sp1.runAction(forever); sp2.runAction(forever2); schedule(new SEL_SCHEDULE(this.addAndRemove), 2.0f); }
public SpriteBatchNodeAliased() { CCSpriteBatchNode batch = CCSpriteBatchNode.batchNodeWithFile("Images/grossini_dance_atlas", 10); addChild(batch, 0, (int)kTags.kTagSpriteBatchNode); CCSize s = CCDirector.sharedDirector().getWinSize(); CCSprite sprite1 = CCSprite.spriteWithTexture(batch.Texture, new CCRect(85 * 1, 121 * 1, 85, 121)); sprite1.position = (new CCPoint(s.width / 2 - 100, s.height / 2)); batch.addChild(sprite1, 0, (int)kTagSprite.kTagSprite1); CCSprite sprite2 = CCSprite.spriteWithTexture(batch.Texture, new CCRect(85 * 1, 121 * 1, 85, 121)); sprite2.position = (new CCPoint(s.width / 2 + 100, s.height / 2)); batch.addChild(sprite2, 0, (int)kTagSprite.kTagSprite2); CCActionInterval scale = CCScaleBy.actionWithDuration(2, 5); CCActionInterval scale_back = (CCActionInterval)scale.reverse(); CCActionInterval seq = (CCActionInterval)(CCSequence.actions(scale, scale_back)); CCAction repeat = CCRepeatForever.actionWithAction(seq); CCAction repeat2 = (CCAction)(repeat.copy()); sprite1.runAction(repeat); sprite2.runAction(repeat2); }
public override void OnEnter() { base.OnEnter(); CCActionInterval effect = (new CCSequence(new CCDelayTime(2.0f), new CCShaky3D(5.0f, new CCGridSize(5, 5), 16, false))); // cleanup CCNode bg = GetChildByTag(EffectAdvanceScene.kTagBackground); RemoveChild(bg, true); // background CCLayerColor layer = new CCLayerColor(new CCColor4B(255, 0, 0, 255)); AddChild(layer, -10); CCSprite sprite = new CCSprite("Images/grossini"); sprite.Position = new CCPoint(50, 80); layer.AddChild(sprite, 10); // foreground CCLayerColor layer2 = new CCLayerColor(new CCColor4B(0, 255, 0, 255)); CCSprite fog = new CCSprite("Images/Fog"); var bf = new CCBlendFunc { Source = CCOGLES.GL_SRC_ALPHA, Destination = CCOGLES.GL_ONE_MINUS_SRC_ALPHA }; fog.BlendFunc = bf; layer2.AddChild(fog, 1); AddChild(layer2, 1); layer2.RunAction(new CCRepeatForever(effect)); }
public StressTest2() { CCSize s = CCDirector.sharedDirector().getWinSize(); CCLayer sublayer = CCLayer.node(); CCSprite sp1 = CCSprite.spriteWithFile(TestResource.s_pPathSister1); sp1.position = (new CCPoint(80, s.height / 2)); CCActionInterval move = CCMoveBy.actionWithDuration(3, new CCPoint(350, 0)); CCActionInterval move_ease_inout3 = CCEaseInOut.actionWithAction((CCActionInterval)(move.copy()), 2.0f); CCActionInterval move_ease_inout_back3 = (CCActionInterval)move_ease_inout3.reverse(); CCFiniteTimeAction seq3 = CCSequence.actions(move_ease_inout3, move_ease_inout_back3); sp1.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq3)); sublayer.addChild(sp1, 1); CCParticleFire fire = CCParticleFire.node(); fire.Texture = (CCTextureCache.sharedTextureCache().addImage("Images/fire")); fire.position = (new CCPoint(80, s.height / 2 - 50)); CCActionInterval copy_seq3 = (CCActionInterval)(seq3.copy()); fire.runAction(CCRepeatForever.actionWithAction(copy_seq3)); sublayer.addChild(fire, 2); schedule((shouldNotLeak), 6.0f); addChild(sublayer, 0, CocosNodeTestStaticLibrary.kTagSprite1); }
public ParticleDemo() { initWithColor(ccTypes.ccc4(127, 127, 127, 255)); m_emitter = null; isTouchEnabled = true; CCSize s = CCDirector.sharedDirector().getWinSize(); CCLabelTTF label = CCLabelTTF.labelWithString(title(), "Arial", 28); addChild(label, 100, 1000); label.position = new CCPoint(s.width / 2, s.height - 50); CCLabelTTF tapScreen = CCLabelTTF.labelWithString("(Tap the Screen)", "Arial", 20); tapScreen.position = new CCPoint(s.width / 2, s.height - 80); addChild(tapScreen, 100); CCMenuItemImage item1 = CCMenuItemImage.itemFromNormalImage(TestResource.s_pPathB1, TestResource.s_pPathB2, this, new SEL_MenuHandler(backCallback)); CCMenuItemImage item2 = CCMenuItemImage.itemFromNormalImage(TestResource.s_pPathR1, TestResource.s_pPathR2, this, new SEL_MenuHandler(restartCallback)); CCMenuItemImage item3 = CCMenuItemImage.itemFromNormalImage(TestResource.s_pPathF1, TestResource.s_pPathF2, this, new SEL_MenuHandler(nextCallback)); CCMenuItemToggle item4 = CCMenuItemToggle.itemWithTarget(this, new SEL_MenuHandler(toggleCallback), CCMenuItemFont.itemFromString("Free Movement"), CCMenuItemFont.itemFromString("Relative Movement"), CCMenuItemFont.itemFromString("Grouped Movement")); CCMenu menu = CCMenu.menuWithItems(item1, item2, item3, item4); menu.position = new CCPoint(0, 0); item1.position = new CCPoint(s.width / 2 - 100, 30); item2.position = new CCPoint(s.width / 2, 30); item3.position = new CCPoint(s.width / 2 + 100, 30); item4.position = new CCPoint(0, 100); item4.anchorPoint = new CCPoint(0, 0); addChild(menu, 100); CCLabelAtlas labelAtlas = CCLabelAtlas.labelWithString("0000", "fonts/fnt/images/fps_images", 16, 24, '.'); addChild(labelAtlas, 100, ParticleTestScene.kTagLabelAtlas); labelAtlas.position = new CCPoint(s.width - 66, 50); // moving background m_background = CCSprite.spriteWithFile(TestResource.s_back3); addChild(m_background, 5); m_background.position = new CCPoint(s.width / 2 - 120, s.height - 240); CCActionInterval move = CCMoveBy.actionWithDuration(4, new CCPoint(300, 0)); CCFiniteTimeAction move_back = move.reverse(); CCFiniteTimeAction seq = CCSequence.actions(move, move_back); m_background.runAction(CCRepeatForever.actionWithAction((CCActionInterval)seq)); schedule(new SEL_SCHEDULE(step)); }
public TextLayer() { InitWithColor(CCTypes.CreateColor(32, 32, 32, 255)); var node = new CCNode(); CCActionInterval effect = getAction(); node.RunAction(effect); AddChild(node, 0, EffectTestScene.kTagBackground); var bg = new CCSprite(TestResource.s_back3); node.AddChild(bg, 0); bg.AnchorPoint = new CCPoint(0.5f, 0.5f); bg.Position = CCVisibleRect.Center; var grossini = new CCSprite(TestResource.s_pPathSister2); node.AddChild(grossini, 1); grossini.Position = new CCPoint(CCVisibleRect.Left.X + CCVisibleRect.VisibleRect.Size.Width / 3, CCVisibleRect.Center.Y); CCActionInterval sc = new CCScaleBy(2, 5); CCFiniteTimeAction sc_back = sc.Reverse(); grossini.RunAction(new CCRepeatForever((new CCSequence(sc, sc_back)))); var tamara = new CCSprite(TestResource.s_pPathSister1); node.AddChild(tamara, 1); tamara.Position = new CCPoint(CCVisibleRect.Left.X + 2 * CCVisibleRect.VisibleRect.Size.Width / 3, CCVisibleRect.Center.Y); CCActionInterval sc2 = new CCScaleBy(2, 5); CCFiniteTimeAction sc2_back = sc2.Reverse(); tamara.RunAction(new CCRepeatForever((new CCSequence(sc2, sc2_back)))); var label = new CCLabelTTF(EffectTestScene.effectsList[EffectTestScene.actionIdx], "arial", 32); label.Position = new CCPoint(CCVisibleRect.Center.X, CCVisibleRect.Top.Y - 80); AddChild(label); label.Tag = EffectTestScene.kTagLabel; var item1 = new CCMenuItemImage(TestResource.s_pPathB1, TestResource.s_pPathB2, backCallback); var item2 = new CCMenuItemImage(TestResource.s_pPathR1, TestResource.s_pPathR2, restartCallback); var item3 = new CCMenuItemImage(TestResource.s_pPathF1, TestResource.s_pPathF2, nextCallback); var menu = new CCMenu(item1, item2, item3); menu.Position = CCPoint.Zero; item1.Position = new CCPoint(CCVisibleRect.Center.X - item2.ContentSize.Width * 2, CCVisibleRect.Bottom.Y + item2.ContentSize.Height / 2); item2.Position = new CCPoint(CCVisibleRect.Center.X, CCVisibleRect.Bottom.Y + item2.ContentSize.Height / 2); item3.Position = new CCPoint(CCVisibleRect.Center.X + item2.ContentSize.Width * 2, CCVisibleRect.Bottom.Y + item2.ContentSize.Height / 2); AddChild(menu, 1); Schedule(checkAnim); }
public TMXReadWriteTest() { m_gid = 0; CCTMXTiledMap map = CCTMXTiledMap.tiledMapWithTMXFile("TileMaps/orthogonal-test2"); addChild(map, 0, TileMapTestScene.kTagTileMap); CCSize s = map.contentSize; ////----UXLOG("ContentSize: %f, %f", s.width,s.height); CCTMXLayer layer = map.layerNamed("Layer 0"); layer.Texture.setAntiAliasTexParameters(); map.scale = 1; CCSprite tile0 = layer.tileAt(new CCPoint(1, 63)); CCSprite tile1 = layer.tileAt(new CCPoint(2, 63)); CCSprite tile2 = layer.tileAt(new CCPoint(3, 62));//ccp(1,62)); CCSprite tile3 = layer.tileAt(new CCPoint(2, 62)); tile0.anchorPoint = new CCPoint(0.5f, 0.5f); tile1.anchorPoint = new CCPoint(0.5f, 0.5f); tile2.anchorPoint = new CCPoint(0.5f, 0.5f); tile3.anchorPoint = new CCPoint(0.5f, 0.5f); CCActionInterval move = CCMoveBy.actionWithDuration(0.5f, new CCPoint(0, 160)); CCActionInterval rotate = CCRotateBy.actionWithDuration(2, 360); CCActionInterval scale = CCScaleBy.actionWithDuration(2, 5); CCActionInterval opacity = CCFadeOut.actionWithDuration(2); CCActionInterval fadein = CCFadeIn.actionWithDuration(2); CCActionInterval scaleback = CCScaleTo.actionWithDuration(1, 1); CCActionInstant finish = CCCallFuncN.actionWithTarget(this, removeSprite); CCFiniteTimeAction seq0 = CCSequence.actions(move, rotate, scale, opacity, fadein, scaleback, finish); CCActionInterval seq1 = (CCActionInterval)(seq0.copy()); CCActionInterval seq2 = (CCActionInterval)(seq0.copy()); CCActionInterval seq3 = (CCActionInterval)(seq0.copy()); tile0.runAction(seq0); tile1.runAction(seq1); tile2.runAction(seq2); tile3.runAction(seq3); m_gid = layer.tileGIDAt(new CCPoint(0, 63)); ////----UXLOG("Tile GID at:(0,63) is: %d", m_gid); schedule(updateCol, 2.0f); schedule(repaintWithGID, 2.0f); schedule(removeTiles, 1.0f); ////----UXLOG("++++atlas quantity: %d", layer->textureAtlas()->getTotalQuads()); ////----UXLOG("++++children: %d", layer->getChildren()->count() ); m_gid2 = 0; }
protected bool InitWithAction(CCActionInterval pAction) { if (base.InitWithDuration(pAction.Duration)) { m_pInner = pAction; return(true); } return(false); }
protected bool InitWithAction(CCActionInterval pAction, float fPeriod) { if (base.InitWithAction(pAction)) { m_fPeriod = fPeriod; return true; } return false; }
/// <summary> /// initializes the action /// </summary> /// <param name="pAction"></param> /// <returns></returns> public bool initWithAction(CCActionInterval pAction) { if (base.initWithDuration(pAction.Duration)) { m_pOther = pAction; return true; } return false; }
protected bool InitWithAction(CCActionInterval pAction, float fPeriod) { if (base.InitWithAction(pAction)) { m_fPeriod = fPeriod; return(true); } return(false); }
protected bool InitWithAction(CCActionInterval pAction) { if (base.InitWithDuration(pAction.Duration)) { m_pInner = pAction; return true; } return false; }
protected bool InitWithAction(CCActionInterval pAction, float fRate) { if (base.InitWithAction(pAction)) { m_fRate = fRate; return true; } return false; }
/// <summary> /// Initializes the action with the inner action and the rate parameter /// </summary> /// <param name="pAction"></param> /// <param name="fRate"></param> /// <returns></returns> public bool initWithAction(CCActionInterval pAction, float fRate) { if (base.initWithAction(pAction)) { m_fRate = fRate; return true; } return false; }
/// <summary> /// Creates the action with the inner action and the rate parameter /// </summary> /// <param name="pAction"></param> /// <param name="fRate"></param> /// <returns></returns> public static CCEaseRateAction actionWithAction(CCActionInterval pAction, float fRate) { CCEaseRateAction pRet = new CCEaseRateAction(); if (pRet != null) { if (pRet.initWithAction(pAction, fRate)) { //pRet.autorelease(); } else { //CC_SAFE_RELEASE_NULL(pRet); } } return pRet; }
/// <summary> /// Creates the action with the inner action and the period in radians (default is 0.3) /// </summary> /// <param name="pAction"></param> /// <param name="fPeriod"></param> /// <returns></returns> public static CCEaseElastic actionWithAction(CCActionInterval pAction, float fPeriod) { CCEaseElastic pRet = new CCEaseElastic(); if (pRet != null) { if (pRet.initWithAction(pAction, fPeriod)) { //pRet->autorelease(); } else { //CC_SAFE_RELEASE_NULL(pRet); } } return pRet; }
/// <summary> /// creates the action /// </summary> /// <param name="pAction"></param> /// <returns></returns> public static new CCEaseBounceOut actionWithAction(CCActionInterval pAction) { CCEaseBounceOut pRet = new CCEaseBounceOut(); if (pRet != null) { if (pRet.initWithAction(pAction)) { //pRet.autorelease(); } else { //CC_SAFE_RELEASE_NULL(pRet); } } return pRet; }
/// <summary> /// Initializes the action with the inner action and the period in radians (default is 0.3) /// </summary> /// <param name="pAction"></param> /// <param name="fPeriod"></param> /// <returns></returns> public bool initWithAction(CCActionInterval pAction, float fPeriod) { if (base.initWithAction(pAction)) { m_fPeriod = fPeriod; return true; } return false; }
public CCEaseBounce (CCActionInterval pAction) : base (pAction) { }
public virtual CCFiniteTimeAction EaseAction(CCActionInterval action) { return CCEaseOut.Create(action, 2.0f); }
public CCActionEase(CCActionInterval pAction) { InitWithAction(pAction); }
public static CCEaseRateAction Create(CCActionInterval pAction, float fRate) { var pRet = new CCEaseRateAction(); pRet.InitWithAction(pAction, fRate); return pRet; }
public CCEaseElastic(CCActionInterval pAction) : base(pAction) { InitWithAction(pAction); }
public CCEaseRateAction (CCActionInterval pAction, float fRate) : base (pAction) { m_fRate = fRate; }
public CCEaseBackOut (CCActionInterval pAction) : base (pAction) { }
protected new bool InitWithAction(CCActionInterval pAction) { return InitWithAction(pAction, 0.3f); }
public CCEaseElastic(CCActionInterval pAction, float fPeriod) : base(pAction) { m_fPeriod = fPeriod; }
public CCEaseElastic(CCActionInterval pAction, float fPeriod) { InitWithAction(pAction, fPeriod); }
public CCFiniteTimeAction EaseAction(CCActionInterval action) { return new CCEaseOut(action, 2.0f); }
/// <summary> /// initializes the action /// </summary> /// <param name="pAction"></param> /// <returns></returns> public new bool initWithAction(CCActionInterval pAction) { return initWithAction(pAction, 0.3f); }
public static new CCEaseBounceInOut Create(CCActionInterval pAction) { var pRet = new CCEaseBounceInOut(); pRet.InitWithAction(pAction); return pRet; }
public virtual CCFiniteTimeAction EaseAction(CCActionInterval action) { return new CCEaseInOut(action, 3.0f); }
public virtual CCFiniteTimeAction EaseAction(CCActionInterval action) { return action; }