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); } }
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; } }