Mail Archives: djgpp/2000/08/05/02:32:30.1
On Thu, 3 Aug 2000 15:44:04 +1000, Leon AT caresystems DOT com DOT au wrote:
> In comp.os.msdos.djgpp, on Wed, 2 Aug 2000 19:27:24 -0500,
> "23yrold3yrold" <cbarry AT pangea DOT ca> wrote:
>>
>> >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();
>
>how about
>
>collide=0
>for(int a = 1; a <= pptest_w && !collide; a++){
> for(int b = 1; b <= pptest_h && !collide; 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;
> }
> }
> }
>}
Or how about (like I did in an old 2d library I once wrote on top of
Allegro) making collision its own function and returning when you find
enough overlapping pixels?
--
Damian Yerrick
"I refuse to listen to those who refuse to listen to reason."
See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html
This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses. http://www.mcafee.com/
- Raw text -