Mail Archives: djgpp/1997/10/04/17:32:25
>
>Thanks a lot it works. Would you by any chance also know how to detect a
>rectangle with a circle. Let's say we have:
>
>typedef struct CIR {
> int x1, int y1;
> int radius;
>} CIR;
>
>and then do detect in RECT lies in some point in CIR. Any help would be
>appreciated.
>
Dunno about this, I've never tried it, in my game the "enemy" sprites
are all round, the player is rectangular. I use distance checking for
enemy to enemy and bullet to enemy, for player to enemy I just use
bounding boxes.
I suppose I could use the four corners of the players bounding box
figure out which is closest to the enemy then distance check this corner
point with the enemy.
But just using bounding boxes seems to need less maths, so more speed.
BTW the source code for the game I refer to is available for download on
my site, URL below.
--
http://www.jenkinsdavid.demon.co.uk for C programmers.
David Jenkins
- Raw text -