X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fplayer.cpp;h=afc4eb5e078232cd59033ee104e21c43118c7809;hb=54769dff40025a2e798d2544df6d745196968f94;hp=82fe8a5f7035a265538ec8b51eb1984067429375;hpb=327e45d47ab5ea89493ac8677ce2209810dafeea;p=supertux.git diff --git a/src/player.cpp b/src/player.cpp index 82fe8a5f7..afc4eb5e0 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -371,7 +371,7 @@ Player::handle_horizontal_input() void Player::handle_vertical_input() { - if(input.up == DOWN) + if(input.up == DOWN && input.old_up == UP) { if (on_ground()) { @@ -410,6 +410,7 @@ Player::handle_input() { handle_vertical_input(); } + input.old_up = input.up; /* Shoot! */ @@ -455,11 +456,25 @@ Player::handle_input() duck = false; base.y -= 32; base.height = 64; - old_base = previous_base = base; + // changing base size confuses collision otherwise + old_base = previous_base = base; } } void +Player::grow() +{ + if(size == BIG) + return; + + size = BIG; + base.height = 64; + base.y -= 32; + + old_base = previous_base = base; +} + +void Player::grabdistros() { /* Grab distros: */ @@ -510,13 +525,13 @@ Player::draw() else sprite = &largetux; - if (duck) + if (duck && size != SMALL) { if (dir == RIGHT) sprite->duck_right->draw(base.x - scroll_x, base.y); else sprite->duck_left->draw(base.x - scroll_x, base.y); - } + } else if (skidding_timer.started()) { if (dir == RIGHT) @@ -596,7 +611,8 @@ Player::collision(void* p_c_object, int c_object) !safe_timer.started() && pbad_c->mode != BadGuy::HELD) { - if (pbad_c->mode == BadGuy::FLAT && input.fire == DOWN) + if (pbad_c->mode == BadGuy::FLAT && input.fire == DOWN + && !holding_something) { holding_something = true; pbad_c->mode = BadGuy::HELD; @@ -630,7 +646,7 @@ Player::collision(void* p_c_object, int c_object) } else { - pbad_c->kill_me(); + pbad_c->kill_me(25); } } player_status.score_multiplier++;