Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26419
Modified Files:
player.cpp badguy.cpp player.h
Log Message:
- fixed bounce code a bit, should now be useable, bounce high might still need tuning
Index: player.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- player.cpp 14 Jun 2004 18:34:25 -0000 1.144
+++ player.cpp 14 Jun 2004 21:39:57 -0000 1.145
@@ -1007,16 +1007,16 @@
}
void
-Player::bounce()
+Player::bounce(BadGuy* badguy)
{
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;
+ // Move the player a little bit above the badguy to avoid collision
+ // between badguy and player directly after the bounce has happend
+ base.y = badguy->base.y - base.height - 2;
}
/* EOF */
Index: player.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/player.h,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- player.h 14 Jun 2004 18:34:25 -0000 1.72
+++ player.h 14 Jun 2004 21:39:58 -0000 1.73
@@ -31,6 +31,8 @@
#include "moving_object.h"
#include "physic.h"
+class BadGuy;
+
/* Times: */
#define TUX_SAFE_TIME 1250
@@ -183,7 +185,7 @@
/** let the player jump a bit or more if jump button is hold down
(used when you hit a badguy) */
- void bounce();
+ void bounce(BadGuy* badguy);
bool is_dead() const
{ return dead; }
Index: badguy.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- badguy.cpp 14 Jun 2004 18:34:25 -0000 1.107
+++ badguy.cpp 14 Jun 2004 21:39:57 -0000 1.108
@@ -1028,7 +1028,7 @@
void
BadGuy::squish_me(Player* player)
{
- player->bounce();
+ player->bounce(this);
Sector::current()->add_score(Vector(base.x, base.y),
50 * player_status.score_multiplier);
@@ -1050,7 +1050,7 @@
// mrbomb transforms into a bomb now
explode(false);
- player->bounce();
+ player->bounce(this);
Sector::current()->add_score(Vector(base.x, base.y),
50 * player_status.score_multiplier);
sound_manager->play_sound(sounds[SND_SQUISH], get_pos());
@@ -1084,7 +1084,7 @@
set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right);
}
- player->bounce();
+ player->bounce(this);
player_status.score_multiplier++;
@@ -1101,7 +1101,7 @@
if(physic.get_velocity_y() >= 0)
return;
- player->bounce();
+ player->bounce(this);
Sector::current()->add_score(Vector(base.x, base.y),
25 * player_status.score_multiplier);
@@ -1132,7 +1132,7 @@
physic.set_velocity_x(physic.get_velocity_x() * 2.0f);
// XXX magic number: 66 is BGM_BIG height
- player->bounce();
+ player->bounce(this);
base.y += 66 - base.height;
Sector::current()->add_score(Vector(base.x, base.y),
|