- switch (state) {
-
- case STATE_NORMAL:
- if (on_ground() && might_fall()) {
- // turn around when we are at a ledge
- turn_around();
- }
- else if (!turn_recover_timer.started()) {
- // turn around when we see a Bullet
- Sector* sector = Sector::current();
- for (Sector::GameObjects::iterator i = sector->gameobjects.begin(); i != sector->gameobjects.end(); ++i) {
- Bullet* bullet = dynamic_cast<Bullet*>(*i);
- if (bullet) {
- if (can_see(*bullet)) turn_around();
- }
- }
- }
- break;
-
+ bool wants_to_flee = false;
+
+ // check if we see a bullet
+ Sector* sector = Sector::current();
+ for (Sector::GameObjects::iterator i = sector->gameobjects.begin(); i != sector->gameobjects.end(); ++i) {
+ Bullet* bullet = dynamic_cast<Bullet*>(*i);
+ if (!bullet) continue;
+ if (can_see(*bullet)) wants_to_flee = true;