This question was
closed Dec 15, 2015 at 03:06 PM by
Banana13 for the following reason:
Question is off-topic or not relevant
Vector2.lerp dashing problem
Im making a 2D platformer game, where the player dashes back and forward. Now I want it that the player dashes randomly up and down or back and forward.
So far I made the player dash back and forward only up and down is missing:
player.transform.position = Vector2.Lerp (enemy.transform.position * 0.9f, enemy.transform.position, 0.5f);
enemy.GetComponent<Enemy> ().sliceeffect();
yield return new WaitForSeconds (0.1f);
player.transform.position = Vector2.Lerp (enemy.transform.position * 1.1f, enemy.transform.position, 0.5f);
enemy.GetComponent<Enemy> ().sliceeffect();
yield return new WaitForSeconds (0.1f);
player.transform.position = Vector2.Lerp (enemy.transform.position * 0.9f, enemy.transform.position, 0.5f);
enemy.GetComponent<Enemy> ().sliceeffect();
yield return new WaitForSeconds (0.1f);
player.transform.position = Vector2.Lerp (enemy.transform.position * 1.1f, enemy.transform.position, 0.5f);
enemy.GetComponent<Enemy> ().sliceeffect();
yield return new WaitForSeconds (0.1f);
player.transform.position = Vector2.Lerp (enemy.transform.position * 0.9f, enemy.transform.position, 0.5f);
enemy.GetComponent<Enemy> ().sliceeffect();
yield return new WaitForSeconds (0.1f);
player.transform.position = Vector2.Lerp (enemy.transform.position * 1.1f, enemy.transform.position, 0.5f);
enemy.GetComponent<Enemy> ().sliceeffect();
yield return new WaitForSeconds (0.1f);
player.transform.position = Vector2.Lerp (enemy.transform.position * 0.9f, enemy.transform.position, 0.5f);
enemy.GetComponent<Enemy> ().sliceeffect();
yield return new WaitForSeconds (0.1f);
Comment