Don't reactivate badguys on screen.
authorWolfgang Becker <uafr@gmx.de>
Mon, 29 May 2006 12:07:04 +0000 (12:07 +0000)
committerWolfgang Becker <uafr@gmx.de>
Mon, 29 May 2006 12:07:04 +0000 (12:07 +0000)
SVN-Revision: 3605

data/levels/world1/worldmap.stwm
src/badguy/badguy.cpp

index 6290e29..20a1998 100644 (file)
       (sprite "images/worldmap/common/yeti.sprite")
     )
     (level
-      (name "")
+      (name "bonus.stl")
       (x 3)
       (y 28)
     )
index 676ecb7..6d2632f 100644 (file)
@@ -27,6 +27,7 @@
 #include "log.hpp"
 #include "level.hpp"
 #include "object/bullet.hpp"
+#include "main.hpp"
 
 static const float SQUISH_TIME = 2;
 static const float X_OFFSCREEN_DISTANCE = 1600;
@@ -308,22 +309,13 @@ BadGuy::try_activate()
     dir = RIGHT;
     set_state(STATE_ACTIVE);
     activate();
-  } else if (start_position.x > scroll_x &&
-      start_position.x < scroll_x + X_OFFSCREEN_DISTANCE &&
+  } else if (start_position.x > scroll_x +  SCREEN_WIDTH &&
+      start_position.x < scroll_x + SCREEN_WIDTH + X_OFFSCREEN_DISTANCE &&
       start_position.y > scroll_y - Y_OFFSCREEN_DISTANCE &&
       start_position.y < scroll_y + Y_OFFSCREEN_DISTANCE) {
     dir = LEFT;
     set_state(STATE_ACTIVE);
     activate();
-  } else if (start_position.x > scroll_x - X_OFFSCREEN_DISTANCE &&
-      start_position.x < scroll_x + X_OFFSCREEN_DISTANCE &&
-      ((start_position.y > scroll_y &&
-        start_position.y < scroll_y + Y_OFFSCREEN_DISTANCE) ||
-       (start_position.y > scroll_y - Y_OFFSCREEN_DISTANCE &&
-        start_position.y < scroll_y))) {
-    dir = start_position.x < scroll_x ? RIGHT : LEFT;
-    set_state(STATE_ACTIVE);
-    activate();
   } else if(state == STATE_INIT
       && start_position.x > scroll_x - X_OFFSCREEN_DISTANCE
       && start_position.x < scroll_x + X_OFFSCREEN_DISTANCE