mode = SCROLLTO;
}
-static const float EPSILON = .00001;
+static const float EPSILON = .00001f;
static const float max_speed_y = 140;
void
translation.y = height - SCREEN_HEIGHT;
if(translation.y < 0)
translation.y = 0;
+ if (height < SCREEN_HEIGHT)
+ translation.y = height/2.0 - SCREEN_HEIGHT/2.0;
if(translation.x > width - SCREEN_WIDTH)
translation.x = width - SCREEN_WIDTH;
if(translation.x < 0)
translation.x = 0;
+ if (width < SCREEN_WIDTH)
+ translation.x = width/2.0 - SCREEN_WIDTH/2.0;
}
void
// when suddenly changing directions while scrolling into the other direction.
// abort scrolling, since tux might be going left/right at a relatively small
// part of the map (like when jumping upwards)
-
- // Find out direction in which the player walks: We want to try and show a
+
+ // Find out direction in which the player walks: We want to try and show a
// bit more of what's in front of the player and less of what's behind
- LeftRightScrollChange walkDirection;
+ LeftRightScrollChange walkDirection;
if (player->physic.get_velocity_x() < -EPSILON) walkDirection = LEFT;
else if (player->physic.get_velocity_x() > EPSILON) walkDirection = RIGHT;
else if (player->dir == ::LEFT) walkDirection = LEFT;