pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src/worldmap pingus.cxx,1.15,1.16


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/worldmap pingus.cxx,1.15,1.16
Date: 15 Oct 2002 13:58:34 -0000

Update of /usr/local/cvsroot/Games/Pingus/src/worldmap
In directory dark:/tmp/cvs-serv13697

Modified Files:
        pingus.cxx 
Log Message:
fixed speed bug... ugh...

Index: pingus.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/pingus.cxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- pingus.cxx  14 Oct 2002 10:19:31 -0000      1.15
+++ pingus.cxx  15 Oct 2002 13:58:31 -0000      1.16
@@ -63,10 +63,10 @@
 {
   float velocity = 50.0f;
 
-  //std::cout << "Updating Walk: " << edge_path_position << "/" << 
edge_path_length << std::endl;
+  std::cout << "Updating Walk: " << edge_path_position << "/" << 
edge_path_length << std::endl;
   // Update the edge_path_position
   edge_path_position += velocity * delta;
-
+  
   if (edge_path_position > edge_path_length) // target reached
     {
       if (node_path.empty ()) // final target reached
@@ -155,9 +155,9 @@
         {
           float length = distance(*current, *next);
 
+          // The pingu is between current and next
           if (comp_length + length > edge_path_position) 
             {
-              // FIXME: this is incorrect, it causses speed miss match
               float perc = (edge_path_position - comp_length) // length to 
walk from current node
                 / length;
 
@@ -177,7 +177,10 @@
 float
 Pingus::distance(const Vector& a, const Vector& b)
 {
-  return fabsf(sqrt((a.x * b.x) + (a.y * b.y)));
+  float x = b.x - a.x;
+  float y = b.y - a.y;
+  
+  return fabsf(sqrt((x * x) + (y * y)));
 }
 
 Vector





reply via email to

[Prev in Thread] Current Thread [Next in Thread]