|
Pixel Perfect Exercise |
Scooter
Member #16,799
January 2018
|
Hi Dizzy: |
Dizzy Egg
Member #10,824
March 2009
|
Hello Scooter, I cannot see any code?
---------------------------------------------------- |
Scooter
Member #16,799
January 2018
|
Hi Dizzy: It won't accept my zip file! Here are all files except the background file. It would not load that file for some reason. Thanks! |
DanielH
Member #934
January 2001
|
You create the mask on a stationary image, but the image is rotating. You would need to also rotate the mask. |
Scooter
Member #16,799
January 2018
|
Hi Dizzy: Thanks Daniel posted that I needed to rotate the mask instead of the bitmap. |
Dizzy Egg
Member #10,824
March 2009
|
Hello Scooter. I made some changes to the attached code, the ball will now go in the gap, even when rotating. Couple of things, when you were filling the mask, you had: mask->bits[y * width + x] = (color.a != 0); but should have been: mask->bits[x * width + y] = (color.a != 0); (had the x/y the wrong way round). Secondly, your check_collision code wasn't right, meaning that the ball could never go in the gap, even if not rotating. I've added a new function called CheckCollision that does a bounding box first, then properly finds the collision range for both masks to do per-bit checking. Also, I recalculate the mask every time the disc is rotated, so that the mask reflects the rotated disc image, which you can see in the timer update/draw.
---------------------------------------------------- |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Nice work Dizzy. Although when accessing an array, it is usually stored in row major?
My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Scooter
Member #16,799
January 2018
|
Hi Dizzy: |
|