Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26471
Modified Files:
player.cpp
Log Message:
- butt jump now kills nearby badguys
Index: player.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- player.cpp 30 May 2004 01:08:49 -0000 1.130
+++ player.cpp 30 May 2004 23:00:00 -0000 1.131
@@ -467,22 +467,43 @@
/* In case the player has pressed Down while in a certain range of air,
enable butt jump action */
if (input.down == DOWN && !butt_jump)
- if(tiles_on_air(TILES_FOR_BUTTJUMP))
+ if(tiles_on_air(TILES_FOR_BUTTJUMP) && jumping)
butt_jump = true;
/* When Down is not held anymore, disable butt jump */
if(butt_jump && input.down == UP)
butt_jump = false;
+ // Do butt jump
if (butt_jump && on_ground() && size == BIG)
{
- if(World::current()->trybreakbrick(base.x, base.y + base.height, false)
- || World::current()->trybreakbrick(
- base.x + base.width, base.y + base.height, false)) {
- // make tux jumping a little bit again after breaking the bricks
- physic.set_velocity_y(2);
+ butt_jump = false;
+
+ // Break bricks beneath Tux
+ if(World::current()->trybreakbrick(base.x + 1, base.y + base.height, false)
+ || World::current()->trybreakbrick(
+ base.x + base.width - 1, base.y + base.height, false))
+ {
+ physic.set_velocity_y(2);
+ butt_jump = true;
+ }
+
+ // Kill nearby badguys
+ std::vector<GameObject*> gameobjects = World::current()->gameobjects;
+ for (std::vector<GameObject*>::iterator i = gameobjects.begin();
+ i != gameobjects.end();
+ i++)
+ {
+ BadGuy* badguy = dynamic_cast<BadGuy*> (*i);
+ if(badguy)
+ {
+ if (fabsf(base.x - badguy->base.x) < 300 &&
+ fabsf(base.y - badguy->base.y) < 300 &&
+ (issolid(badguy->base.x + 1, badguy->base.y + badguy->base.height) ||
+ issolid(badguy->base.x + badguy->base.width - 1, badguy->base.y + badguy->base.height)))
+ badguy->kill_me(25);
+ }
}
-// butt_jump = false; // comment this, in case you won't to disable the continued use of buttjump
}
if ( (issolid(base.x + base.width / 2, base.y + base.height + 64) ||
|