Reworked Thunderstorm scripting
[supertux.git] / src / object / camera.cpp
index 6289b9e..a848d2b 100644 (file)
@@ -281,7 +281,15 @@ Camera::update_scroll_normal(float elapsed_time)
     speed_x = maxv;
   else if(speed_x < -maxv)
     speed_x = -maxv;
+
+  // If player is peeking scroll in that direction. Fast.
+  if( player->peeking_direction() == ::LEFT ){
+        speed_x = maxv;
+  }
+  if( player->peeking_direction() == ::RIGHT ){
+        speed_x = -maxv;
+  }
+  
   // apply scrolling
   translation.x -= speed_x * elapsed_time;
 
@@ -300,7 +308,7 @@ Camera::update_scroll_autoscroll(float elapsed_time)
   if(player->is_dying())
     return;
 
-  translation += autoscroll_walker->advance(elapsed_time);
+  translation = autoscroll_walker->advance(elapsed_time);
 
   keep_in_bounds(translation);
   shake();