This topic is now archived and is closed to further replies.


Methodologies v. Philosophies

Recommended Posts

Hello. I am developing a 2d, yes 2d, beatemup in DirectX. I have reached the stage where it is necessary to go someway towards collision detection between my sprites. All the characters are stored in cells of 350x350. However, they may only take up a quarter of this at any one time. So some degree of pixel based collision detection is needed. Suppose the sprite is kicking, ie. with his foot extended. I need to know if that has hit the body of the other sprite. My original idea was to make a quick copy of the bitmap holding the sprite images, make a new layer and draw blotches in that layer over hand and feet positions only in ''offensive'' cells. Then a pixel based detection could be done with the attacking ''blotch'' bitmap which describes the positions of only the feet and hands, and the normal image of the victim. However this might lead to memory problems, as the memory required for every character would most likely double in value. (This is assuming all directdraw surfaces are kept as 16bit...if I can keep the ''blotch'' series as a 1 bit image in memory and have directdraw automatically figure out how to blt it to a 16bit surface, the overhead would be much less). Another solution, which would require less memory, but is less flexible and more tedious, would be to measure the feet and hand rectangles for every single offensive frame, and then check whether the body of the enemy sprite exists within that rectangle by method of pixel scanning, offsetted of course by the position vector of the attacking sprite. I ask only because the first method is easier, but veritably insane, and I am too lazy to start the second. Anything I have perhaps overlooked ? Thanking you in advance, sirs and madams. << The mere thought hadn''t even begun to speculate about the slightest possibility of crossing the vast eternity that is my mind. >>

Share this post

Link to post
Share on other sites