load selected pixels[]
in
Programming Questions
•
2 years ago
Hi,
I am currently doing some collision detection by checking if my object's X and Y coordinates are over a certain color, this is done by loading the whole screen's pixels[] and checking with:
if (pixels[(int(y + 60)*width) + int(x)] == c) {
return true;
}
else {
return false;
return true;
}
else {
return false;
But, my object's X position never changes, it's always 100. Perhaps I'm looking at this the wrong way, but it seems to me I'm loading a load of pixels i really don't need every time through draw() - is there some way to only load the 100th column of pixels across, and then analyze this "slice" of the array on it's own for whether the Y position is over the specified color...?
Thanks, hope you can help
Dave
1