Hi, everyone! I am very new to Unity, even more so to coding in JavaScript and am having some issues. My group and I are trying to make a game where you play as a 2D Snowball that rolls down a hill, growing as it collides with the snowy ground. We have it set to where the snowball grows, but now it wont stop growing!
This is the code we have so far:
#pragma strict
function OnCollisionStay2D(other : Collision2D) {
if(other.gameObject.tag == “Ground”) {
transform.localScale += Vector3 (0.01, 0.01, 0.01)
}
}
We were looking into seeing if we could constrain the Transform so that once it reaches a certain size, it stops growing, but we havn’t had any luck there.
Thank you for your help in advance, I may add more as the project continues.
Thanks XD