How can I program portals like actual vale portals in 2d?

The main problem that I found programming the portals is the transition. In portal you can stay in the middle of a portal so you are half on one part of the screen and half on other part of the screen.
Any idea on how can achieve that?

Sry for my English guys:(

In the real portal game what they do is simply create a copy of the model that is touching the portal, move it to the other portal, and of course clip the model (using real geometry clipping, or simply render clipping using the stencil buffer).

Doing the same in 2D should be way easier because you can just mask the objects as they enter the portal (so they don’t show behind the portal)

Wow,Really? I didn’t know that portal worked that way.
I thought about that and I’m already doing that thank you so much

If i remember correctly there is a talk/video or maybe even some presentation thing somewhere on the internet about that.
I remember that they went into all sorts of technical details of how they use the stencil buffer and what they have to do to make sure not only object rendering is suppressed behind the portals, but also making sure the physics engine doesn’t flip out (because you’ll have objects that are stuck inside the wall, and they shouldn’t get “ejected” of course)

Maybe take a look at valves website or so if you want to know more :slight_smile: