projects
/
supertux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3d44636
)
fixed direction of badguy
author
Wolfgang Becker
<uafr@gmx.de>
Thu, 6 Jul 2006 14:23:08 +0000
(14:23 +0000)
committer
Wolfgang Becker
<uafr@gmx.de>
Thu, 6 Jul 2006 14:23:08 +0000
(14:23 +0000)
SVN-Revision: 3918
src/badguy/badguy.cpp
patch
|
blob
|
history
diff --git
a/src/badguy/badguy.cpp
b/src/badguy/badguy.cpp
index
e37fb9c
..
3c1595f
100644
(file)
--- a/
src/badguy/badguy.cpp
+++ b/
src/badguy/badguy.cpp
@@
-354,7
+354,16
@@
BadGuy::try_activate()
start_position.y < scroll_y + SCREEN_HEIGHT + Y_OFFSCREEN_DISTANCE) ||
(start_position.y > scroll_y - Y_OFFSCREEN_DISTANCE &&
start_position.y < scroll_y - bbox.get_height() ))) {
start_position.y < scroll_y + SCREEN_HEIGHT + Y_OFFSCREEN_DISTANCE) ||
(start_position.y > scroll_y - Y_OFFSCREEN_DISTANCE &&
start_position.y < scroll_y - bbox.get_height() ))) {
- if (start_dir != AUTO) dir = start_dir; else dir = start_position.x < scroll_x ? RIGHT : LEFT;
+ if (start_dir != AUTO) dir = start_dir;
+ else{
+ // if nearest player is to our right, start facing right
+ Player* player = get_nearest_player();
+ if (player && (player->get_bbox().p1.x > get_bbox().p2.x)) {
+ dir = RIGHT;
+ } else {
+ dir = LEFT;
+ }
+ }
set_state(STATE_ACTIVE);
activate();
} else if(state == STATE_INIT
set_state(STATE_ACTIVE);
activate();
} else if(state == STATE_INIT