So I need a script for my game i’ve been working on, progress has been pretty good. To be honest its one of my most worked on projects yet. Its just i’ve run into a couple problems before and this one is causing me to draw a blank any help???.
The object I want to pick up is called “rupee animated” and the name of my gui is called “rupee text beta”.
I just want a script where if you walk into a game object it destroys itself (disappears) plays a sound and then adds itself to the gui. any help???
here is something I have so far
function OnCollisionEnter(collision : Collision) {
if (collision.gameObject.name == “rupee animated”){ // if the hit object’s name is rupee animated…
Destroy(gameObject); // destroy it
}
}
var Get_Rupee : AudioClip; // set this to your sound in the inspector
function OnCollisionEnter (collision : Collision) {
// next line requires an AudioSource component on this gameobject
audio.PlayOneShot(Get_Rupee);
these links should help http://www.youtube.com/watch?v=cKJiSsqZCJM&list=PL27B696FB515608D2 http://www.youtube.com/watch?v=hbjB80-Mc7E&list=PL27B696FB515608D2 http://www.youtube.com/watch?v=btMdGy3hBw4&list=PL27B696FB515608D2 http://www.youtube.com/watch?v=I6fkQQSWwNs&list=PL27B696FB515608D2
– NAKAS