delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/05/02:32:30.1

From: Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: BREAKing out of a nested loop
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <67kmosselbfbtblgtkhd5hrfbjt4hqg21j@4ax.com>
References: <3988e66b DOT 4161646 AT news DOT vallnet DOT com> <39899344 DOT 29767 DOT 9075C8 AT localhost>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 55
X-Trace: +4f596+R9lsk+QxQozvz9GbszqOK+IoWD6Adq1aO4b21b5j0/gytXllcF/sYlWzfjIO3K+ZqO440!PVabVD2DvVlxCj8htrUw6J6J5cYpha8IgAGlFPr146KBy35kReADDsLJdkiG46QlyiCr2yxgbGH7!vQg=
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Fri, 04 Aug 2000 23:26:41 GMT
Distribution: world
Date: Fri, 04 Aug 2000 23:26:41 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Thu, 3 Aug 2000 15:44:04 +1000, Leon AT caresystems DOT com DOT au wrote:

> In comp.os.msdos.djgpp, on Wed, 2 Aug 2000 19:27:24 -0500,
> "23yrold3yrold" <cbarry AT pangea DOT ca> wrote:
>> 
>> >Hullo. I would like a little help with something. I've written a simple
>> >collision-detection program, but I need a little clarification with
>> >something:
>> >
>> >
>> >for(int a = 1; a <= pptest_w; a++){
>> >   for(int b = 1; b <= pptest_h; b++){
>> >      pixelcheck = getpixel(pptest_1a, a, b);
>> >      if(pixelcheck <= 0){
>> >      }else if(pixelcheck != 0){
>> >         pixelcheck = getpixel(pptest_2a, a, b);
>> >         if(pixelcheck <= 0){
>> >         }else if(pixelcheck != 0){
>> >            collide = 1;
>> >            break;
>> >         }
>> >      }
>> >   }
>> >}
>> >
>> >FUNKtion();
>
>how about
>
>collide=0
>for(int a = 1; a <= pptest_w && !collide; a++){
>   for(int b = 1; b <= pptest_h && !collide; b++){
>      pixelcheck = getpixel(pptest_1a, a, b); 
>      if(pixelcheck <= 0){
>      }else if(pixelcheck != 0){
>         pixelcheck = getpixel(pptest_2a, a, b);
>         if(pixelcheck <= 0){
>         }else if(pixelcheck != 0){
>            collide = 1;
>         }
>      }
>   }
>}

Or how about (like I did in an old 2d library I once wrote on top of
Allegro) making collision its own function and returning when you find
enough overlapping pixels?

-- 
Damian Yerrick
"I refuse to listen to those who refuse to listen to reason."
See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html

This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses.  http://www.mcafee.com/

- Raw text -


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