*/
void set_acceleration(float ax, float ay);
+ void set_acceleration_x(float ax);
+ void set_acceleration_y(float ay);
+
float get_acceleration_x();
float get_acceleration_y();
previous_base = base;
physic.apply(frame_ratio, base.x, base.y);
- if(dying == DYING_NOT) {
+ if(dying == DYING_NOT)
+ {
+ base_type target = base;
+
collision_swept_object_map(&old_base, &base);
+
+ // Don't accelerate Tux if he is running against a wall
+ if (target.x != base.x)
+ {
+ physic.set_velocity_x(0);
+ }
+
// special exception for cases where we're stuck under tiles after
// being ducked. In this case we drift out
if(!duck && on_ground() && old_base.x == base.x && old_base.y == base.y
- && collision_object_map(&base)) {
- base.x += frame_ratio * WALK_SPEED * (dir ? 1 : -1);
- previous_base = old_base = base;
+ && collision_object_map(&base)) {
+ base.x += frame_ratio * WALK_SPEED * (dir ? 1 : -1);
+ previous_base = old_base = base;
}
keep_in_bounds();
- }
+ }
if (dying == DYING_NOT)
{
if (get_current_music() == HERRING_MUSIC && !invincible_timer.check())
{
/*
- no, we are no more invincible
- or we were not in invincible mode
- but are we in hurry ?
- */
+ no, we are no more invincible
+ or we were not in invincible mode
+ but are we in hurry ?
+ */
// FIXME: Move this to gamesession
if (GameSession::current()->time_left.get_left() < TIME_WARNING)
/* yes, we are in hurry
stop the herring_song, prepare to play the correct
fast level_song !
- */
+ */
set_current_music(HURRYUP_MUSIC);
}
else