git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@5910
837edb03-e0f3-0310-88ca-
d4d4e8b29345
break;
case STATE_TRACKING:
- if (dist.norm() <= vanish_range) {
+ if (dist.norm() > vanish_range) {
+ vanish();
+ } else if (dist.norm() >= 1) {
Vector dir = dist.unit();
movement = dir * elapsed_time * flyspeed;
} else {
- vanish();
+ /* We somehow landed right on top of the player without colliding.
+ * Sit tight and avoid a division by zero. */
}
sound_source->set_position(get_pos());
break;