create a map corridor (resolution size) and loop this horizontal and vertical,
create another map corridor which can be bigger.
on the event that ports you to the corridor, make a conditional branch,
either with item, variable or switch to be true (ON).
if the switch is ON
teleports to the corridor (correct one)
else
teleport to the infinite corridor
end.
however, when creating this infinite corridor you must create another corridor to
exit this one, when the player FACE DOWN direction, if face up, it will constantly loop
vertical UP, else exit to the previous map.
this can also when you do down to the corridor, than FACE UP direction is needed,
if right or left, do the face direction that way.
There are other methodes as well, but it depends what's easier for you.