gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Collision detection, over and under

#5025 - sgeos - Thu Apr 17, 2003 10:11 pm

Some games allow player characters (PCs) to walk over and under objects, such as a bridge. PCs can walk from one shore, over the bridge, to the other shore. PCs can also walk through the stream, and under the bridge to the other side, and then keep going. (PCs can also climb in and out of the stream using a ladder.) What kind of design does one need in order to achieve this?

My best guess is that two (or more, depending) hardness maps and an elevation variable are needed. When walking off the ladder in the example above, the elevation would be set based on the direction of exit.

As far as the display goes, I imagine that it is just a matter setting sprite display priority and elevation at the same time.

What is a better approach?

-Brendan

#5028 - Lord Graga - Thu Apr 17, 2003 10:28 pm

You could use two BG layers, and then just switch the sprite priority every time you used a ladder/etc.
Also remember to reload collision maps/etc.

#5042 - pollier - Fri Apr 18, 2003 3:34 am

I always end up thinking about game designs that have sprites on multiple levels of elevation that are hiding certain objects and being hidden by others, and about how to accomplish such scenarios without artefacts. Then I remember that levels are simply engineered so that none of those really complicated situations ever happen. Heh.
_________________
(Works for me!)