From 177277c32468eef83d5eea53d46052637857784e Mon Sep 17 00:00:00 2001 From: Ryan Flegel Date: Thu, 27 May 2004 23:54:31 +0000 Subject: [PATCH] - walking tree tweaks SVN-Revision: 1343 --- src/badguy.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/badguy.cpp b/src/badguy.cpp index 19542fd47..09adc6dee 100644 --- a/src/badguy.cpp +++ b/src/badguy.cpp @@ -834,11 +834,29 @@ BadGuy::action_wingling(double elapsed_time) void BadGuy::action_walkingtree(double elapsed_time) { + Player& tux = *World::current()->get_tux(); + Direction v_dir = physic.get_velocity_x() < 0 ? LEFT : RIGHT; + if (dying == DYING_NOT) check_horizontal_bump(); fall(); + if (mode == BGM_BIG) + { + if ((tux.base.x + tux.base.width/2 > base.x + base.width/2) && v_dir == LEFT) + { + dir = RIGHT; + physic.set_velocity_x(-physic.get_velocity_x()); + } + else if ((tux.base.x + tux.base.width/2 < base.x + base.width/2) && v_dir == RIGHT) + { + dir = LEFT; + physic.set_velocity_x(-physic.get_velocity_x()); + } + } + + physic.apply(elapsed_time, base.x, base.y); if (dying != DYING_FALLING) collision_swept_object_map(&old_base,&base); -- 2.11.0