From: Marek Moeckel Date: Tue, 8 Jun 2004 07:12:37 +0000 (+0000) Subject: Stomp sprite stays in place now (i.e. doesn't follow Tux around anymore) X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ce69baac515773d44fe257b93a7209121e271ed8;p=supertux.git Stomp sprite stays in place now (i.e. doesn't follow Tux around anymore) SVN-Revision: 1427 --- diff --git a/src/player.cpp b/src/player.cpp index a049774fc..b0eca4e94 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -116,7 +116,8 @@ Player::init() jumping = false; can_jump = true; butt_jump = false; - + + stomp_pos = Vector(0,0); frame_main = 0; frame_ = 0; @@ -508,7 +509,13 @@ Player::handle_vertical_input() // Do butt jump if (butt_jump && on_ground() && size == BIG) { + + if (duck) + stomp_pos = Vector(base.x - 32, base.y); + else + stomp_pos = Vector(base.x - 32, base.y + 32); stomp_timer.start(STOMP_TIME); + butt_jump = false; // Break bricks beneath Tux @@ -769,10 +776,7 @@ Player::draw(DrawingContext& context) // Draw stomp clouds when doing a butt jump if (stomp_timer.check()) - if (duck) - sprite->stomp->draw(context, Vector(base.x - 32, base.y), LAYER_OBJECTS + 1); - else - sprite->stomp->draw(context, Vector(base.x - 32, base.y + 32), LAYER_OBJECTS + 1); + sprite->stomp->draw(context, stomp_pos, LAYER_OBJECTS + 1); // Draw blinking star overlay if (invincible_timer.started() && diff --git a/src/player.h b/src/player.h index 8c2e342c4..dbf43bbb5 100644 --- a/src/player.h +++ b/src/player.h @@ -153,6 +153,8 @@ public: Timer growing_timer; Timer stomp_timer; Physic physic; + + Vector stomp_pos; public: Player();