- added quick&dirty peeking back (not exactly perfect, but better then no peeking)
[supertux.git] / src / object / path_walker.hpp
index 9f237ef..829eca1 100644 (file)
@@ -32,7 +32,7 @@
 class PathWalker
 {
 public:
-  PathWalker(const Path* path);
+  PathWalker(const Path* path, bool running = true);
   virtual ~PathWalker();
 
   /**
@@ -41,16 +41,38 @@ public:
    */
   virtual Vector advance(float elapsed_time);
 
+  /** advance until at given node, then stop */
+  void goto_node(int node_no);
+
+  /** start advancing automatically */
+  void start_moving();
+
+  /** stop advancing automatically */
+  void stop_moving();
+
+  /** returns true if PathWalker is currently moving */
+  bool is_moving() {
+    return running;
+  }
+  
   const Path* path;
 
 private:
   void advance_node();
   void goback_node();
-  
+
+  /**
+   * set to false to immediately stop advancing
+   */
+  bool running;
+
   size_t current_node_nr;
   size_t next_node_nr;
 
-  Vector last_pos;
+  /**
+   * stop advancing automatically when this node is reached
+   */
+  int stop_at_node_nr;
 
   /**
    * the position between the current node and the next node as fraction