From: Leon AT caresystems DOT com DOT au To: djgpp AT delorie DOT com Date: Thu, 3 Aug 2000 15:44:04 +1000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: BREAKing out of a nested loop Message-ID: <39899344.29767.9075C8@localhost> In-reply-to: <3988e66b.4161646@news.vallnet.com> X-mailer: Pegasus Mail for Win32 (v3.12c) Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk In comp.os.msdos.djgpp, on Wed, 2 Aug 2000 19:27:24 -0500, "23yrold3yrold" 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; } } } }