Ejemplo n.º 1
0
        private void ChaseMouse(double catSpeed)
        {
            Point  position  = MouseHandler.GetMousePosition();
            double CatLeft   = Canvas.GetLeft(Cat);
            double CatTop    = Canvas.GetTop(Cat);
            double threshold = 5;

            var    direction = GetDirection(position, CatLeft, CatTop);
            double distance  = GetDistance(direction);

            if (distance > threshold)
            {
                MoveCatSprite(direction, distance, CatLeft, CatTop, catSpeed, position);
            }
            else
            {
                CatTakeMouseStart();
            }
        }
Ejemplo n.º 2
0
 public double GetDistanceFromCatToMouse()
 {
     return(GetDistance(GetDirection(MouseHandler.GetMousePosition(), Canvas.GetLeft(Cat), Canvas.GetTop(Cat))));
 }