www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/02/20:30:14

From: "23yrold3yrold" <cbarry AT pangea DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: BREAKing out of a nested loop
Date: Wed, 2 Aug 2000 19:27:24 -0500
Lines: 32
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
NNTP-Posting-Host: 64.4.88.110
Message-ID: <3988bc46_2@spamkiller.newsfeeds.com>
X-Trace: 2 Aug 2000 19:26:46 -0500, 64.4.88.110
X-Comments: This message was posted through Newsfeeds.com
X-Comments2: IMPORTANT: Newsfeeds.com does not condone, nor support, spam or any illegal or copyrighted postings.
X-Comments3: IMPORTANT: Under NO circumstances will postings containing illegal or copyrighted material through this service be tolerated!!
X-Report: Please report illegal or inappropriate use to <abuse AT newsfeeds DOT com> You may also use our online abuse reporting from: http://www.newsfeeds.com/abuseform.htm
X-Abuse-Info: Please be sure to forward a copy of ALL headers, INCLUDING the body (DO NOT SEND ATTACHMENTS)
Organization: Newsfeeds.com http://www.newsfeeds.com 73,000+ UNCENSORED Newsgroups.
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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();

I would like to get it to break as soon as a collision is detected and go
straight to FUNKtion(). Is this enough to bust out of all those nested
loops? Putting if(collide){break;} latter in that mess would be kind of
stupid because you're just putting it in another loop, correct? Any help
will be appreciated. Thank you.


Chris


- Raw text -


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