stopping the enemies from falling off the edge of platforms