[Super-tux-commit] supertux/src badguy.cpp,1.132,1.133
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-10-21 21:40:50
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8744/src Modified Files: badguy.cpp Log Message: Forgot to check for enemies on top or under screen. This should do the trick. Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.132 retrieving revision 1.133 diff -u -d -r1.132 -r1.133 --- badguy.cpp 21 Oct 2004 18:34:13 -0000 1.132 +++ badguy.cpp 21 Oct 2004 21:40:33 -0000 1.133 @@ -210,6 +210,8 @@ frozen_timer.init(true); timer.init(true); + seen = true; + dir = activation_dir; float dirsign = activation_dir == LEFT ? -1 : 1; @@ -257,11 +259,6 @@ base.width = 66; base.height = 66; } - - base.x = start_position.x; - base.y = start_position.y; - old_base = base; - seen = true; } Surface* @@ -873,6 +870,18 @@ start_position.y > scroll_y - Y_OFFSCREEN_DISTANCE && start_position.y < scroll_y + screen->h + Y_OFFSCREEN_DISTANCE) activate(LEFT); + else if (start_position.x > scroll_x - X_OFFSCREEN_DISTANCE && + start_position.x < scroll_x + screen->w + X_OFFSCREEN_DISTANCE && + ((start_position.y > scroll_y + screen->h && + start_position.y < scroll_y + screen->h + Y_OFFSCREEN_DISTANCE) || + (start_position.y > scroll_y - Y_OFFSCREEN_DISTANCE && + start_position.y < scroll_y))) + { + if(start_position.x < scroll_x - screen->w/2) + activate(RIGHT); + else + activate(LEFT); + } /* Special case for badguys on start of the level. * If in the future, it's possible to set Tux start pos, this case * should contemplate that. */ |