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: // Lens3D is Grid3D and it's size is (15,10) // Waves3D is Grid3D and it's size is (15,10) CCSize size = CCDirector.SharedDirector.WinSize; CCActionInterval lens = new CCLens3D(0.0f, new CCGridSize(15, 10), new CCPoint(size.Width / 4, size.Height / 4), 240); CCActionInterval waves = new CCWaves3D(10, new CCGridSize(15, 10), 18, 15); CCFiniteTimeAction reuse = new CCReuseGrid(1); CCActionInterval delay = new CCDelayTime(8); CCActionInterval orbit = new CCOrbitCamera(5, 1, 2, 0, 180, 0, -90); CCFiniteTimeAction orbit_back = orbit.Reverse(); target.RunAction(new CCRepeatForever((new CCSequence(orbit, orbit_back)))); target.RunAction(new CCSequence(lens, delay, reuse, waves)); }
public override void OnEnter() { // todo : CCOrbitCamera hasn't been implement base.OnEnter(); centerSprites(3); var orbit1 = new CCOrbitCamera(2, 1, 0, 0, 180, 0, 0); var action1 = CCSequence.FromActions(orbit1, orbit1.Reverse()); var orbit2 = new CCOrbitCamera(2, 1, 0, 0, 180, -45, 0); var action2 = CCSequence.FromActions(orbit2, orbit2.Reverse()); var orbit3 = new CCOrbitCamera(2, 1, 0, 0, 180, 90, 0); var action3 = CCSequence.FromActions(orbit3, orbit3.Reverse()); m_kathia.RunAction(new CCRepeatForever(action1)); m_tamara.RunAction(new CCRepeatForever(action2)); m_grossini.RunAction(new CCRepeatForever(action3)); var move = new CCMoveBy(3, new CCPoint(100, -100)); var move_back = move.Reverse(); var seq = CCSequence.FromActions(move, move_back); var rfe = new CCRepeatForever(seq); m_kathia.RunAction(rfe); m_tamara.RunAction((CCAction)(rfe.Copy())); m_grossini.RunAction((CCAction)(rfe.Copy())); }
public override void OnEnter() { base.OnEnter(); GameView.DepthTesting = true; CCRect visibleBounds = VisibleBoundsWorldspace; // To reuse a grid the grid size and the grid type must be the same. // in this case: // Lens3D is Grid3D and it's size is (15,10) // Waves3D is Grid3D and it's size is (15,10) var lens = new CCLens3D(0.0f, new CCGridSize(15, 10), visibleBounds.Center, 200); var waves = new CCWaves3D(10, new CCGridSize(15, 10), 18, 30); var reuse = new CCReuseGrid(1); var delay = new CCDelayTime(8); //bgNode.AnchorPoint = CCPoint.AnchorMiddle; var orbit = new CCOrbitCamera(5, 1.0f, 2, 0, 180, 0, -90); var orbit_back = orbit.Reverse(); //bgNode.RepeatForever(orbit, orbit_back); bgNode.RunActions(lens, delay, reuse, waves); }
public CameraCenterTest() { CCSize s = CCDirector.SharedDirector.WinSize; CCSprite sprite; CCOrbitCamera orbit; // LEFT-TOP sprite = new CCSprite("Images/white-512x512"); AddChild(sprite, 0); sprite.Position = new CCPoint(s.Width / 5 * 1, s.Height / 5 * 1); sprite.Color = CCTypes.CCRed; sprite.TextureRect = new CCRect(0, 0, 120, 50); orbit = new CCOrbitCamera(10, 1, 0, 0, 360, 0, 0); sprite.RunAction(new CCRepeatForever(orbit)); // LEFT-BOTTOM sprite = new CCSprite("Images/white-512x512"); AddChild(sprite, 0, 40); sprite.Position = (new CCPoint(s.Width / 5 * 1, s.Height / 5 * 4)); sprite.Color = CCTypes.CCBlue; sprite.TextureRect = new CCRect(0, 0, 120, 50); orbit = new CCOrbitCamera(10, 1, 0, 0, 360, 0, 0); sprite.RunAction(new CCRepeatForever(orbit)); // RIGHT-TOP sprite = new CCSprite("Images/white-512x512"); AddChild(sprite, 0); sprite.Position = (new CCPoint(s.Width / 5 * 4, s.Height / 5 * 1)); sprite.Color = CCTypes.CCYellow; sprite.TextureRect = new CCRect(0, 0, 120, 50); orbit = new CCOrbitCamera(10, 1, 0, 0, 360, 0, 0); sprite.RunAction(new CCRepeatForever(orbit)); // RIGHT-BOTTOM sprite = new CCSprite("Images/white-512x512"); AddChild(sprite, 0, 40); sprite.Position = (new CCPoint(s.Width / 5 * 4, s.Height / 5 * 4)); sprite.Color = CCTypes.CCGreen; sprite.TextureRect = new CCRect(0, 0, 120, 50); orbit = new CCOrbitCamera(10, 1, 0, 0, 360, 0, 0); sprite.RunAction(new CCRepeatForever(orbit)); // CENTER sprite = new CCSprite("Images/white-512x512"); AddChild(sprite, 0, 40); sprite.Position = (new CCPoint(s.Width / 2, s.Height / 2)); sprite.Color = CCTypes.CCWhite; sprite.TextureRect = new CCRect(0, 0, 120, 50); orbit = new CCOrbitCamera(10, 1, 0, 0, 360, 0, 0); sprite.RunAction(new CCRepeatForever(orbit)); }
protected override void AddedToScene() { base.AddedToScene(); CCSize s = Layer.VisibleBoundsWorldspace.Size; CCSprite p = new CCSprite(TestResource.s_back3); AddChild(p, 0); p.Position = (new CCPoint(s.Width / 2, s.Height / 2)); //p.Opacity = 50; CCSprite sprite; CCOrbitCamera orbit; CCCamera cam; CCSize ss; // LEFT s = p.ContentSize; sprite = new CCSprite(TestResource.s_pPathGrossini); sprite.Scale = (0.5f); p.AddChild(sprite, 0); sprite.Position = (new CCPoint(s.Width / 4 * 1, s.Height / 2)); cam = sprite.Camera; orbit = new CCOrbitCamera(2, 1, 0, 0, 360, 0, 0); sprite.RunAction(new CCRepeatForever(orbit)); // CENTER sprite = new CCSprite(TestResource.s_pPathGrossini); sprite.Scale = 1.0f; p.AddChild(sprite, 0); sprite.Position = new CCPoint(s.Width / 4 * 2, s.Height / 2); orbit = new CCOrbitCamera(2, 1, 0, 0, 360, 45, 0); sprite.RunAction(new CCRepeatForever(orbit)); // RIGHT sprite = new CCSprite(TestResource.s_pPathGrossini); sprite.Scale = 2.0f; p.AddChild(sprite, 0); sprite.Position = new CCPoint(s.Width / 4 * 3, s.Height / 2); ss = sprite.ContentSize; orbit = new CCOrbitCamera(2, 1, 0, 0, 360, 90, -45); sprite.RunAction(new CCRepeatForever(orbit)); // PARENT orbit = new CCOrbitCamera(10, 1, 0, 0, 360, 0, 90); p.RunAction(new CCRepeatForever(orbit)); Scale = 1; }
public CameraOrbitTest() { CCSize s = CCDirector.SharedDirector.WinSize; CCSprite p = new CCSprite(TestResource.s_back3); AddChild(p, 0); p.Position = (new CCPoint(s.Width / 2, s.Height / 2)); p.Opacity = 128; CCSprite sprite; CCOrbitCamera orbit; CCCamera cam; CCSize ss; // LEFT s = p.ContentSize; sprite = new CCSprite(TestResource.s_pPathGrossini); sprite.Scale = (0.5f); p.AddChild(sprite, 0); sprite.Position = (new CCPoint(s.Width / 4 * 1, s.Height / 2)); cam = sprite.Camera; orbit = new CCOrbitCamera(2, 1, 0, 0, 360, 0, 0); sprite.RunAction(new CCRepeatForever(orbit)); // CENTER sprite = new CCSprite(TestResource.s_pPathGrossini); sprite.Scale = 1.0f; p.AddChild(sprite, 0); sprite.Position = new CCPoint(s.Width / 4 * 2, s.Height / 2); orbit = new CCOrbitCamera(2, 1, 0, 0, 360, 45, 0); sprite.RunAction(new CCRepeatForever(orbit)); // RIGHT sprite = new CCSprite(TestResource.s_pPathGrossini); sprite.Scale = 2.0f; p.AddChild(sprite, 0); sprite.Position = new CCPoint(s.Width / 4 * 3, s.Height / 2); ss = sprite.ContentSize; orbit = new CCOrbitCamera(2, 1, 0, 0, 360, 90, -45); sprite.RunAction(new CCRepeatForever(orbit)); // PARENT orbit = new CCOrbitCamera(10, 1, 0, 0, 360, 0, 90); p.RunAction(new CCRepeatForever(orbit)); Scale = 1; }
public CameraOrbitTest() { CCSize s = CCDirector.sharedDirector().getWinSize(); CCSprite p = CCSprite.spriteWithFile(TestResource.s_back3); addChild(p, 0); p.position = (new CCPoint(s.width / 2, s.height / 2)); p.Opacity = 128; CCSprite sprite; CCOrbitCamera orbit; CCCamera cam; CCSize ss; // LEFT s = p.contentSize; sprite = CCSprite.spriteWithFile(TestResource.s_pPathGrossini); sprite.scale = (0.5f); p.addChild(sprite, 0); sprite.position = (new CCPoint(s.width / 4 * 1, s.height / 2)); cam = sprite.Camera; orbit = CCOrbitCamera.actionWithDuration(2, 1, 0, 0, 360, 0, 0); //sprite.runAction(CCRepeatForever.actionWithAction(orbit)); // CENTER sprite = CCSprite.spriteWithFile(TestResource.s_pPathGrossini); sprite.scale = 1.0f; p.addChild(sprite, 0); sprite.position = new CCPoint(s.width / 4 * 2, s.height / 2); orbit = CCOrbitCamera.actionWithDuration(2, 1, 0, 0, 360, 45, 0); //sprite.runAction(CCRepeatForever.actionWithAction(orbit)); // RIGHT sprite = CCSprite.spriteWithFile(TestResource.s_pPathGrossini); sprite.scale = 2.0f; p.addChild(sprite, 0); sprite.position = new CCPoint(s.width / 4 * 3, s.height / 2); ss = sprite.contentSize; orbit = CCOrbitCamera.actionWithDuration(2, 1, 0, 0, 360, 90, -45); //sprite.runAction(CCRepeatForever.actionWithAction(orbit)); // PARENT orbit = CCOrbitCamera.actionWithDuration(10, 1, 0, 0, 360, 0, 90); //p.runAction(CCRepeatForever.actionWithAction(orbit)); scale = 1; }
public CameraTest1() { sprite1 = new CCSprite(TestResource.s_back3); AddChild(sprite1); sprite1.Scale = 0.5f; sprite2 = new CCSprite(TestResource.s_back3); AddChild(sprite2); sprite2.Scale = 0.5f; var camera = new CCOrbitCamera(10, 0, 1, 0, 360, 0, 0); sprite1.RunAction(camera); sprite2.RunAction(camera); }
public SpriteBatchNodeZVertex() { // // This test tests z-order // If you are going to use it is better to use a 3D projection // // WARNING: // The developer is resposible for ordering it's sprites according to it's Z if the sprite has // transparent parts. // CCSize s = CCDirector.sharedDirector().getWinSize(); float step = s.width / 12; // small capacity. Testing resizing. // Don't use capacity=1 in your real game. It is expensive to resize the capacity CCSpriteBatchNode batch = CCSpriteBatchNode.batchNodeWithFile("Images/grossini_dance_atlas", 1); // camera uses the center of the image as the pivoting point batch.contentSize = new CCSize(s.width, s.height); batch.anchorPoint = (new CCPoint(0.5f, 0.5f)); batch.position = (new CCPoint(s.width / 2, s.height / 2)); addChild(batch, 0, (int)kTags.kTagSpriteBatchNode); for (int i = 0; i < 5; i++) { CCSprite sprite = CCSprite.spriteWithTexture(batch.Texture, new CCRect(85 * 0, 121 * 1, 85, 121)); sprite.position = (new CCPoint((i + 1) * step, s.height / 2)); sprite.vertexZ = (10 + i * 40); batch.addChild(sprite, 0); } for (int i = 5; i < 11; i++) { CCSprite sprite = CCSprite.spriteWithTexture(batch.Texture, new CCRect(85 * 1, 121 * 0, 85, 121)); sprite.position = (new CCPoint((i + 1) * step, s.height / 2)); sprite.vertexZ = 10 + (10 - i) * 40; batch.addChild(sprite, 0); } batch.runAction(CCOrbitCamera.actionWithDuration(10, 1, 0, 0, 360, 0, 0)); }
public SpriteZVertex() { // // This test tests z-order // If you are going to use it is better to use a 3D projection // // WARNING: // The developer is resposible for ordering it's sprites according to it's Z if the sprite has // transparent parts. // m_dir = 1; m_time = 0; CCSize s = CCDirector.sharedDirector().getWinSize(); float step = s.width / 12; CCNode node = CCNode.node(); // camera uses the center of the image as the pivoting point node.contentSize = (new CCSize(s.width, s.height)); node.anchorPoint = (new CCPoint(0.5f, 0.5f)); node.position = (new CCPoint(s.width / 2, s.height / 2)); addChild(node, 0); for (int i = 0; i < 5; i++) { CCSprite sprite = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 0, 121 * 1, 85, 121)); sprite.position = (new CCPoint((i + 1) * step, s.height / 2)); sprite.vertexZ = (10 + i * 40); node.addChild(sprite, 0); } for (int i = 5; i < 11; i++) { CCSprite sprite = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(85 * 1, 121 * 0, 85, 121)); sprite.position = (new CCPoint((i + 1) * step, s.height / 2)); sprite.vertexZ = 10 + (10 - i) * 40; node.addChild(sprite, 0); } node.runAction(CCOrbitCamera.actionWithDuration(10, 1, 0, 0, 360, 0, 0)); }
public override void OnEnter() { base.OnEnter(); CCRect visibleBounds = VisibleBoundsWorldspace; // To reuse a grid the grid size and the grid type must be the same. // in this case: // Lens3D is Grid3D and it's size is (15,10) // Waves3D is Grid3D and it's size is (15,10) 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.1f, 100.0f); contentCamera.PerspectiveFieldOfView = (float)Math.PI / 3.0f; //(float)Math.Atan(visibleBounds.Size.Height / (2.0f * targeCenterLength)); var lens = new CCLens3D(0.0f, new CCGridSize(15, 10), bgNode.ContentSize.Center, 90); var waves = new CCWaves3D(10, new CCGridSize(15, 10), 18, 15); var reuse = new CCReuseGrid(1); var delay = new CCDelayTime(8); bgNode.AnchorPoint = CCPoint.AnchorMiddle; var orbit = new CCOrbitCamera(5, 30.0f, 2, 20, 180, 0, -90); var orbit_back = orbit.Reverse(); bgNode.RepeatForever(orbit, orbit_back); bgNode.RunActions(lens, delay, reuse, waves); }
private void CheckSiblings(CCNode currentTarget, List <int> currentSiblings) { var parent = currentTarget.Parent; var card = currentTarget.Children[0].UserObject as CardBase; foreach (var i in currentSiblings) { if (i == -1) { continue; } var sibling = parent.GetChildByTag(i); if (sibling.ChildrenCount == 1) { var siblingCardSprite = sibling.Children[0] as CCSprite; var siblingCard = siblingCardSprite.UserObject as CardBase; if (card.GetType() == siblingCard.GetType()) { continue; } if (CardBase.Compare(card, siblingCard, currentSiblings.IndexOf(i))) { var action = new CCOrbitCamera(1, 1, 0, 0, 360, 0, 0); siblingCardSprite.RunAction(action); var nSiblingCard = siblingCard.ChangeTeam(); CCTexture2D tex = CCTextureCache.SharedTextureCache.AddImage(nSiblingCard.ImageName); siblingCardSprite.Texture = tex; siblingCardSprite.UserObject = nSiblingCard; CheckSiblings(sibling, _siblings[sibling.Tag]); } } } }
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: // Lens3D is Grid3D and it's size is (15,10) // Waves3D is Grid3D and it's size is (15,10) CCSize size = CCDirector.sharedDirector().getWinSize(); CCActionInterval lens = CCLens3D.actionWithPosition(new CCPoint(size.width / 2, size.height / 2), 240, new ccGridSize(15, 10), 0.0f); CCActionInterval waves = CCWaves3D.actionWithWaves(18, 15, new ccGridSize(15, 10), 10); CCFiniteTimeAction reuse = CCReuseGrid.actionWithTimes(1); CCActionInterval delay = CCDelayTime.actionWithDuration(8); CCActionInterval orbit = CCOrbitCamera.actionWithDuration(5, 1, 2, 0, 180, 0, -90); CCFiniteTimeAction orbit_back = orbit.reverse(); target.runAction(CCRepeatForever.actionWithAction((CCActionInterval)(CCSequence.actions(orbit, orbit_back)))); target.runAction(CCSequence.actions(lens, delay, reuse, waves)); }
public override void onEnter() { // todo : CCOrbitCamera hasn't been implement base.onEnter(); centerSprites(3); CCOrbitCamera orbit1 = CCOrbitCamera.actionWithDuration(2, 1, 0, 0, 180, 0, 0); CCFiniteTimeAction action1 = CCSequence.actions( orbit1, orbit1.reverse()); CCOrbitCamera orbit2 = CCOrbitCamera.actionWithDuration(2, 1, 0, 0, 180, -45, 0); CCFiniteTimeAction action2 = CCSequence.actions( orbit2, orbit2.reverse()); CCOrbitCamera orbit3 = CCOrbitCamera.actionWithDuration(2, 1, 0, 0, 180, 90, 0); CCFiniteTimeAction action3 = CCSequence.actions( orbit3, orbit3.reverse()); m_kathia.runAction(CCRepeatForever.actionWithAction((CCActionInterval)action1)); m_tamara.runAction(CCRepeatForever.actionWithAction((CCActionInterval)action2)); m_grossini.runAction(CCRepeatForever.actionWithAction((CCActionInterval)action3)); CCActionInterval move = CCMoveBy.actionWithDuration(3, new CCPoint(100, -100)); CCFiniteTimeAction move_back = move.reverse(); CCFiniteTimeAction seq = CCSequence.actions(move, move_back); CCAction rfe = CCRepeatForever.actionWithAction((CCActionInterval)seq); m_kathia.runAction(rfe); m_tamara.runAction((CCAction)(rfe.copy())); m_grossini.runAction((CCAction)(rfe.copy())); }
public CameraCenterTest() { CCSize s = CCDirector.sharedDirector().getWinSize(); CCSprite sprite; CCOrbitCamera orbit; // LEFT-TOP sprite = new CCSprite();//::node(); sprite.init(); addChild(sprite, 0); sprite.position = (new CCPoint(s.width / 5 * 1, s.height / 5 * 1)); sprite.Color = (new ccColor3B(Color.Red)); sprite.setTextureRect(new CCRect(0, 0, 120, 50)); orbit = CCOrbitCamera.actionWithDuration(10, 1, 0, 0, 360, 0, 0); //sprite.runAction(CCRepeatForever.actionWithAction( orbit)); // [sprite setAnchorPoint: CCPointMake(0,1)); // LEFT-BOTTOM sprite = new CCSprite();//::node(); sprite.init(); addChild(sprite, 0, 40); sprite.position = (new CCPoint(s.width / 5 * 1, s.height / 5 * 4)); sprite.Color = new ccColor3B(Color.Blue); sprite.setTextureRect(new CCRect(0, 0, 120, 50)); orbit = CCOrbitCamera.actionWithDuration(10, 1, 0, 0, 360, 0, 0); //sprite.runAction(CCRepeatForever.actionWithAction( orbit )); // [sprite setAnchorPoint: CCPointMake(0,0)); // RIGHT-TOP sprite = new CCSprite();//::node(); sprite.init(); addChild(sprite, 0); sprite.position = (new CCPoint(s.width / 5 * 4, s.height / 5 * 1)); sprite.Color = new ccColor3B(Color.Yellow); sprite.setTextureRect(new CCRect(0, 0, 120, 50)); orbit = CCOrbitCamera.actionWithDuration(10, 1, 0, 0, 360, 0, 0); //sprite.runAction(CCRepeatForever.actionWithAction(orbit)); // [sprite setAnchorPoint: CCPointMake(1,1)); // RIGHT-BOTTOM sprite = new CCSprite();//::node(); sprite.init(); addChild(sprite, 0, 40); sprite.position = (new CCPoint(s.width / 5 * 4, s.height / 5 * 4)); sprite.Color = new ccColor3B(Color.Green); sprite.setTextureRect(new CCRect(0, 0, 120, 50)); orbit = CCOrbitCamera.actionWithDuration(10, 1, 0, 0, 360, 0, 0); // sprite.runAction(CCRepeatForever.actionWithAction(orbit)); // [sprite setAnchorPoint: CCPointMake(1,0)); // CENTER sprite = new CCSprite(); sprite.init(); addChild(sprite, 0, 40); sprite.position = (new CCPoint(s.width / 2, s.height / 2)); sprite.Color = new ccColor3B(Color.White); sprite.setTextureRect(new CCRect(0, 0, 120, 50)); orbit = CCOrbitCamera.actionWithDuration(10, 1, 0, 0, 360, 0, 0); // sprite.runAction(CCRepeatForever.actionWithAction(orbit)); // [sprite setAnchorPoint: CCPointMake(0.5f, 0.5f)); }
//CCWindowProjection preProjection; public CameraCenterTest() { CCSprite sprite; CCOrbitCamera orbit = new CCOrbitCamera(10, 1, 0, 0, 360, 0, 0);; // LEFT-TOP sprite = new CCSprite("Images/white-512x512") { Tag = 100 }; AddChild(sprite, 0); sprite.Color = CCColor3B.Red; sprite.TextureRectInPixels = new CCRect(0, 0, 120, 50); sprite.RepeatForever(orbit); // LEFT-BOTTOM sprite = new CCSprite("Images/white-512x512") { Tag = 101 }; AddChild(sprite, 0); sprite.Color = CCColor3B.Blue; sprite.TextureRectInPixels = new CCRect(0, 0, 120, 50); sprite.RepeatForever(orbit); // RIGHT-TOP sprite = new CCSprite("Images/white-512x512") { Tag = 102 }; AddChild(sprite, 0); sprite.Color = CCColor3B.Yellow; sprite.TextureRectInPixels = new CCRect(0, 0, 120, 50); sprite.RepeatForever(orbit); // RIGHT-BOTTOM sprite = new CCSprite("Images/white-512x512") { Tag = 103 }; AddChild(sprite, 0); sprite.Color = CCColor3B.Green; sprite.TextureRectInPixels = new CCRect(0, 0, 120, 50); sprite.RepeatForever(orbit); // CENTER sprite = new CCSprite("Images/white-512x512") { Tag = 104 }; AddChild(sprite, 0); sprite.Color = CCColor3B.White; sprite.TextureRectInPixels = new CCRect(0, 0, 120, 50); sprite.RepeatForever(orbit); }