1 bit graphics?!

BlitzPlus Forums/BlitzPlus Programming/1 bit graphics?!

Who was John Galt?(Posted 2003) [#1]
I'm writing a game with a little ship flying around a landscape which uses Imagescollide detections between ship and background to see if the player has crashed. Now I want to have the background of the tunnels you fly through coloured in rather than black. This gives me 2 options:

1. Paste a background graphic down, then overlay the terrain graphic on it.

*or*

2. Draw the bagrounds into the terrain graphic, and use a separate graphic containing the terrain, but with an empty background, as a collision map.

I've decided to plump for 2 for speed. Problem is that memory is limited and I don't want to use a 16-bit background just for the collision map. Is there any way to load a 1 bit image and check for collisions with it, or can anyone suggest another alternative?


Anthony Flack(Posted 2003) [#2]
Possibly; load in a 1 bit-per-pixel data file, and check collisions manually (sorry, can't help with the collision command). You would want to make a little program that converts graphics files into 1 bit-per-pixel data files and saves them. You could also quite comfortably halve the resolution of your collision map, thus saving a further 3/4 of the size.


andy_mc(Posted 2003) [#3]
memory and processor usage wise, best solution is to setup an array, say one third the resolution of the actualy graphics (you don't need pixel perfect collision really). So you've got an array now of say 400x400 (giving you a level size of 1200x1200), now check the coords of on screen objects, such as players and computer characters against coords in this array, as if it were a background.
Sorry I couldn't make it more simple, I'm very tired and need to sleep...... if you want some sample code, send me a mail.


Who was John Galt?(Posted 2003) [#4]
Thanks for the ideas.