예제 #1
0
        /// <summary>
        /// CALCULATES THE SPEED OF THE PLAYER.
        /// </summary>
        private void CalcSpeed()
        {
            int speed;

            if (PastX != PlayerX)
            {
                speed = PlayerX - PastX;
                Speed = Math.Abs(speed);

                //THIS WILL CHECK FOR DIRECTION.  PLAYER CAN ONLY MOVE FORWARD.
                PlayerMove.Add('f');
            }
            if (PastY != PlayerY)
            {
                speed = PlayerY - PastY;
                Speed = Math.Abs(speed);

                //THIS WILL CHECK FOR DIRECTION.
                if (speed < 0)
                {
                    PlayerMove.Add('u');
                }
                else
                {
                    PlayerMove.Add('d');
                }
            }
        }