Im working on a 2D, non-scrolling, portal-themed platformer in scratch, and I was wondering if there was a function or script that I could make to help find the angle of a wall. As it stands, the portals do "stick" to the walls, but I want them to be perfectly level with the wall.
(link to the project for more details, its still in development: https://scratch.mit.edu/projects/899664020/)
Also, I have some coding knowledge, so if your answer isn't in a scratch coding language, but is still compatible with it, I can most likely decipher it.
I haven't tried anything yet, mostly because I don't know what to do, or how to accomplish it. I did try googling for some similar questions/answers but got nothing.
EDIT: I think what I'm looking for is a form of raycasting, so It can detect any angle without having to do any manual work.
I did not understand exactly what is the
wallyou are talking about, and how it is specified in your code.I will assume that you can find the
slopeof that wall. You can get the angle from there using arcsine function. It's calledasinin Scratch.