/** maximum run velocity (pixel/s) */
static const float MAX_RUN_XM = 320;
/** maximum horizontal climb velocity */
-static const float MAX_CLIMB_XM = 48;
+static const float MAX_CLIMB_XM = 96;
/** maximum vertical climb velocity */
static const float MAX_CLIMB_YM = 128;
/** instant velocity when tux starts to walk */
// check if we landed
if(on_ground()) {
jumping = false;
- if (backflipping && (!backflip_timer.started())) {
+ if (backflipping && (backflip_timer.get_timegone() > 0.15f)) {
backflipping = false;
backflip_direction = 0;
if (sprite->animation_done()) growing = false;
}
+ // when climbing animate only while moving
+ if(climbing){
+ if((physic.get_velocity_x()==0)&&(physic.get_velocity_y()==0))
+ sprite->stop_animation();
+ else
+ sprite->set_animation_loops(-1);
+ }
+
}
bool
backflipping = true;
do_jump(-580);
sound_manager->play("sounds/flip.wav");
- backflip_timer.start(0.15f);
+ backflip_timer.start(TUX_BACKFLIP_TIME);
}
void
dest.p1.x = bbox.get_right() + 1;
dest.p2.x = dest.p1.x + grabbed_bbox.get_width();
}
- if(Sector::current()->is_free_of_movingstatics(dest)) {
+ if(Sector::current()->is_free_of_tiles(dest, true)) {
moving_object->set_pos(dest.p1);
if(controller->hold(Controller::UP)) {
grabbed_object->ungrab(*this, UP);
log_debug << "Non MovingObject grabbed?!?" << std::endl;
}
}
+
+ /* stop backflipping at will */
+ if( backflipping && ( !controller->hold(Controller::JUMP) && !backflip_timer.started()) ){
+ backflipping = false;
+ backflip_direction = 0;
+ }
}
void
{
if((player_status->bonus == NO_BONUS) && (type != NO_BONUS)) {
if (!adjust_height(BIG_TUX_HEIGHT)) {
- printf("can't adjust\n");
+ log_debug << "Can't adjust Tux height" << std::endl;
return false;
}
if(animate) {
return;
}
+ if (player_status->coins >= 25 && !GameSession::current()->get_reset_point_sectorname().empty())
+ {
+ for (int i = 0; i < 5; i++)
+ {
+ // the numbers: starting x, starting y, velocity y
+ Sector::current()->add_object(new FallingCoin(get_pos() +
+ Vector(graphicsRandom.rand(5), graphicsRandom.rand(-32,18)),
+ graphicsRandom.rand(-100,100)));
+ }
+ player_status->coins -= std::max(player_status->coins/10, 25);
+ }
+ else
+ {
+ GameSession::current()->set_reset_point("", Vector());
+ }
physic.enable_gravity(true);
physic.set_gravity_modifier(1.0f); // Undo jump_early_apex
safe_timer.stop();
void
Player::start_climbing(Climbable& climbable)
{
- if (climbing == &climbable) return;
+ if (climbing || !&climbable) return;
climbing = &climbable;
physic.enable_gravity(false);
physic.set_velocity(0, 0);
physic.set_acceleration(0, 0);
+ if (backflipping) {
+ backflipping = false;
+ backflip_direction = 0;
+ }
}
void