From: Moo-Juice Newsgroups: comp.os.msdos.djgpp Subject: Re: Collison detection fo Action game Date: Thu, 6 Feb 1997 09:50:12 +0000 Organization: Honest Ron's Car Emporium Distribution: world Message-ID: <1GKh7AAUla+yEwGM@flag.demon.co.uk> References: <855142026 DOT 12716 AT dejanews DOT com> NNTP-Posting-Host: flag.demon.co.uk MIME-Version: 1.0 Lines: 27 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article , Shawn Hargreaves writes >If true pixel-perfect testing is needed, one of the fastest approaches >is to pregenerate a monochrome mask for each sprite, containing one bits >for the pixels that are set and zeros for the ones that aren't. To test >two objects for a collision, line up these bitmasks depending on the >relative positions of the sprites (this involves a lot of shifting and >can be a big pain to get right), and then bitwise-or the two masks >together. If the resulting value is non-zero, the objects have collided. >This technique lets you check 32 pixels with each test, rather than >having to laboriously loop through every single pixel in the sprite... Any chance you post some example code for this Shawn? -- . ben AT flag DOT demon DOT co DOT uk / www.flag.demon.co.uk Moo-Juice on IRC. ___ . : _~#~_ '#####` : 'o o` #include void main(){__djgpp_ |o o| : ::| | || nearptr_enable();char *v=(char*)(__djgpp_conv | | |:: :: || entional_base+0xb8000);v[0]='M';v[1]=15;v[2]= | :: |==- /| 'o';v[3]=15;v[4]='o';v[5]=15;v[6]='!';v[7]=15 \ -== | | | | ;__djgpp_nearptr_disable();}; | | -oOOo---oOOo---The---Adventures---Of---Poke---And---Moo---oOOo-oOOo--