git repos / saland

commit 96491863

sago007 · 2017-08-24 11:05
9649186381b9b0d918154b95f6c2233dc6350e6f patch · browse files
parent 5c4e0c7122f510cc7b133a42d3ccb7a577f2b340

Player no longer moves while casting

Changed files

M src/saland/Game.cpp before
diff --git a/src/saland/Game.cpp b/src/saland/Game.cpp index 5a668ea..0a4f037 100644 --- a/src/saland/Game.cpp +++ b/src/saland/Game.cpp
@@ -198,7 +198,7 @@ static void SetDesiredVelocity(b2Body* body, float x, float y) {
body->ApplyLinearImpulse( b2Vec2(impulseX, impulseY), body->GetWorldCenter(), true );
}
-static void MoveHumanEntity (Creature *entity, float directionX, float directionY) {
+static void SetCreatureMovementEntity (Creature *entity, float directionX, float directionY) {
float deltaX = directionX;
float deltaY = directionY;
@@ -235,9 +235,11 @@ static void UpdateHuman(Human *entity, float fDeltaTime) {
if (entity->castTimeRemaining < 0) {
entity->castTimeRemaining = 0;
}
- if (entity->castTimeRemaining == 0) {
- MoveHumanEntity(entity, entity->moveX, entity->moveY);
+ if (entity->castTimeRemaining != 0) {
+ entity->moveX = 0.0f;
+ entity->moveY = 0.0f;
}
+ SetCreatureMovementEntity(entity, entity->moveX, entity->moveY);
b2Vec2 place = entity->body->GetPosition();
entity->X = place.x*pixel2unit;
entity->Y = place.y*pixel2unit;