This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void OnCollisionEnter2D (Collision2D collision) { | |
Vector2 xtweak = new Vector2 (Random.Range (-ballKick,ballKick),0f); | |
Vector2 ytweak = new Vector2 (0f,Random.Range (2f,ballKick)); | |
if (hasStarted) { | |
if(GetComponent<Rigidbody2D>().velocity.x >= -bounceTolerance && GetComponent<Rigidbody2D>().velocity.x <= bounceTolerance){ | |
print ("Engage X kick!"); | |
GetComponent<Rigidbody2D>().velocity += xtweak; | |
} else if (GetComponent<Rigidbody2D>().velocity.y >= 0 && GetComponent<Rigidbody2D>().velocity.y <= bounceTolerance){ | |
print ("Engage Y kick!"); |