* Add Airship (regular above-ground theme) and Battle (castle/boss theme) music court...
[supertux.git] / src / object / path_walker.hpp
index 44d947a..cc15320 100644 (file)
 #define __PATH_WALKER_HPP__
 
 #include "path.hpp"
-#include "math/vector.hpp"
-#include "game_object.hpp"
-#include "lisp/lisp.hpp"
-#include "serializable.hpp"
 
 /**
  * A walker that travels along a path
 class PathWalker
 {
 public:
-  PathWalker(const Path* path);
+  PathWalker(const Path* path, bool running = true);
   virtual ~PathWalker();
 
   /**
-   * advanves the path walker on the path and returns the position delta
+   * advances the path walker on the path and returns the position delta
    * to the last position
    */
   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();
-  
-  const Path* path;
+
+  /**
+   * 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