public static Vector2 FixPos(Vector2 a) { Vector2 size = game.size; Vector2 old = a.Copy(); a.x = a.x - size.x * (int)Math.Floor((double)a.x / size.x); a.y = a.y - size.y * (int)Math.Floor((double)a.y / size.y); if (old != a) { if (game.Event_portal()) { a.Set(old); return(null); } } return(a); }