[Super-tux-commit] supertux/src badguy.cpp,1.40,1.41
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-04-22 10:43:44
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15673/src Modified Files: badguy.cpp Log Message: Applied Ryan's patch for overlaping badguys. Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- badguy.cpp 20 Apr 2004 20:10:26 -0000 1.40 +++ badguy.cpp 22 Apr 2004 10:43:36 -0000 1.41 @@ -1025,6 +1025,26 @@ // Jumpy is an exception if (pbad_c->kind == BAD_MONEY) break; + + // Bounce off of other badguy if we land on top of him + if (base.y + base.height < pbad_c->base.y + pbad_c->base.height) + { + Direction old_dir = dir; + if (pbad_c->dir == LEFT) + dir = RIGHT; + else if (pbad_c->dir == RIGHT) + dir = LEFT; + + if (dir != old_dir) + physic.inverse_velocity_x(); + + physic.set_velocity(fabs(physic.get_velocity_x()), 2); + + break; + } + else if (base.y + base.height > pbad_c->base.y + pbad_c->base.height) + break; + if (dir == LEFT) dir = RIGHT; else if (dir == RIGHT) |