Portals in snap!

I made a little toy that people could play around with

It makes portals in snap complete with angle calculation, exit positioning, a lazer, and even momentum redirection (wip)

Momentum redirection is in its beta stages as I don’t think there is an equation for that as portals don’t exist in the real world

Update 2.5: added a new sprite that can be rotated, moved, and have portals placed on it to demonstrate the new angles, fixed a silly issue that caused portals to go to the player when shot instead of to the wall

Update 2: shooting portals corrected, corrected angle issues!, rewrote all portal teleport code. You can now shoot portals onto angled surfaces! (in 15 degree increments)

Update 1.5: added shooting portals but they are kinda buggy
Update 1: made it so that you can go in both portals and added lines to indicate the side of entry and exit

Light line will exit you on the other light line, dark will output you on the other dark line

A cool part about this is that it doesn’t use any preset values and all the portal code is handled in the player sprite meaning you can move and rotate the portals however you want and they will work perfectly, and that the portal themselves can be modified without any issues

I’ll work on adding a portal gun next only hard part should be angling the portal

I would just angle the portal to the nearest whole degree but while it looks like it works

If you shoot the portal at a steep angle this happens

I wanna make it not deterministic and eventually wanna add shooting portals on angular surfaces but to do that I need to actually get the angle of the line

Update: got a way to get the angle of a line and shooting portals, but I ran into another issue
Going into a portal on the feeling will put you on the x offset from that portal’s center on the x x axis of the other end instead of swapping x and y

This would probably involve trigonometry to fix but idk that

Worst comes to worst I will just make 360 different modifier values for the xy pos

Nice idea.

Long ago there was a product called Imagine Logo, a version of Logo with turtles as objects, and one of its cool features was mesh networking, and they had this great demo that was like yours, but when a turtle went into a portal it came out a matching portal on the other computer. Way cool, especially for 40-odd years ago.

That’s definitely possible but idk how to do server side stuff

I may have been vastly over/under complicating things

It’s really really close

I think I got it

New update!!!

Added: shooting portals(last update) corrected angle issues! You can now shoot portals onto angled surfaces (in 15 degree increments)

It broke again but not if they are facing the same way it doesn’t work

I’m entirely cluless

I don’t even care anymore I’m rewriting all the code

The portal costumes are at a different angle then I have to do the calculations at so I’m fixing that

Updated portal textures
costume3 18
costume1 30

The new code would be done but it just decided it now wanted to come out the bottom when going in the top and come out the top when going in the bottom