www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/06/12:39:37

From: Moo-Juice <Ben AT flag DOT demon DOT co DOT uk>
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>
<vgpI$hAr7O+yEwGt AT talula DOT demon DOT co DOT uk>
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 <vgpI$hAr7O+yEwGt AT talula DOT demon DOT co DOT uk>, Shawn Hargreaves
<Shawn AT talula DOT demon DOT co DOT uk> 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 <sys/nearptr.h> 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--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019