Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bitmap Collision Detection (VB6)

0 views
Skip to first unread message

Brigand

unread,
Dec 12, 2007, 10:01:32 AM12/12/07
to
Hi guys,

I am currently trying to redesign a game I have been working on a
while, and I have hit a stumbling block. I'll try to succintly
describe the problem:

Currently, my game does collision detection as the standard, good ole'
fashioned intersecting rectangles calculation - simple enough, and not
too processor intensive for the most part. This works GREAT for
sprites. But not so great for the ground/background/environment.

The downside is that I have to basically map rectangles to every part
of my environment, over the top of whatever image I draw for the
background. It works.....but is not very elegant, and requires a mind
numbing amount of work mapping rectangles and checking each and every
one of them for collisions on each screen.

What I would LIKE to do is draw my background, and import it as a
bitmap, and use some sort of algorithm to determine collisions with
the bitmapped image. The best I have been able to come up with is to
either use one color for the 'empty space' (the part that doesn't
inhibit movement), and simple flag a collision anytime a color is
detected at one of the four corners of a sprite, OR a variation of
this where the background is one or 2 predefined colors, and any
intersection with that color flags a collision. This works kinda sorta
OK, but it really limits what my backgrounds can look like color-wise.
I really don't want to rely on one or 2 color 'solid' ground, or
always having a black background from an artistic standpoint; it
really limits the visual appeal of the game.


Does anyone have a suggestion for how to implement collision detection
on imported bitmap backgrounds??


Thanks for any advice you can give!!

Paul Sinnett

unread,
Dec 12, 2007, 12:44:43 PM12/12/07
to
Brigand wrote:
> Does anyone have a suggestion for how to implement collision detection
> on imported bitmap backgrounds??

Can you use the alpha channel of the bitmap backgrounds to hold the
collision information? This will work as you have it with the pixel test
but won't limit your use of colour.

0 new messages