Re: Bitmap collision detection in VB6
- From: "Auric__" <not.my.real@xxxxxxxxxxxxx>
- Date: Wed, 12 Dec 2007 16:55:56 +0000 (UTC)
On Wed, 12 Dec 2007 15:03:29 GMT, Brigand wrote:
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??
Keep your normal background. Make a b&w copy of it -- black is solid,
white is open (or whatever works for you). Load that behind the color
version (or load it without showing it). Check against the b&w copy
for collision.
(This is just a thought. I don't do games that require collision
detection so I've never had to work this out myself. Several years
ago, I read about techniques to do what you want, but I can't think of
any offhand, and have no links handy.)
--
auric dot auric at gmail dot com
email sent to the above address is not treated as private
*****
Understanding requires words. Some things cannot be reduced to words.
There are things that can only be experienced wordlessly.
.
- Follow-Ups:
- Re: Bitmap collision detection in VB6
- From: Brigand
- Re: Bitmap collision detection in VB6
- References:
- Bitmap collision detection in VB6
- From: Brigand
- Bitmap collision detection in VB6
- Prev by Date: Bitmap collision detection in VB6
- Next by Date: Re: Bitmap collision detection in VB6
- Previous by thread: Bitmap collision detection in VB6
- Next by thread: Re: Bitmap collision detection in VB6
- Index(es):
Relevant Pages
|