The easiest way to avoid infinite loop is to include a condition like "loopindex<100" to the While loop.
While that's useful to know it doesn't actually help in this situation. The problem is that I can't come up with a way for this While loop to have something resembling an "else" that doesn't create an infinite loop.
Currently I have a "While" loop that checks to see if the shadow is overlapping a platform, and if that platform is in the same "Z-Lane" as the shadow. If it is, it sets the shadows Y position to shadow.y-1
This causes the shadow snap to the tops of platforms higher than its starting position, but I cannot figure out how to reverse this and have it snap to the tops of platforms lower than it's starting position.
Pseudocode wise it needs to look something like this:
NOT Overlapping a platform
Overlapping platform, but platform's Zlane is not equal to shadow Zlane
Set shadow.y to shadow.y+1
But if I just do that, it will flip between the previous while loop and this one.