So I'm working on my projects interface elements and I'm just wondering if there's a way to make screen objects draggable.
For example I would like to make this character info pop up moveable but from what I know I'm incapable of doing so and was hoping someone could point me in the right direction if it's a doable thing.
https://gyazo.com/3b2f9b223c90b72880034773f2fbe1c4
ID:2244544
May 7 2017, 7:20 am
|
|
May 7 2017, 8:08 am
|
|
Kaiochao would probably be a good help here, I've seen him do it before with his absolute positions library. I've never tried it myself, but I assume it would be possible with a PLANE_MASTER and some pixel precise mouse-tracking.
|
I've tried this before, and got messy so I stopped. I was using screen objects for maptext back in the day and wanted to make the chatbox moveable. Basically had to get original location and new location and after a bunch of math to make sure the chatbox wouldn't cut outside the map or collide with another screen_obj.
I've actually done this 2 different ways. I've added and invisible screen-obj grid on the whole entire map screen and did it based on that, and then I tried to move onto something more dynamic and more per-pixel basis so I scrapped the invisible screen-obj grid and just did it by screen_loc. It's not entirely hard but it can get messy if you're not organizing your screen_objs. The first method was easier to manage since I could tell screen_objs what grid "box" they were in and when I moved screen_objs around, like the chatbox, I could first check if something was already occupying any of the target grid boxes. The second method was more pleasing since I was able to make smoother animations and it was per-pixel so gave more flexibility where things could go, but it started getting messy when trying to figure out how wide and tall the map was, then to get the screen_obj's size and then the target screen_loc and make sure not a single pixel was going to collide with anything else (unless it was on a different layer), and whatnot. |