public static void CenterCameraOnWorldPosition(float x, float y) { int topLeftX = (int)(x - (1024 / 2)); int topLeftY = (int)(y - (768 / 2)); if (topLeftX < 0) topLeftX = 0; if (topLeftY < 0) topLeftY = 0; topLeftCornerWorldPosition.X = topLeftX; topLeftCornerWorldPosition.Y = topLeftY; }
public void CenterCameraOnPlayer() { Vector2 playerWorldPosition = ConvertTileIndexToWorldPosition(Player.WorldIndex.X, Player.WorldIndex.Y); Camera.CenterCameraOnWorldPosition(playerWorldPosition.X, playerWorldPosition.Y); }