]> git.leopard-lacewing.eu Git - cgue_weave.git/commitdiff
walking animation only plays when walking
authorLockedLunatic <locked.lunatic@aon.at>
Tue, 28 Jun 2016 00:36:33 +0000 (02:36 +0200)
committerLockedLunatic <locked.lunatic@aon.at>
Tue, 28 Jun 2016 00:36:33 +0000 (02:36 +0200)
Weave/Scene/Marvin.cpp

index 3414684403e5f738a82591d94515d05707e6d23f..43c308838484b93ead00e1bcd149f6fa0daf28ad 100644 (file)
@@ -40,8 +40,12 @@ void Marvin::update(float deltaT)
        if (movable)
        {
                //Jump
-               if (Events::getJump() && abs(yFloorDist)<.5)
+               if (Events::getJump() && abs(yFloorDist) < .5)
+               {
                        ySpeed = 5.5;
+                       //startanimation(1, 1);
+                       //setAnimationLoop(false);
+               }
 
                int move_x = Events::getMoveX();
                int move_y = Events::getMoveY();
@@ -66,24 +70,31 @@ void Marvin::update(float deltaT)
                }
 
                //MOVE Animation
-               if (move_y > 0)
+               if (abs(yFloorDist) < .5)
                {
-                       if (animationSpeed <= 0)
+                       if (move_y > 0)
                        {
-                               startanimation(0, 1);
+                               if (animationSpeed <= 0)
+                               {
+                                       startanimation(0, 1);
+                                       setAnimationLoop(true);
+                               }
                        }
-               }
-               else if (move_y < 0)
-               {
-                       if (animationSpeed >= 0)
+                       else if (move_y < 0)
                        {
-                               startanimation(0, -1);
+                               if (animationSpeed >= 0)
+                               {
+                                       startanimation(0, -1);
+                                       setAnimationLoop(true);
+                               }
+                       }
+                       else
+                       {
+                               startanimation(0, 0);
+                               setAnimationLoop(true);
                        }
                }
-               else
-               {
-                       startanimation(0, 0);
-               }
+               
 
                //Rotate Player in move direction
                if (move_x || move_y)