ID:935951
Aug 17 2012, 3:42 pm
|
|
Hey guys. This may have to be a feature request, but I figured I'd post here to see how possible it is already. I'm working on making ramps in my sidescroller system (Yes, I know about FA's system. I'm making my own completely different from his for my own personal use.), and there's one thing that I need to advance. I need to see where I am inside another bounding box. I can use bounds_dist() to see how much I'm overlapping, but I can't figure out how high I am on the bounding box. If someone knows how, please do tell. Otherwise I'm going to make a feature request asking for a way to see where the bottom-left corner of my bounding box is in another atom's bounding box.
| |
#2 Aug 17 2012, 4:16 pm
|
||
Yeah we are trying to figure it out on Chatters right now. We've gotten to the part where I am trying to figure out what my Y should be based on how far I am into the ramp on the X axis and the ramp's angle.
My goal is to make ramps super-simple, where you can just do:
And you'll move along it. The angular movement works fine, but I need to fine-tune the visuals so it always appears that you are on the ramp. | ||
#3 Aug 17 2012, 4:20 pm
|
|
In my feature request for Pixel Collision, there was some chatter about 'sliding' by Falacy, whom made a request for that here, in which it was discussed to have Bump() return pixels that are touching. Neither of which got a definitive answer. You could post a request specificly for this, showing the number of pixel's and their location compairitive to the obj moving into the other. I'd happily support this.
| |
#4 Aug 17 2012, 4:25 pm
|
||
They're axis-aligned bounding boxes, just subtract their origins:
That should work, assuming 'A' is the object, and 'B' is the ramp. <edit> Doh, I need to stop opening these all at once and answering them later... | ||
You can do that with tangent, if you want to use trig:
I would recommend caching the tan value, and you might want to center the offset value. | ||
#6 Aug 17 2012, 8:42 pm
|
||
Thanks for the help guys. Here's my very messy snippet of how I got it working. I'm going to clean it up, but I feel like I need to post this here.
I went with the option of giving everything a y1 and y2 and determine the angle to go based on those two points. y1 being on the left side and y2 being on the right.
| ||
Forum_account's library was built before native pixel movement. Soft-coded pixel movement is pretty much based completely on absolute coordinates like this, allowing it to be much more flexible, so it would be best for you to get used to them.