Re: Bitmap collision detection in VB6



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.
.



Relevant Pages

  • Re: Bitmap collision detection in VB6
    ... and any intersection with that color flags a collision. ... on imported bitmap backgrounds?? ... detection so I've never had to work this out myself. ...
    (comp.lang.basic.visual.misc)
  • Re: new here, my lang project...
    ... > computer game. ... > the end of that time slice ends in a new collision, ... > plane view because it is more efficient for some game entities when one is ... >> movetypes basically allow one to specify various sets of physics features ...
    (comp.object)
  • Bitmap collision detection in VB6
    ... Currently, my game does collision detection as the standard, good ... The downside is that I have to basically map rectangles to every part ... on imported bitmap backgrounds?? ...
    (comp.lang.basic.visual.misc)
  • Re: Space Game!
    ... not be acceptable to a real Apple IIGS. ... the source code to make it run at any speed you want. ... I took a look at your space game last night. ... handling, random number generation, object collision, graphics, etc. ...
    (comp.sys.apple2.programmer)
  • Re: rubygame
    ... an axis-aligned bounding box would be a rectangle defined by two points. ... shaped objects in a game; ... Quake use AABB's for collision detection.) ... might think there is one tile, ...
    (comp.lang.ruby)