- Home /
How do I get this to work?
This is my script
function OnTriggerEnter2D (other : Collider2D)
{
if(gameObject.tag == "SuperSpeed");
{
Destroy(GameObject.Find("SuperSpeed"));
Speed = Speed + 8;
}
}
I want it so that when I touch the power up it will give me more speed, but the problem is when I touch my other power up (Which I have not scripted yet) it also gives me more speed and I don't want this to happen, the script is on my player and I am using 'Is trigger' on the box collier. This is a 2D game and can all answers be in javascript please. Thank You!!!
Thanks very much $$anonymous$$rSoad my script now works and I am starting on shooting
Answer by MrSoad · Dec 03, 2014 at 07:09 PM
You have a ";" in the wrong place on line 3, and a couple of other things that don't look right. Try this :
function OnTriggerEnter2D (other : Collider2D) {
if (other.gameObject.tag == "SuperSpeed") {
Destroy(other.gameObject);
Speed = Speed + 8;
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613173115im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
UnityEngine.Input.GetMouseButton(1)) issue 1 Answer
I made a better shader how do i fix[add _Shadow Strength]help???>Sorry that im asking for to much 1 Answer
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers
Call StartCoroutine() from inside a function other than Start!? 2 Answers