Example #1
0
        public lvl()
        {
            InitializeComponent();

            KeyDown += Lvl_KeyDown;

            FPS.Start();

            X = 30;
            Y = 30;
            Graphics g = Graphics.FromImage(bmp);

            g.FillEllipse(Brushes.GreenYellow, X, Y, Settings.characterSize, Settings.characterSize);

            loc = new int[Settings.numberQuestions];

            MaximumSize = new Size(1100, 1100);
            MinimumSize = new Size(1100, 1100);

            Map.Image    = bmp;
            Map.Size     = new Size(bmp.Width, bmp.Height);
            Map.Location = new Point(0, 0);


            for (int y = 0; y < VisibleZone.Height; y++)
            {
                for (int x = 0; x < VisibleZone.Width; x++)
                {
                    VisibleZone.SetPixel(x, y, Color.Black);
                }
            }
            Visible_Zone.Size     = new Size(bmp.Width, bmp.Height);
            Visible_Zone.Image    = VisibleZone;
            Visible_Zone.Location = new Point(0, 0);
            Visible_Zone.BringToFront();
            DrawVisibleZone(X, Y);

            Visible_Zone.Visible = true;

            Map.Focus();

            lbl = new Label[] {
                label1,
                label2,
                label3,
                label4,
                label5,
                label6,
                label7,
                label8,
                label9,
                label10,
                label11,
                label12,
                label13,
                label14,
                label15,
                label16,
                label17
            };
            for (int i = 0; i < lbl.Length; i++)
            {
                lbl[i].Size    = new Size(Settings.SizeBox, Settings.SizeBox);
                lbl[i].Visible = false;
            }
            DrawingTaskBox(Settings.numberQuestions, lbl.Length, loc);
        }
Example #2
0
        private void FPS_Tick(object sender, EventArgs e)
        {
            Graphics g = Graphics.FromImage(bmp);

            g.FillEllipse(Brushes.White, X, Y, Settings.characterSize, Settings.characterSize);
            int param = 0;

            switch (way)
            {
            case (1):    //вверх
            {
                if (MoveCheck(X, Y - Settings.characterSize, ref param) == true)
                {
                    Y = Y - Settings.Speed;
                    int index = 0;
                    for (int i = 0; i < loc.Length; i++)
                    {
                        index = loc[i];
                        if (Y <= lbl[index].Location.Y &&
                            Y >= lbl[index].Location.Y &&
                            X + Settings.characterSize >= lbl[index].Location.X &&
                            X <= lbl[index].Location.X + Settings.SizeBox && param == 1)
                        {
                            Lvl1_QuestEvent(lbl[index]);

                            break;
                        }
                    }
                }


                break;
            }

            case (2):    //вправо
            {
                if (MoveCheck(X + Settings.characterSize, Y, ref param) == true)
                {
                    X = X + Settings.Speed;
                    int index = 0;
                    for (int i = 0; i < Settings.numberQuestions; i++)
                    {
                        index = loc[i];
                        if (X + Settings.characterSize >= lbl[index].Location.X &&
                            X <= lbl[index].Location.X + Settings.SizeBox &&
                            Y + Settings.characterSize >= lbl[index].Location.Y &&
                            Y <= lbl[index].Location.Y + Settings.SizeBox && param == 1)
                        {
                            Lvl1_QuestEvent(lbl[index]);

                            break;
                        }
                    }
                }

                break;
            }

            case (3):    //вниз
            {
                if (MoveCheck(X, Y + Settings.characterSize, ref param) == true)
                {
                    Y = Y + Settings.Speed;
                    int index = 0;
                    for (int i = 0; i < loc.Length; i++)
                    {
                        index = loc[i];
                        if (Y + Settings.characterSize >= lbl[index].Location.Y &&
                            Y + Settings.characterSize <= lbl[index].Location.Y + Settings.SizeBox &&
                            X + Settings.characterSize >= lbl[index].Location.X &&
                            X <= lbl[index].Location.X + Settings.SizeBox && param == 1)
                        {
                            Lvl1_QuestEvent(lbl[index]);

                            break;
                        }
                    }
                }
                break;
            }

            case (4):    //влево
            {
                if (MoveCheck(X - Settings.characterSize, Y, ref param) == true)
                {
                    X = X - Settings.Speed;
                    int index = 0;
                    for (int i = 0; i < loc.Length; i++)
                    {
                        index = loc[i];
                        if (X <= lbl[index].Location.X + Settings.SizeBox &&
                            X + Settings.characterSize > lbl[index].Location.X &&
                            Y + Settings.characterSize >= lbl[index].Location.Y &&
                            Y <= lbl[index].Location.Y + Settings.SizeBox && param == 1)
                        {
                            Lvl1_QuestEvent(lbl[index]);

                            break;
                        }
                    }
                }
                break;
            }

            default:

                break;
            }


            g.FillEllipse(Brushes.GreenYellow, X, Y, Settings.characterSize, Settings.characterSize);
            Map.Refresh();
            DrawVisibleZone(X, Y);
            Visible_Zone.Refresh();
        }