I'm not attaching a CAPX file to this message because I'm asking it on behalf of a student who is enrolled in my games class. (I teach at a liberal arts university in San Antonio, Texas.)
Her game is a simple platform game that follows the logic of the jungle platform tutorial. An invisible border box is attached to the skin for the player character, and that border box is used to detect collision with other objects. The platform behavior is also attached to the border box.
Enemies move from left to right, and they check for collision with an invisible edge sprite when they reach the end of their platforms. In this case, the enemies are just an animated sprite. They do not have an invisible box attached to them. As in the tutorial, an instance variable is used to keep track of the enemy's direction, and the enemies are flipped each time they collide with an invisible edge sprite.
As the player moves through the game, the enemies suddenly start running off the platforms and falling to their deaths. It seems like it might be a collision detection problem. For some reason, it is more likely to happen when the enemies are outside of the viewport window. This is what the collision boundaries look like for the enemy sprite:
I noticed that the fox sprite is *slightly* wider on certain frames than on other frames. (Never more than a couple pixels.)
Should we be using invisible border boxes with our enemy sprites to avoid this problem? If so, how would one do this with multiple enemy sprites? Would we need to have a unique invisible border box for each enemy sprite? That seems hugely unwieldy. Would we use UIDs to pin invisible border boxes to enemy sprites when the layout loads?
Thanks in advance for any help you might provide.