示例#1
0
 public void DispatcherTimer_Tick(object sender, EventArgs e)
 {
     YellowGhost.Move();
     PinkGhost.Move();
     RedGhost.Move();
     PacMove();
     // One.Move(Move);
     //Each Time a the timer ticks the ghost will call its Move() method to
     //make it move in the appropriate direction
 }
示例#2
0
        private void MoveGhosts()
        {
            for (int i = 0; i < GameObjects.Count; i++)
            {
                if (GameObjects[i].GetType() == typeof(Ghost))
                {
                    Ghost ghost = (Ghost)GameObjects[i];
                    ghost.NextDirection = ghost.ghostAi.ChooseDirection(pacMan);
                    ghost.Move();

                    if (FindCharacterLocation(ghost) != new Point(-1, -1))
                    {
                        ghost.TileLocation = FindCharacterLocation(ghost); //location
                    }
                }
            }
        }