[Super-tux-commit] supertux/src badguy.cpp,1.113,1.114
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-08-14 11:51:16
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30373/src Modified Files: badguy.cpp Log Message: Changed Walking Tree direction change behavior. Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.113 retrieving revision 1.114 diff -u -d -r1.113 -r1.114 --- badguy.cpp 13 Aug 2004 13:39:18 -0000 1.113 +++ badguy.cpp 14 Aug 2004 11:50:58 -0000 1.114 @@ -818,29 +818,11 @@ void BadGuy::action_walkingtree(double elapsed_time) { - Player& tux = *Sector::current()->player; - Direction v_dir = physic.get_velocity_x() < 0 ? LEFT : RIGHT; - if (dying == DYING_NOT) check_horizontal_bump(); fall(); - if (mode == BGM_BIG && tux.dying == DYING_NOT) - { - 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, Sector::current()->gravity); if (dying != DYING_FALLING) collision_swept_object_map(&old_base,&base); @@ -1131,6 +1113,12 @@ { set_sprite(img_walkingtree_left_small, img_walkingtree_left_small); physic.set_velocity_x(physic.get_velocity_x() * 2.0f); + + /* Move to the player's direction */ + if(dir != Sector::current()->player->dir) + physic.set_velocity_x(-physic.get_velocity_x()); + dir = Sector::current()->player->dir; + // XXX magic number: 66 is BGM_BIG height player->bounce(this); |