Page 3 of 3

Re: Basic Collision Detection help

PostPosted: Mon Aug 18, 2014 3:58 pm
by rodot
yodasvideoarcade wrote:It would be useful to have an additional collission-detection function for detecting pixel-perfect collission between bitmaps.


That would be useful and pretty quick to implement, I'll give it a try asap. Thanks for the suggestion :)

Re: Basic Collision Detection help

PostPosted: Mon Aug 18, 2014 5:06 pm
by Matrix828
rodot wrote:
yodasvideoarcade wrote:It would be useful to have an additional collission-detection function for detecting pixel-perfect collission between bitmaps.


That would be useful and pretty quick to implement, I'll give it a try asap. Thanks for the suggestion :)



Does what I posted work? (saves you a few minutes atleast :D )
Code: Select all
boolean collideBitmap(const uint8_t *bitmap1, int8_t x1, int8_t y1, const uint8_t *bitmap2, int8_t x2, int8_t y2) {
    int8_t w1 = pgm_read_byte(bitmap1);
    int8_t h1 = pgm_read_byte(bitmap1 + 1);

    int8_t w2 = pgm_read_byte(bitmap2);
    int8_t h2 = pgm_read_byte(bitmap2 + 1);

    return gb.collideRectRect(x1, y1, w1, h1, x2, y2, w2, h2);
}

Re: Basic Collision Detection help

PostPosted: Mon Aug 18, 2014 5:20 pm
by rodot
Yoda was talking about a pixel-wise collision, what you suggest here is the collisions between the rectangles containing the bitmap, do you get the difference?

Re: Basic Collision Detection help

PostPosted: Fri Sep 05, 2014 9:05 pm
by rodot
A wild pixel-wise collision detection appears! :o

You'll find it in the library's beta branch. If you catch any bug please tell me.

Re: Basic Collision Detection help

PostPosted: Sat Sep 06, 2014 11:15 pm
by DFX2KX
rodot wrote:A wild pixel-wise collision detection appears! :o

You'll find it in the library's beta branch. If you catch any bug please tell me.


:o! YAYYY! It appears you don't have to draw said bitmaps either, this will be quite useful for all sorts of things! Thanks Rodot!