Message-ID: <002501be09c7$ebc8cd60$d1acf482@win95.swipnet.se> From: "Ulrik Sunnvius aka Keso - \"Be strong, be wrong!\"" To: Subject: Re: How do I detect a RLE-sprite on a bitmap? Date: Fri, 6 Nov 1998 21:56:25 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.0 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id PAA23842 Reply-To: djgpp AT delorie DOT com You see my problem is that aliens shoot randomly at the RLE-sprite, and then I want some way to find out if the shoot (vline(..)) has hit the RLE- sprite. If hit, the shoot should disappear, and the "hero" dies.. Hmm... mayby I can get the x value, but i need to know the y-value where the sprite begins (the shoot shouldn't continue..). I hope you can help me. If not, thanks anyway! /US ------------------------------ +46 70 3695091 http://start.at/cprog/ keso-98 AT swipnet DOT se ------------------------------ >> 1. How do I detect (i.e. where it is on the bitmap) a RLE-sprite on a >> bitmap? (getpixel() don't work...) >> >> (2. How do I detect a regular sprite on a bitmap?) >> (3. How do I detect a little bitmap on a bitmap?) > >Sorry, what are you trying to do? If you want to know where an RLE sprite is >on a bitmap, wouldn't you know already as you've just placed it there? > >If you're thinking of comparing two images to find an area of one image >which is the same as the other image, don't use RLE sprites unless you want >to make your job 20 times more complex. A very much simplified algortihm >could be: > >1. Use getpixel on the larger bitmap scanning across until you find a pixel >the same colour as the top-left pixel of the sprite. > >2. Check the next pixels on the line in turn. Compare these to the sprite >image. If you find a pixel out of place return to step one. > >You've got to repeat this many times. > >James Arthur >jaa AT arfa DOT clara DOT net >ICQ#15054819 > >