delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/06/06:56:56

From: "Michael Stewart" <mike AT reggin DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Collision detection (Was: Simple timer question...)
Date: Thu, 6 May 1999 11:32:34 +0100
Organization: USENET UK
Message-ID: <7grqui$9it$1@hagen.cloud9.co.uk>
References: <8D53104ECD0CD211AF4000A0C9D60AE30136620B AT probe-2 DOT acclaim-euro DOT net> <mCtvWEAVuJM3EwRy AT zaynar DOT demon DOT co DOT uk>
NNTP-Posting-Host: hgty.capgemini.co.uk
X-Trace: hagen.cloud9.co.uk 925986578 9821 194.42.240.2 (6 May 1999 10:29:38 GMT)
X-Complaints-To: abuse AT usenet DOT co DOT uk
NNTP-Posting-Date: 6 May 1999 10:29:38 GMT
X-Newsreader: Microsoft Outlook Express 4.72.3155.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
Lines: 22
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> I now have another problem which I need help with: I have the spaceship
>(a 32x32 bitmap object) moving about the playing area (a 200x400 bitmap
>object, with colour 128 being solid land), and I want to know when the
>spaceship has hit the land. The spaceship isn't square -- it can be lots
>of different shapes.
> I have thought of making two 32x32 bitmap objects, and then putting the
>land picture with the spaceship over it in one, and the spaceship with
>the land over it in the other, compare the two, and if they're different
>then the land and spaceship must be overlapping. However, I don't know
>how to easily compare two bitmap objects...
> If you know how to do this, or know of any better/alternative way to
>achieve collision detection, then I'd be grateful for any help!


Doing the comparison the way you mention would be a very slow method. Take a
look at the Allegro add-on page for such things
(http://www.talula.demon.co.uk/allegro/addons.html) look for pixel `perfect
collision detection'.

Michael Stewart


- Raw text -


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