From bbecaf79e2406262c12d4c33dd92bcdb656cd561 Mon Sep 17 00:00:00 2001 From: Christoph Sommer Date: Thu, 6 Jul 2006 13:49:37 +0000 Subject: [PATCH] Made badguys face right when spawning onscreen and to the left of the nearest player SVN-Revision: 3915 --- src/badguy/badguy.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index 755723b5f..560b37f43 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -362,7 +362,17 @@ BadGuy::try_activate() && start_position.x < scroll_x + X_OFFSCREEN_DISTANCE && start_position.y > scroll_y - Y_OFFSCREEN_DISTANCE && start_position.y < scroll_y + Y_OFFSCREEN_DISTANCE) { - if (start_dir != AUTO) dir = start_dir; else dir = 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(); } -- 2.11.0