Made buttjump a bit easier to perform
authorChristoph Sommer <mail@christoph-sommer.de>
Mon, 11 Feb 2008 20:14:41 +0000 (20:14 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Mon, 11 Feb 2008 20:14:41 +0000 (20:14 +0000)
SVN-Revision: 5322

src/badguy/mriceblock.cpp
src/badguy/snail.cpp
src/object/block.cpp
src/object/player.cpp
src/object/player.hpp

index 7cd8d86..0d84d81 100644 (file)
@@ -189,7 +189,7 @@ MrIceBlock::collision_squished(GameObject& object)
       {
        Player* player = dynamic_cast<Player*>(&object);
         squishcount++;
-        if ((squishcount >= MAXSQUISHES) || (player && player->butt_jump)) {
+        if ((squishcount >= MAXSQUISHES) || (player && player->does_buttjump)) {
           kill_fall();
           return true;
         }
index 33d1915..8533d7d 100644 (file)
@@ -215,7 +215,7 @@ Snail::collision_squished(GameObject& object)
       {
        Player* player = dynamic_cast<Player*>(&object);
         squishcount++;
-        if ((squishcount >= MAXSQUISHES) || (player && player->butt_jump)) {
+        if ((squishcount >= MAXSQUISHES) || (player && player->does_buttjump)) {
           kill_fall();
           return true;
         }
index 4cf7920..bb309f0 100644 (file)
@@ -356,7 +356,7 @@ Brick::collision(GameObject& other, const CollisionHit& hit){
 
     Player* player = dynamic_cast<Player*> (&other);
     if (player) {
-      if (player->butt_jump) try_break();
+      if (player->does_buttjump) try_break();
     }
 
     BadGuy* badguy = dynamic_cast<BadGuy*> (&other);
index 08b50da..df80ca0 100644 (file)
@@ -54,7 +54,7 @@
 //#define SWIMMING
 
 static const int TILES_FOR_BUTTJUMP = 3;
-static const float BUTTJUMP_MIN_VELOCITY_Y = 700.0f;
+static const float BUTTJUMP_MIN_VELOCITY_Y = 400.0f;
 static const float SHOOTING_TIME = .150f;
 /// time before idle animation starts
 static const float IDLE_TIME = 2.5f;
@@ -141,7 +141,8 @@ Player::init()
   fall_mode = ON_GROUND;
   jumping = false;
   can_jump = true;
-  butt_jump = false;
+  wants_buttjump = false;
+  does_buttjump = false;
   growing = false;
   deactivated = false;
   backflipping = false;
@@ -496,7 +497,7 @@ Player::do_duck() {
     return;
   if (!on_ground())
     return;
-  if (butt_jump)
+  if (does_buttjump)
     return;
 
   if (adjust_height(31.8f)) {
@@ -588,13 +589,16 @@ Player::handle_vertical_input()
 
   /* In case the player has pressed Down while in a certain range of air,
      enable butt jump action */
-  if (controller->hold(Controller::DOWN) && !butt_jump && !duck && is_big() && !on_ground() && (physic.get_velocity_y() >= BUTTJUMP_MIN_VELOCITY_Y)) {
-    butt_jump = true;
+  if (controller->hold(Controller::DOWN) && !duck && is_big() && !on_ground()) {
+    wants_buttjump = true;
+    if (physic.get_velocity_y() >= BUTTJUMP_MIN_VELOCITY_Y) does_buttjump = true;
   }
 
   /* When Down is not held anymore, disable butt jump */
-  if(butt_jump && !controller->hold(Controller::DOWN))
-    butt_jump = false;
+  if(!controller->hold(Controller::DOWN)) {
+    wants_buttjump = false;
+    does_buttjump = false;
+  }
 
   // swimming
   physic.set_acceleration_y(0);
@@ -833,7 +837,7 @@ Player::set_bonus(BonusType type, bool animate)
   }
 
   if (type == NO_BONUS) {
-    if (butt_jump) butt_jump = false;
+    if (does_buttjump) does_buttjump = false;
   }
 
   if ((type == NO_BONUS) || (type == GROWUP_BONUS)) {
@@ -932,7 +936,7 @@ Player::draw(DrawingContext& context)
   else if (kick_timer.started() && !kick_timer.check()) {
     sprite->set_action(sa_prefix+((dir == LEFT)?"-kick-left":"-kick-right"));
   }
-  else if (butt_jump && is_big()) {
+  else if ((wants_buttjump || does_buttjump) && is_big()) {
     sprite->set_action(sa_prefix+((dir == LEFT)?"-buttjump-left":"-buttjump-right"));
   }
   else if (!on_ground()) {
@@ -1009,8 +1013,8 @@ Player::collision_solid(const CollisionHit& hit)
     floor_normal = hit.slope_normal;
 
     // Butt Jump landed    
-    if (butt_jump) {
-      butt_jump = false;
+    if (does_buttjump) {
+      does_buttjump = false;
       physic.set_velocity_y(-300);
       on_ground_flag = false;
       Sector::current()->add_object(new Particles(
index 81aad00..4c715c7 100644 (file)
@@ -85,7 +85,8 @@ public:
   bool on_ground_flag;
   bool jumping;
   bool can_jump;
-  bool butt_jump;
+  bool wants_buttjump;
+  bool does_buttjump;
 
   Timer invincible_timer;
   Timer skidding_timer;