delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/06/18:06:59

Message-Id: <199811062306.XAA22477@remus.clara.net>
From: "Arthur" <arfa AT clara DOT net>
To: <djgpp AT delorie DOT com>
Subject: RE: How do I detect a RLE-sprite on a bitmap?
Date: Fri, 6 Nov 1998 23:06:30 -0000
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0
Importance: Normal
In-Reply-To: <002501be09c7$ebc8cd60$d1acf482@win95.swipnet.se>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
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!

Oh, right. You should know the x and y position of the sprite, the width and
height of the sprite, and the x and y position of the bullet. If you don't
know these things, then this is a very odd game. Imagine a box which covers
your sprite from the x,y coordinate to the coordinate at the bottom right
corner of the sprite (x+width,y+height). Simply check to see if the x,y of
the bullet is inside this box to see if there is a hit. This is a very
simple method of collision detection.

James Arthur
jaa AT arfa DOT clara DOT net
ICQ#15054819


- Raw text -


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