Fix endsequence walking direction
authorTim Goya <tuxdev103@gmail.com>
Mon, 19 Feb 2007 00:22:37 +0000 (00:22 +0000)
committerTim Goya <tuxdev103@gmail.com>
Mon, 19 Feb 2007 00:22:37 +0000 (00:22 +0000)
SVN-Revision: 4865

src/game_session.cpp

index 852d8f0..2abb68c 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "game_session.hpp"
 #include "log.hpp"
+#include "console.hpp"
 #include "worldmap/worldmap.hpp"
 #include "mainloop.hpp"
 #include "audio/sound_manager.hpp"
@@ -586,7 +587,7 @@ GameSession::start_sequence(const std::string& sequencename)
   if (sequencename == "endsequence") {
 
     // Determine walking direction for Tux
-    float xst = 1.f, xend = 2.f;
+    /*float xst = 1.f, xend = 2.f;
     for(std::vector<GameObject*>::iterator i = currentsector->gameobjects.begin(); i != currentsector->gameobjects.end(); i++) {
       SequenceTrigger* st = dynamic_cast<SequenceTrigger*>(*i);
       if(!st)
@@ -601,6 +602,11 @@ GameSession::start_sequence(const std::string& sequencename)
       end_sequence = new EndSequenceWalkLeft();
     } else {
       end_sequence = new EndSequenceWalkRight();
+    }*/
+    if (currentsector->get_players()[0]->physic.get_velocity_x() < 0) {
+      end_sequence = new EndSequenceWalkLeft();
+    } else {
+      end_sequence = new EndSequenceWalkRight();
     }
   }
   else if (sequencename == "fireworks") end_sequence = new EndSequenceFireworks();