Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12710
Modified Files:
badguy.cpp badguy.h player.h player.cpp
Log Message:
- added jumping from badguys (hold jump pressed while jumping on one)
Index: player.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -d -r1.143 -r1.144
--- player.cpp 9 Jun 2004 05:23:19 -0000 1.143
+++ player.cpp 14 Jun 2004 18:34:25 -0000 1.144
@@ -1006,3 +1006,18 @@
}
}
+void
+Player::bounce()
+{
+ if (input.up)
+ physic.set_velocity_y(5.2);
+ else
+ physic.set_velocity_y(2);
+
+ // FIXME: moving tux up looks ugly, but without it tux might collide
+ // FIXME: with enemies, which he has just jump onto (iceblock)
+ //base.y = base.y - base.height - 2;
+}
+
+/* EOF */
+
Index: player.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/player.h,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- player.h 9 Jun 2004 05:23:20 -0000 1.71
+++ player.h 14 Jun 2004 18:34:25 -0000 1.72
@@ -180,6 +180,11 @@
bool tiles_on_air(int tiles);
void grow(bool animate);
void move(const Vector& vector);
+
+ /** let the player jump a bit or more if jump button is hold down
+ (used when you hit a badguy) */
+ void bounce();
+
bool is_dead() const
{ return dead; }
Index: badguy.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/badguy.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- badguy.h 9 Jun 2004 05:23:20 -0000 1.53
+++ badguy.h 14 Jun 2004 18:34:25 -0000 1.54
@@ -160,9 +160,6 @@
* ground */
void fall();
- /** let the player jump a bit (used when you hit a badguy) */
- void make_player_jump(Player* player);
-
/** Turn enemy into a bomb. To explode right way pass true */
void explode(bool right_away);
Index: badguy.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -d -r1.106 -r1.107
--- badguy.cpp 9 Jun 2004 05:23:19 -0000 1.106
+++ badguy.cpp 14 Jun 2004 18:34:25 -0000 1.107
@@ -1026,16 +1026,9 @@
}
void
-BadGuy::make_player_jump(Player* player)
-{
- player->physic.set_velocity_y(2);
- player->base.y = base.y - player->base.height - 2;
-}
-
-void
BadGuy::squish_me(Player* player)
{
- make_player_jump(player);
+ player->bounce();
Sector::current()->add_score(Vector(base.x, base.y),
50 * player_status.score_multiplier);
@@ -1057,7 +1050,7 @@
// mrbomb transforms into a bomb now
explode(false);
- make_player_jump(player);
+ player->bounce();
Sector::current()->add_score(Vector(base.x, base.y),
50 * player_status.score_multiplier);
sound_manager->play_sound(sounds[SND_SQUISH], get_pos());
@@ -1091,7 +1084,7 @@
set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right);
}
- make_player_jump(player);
+ player->bounce();
player_status.score_multiplier++;
@@ -1108,7 +1101,7 @@
if(physic.get_velocity_y() >= 0)
return;
- make_player_jump(player);
+ player->bounce();
Sector::current()->add_score(Vector(base.x, base.y),
25 * player_status.score_multiplier);
@@ -1139,7 +1132,7 @@
physic.set_velocity_x(physic.get_velocity_x() * 2.0f);
// XXX magic number: 66 is BGM_BIG height
- make_player_jump(player);
+ player->bounce();
base.y += 66 - base.height;
Sector::current()->add_score(Vector(base.x, base.y),
|