Tux can peek to the left and to the right as far as the camera would move in best...
[supertux.git] / src / object / player.cpp
index 23aaf33..4aab47f 100644 (file)
@@ -144,6 +144,7 @@ Player::init()
   dead = false;
 
   dying = false;
+  peeking = AUTO;
   last_ground_y = 0;
   fall_mode = ON_GROUND;
   jumping = false;
@@ -614,6 +615,20 @@ Player::handle_input()
       grabbed_object = NULL;
     }
   }
+
+  /* Peeking */
+  if( controller->released( Controller::PEEK_LEFT ) ) {
+    peeking = AUTO;
+  } 
+  if( controller->released( Controller::PEEK_RIGHT ) ) {
+    peeking = AUTO;
+  }
+  if( controller->pressed( Controller::PEEK_LEFT ) ) {
+    peeking = LEFT;
+  } 
+  if( controller->pressed( Controller::PEEK_RIGHT ) ) {
+    peeking = RIGHT;
+  }
  
   /* Handle horizontal movement: */
   if (!backflipping) handle_horizontal_input();