[stella] My best collision detection

Subject: [stella] My best collision detection
From: Manuel Polik <cybergoth@xxxxxxxx>
Date: Fri, 25 Oct 2002 07:48:00 +0200
Hi there!

Not knowing how the collision detection works in Space 
Instigators, I thought to present mine. I once spent 
almost a whole day for finding the optimal technique to 
determine wether a particle hit a square and I think it 
possibly might be adopted to detect a collision with 
variable width invaders:


This is determining a wether a single pixel hit an 8*11 
square:

     LDA bulletHorPos,Y
     ADC #$08
     SBC horPosP0,X
     BMI NoHit
     SBC #$08
     BPL NoHit
     LDA verPosP0,X
     SBC bulletVerPos,Y
     BMI NoHit
     SBC #$0B
     BPL NoHit

I case the invader is only 6 pixel wide, it could still 
be aligned on the left side of the sprite, so all that 
was required to change in this code was adopting the 
height from #$0B to the invader height and replacing the 
hardcoded #$08 with a temporary variable.

Maybe that helps,
	Greetings,	
		Manuel

----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread