Ejemplo n.º 1
0
        public SpriteOffsetAnchorFlip()
        {
            CCSpriteFrameCache cache = CCSpriteFrameCache.SharedSpriteFrameCache;

            cache.AddSpriteFrames("animations/grossini.plist");
            cache.AddSpriteFrames("animations/grossini_gray.plist", "animations/grossini_gray");

            var    animFrames = new List <CCSpriteFrame>();
            string tmp        = "";

            for (int j = 0; j < 14; j++)
            {
                string temp = "";
                if (j + 1 < 10)
                {
                    temp = "0" + (j + 1);
                }
                else
                {
                    temp = (j + 1).ToString();
                }
                tmp = string.Format("grossini_dance_{0}.png", temp);
                CCSpriteFrame frame = cache[tmp];
                animFrames.Add(frame);
            }

            animation = new CCAnimation(animFrames, 0.3f);

            var flip      = new CCFlipY(true);
            var flip_back = flip.Reverse();
            var delay     = new CCDelayTime(1);

            seq = new CCSequence(delay, flip, delay, flip_back);

            sprites      = new CCSprite[numOfSprites];
            pointSprites = new CCSprite[numOfSprites];

            for (int i = 0; i < numOfSprites; i++)
            {
                // Animation using Sprite batch
                sprites[i] = new CCSprite("grossini_dance_01.png");
                AddChild(sprites[i], 0);

                pointSprites[i] = new CCSprite("Images/r1");
                AddChild(pointSprites[i], 1);
            }
        }