Commit 06d1a132 authored by Jordan B Mckenney's avatar Jordan B Mckenney
Browse files

Merge branch 'walk' of git.gmu.edu:gadig/Birb into walk

parents 1a6a7e32 a08f69c1
...@@ -7,9 +7,11 @@ public class Walk : AbstractBehavior { ...@@ -7,9 +7,11 @@ public class Walk : AbstractBehavior {
private float airSpeed; private float airSpeed;
public float airAcceleration; public float airAcceleration;
private float xScale;
// Use this for initialization // Use this for initialization
void Start() { void Start() {
xScale = body.transform.localScale.x;
} }
// Update is called once per frame // Update is called once per frame
...@@ -50,5 +52,19 @@ public class Walk : AbstractBehavior { ...@@ -50,5 +52,19 @@ public class Walk : AbstractBehavior {
} }
body.velocity = new Vector2(airSpeed, body.velocity.y); body.velocity = new Vector2(airSpeed, body.velocity.y);
} }
//change localScale depending on direction
if (inputState.GetButtonValue (right) && inputState.GetButtonValue (left))
{
} else if (inputState.GetButtonValue (right))
{
inputState.direction = Directions.Right;
body.transform.localScale = new Vector3 (xScale, body.transform.localScale.y, body.transform.localScale.z);
} else if (inputState.GetButtonValue (left))
{
inputState.direction = Directions.Left;
body.transform.localScale = new Vector3 (-xScale, body.transform.localScale.y, body.transform.localScale.z);
}
} }
} }
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