From: Christoph Sommer Date: Mon, 11 Feb 2008 20:14:41 +0000 (+0000) Subject: Made buttjump a bit easier to perform X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a98f7cee9f6a2593c0e1f3442800f159bad410df;p=supertux.git Made buttjump a bit easier to perform SVN-Revision: 5322 --- diff --git a/src/badguy/mriceblock.cpp b/src/badguy/mriceblock.cpp index 7cd8d863a..0d84d8129 100644 --- a/src/badguy/mriceblock.cpp +++ b/src/badguy/mriceblock.cpp @@ -189,7 +189,7 @@ MrIceBlock::collision_squished(GameObject& object) { Player* player = dynamic_cast(&object); squishcount++; - if ((squishcount >= MAXSQUISHES) || (player && player->butt_jump)) { + if ((squishcount >= MAXSQUISHES) || (player && player->does_buttjump)) { kill_fall(); return true; } diff --git a/src/badguy/snail.cpp b/src/badguy/snail.cpp index 33d19155e..8533d7d95 100644 --- a/src/badguy/snail.cpp +++ b/src/badguy/snail.cpp @@ -215,7 +215,7 @@ Snail::collision_squished(GameObject& object) { Player* player = dynamic_cast(&object); squishcount++; - if ((squishcount >= MAXSQUISHES) || (player && player->butt_jump)) { + if ((squishcount >= MAXSQUISHES) || (player && player->does_buttjump)) { kill_fall(); return true; } diff --git a/src/object/block.cpp b/src/object/block.cpp index 4cf7920e3..bb309f037 100644 --- a/src/object/block.cpp +++ b/src/object/block.cpp @@ -356,7 +356,7 @@ Brick::collision(GameObject& other, const CollisionHit& hit){ Player* player = dynamic_cast (&other); if (player) { - if (player->butt_jump) try_break(); + if (player->does_buttjump) try_break(); } BadGuy* badguy = dynamic_cast (&other); diff --git a/src/object/player.cpp b/src/object/player.cpp index 08b50da28..df80ca074 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -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( diff --git a/src/object/player.hpp b/src/object/player.hpp index 81aad0026..4c715c79e 100644 --- a/src/object/player.hpp +++ b/src/object/player.hpp @@ -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;