this is my pick up item script. i pick up candy.
wait, there’s more.
#pragma strict
private var score : int = 0;
var guiScore : GUIText;
function Start () {
guiScore.text = "Sweets: 0";
}
function OnCollisionEnter(col : Collision){
if(col.collider.name == "Candy"){
Destroy(col.gameObject);
score += 10;
guiScore.text = "Sweets: " + score;
print("collide with Candy");
}
}
i have a character that spits chewed candy.
the thing is… he can spit an unlimited amount of candy as of now.
i wanted him to have to pick up the candy before he spit it out… much like ammo…or…exactly like ammo.
is there a way to disable the shoot function until he eats at least one candy? one candy will give him 10 ammo? my script above works well and displays a gui that indicates the amount picked up. now if only i could have that number decrease by one as he spits.
i know it sounds crazy. i dont know where to start… otherwise i would be fixing this problem instead of desperation typing on a message board. any ideas? any at all? i am stumped. if you need my bullet code or spawn code let me know. all of them work perfectly. this little thing would give the collecting of candy much needed importance!
thanks again. -matt