Exemplo n.º 1
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Space:
            case Keys.Enter:
                if (fild.isBlocked())
                {
                    if (fild.isWinner())
                    {
                        ChangeLevel();
                        break;
                    }
                }
                level--;
                ChangeLevel();
                break;

            case Keys.Down:
                fild.MoveDown();
                fild.drawFild(graphics);
                break;

            case Keys.Right:
                fild.MoveRight();
                fild.drawFild(graphics);
                break;

            case Keys.Up:
                fild.MoveUp();
                fild.drawFild(graphics);
                break;

            case Keys.Left:
                fild.MoveLeft();
                fild.drawFild(graphics);
                break;
            }
            if (fild.isBlocked())
            {
                if (fild.isWinner())
                {
                    showWin();
                }
                else
                {
                    showLoose();
                }
            }
        }
Exemplo n.º 2
0
 private void Form1_Shown(object sender, EventArgs e)
 {
     graphics = this.CreateGraphics();
     looseFrases.Add("Where did I go wrong?..");
     looseFrases.Add("Deadlock again?..");
     looseFrases.Add("It's so simple!");
     fild = new Fild(@"..\..\Levels\" + level.ToString() + ".txt");
     fild.drawFild(graphics);
 }
Exemplo n.º 3
0
        private void Form1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int x = e.Location.X;
            int y = e.Location.Y;

            fild = new Fild(@"..\..\Levels\" + level.ToString() + ".txt");
            fild.SetCursor(x, y, graphics);
            fild.drawFild(graphics);
        }
Exemplo n.º 4
0
 public void ChangeLevel()
 {
     if (level == 6)
     {
         graphics.Clear(Color.LightBlue);
         fild = new Fild();
         graphics.DrawString("CONGRATULATIONS!\n   YOU BEAT\n   THE GAME!",
                             new Font("Cooper Black", 50), new SolidBrush(Color.DarkGoldenrod), new PointF(0, 100));
         level = 1;
         return;
     }
     level++;
     fild = new Fild(@"..\..\Levels\" + level.ToString() + ".txt");
     fild.drawFild(graphics);
 }