- Home /
Question by
Henrik213 · Apr 26, 2014 at 07:05 PM ·
animationjavascriptcollision
Can someone help me with my script?
I'm a newbie scripter but im trying to make= (If this object hit another object tag "Rock_Mesh" playsound/animation) = (And if this object hit's another object not tag Rock_Mesh play animation)..
Script so far:
var otherObjectTag = "Rock_Mesh";
var Sound : AudioClip;
function Update() {
if(Input.GetMouseButtonDown(0))
animation.Play("Mine");
}
function otherObjectTag(){
if (otherObjectTag);
if (Input.GetMouseButtonDown(0))
audio.clip = Sound;
audio.Play ();
}
Comment
You if(otherObjectTag); statement only checks if it exists. $$anonymous$$ake it equal to the actual name you are looking for. Also remove the ; from the end of it and encase ALL the code you want executed from the if within {}
if(condition)
{
//Do stuff
}
Your answer
Follow this Question
Related Questions
Enemy not getting hit (Collider issue) 2 Answers
Attack animation Wont Play 1 Answer
How could it be done "Cooldown" for a shield ? 2 Answers
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer