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);
player_status->add_coins(count);
}
+int
+Player::get_coins()
+{
+ return player_status->coins;
+}
+
bool
Player::add_bonus(const std::string& bonustype)
{
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);
}