From: LockedLunatic Date: Tue, 28 Jun 2016 00:36:33 +0000 (+0200) Subject: walking animation only plays when walking X-Git-Url: https://git.leopard-lacewing.eu/?a=commitdiff_plain;h=4fe4f8b35d6bb3c10156e3c212aa12b10c0111ee;p=cgue_weave.git walking animation only plays when walking --- 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)