コード例 #1
0
 private void startButton_Click(object sender, EventArgs e)
 {
     //canvas.DrawPie(new Pen(Color.Black), 100, 100, 20, 20, 0, 45);
     Labirint.Init();
     Labirint.PrintAll();
     MainForm.picture.Refresh();
     mainTimer.Enabled   = true;
     startButton.Enabled = false;
 }
コード例 #2
0
ファイル: Pacman.cs プロジェクト: vitpunch/pacman
        private void GoCell()
        {
            if (x == 1 && direction == Direction.left)
            {
                Labirint.PrintArroundDot(x, y);
                x = 28;
            }

            if (x == 26 && direction == Direction.right)
            {
                Labirint.PrintArroundDot(x, y);
                x = 1;
            }
            switch (direction)
            {
            case Direction.right:
                x++;
                break;

            case Direction.left:
                x--;
                break;

            case Direction.up:
                y--;
                break;

            case Direction.down:
                y++;
                break;

            case Direction.stop:
                break;
            }
            if (Labirint.MayPassToDot(x, y, newDirection))
            {
                direction = newDirection;
            }
            else
            if (!Labirint.MayPassToDot(x, y, direction))
            {
                direction = Direction.stop;
            }
            if (Labirint.GetDot(x, y) == '.')
            {
                Labirint.SetEmpty(x, y);
                eatedDots++;
            }
        }
コード例 #3
0
ファイル: Pacman.cs プロジェクト: vitpunch/pacman
 public void Go()
 {
     pixelShift = timeCalculator.PixelShift(speed);
     mouth     += mouthDirection;
     if (mouth > 45 || mouth < 0)
     {
         mouthDirection = -mouthDirection;
     }
     shift += pixelShift;
     if (shift > 19)
     {
         shift -= 20;
         GoCell();
     }
     Labirint.PrintArroundDot(x, y);
     Draw();
     MainForm.picture.Refresh();
 }