borders within a background image...

Hi,

I have a question regarding how to determine borders, or places you can’t move, when you have a single image for a background. In a game similar to, let’s say some of the older 2d adventure games. The background was a static image, and the characters moved around on the screen, but obviously they were constrained to the ‘floor’ part of the image.

How is something like that achieved? Can I somehow use the colors of the floor to determine where I can move? Do I need another image that’s just black and white, that will give the walkable/nonwalkable areas of the screen?

Thanks,
David

most games like that use tilemaps, where the player is moving along a grid (where the grid cells are the same size or larger than the player). it is possible to use a collision maps to determine which tiles are allowed to be walked on, etc.

Adventure game systems usually use a special image (1bit) or several shapes (and you can only walk inside of those convex polygons).

You might want to take a look at AGS.

It gets more complicated if you want that there are some foreground bits, which can be in front of the player. But again it can be solved with a 1bit image. “Extract” the regions where the foreground bit is set and draw em back to front while using the lower edge of em (and of the player) for determining the order.

If you want extra neat (correct) antialiasing you’ll need seperate images, which need to be placed into the scene with some kind of editor.

thanks woogley… i had thought about that, but i really wanted to just have a single image rather than worry about tiles…

onyx: what do you mean by 1bit image? you mean something that’s just a black and white regions where you can or can’t move? the AGS thing looks neat, but i’m looking to do it all myself, rather than use a tool… but thanks, though.

what do you mean by 1bit image? you mean something that’s just a black and white regions where you can or
can’t move?

Yes. But it could be red/blue or black/transparent, too. (Black/white makes more sense tho.)

The advantage of doing that via images is that you don’t need to write extra editors for that.

Oh and that foreground solution, I outlined above, has apparently some limitation. Areas with different Z-values (determined by the lower edge) can’t overlap. Well, you could work around that by using different colors (and letting the stuff which is closer to the cam overlap the stuff which is farer away).

edit: Btw the reason why I pointed at AGS is because you might want to take a look how they solved that stuff.

ahh… yeah i see what you mean… thanks again for the link and tips. :slight_smile: