From cc9f1cd9297aed8aa9c9f0d6ab314cd736c59a27 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 28 Feb 2010 10:30:54 +0000 Subject: [PATCH] Haywire: Walk towards the player if possible. This is a simple version of the "follow the player" behavior proposed in the Milestone 2 design document. SVN-Revision: 6446 --- src/badguy/haywire.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/badguy/haywire.cpp b/src/badguy/haywire.cpp index ebcf3f12d..6dff5ccdf 100644 --- a/src/badguy/haywire.cpp +++ b/src/badguy/haywire.cpp @@ -130,6 +130,20 @@ Haywire::active_update(float elapsed_time) } } + if (is_exploding && !turn_around_timer.started()) { + Player *p = Sector::current()->get_nearest_player (this->get_pos ()); + + if (p) { + Direction player_dir = LEFT; + + if (p->get_pos ().x > this->get_pos ().x) + player_dir = RIGHT; + + if (player_dir != dir) + turn_around (); + } + } + WalkingBadguy::active_update(elapsed_time); } -- 2.11.0