From 4fe4f8b35d6bb3c10156e3c212aa12b10c0111ee Mon Sep 17 00:00:00 2001 From: LockedLunatic Date: Tue, 28 Jun 2016 02:36:33 +0200 Subject: [PATCH] walking animation only plays when walking --- Weave/Scene/Marvin.cpp | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/Weave/Scene/Marvin.cpp b/Weave/Scene/Marvin.cpp index 3414684..43c3088 100644 --- a/Weave/Scene/Marvin.cpp +++ b/Weave/Scene/Marvin.cpp @@ -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) -- 2.47.3