Example #1
0
        public static void LoadSprite()
        {
            FrameSequence seq = new FrameSequence();

            seq.AddFrame(sprtBmp, 0, 0);
            seq.AddFrame(sprtBmp, 1, 0);
            seq.AddFrame(sprtBmp, 2, 0);
            seq.AddFrame(sprtBmp, 3, 0);
            seq.SequenceCycleType = Gondwana.Common.Enums.CycleType.PingPong;

            Cycle cycle = new Cycle(seq, 0.03, "groovin");

            sprite = Sprites.CreateSprite(matrix, seq[0]);
            sprite.TileAnimator.CurrentCycle = cycle;
            sprite.RenderSize = new Size(50, 50);
            sprite.VertAlign  = Gondwana.Common.Enums.VerticalAlignment.Top;
            sprite.HorizAlign = Gondwana.Common.Enums.HorizontalAlignment.Left;
            sprite.MoveSprite(3, 3);
            sprite.Visible = true;
            sprite.TileAnimator.StartAnimation();
            sprite.DetectCollision = CollisionDetection.All;

            //matrix2[1, 1].EnableAnimator = true;
            //matrix2[1, 1].TileAnimator.CurrentCycle = Cycles.GetAnimationCycle("groovin");
            //matrix2[1, 1].TileAnimator.StartAnimation();
        }
Example #2
0
        private void InitializeSprites(int tileWidth, int tileHeight)
        {
            Sprites.Clear();

            for (int x = 0; x < numColumns; x++)
            {
                for (int y = 0; y < numRows; y++)
                {
                    Sprite sprite = Sprites.CreateSprite(matrixes[0], new Frame(tilesheet, x, y),
                                                         x.ToString() + "-" + y.ToString());
                    sprite.MoveSprite((float)x, (float)y);
                    sprite.Visible = true;
                }
            }

            // remove the bottom-right tile; this will be the space for sliding
            int maxX = numColumns - 1;
            int maxY = numRows - 1;

            Sprites.GetSpriteByID(maxX.ToString() + "-" + maxY.ToString()).Dispose();
            openSpace = new Point(maxX, maxY);
        }