From: Wolfgang Becker Date: Mon, 29 May 2006 12:07:04 +0000 (+0000) Subject: Don't reactivate badguys on screen. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=5df475e5b1c7736b82faf53f7d5c0605672f0090;p=supertux.git Don't reactivate badguys on screen. SVN-Revision: 3605 --- diff --git a/data/levels/world1/worldmap.stwm b/data/levels/world1/worldmap.stwm index 6290e29f1..20a199836 100644 --- a/data/levels/world1/worldmap.stwm +++ b/data/levels/world1/worldmap.stwm @@ -148,7 +148,7 @@ (sprite "images/worldmap/common/yeti.sprite") ) (level - (name "") + (name "bonus.stl") (x 3) (y 28) ) diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index 676ecb7bf..6d2632f55 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -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