Пример #1
0
        public static int CenterX(Sprite sprite, int x)
        {
            int newX = x - (sprite.GetWidth() / 2);

            if (newX + sprite.GetWidth() >= LSystem.screenRect.width)
            {
                return(LSystem.screenRect.width - sprite.GetWidth() - 1);
            }
            if (newX < 0)
            {
                return(x);
            }
            else
            {
                return(newX);
            }
        }
Пример #2
0
 public static int CenterX(Sprite sprite, int x)
 {
     int newX = x - (sprite.GetWidth() / 2);
     if (newX + sprite.GetWidth() >= LSystem.screenRect.width)
     {
         return (LSystem.screenRect.width - sprite.GetWidth() - 1);
     }
     if (newX < 0)
     {
         return x;
     }
     else
     {
         return newX;
     }
 }