Exemplo n.º 1
0
        public static int CenterY(Sprite sprite, int y)
        {
            int newY = y - (sprite.GetHeight() / 2);

            if (newY + sprite.GetHeight() >= LSystem.screenRect.height)
            {
                return(LSystem.screenRect.height - sprite.GetHeight() - 1);
            }
            if (newY < 0)
            {
                return(y);
            }
            else
            {
                return(newY);
            }
        }
Exemplo n.º 2
0
 public static int CenterY(Sprite sprite, int y)
 {
     int newY = y - (sprite.GetHeight() / 2);
     if (newY + sprite.GetHeight() >= LSystem.screenRect.height)
     {
         return (LSystem.screenRect.height - sprite.GetHeight() - 1);
     }
     if (newY < 0)
     {
         return y;
     }
     else
     {
         return newY;
     }
 }