コード例 #1
0
 void Enemy_Enemy_Movement(object sender, System.Drawing.Point location)
 {
     if (_pacman?.Intersect(this) == true)
     {
         _pacman.Catched(this);
     }
 }
コード例 #2
0
ファイル: Enemy.cs プロジェクト: MineBloxMaster/Snake-Game
        void Enemy_Enemy_Movement(object sender, System.Drawing.Point location)
        {
            if (_pacman.Location == location)
            {
                if (Enemy_PacmanCatched != null)
                {
                    Enemy_PacmanCatched(this);
                }

                _pacman.Catched(this);
            }
        }
コード例 #3
0
        private void Pacmantimer_Tick(object sender, EventArgs e)
        {
            switch (direction)
            {
            case 1:
                pack.Move(Characters.MovementWay.Up);
                break;

            case 2:
                pack.Move(Characters.MovementWay.Down);
                break;

            case 3:
                pack.Move(Characters.MovementWay.Left);
                break;

            case 4:
                pack.Move(Characters.MovementWay.Right);
                break;

            default:
                break;
            }
            if (pack.Location == enemy.Location)
            {
                pack.Catched(enemy);
            }
            if (_check[0] == false)
            {
                if (40 >= pack.Location.X && 40 <= (pack.Location.X + (pack.Width / 3)) && 80 >= pack.Location.Y && 80 <= ((pack.Height / 3) + pack.Location.Y))
                {
                    enemy.Location = new Point(440, 100);
                    _check[0]      = true;
                }
            }
            if (_check[1] == false)
            {
                if (480 >= pack.Location.X && 480 <= (pack.Location.X + (pack.Width / 3)) && 440 >= pack.Location.Y && 440 <= ((pack.Height / 3) + pack.Location.Y))
                {
                    enemy.Location = new Point(440, 100);
                    _check[1]      = true;
                }
            }
        }