Rather than using constants, why not use Allegro's BITMAP::w and BITMAP::h for width and height in your checks? This will prevent you typing width X for an image with Y width.
But it only follows if the top of BotY is less or more then BoxY. How do I make it so it follows it when it's not equal to the MIDDLE of the BotY, not the top.. And I guess adding half of the BotY doesn't work.