Newb question #3
Right now I have a 2d array of booleans for obstructions, grid[][]. Every x/y that’s true is obstructed (can’t walk there), and so far it’s working great, but I have to manually set it each time. I’m trying to figure out how to use pixelgrabber, but the tutorials expect you to know bitwise operations. I read some tutorials on bitwise operations, and still couldn’t understand it.
Anyway, what I want to do is draw a 2nd layer, on that has trees, walls, tables, etc… obstructable tiles. Then I want pixelgrabber to tell me which pixels have a color (anything other than translucent) and set that pixel in grid[][] to true.
after I do this jazz:
public void handlesinglepixel(int x, int y, int pixel) {
int alpha = (pixel >> 24) & 0xff;
int red = (pixel >> 16) & 0xff;
int green = (pixel >> 8) & 0xff;
int blue = (pixel ) & 0xff;
i’m lost. How, for example, can I test if the present pixel has alpha? Am I dealing with ints that have separated the byte value for each pixel int? wh… i… i guess i just don’t… confused!