Merged back changes from 0.3.x branch
[supertux.git] / src / object / player.cpp
index f995622..8367bd6 100644 (file)
@@ -526,7 +526,7 @@ Player::handle_vertical_input()
   if(controller->pressed(Controller::JUMP) && (can_jump)) {
     if (duck) {
       // when running, only jump a little bit; else do a backflip
-      if (physic.get_velocity_x() != 0) do_jump(-300); else do_backflip();
+      if ((physic.get_velocity_x() != 0) || (controller->hold(Controller::LEFT)) || (controller->hold(Controller::RIGHT))) do_jump(-300); else do_backflip();
     } else {
       // jump a bit higher if we are running; else do a normal jump
       if (fabs(physic.get_velocity_x()) > MAX_WALK_XM) do_jump(-580); else do_jump(-520);
@@ -694,6 +694,12 @@ Player::add_coins(int count)
   player_status->add_coins(count);
 }
 
+int
+Player::get_coins()
+{
+  return player_status->coins;
+}
+
 bool
 Player::add_bonus(const std::string& bonustype)
 {
@@ -808,6 +814,7 @@ Player::draw(DrawingContext& context)
   if (Sector::current() && Sector::current()->camera && (get_bbox().p2.y + 16 < Sector::current()->camera->get_translation().y)) {
     float px = get_pos().x + (get_bbox().p2.x - get_bbox().p1.x - airarrow.get()->get_width()) / 2;
     float py = Sector::current()->camera->get_translation().y;
+    py += std::min(((py - (get_bbox().p2.y + 16)) / 4), 16.0f);
     context.draw_surface(airarrow.get(), Vector(px, py), LAYER_HUD - 1);
   }