- Home /
Expand object on touch?
Hello. Part of my game needs a script that, when the object specified is touched, will expand the object on the X and Y axis. I made the following script hoping that it would work as I had wished, but unfortunately it doesn't work. I was hoping that posting this on here would let someone help me. But the past couple posts just don't get responses. The game is 2D and for the Android. Even if this seems quite easy to most of you, due to my lack of knowledge with Scripting and Game Creation it isn't for me, so all help is very appreciated.
pragma strict
public var localScale: Vector3;
function Update() {
for (var i = 0; i < Input.touchCount; ++i) {
if (Input.GetTouch(i).phase == TouchPhase.Began)
transform.localScale += new Vector3(0.1F, 0, 0);
}
}
Answer by toddisarockstar · Mar 07, 2015 at 02:54 AM
transform.localScale.x=transform.localScale.x*2;
transform.localScale.y=transform.localScale.y*2;
Thank you so much for responding. This unfortunately makes no difference and it still doesn't expand.
Your answer
Follow this Question
Related Questions
Transform.LocalScale Script Problem. Please help. 2 Answers
Collision On Specific Object= Destroy not working. 2 Answers
Scaling Script? 1 Answer
Transform.localPosition Script Problem. 3 Answers