コード例 #1
0
        public void MoveDown()
        {
            Point movingArea = mapObjectOperator.GetTargetMovingArea(Directions.Down, ghost.image.Location);

            if (!mapObjectOperator.IsWall(movingArea))
            {
                if (!mapObjectOperator.IsSpace(movingArea))
                {
                    Eat(mapObjectOperator.GetObject(movingArea));
                    ghost.image.Location = movingArea;
                }
                else
                {
                    MoveToOtherSpace();
                }
                oppositeDirection = Directions.Up;
                isNewDirection    = false;
            }
            else
            {
                isNewDirection = true;
            }

            FindDirection();
        }
コード例 #2
0
        public void MoveDown()
        {
            Point movingArea = mapObjectOperator.GetTargetMovingArea(Directions.Down, thePacman.image.Location);

            if (!mapObjectOperator.IsWall(movingArea))
            {
                if (!mapObjectOperator.IsSpace(movingArea))
                {
                    Eat(mapObjectOperator.GetObject(movingArea));
                    thePacman.image.Location = movingArea;
                }
                else
                {
                    MoveToOtherSpace();
                }
            }
        }