01-22-2023, 08:24 PM
@bplus The process of what it does is really rather simple:
1) It takes a look at your image, and assumes that the background is transparent color 0 (&H00000000).
2) Then it checks each pixel from top to bottom, left to right, and checks to see if it borders a transparent pixel. (For example, point (100,100) is red, and point(100,101) is transparent.) If a point has a transparent parner beside it, it stores that point into our array -- that's how it forms an outline of the image.
3) It then checks later to see if our point has changed from the default color of our image. (In this case, I was only using the redStar, or redScribble, so I hardcoded to check to see if our array still pointed to all red pixels on the screen where our outline was produced.) Other ways to do this check would be to make certain the pixel in question was still clear transparent 0 *before* placing the redStar onto the screen over it, or to store the redStar's pixel colors with the x/y point information to compare against in case we had multiple colors in our raindowStar...
But the overall process is rather simple in concept -- make an outline of the image and store that outline in an array. Then just check those array points to see if they match what we expect our outline to be. If not, the *something* has been drawn on top of our image, and *THAT* qualifies as a collision.
1) It takes a look at your image, and assumes that the background is transparent color 0 (&H00000000).
2) Then it checks each pixel from top to bottom, left to right, and checks to see if it borders a transparent pixel. (For example, point (100,100) is red, and point(100,101) is transparent.) If a point has a transparent parner beside it, it stores that point into our array -- that's how it forms an outline of the image.
3) It then checks later to see if our point has changed from the default color of our image. (In this case, I was only using the redStar, or redScribble, so I hardcoded to check to see if our array still pointed to all red pixels on the screen where our outline was produced.) Other ways to do this check would be to make certain the pixel in question was still clear transparent 0 *before* placing the redStar onto the screen over it, or to store the redStar's pixel colors with the x/y point information to compare against in case we had multiple colors in our raindowStar...
But the overall process is rather simple in concept -- make an outline of the image and store that outline in an array. Then just check those array points to see if they match what we expect our outline to be. If not, the *something* has been drawn on top of our image, and *THAT* qualifies as a collision.