- fixed bounce code a bit, should now be useable, bounce high might still need tuning
authorIngo Ruhnke <grumbel@gmx.de>
Mon, 14 Jun 2004 21:39:58 +0000 (21:39 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Mon, 14 Jun 2004 21:39:58 +0000 (21:39 +0000)
SVN-Revision: 1487

src/badguy.cpp
src/player.cpp
src/player.h

index daff4ad..b9e9c25 100644 (file)
@@ -1028,7 +1028,7 @@ BadGuy::bump()
 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 @@ BadGuy::squish(Player* player)
     // 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 @@ BadGuy::squish(Player* player)
         set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right);
       }
 
-    player->bounce();
+    player->bounce(this);
 
     player_status.score_multiplier++;
 
@@ -1101,7 +1101,7 @@ BadGuy::squish(Player* player)
     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 @@ BadGuy::squish(Player* player)
       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),
index e43bd63..c42499d 100644 (file)
@@ -1007,16 +1007,16 @@ Player::check_bounds(Camera* camera)
 }
 
 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 6805b78..0d17af3 100644 (file)
@@ -31,6 +31,8 @@
 #include "moving_object.h"
 #include "physic.h"
 
+class BadGuy;
+
 /* Times: */
 
 #define TUX_SAFE_TIME 1250
@@ -183,7 +185,7 @@ public:
 
   /** 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; }