コード例 #1
0
        void CreateBreacks()
        {
            int[,] x =
            {
                // 4
                {  90,  50, 25,  60 },
                {  90, 110, 60,  25 },
                { 150,  50, 25, 160 },

                // С
                { 260,  50, 25, 160 },
                { 285,  50, 60,  25 },
                { 285, 185, 60,  25 },

                // Е
                { 375,  50, 25, 160 },
                { 400,  50, 60,  25 },
                { 400, 115, 60,  25 },
                { 400, 185, 60,  25 },

                // З
                { 490,  50, 60,  25 },
                { 490, 115, 60,  25 },
                { 490, 185, 60,  25 },
                { 550,  50, 25, 160 },

                // О
                { 605,  50, 25, 135 },
                { 630,  50, 60,  25 },
                { 605, 185, 60,  25 },
                { 665,  75, 25, 135 },

                // Н
                { 720,  50, 25, 160 },
                { 745, 115, 35,  25 },
                { 780,  50, 25, 160 }
            };

            for (int i = 0; i < x.GetLength(0); i++)
            {
                SuperBrick siBrick = new SuperBrick(matilda1, null, x[i, 0], x[i, 1], x[i, 2], x[i, 3], "Кирпич");
                siBrick.OnPaint += SiBrick_OnPaint;

                if (matilda1.RandomInt(1, 10) == 1)
                {
                    siBrick.include_fireballpack = true;
                }
                else
                if (matilda1.RandomInt(1, 10) == 1)
                {
                    siBrick.multi_live = true;
                }

                bricks.Add(siBrick);
            }
        }
コード例 #2
0
        void BrickContact(SuperBrick brick)
        {
            if (brick.include_fireballpack)
            {
                SuperBall pack = new SuperBall(matilda1, "3_fireballs_pack.png", brick.Left + brick.Width / 2 - 25 / 2, brick.Top, 25, 25, "firepack");
                fireballs_pack.Add(pack);
            }

            if (brick.multi_live)
            {
                brick.count_live--;
                if (brick.count_live > 0)
                {
                    return;
                }
            }

            brick.Dispose();
            bricks.Remove(brick);
        }
コード例 #3
0
        // Цветом зарисовываем кирпич, да с рамкой
        private void SiBrick_OnPaint(SuperImage s, SuperImagePainter p)
        {
            SuperBrick brick = (SuperBrick)s;

            if (brick.include_fireballpack)
            {
                p.FillRectangle(0, 0, s.Width, s.Height, Color.Red);
            }
            else if (brick.multi_live)
            {
                p.FillRectangle(0, 0, s.Width, s.Height, Color.Gray);

                p.FillRectangle(6, 6, 12, 16, Color.White);

                p.DrawString(brick.count_live.ToString(), 10, 6, 6, Color.Black);
            }
            else
            {
                p.FillRectangle(0, 0, s.Width, s.Height, Color.LightBlue);
            }

            p.DrawRectangle(0, 0, s.Width, s.Height, Color.Black, 1);
        }