public SpriteChildrenVisibility()
        {
            CCSize s = CCDirector.sharedDirector().getWinSize();

            CCSpriteFrameCache.sharedSpriteFrameCache().addSpriteFramesWithFile("animations/grossini");

            CCNode   aParent;
            CCSprite sprite1, sprite2, sprite3;

            //
            // SpriteBatchNode
            //
            // parents
            aParent          = CCSpriteBatchNode.batchNodeWithFile("animations/images/grossini", 50);
            aParent.position = (new CCPoint(s.width / 3, s.height / 2));
            addChild(aParent, 0);



            sprite1          = CCSprite.spriteWithSpriteFrameName("grossini_dance_01.png");
            sprite1.position = (new CCPoint(0, 0));

            sprite2          = CCSprite.spriteWithSpriteFrameName("grossini_dance_02.png");
            sprite2.position = (new CCPoint(20, 30));

            sprite3          = CCSprite.spriteWithSpriteFrameName("grossini_dance_03.png");
            sprite3.position = (new CCPoint(-20, 30));

            aParent.addChild(sprite1);
            sprite1.addChild(sprite2, -2);
            sprite1.addChild(sprite3, 2);

            sprite1.runAction(CCBlink.actionWithDuration(5, 10));

            //
            // Sprite
            //
            aParent          = CCNode.node();
            aParent.position = (new CCPoint(2 * s.width / 3, s.height / 2));
            addChild(aParent, 0);

            sprite1          = CCSprite.spriteWithSpriteFrameName("grossini_dance_01.png");
            sprite1.position = (new CCPoint(0, 0));

            sprite2          = CCSprite.spriteWithSpriteFrameName("grossini_dance_02.png");
            sprite2.position = (new CCPoint(20, 30));

            sprite3          = CCSprite.spriteWithSpriteFrameName("grossini_dance_03.png");
            sprite3.position = (new CCPoint(-20, 30));

            aParent.addChild(sprite1);
            sprite1.addChild(sprite2, -2);
            sprite1.addChild(sprite3, 2);

            sprite1.runAction(CCBlink.actionWithDuration(5, 10));
        }
Beispiel #2
0
        public override void onEnter()
        {
            base.onEnter();

            centerSprites(2);

            CCActionInterval action1 = CCBlink.actionWithDuration(2, 10);
            CCActionInterval action2 = CCBlink.actionWithDuration(2, 5);

            m_tamara.runAction(action1);
            m_kathia.runAction(action2);
        }
Beispiel #3
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(2);

            var action1 = new CCBlink(2, 10);
            var action2 = new CCBlink(2, 5);

            m_tamara.RunAction(action1);
            m_kathia.RunAction(action2);
        }
        public void addNewSprite()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            CCPoint p = new CCPoint((float)(CCRandom.NextDouble() * s.Width), (float)(CCRandom.NextDouble() * s.Height));

            int idx = (int)(CCRandom.NextDouble() * 1400 / 100);
            int x   = (idx % 5) * 85;
            int y   = (idx / 5) * 121;


            CCNode   node   = GetChildByTag((int)kTags.kTagSpriteBatchNode);
            CCSprite sprite = new CCSprite(m_texture1, new CCRect(x, y, 85, 121));

            node.AddChild(sprite);

            sprite.Position = (new CCPoint(p.X, p.Y));

            CCActionInterval action;
            float            random = (float)CCRandom.NextDouble();

            if (random < 0.20)
            {
                action = new CCScaleBy(3, 2);
            }
            else if (random < 0.40)
            {
                action = new CCRotateBy(3, 360);
            }
            else if (random < 0.60)
            {
                action = new CCBlink(1, 3);
            }
            else if (random < 0.8)
            {
                action = new CCTintBy(2, 0, -255, -255);
            }
            else
            {
                action = new CCFadeOut(2);
            }

            CCActionInterval action_back = (CCActionInterval)action.Reverse();
            CCActionInterval seq         = (CCActionInterval)(CCSequence.FromActions(action, action_back));

            sprite.RunAction(new CCRepeatForever(seq));
        }
Beispiel #5
0
        public void addNewSprite()
        {
            CCSize s = CCDirector.sharedDirector().getWinSize();

            CCPoint p = new CCPoint((float)(rand.NextDouble() * s.width), (float)(rand.NextDouble() * s.height));

            int idx = (int)(rand.NextDouble() * 1400 / 100);
            int x   = (idx % 5) * 85;
            int y   = (idx / 5) * 121;


            CCNode   node   = getChildByTag((int)kTags.kTagSpriteBatchNode);
            CCSprite sprite = CCSprite.spriteWithTexture(m_texture1, new CCRect(x, y, 85, 121));

            node.addChild(sprite);

            sprite.position = (new CCPoint(p.x, p.y));

            CCActionInterval action;
            float            random = (float)rand.NextDouble();

            if (random < 0.20)
            {
                action = CCScaleBy.actionWithDuration(3, 2);
            }
            else if (random < 0.40)
            {
                action = CCRotateBy.actionWithDuration(3, 360);
            }
            else if (random < 0.60)
            {
                action = CCBlink.actionWithDuration(1, 3);
            }
            else if (random < 0.8)
            {
                action = CCTintBy.actionWithDuration(2, 0, -255, -255);
            }
            else
            {
                action = CCFadeOut.actionWithDuration(2);
            }

            CCActionInterval action_back = (CCActionInterval)action.reverse();
            CCActionInterval seq         = (CCActionInterval)(CCSequence.actions(action, action_back));

            sprite.runAction(CCRepeatForever.actionWithAction(seq));
        }
Beispiel #6
0
        void AddNewSprite()
        {
            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            CCPoint p = new CCPoint((float)(CCRandom.NextDouble() * s.Width), (float)(CCRandom.NextDouble() * s.Height));

            int idx = (int)(CCRandom.NextDouble() * 1400 / 100);
            int x   = (idx % 5) * 85;
            int y   = (idx / 5) * 121;


            CCNode   node   = GetChildByTag((int)kTags.kTagSpriteBatchNode);
            CCSprite sprite = new CCSprite(texture1, new CCRect(x, y, 85, 121));

            node.AddChild(sprite);

            sprite.Position = (new CCPoint(p.X, p.Y));

            CCFiniteTimeAction action;
            float random = (float)CCRandom.NextDouble();

            if (random < 0.20)
            {
                action = new CCScaleBy(3, 2);
            }
            else if (random < 0.40)
            {
                action = new CCRotateBy(3, 360);
            }
            else if (random < 0.60)
            {
                action = new CCBlink(1, 3);
            }
            else if (random < 0.8)
            {
                action = new CCTintBy(2, 0, -255, -255);
            }
            else
            {
                action = new CCFadeOut(2);
            }

            CCFiniteTimeAction action_back = (CCFiniteTimeAction)action.Reverse();
            CCFiniteTimeAction seq         = (CCFiniteTimeAction)(new CCSequence(action, action_back));

            sprite.RunAction(new CCRepeatForever(seq));
        }
        public void addNewSpriteWithCoords(CCPoint p)
        {
            CCSpriteBatchNode BatchNode = (CCSpriteBatchNode)GetChildByTag((int)kTags.kTagSpriteBatchNode);

            int idx = (int)(CCRandom.NextDouble() * 1400 / 100);
            int x   = (idx % 5) * 85;
            int y   = (idx / 5) * 121;


            CCSprite sprite = new CCSprite(BatchNode.Texture, new CCRect(x, y, 85, 121));

            BatchNode.AddChild(sprite);

            sprite.Position = (new CCPoint(p.X, p.Y));

            CCActionInterval action = null;
            float            random = (float)CCRandom.NextDouble();

            if (random < 0.20)
            {
                action = new CCScaleBy(3, 2);
            }
            else if (random < 0.40)
            {
                action = new CCRotateBy(3, 360);
            }
            else if (random < 0.60)
            {
                action = new CCBlink(1, 3);
            }
            else if (random < 0.8)
            {
                action = new CCTintBy(2, 0, -255, -255);
            }
            else
            {
                action = new CCFadeOut(2);
            }

            CCActionInterval action_back = (CCActionInterval)action.Reverse();
            CCActionInterval seq         = (CCActionInterval)(new CCSequence(action, action_back));

            sprite.RunAction(new CCRepeatForever(seq));
        }
        public void addNewSpriteWithCoords(CCPoint p)
        {
            CCSpriteBatchNode BatchNode = (CCSpriteBatchNode)getChildByTag((int)kTags.kTagSpriteBatchNode);

            int idx = (int)(rand.NextDouble() * 1400 / 100);
            int x   = (idx % 5) * 85;
            int y   = (idx / 5) * 121;


            CCSprite sprite = CCSprite.spriteWithTexture(BatchNode.Texture, new CCRect(x, y, 85, 121));

            BatchNode.addChild(sprite);

            sprite.position = (new CCPoint(p.x, p.y));

            CCActionInterval action = null;
            float            random = (float)rand.NextDouble();

            if (random < 0.20)
            {
                action = CCScaleBy.actionWithDuration(3, 2);
            }
            else if (random < 0.40)
            {
                action = CCRotateBy.actionWithDuration(3, 360);
            }
            else if (random < 0.60)
            {
                action = CCBlink.actionWithDuration(1, 3);
            }
            else if (random < 0.8)
            {
                action = CCTintBy.actionWithDuration(2, 0, -255, -255);
            }
            else
            {
                action = CCFadeOut.actionWithDuration(2);
            }

            CCActionInterval action_back = (CCActionInterval)action.reverse();
            CCActionInterval seq         = (CCActionInterval)(CCSequence.actions(action, action_back));

            sprite.runAction(CCRepeatForever.actionWithAction(seq));
        }
Beispiel #9
0
        public void addNewSpriteWithCoords(CCPoint p)
        {
            int idx = (int)(CCMacros.CCRandomBetween0And1() * 1400.0f / 100.0f);
            int x   = (idx % 5) * 85;
            int y   = (idx / 5) * 121;

            CCSprite sprite = new CCSprite("Images/grossini_dance_atlas", new CCRect(x, y, 85, 121));

            AddChild(sprite);

            sprite.Position = p;

            CCActionInterval action;
            float            random = CCMacros.CCRandomBetween0And1();

            if (random < 0.20)
            {
                action = new CCScaleBy(3, 2);
            }
            else if (random < 0.40)
            {
                action = new CCRotateBy(3, 360);
            }
            else if (random < 0.60)
            {
                action = new CCBlink(1, 3);
            }
            else if (random < 0.8)
            {
                action = new CCTintBy(2, 0, -255, -255);
            }
            else
            {
                action = new CCFadeOut(2);
            }
            object           obj         = action.Reverse();
            CCActionInterval action_back = (CCActionInterval)action.Reverse();
            CCActionInterval seq         = (CCActionInterval)(new CCSequence(action, action_back));

            sprite.RunAction(new CCRepeatForever(seq));
        }
Beispiel #10
0
        public void addNewSpriteWithCoords(CCPoint p)
        {
            int idx = (int)(ccMacros.CCRANDOM_0_1() * 1400.0f / 100.0f);
            int x   = (idx % 5) * 85;
            int y   = (idx / 5) * 121;

            CCSprite sprite = CCSprite.spriteWithFile("Images/grossini_dance_atlas", new CCRect(x, y, 85, 121));

            addChild(sprite);

            sprite.position = p;

            CCActionInterval action;
            float            random = ccMacros.CCRANDOM_0_1();

            if (random < 0.20)
            {
                action = CCScaleBy.actionWithDuration(3, 2);
            }
            else if (random < 0.40)
            {
                action = CCRotateBy.actionWithDuration(3, 360);
            }
            else if (random < 0.60)
            {
                action = CCBlink.actionWithDuration(1, 3);
            }
            else if (random < 0.8)
            {
                action = CCTintBy.actionWithDuration(2, 0, -255, -255);
            }
            else
            {
                action = CCFadeOut.actionWithDuration(2);
            }
            object           obj         = action.reverse();
            CCActionInterval action_back = (CCActionInterval)action.reverse();
            CCActionInterval seq         = (CCActionInterval)(CCSequence.actions(action, action_back));

            sprite.runAction(CCRepeatForever.actionWithAction(seq));
        }
Beispiel #11
0
        public void BeginLevelChangeAnimation(uint level, Action callback)
        {
            //foreach (PositionInGame positionType in Enum.GetValues(typeof(PositionInGame)))
            //{
            //    var square = _cordinatesGenerator.PositionAndSquare[positionType];


            //    square.RunAction(blink);
            //}

            int levelIndex = 1;

            while (levelIndex < level)
            {
                var smallSquare = _cordinatesGenerator.Levels[(LevelLivePosition)levelIndex];
                smallSquare.RunAction(blinkOnce);

                levelIndex++;
            }

            var completedAction = new CCCallFunc(callback);

            CCBlink    blinkLevel         = new CCBlink(1.0f, 3);
            CCSequence mySequence         = new CCSequence(blinkLevel, completedAction);
            var        currentLevelSquare = _cordinatesGenerator.Levels[(LevelLivePosition)level];

            currentLevelSquare.Visible = true;
            currentLevelSquare.RunAction(mySequence);
            //RunAction(mySequence);

            //if (level >= 10)
            //{
            //    if (rotating == false)
            //    {
            //        rotating = true;
            //        //DiagonalSquares(() => StarRotating(true));
            //        StarRotating(true);
            //    }
            //}
        }
Beispiel #12
0
 protected CCBlink(CCBlink blink) : base(blink)
 {
     InitWithDuration(m_fDuration, m_nTimes);
 }
Beispiel #13
0
 protected CCBlink(CCBlink blink) : base(blink)
 {
     InitWithDuration(m_fDuration, m_nTimes);
 }
Beispiel #14
0
 public CCBlinkState(CCBlink action, CCNode target)
     : base(action, target)
 {
     Times         = action.Times;
     OriginalState = target.Visible;
 }
Beispiel #15
0
 public CCBlinkState (CCBlink action, CCNode target)
     : base (action, target)
 { 
     Times = action.Times;
     OriginalState = target.Visible;
 }