From: Florian Forster Date: Sat, 30 Jan 2010 10:43:02 +0000 (+0000) Subject: Bug 507: Reset stuff upon player death X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=5f6e8d69ee645f89f4ccbab31dc19003438edec3;p=supertux.git Bug 507: Reset stuff upon player death If Tux dies while he is subject to increased gravity (jump_early_apex), he retains this attribute during the dying sequence, which looks weird. I will attach a patch that resets the safe_timer and gravity and, for consistency, resets the invincibility upon death instead of checking !dying when creating sparkles. Resolves #507. Thanks to Matt McCutchen for this patch. SVN-Revision: 6290 --- diff --git a/src/object/player.cpp b/src/object/player.cpp index 77ef59395..06941c649 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -390,7 +390,7 @@ Player::update(float elapsed_time) ice_this_frame = false; // when invincible, spawn particles - if (invincible_timer.started() && !dying) + if (invincible_timer.started()) { if (systemRandom.rand(0, 2) == 0) { float px = systemRandom.randf(bbox.p1.x+0, bbox.p2.x-0); @@ -1291,6 +1291,9 @@ Player::kill(bool completely) GameSession::current()->set_reset_point("", Vector()); } physic.enable_gravity(true); + physic.set_gravity_modifier(1.0f); // Undo jump_early_apex + safe_timer.stop(); + invincible_timer.stop(); physic.set_acceleration(0, 0); physic.set_velocity(0, -700); set_bonus(NO_BONUS, true);