Commit e646a165 by Philipp Adolf

Make dash animation adjust to dash direction

parent dbd944a9
...@@ -106,6 +106,7 @@ public class PlayerControl : MonoBehaviour ...@@ -106,6 +106,7 @@ public class PlayerControl : MonoBehaviour
hasLandedSinceLastDash = false; hasLandedSinceLastDash = false;
//dash effect: //dash effect:
dashAnimator.transform.rotation = Quaternion.FromToRotation(Vector2.right, (Vector2) currentDashDirection);
dashAnimator.SetTrigger("play"); dashAnimator.SetTrigger("play");
} }
...@@ -124,15 +125,10 @@ public class PlayerControl : MonoBehaviour ...@@ -124,15 +125,10 @@ public class PlayerControl : MonoBehaviour
velocity = body2D.velocity; velocity = body2D.velocity;
if (inputMapping.isRightPressed()) if (inputMapping.isRightPressed())
{ {
if (transform.localScale.x > 0f)
transform.localScale = new Vector3(-transform.localScale.x, transform.localScale.y, transform.localScale.z);
velocity.x = runSpeed; velocity.x = runSpeed;
} }
else if (inputMapping.isLeftPressed()) else if (inputMapping.isLeftPressed())
{ {
if (transform.localScale.x < 0f)
transform.localScale = new Vector3(-transform.localScale.x, transform.localScale.y, transform.localScale.z);
velocity.x = -runSpeed; velocity.x = -runSpeed;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment