Tuesday, October 26, 2010

Week 3: Programming

function OnTriggerEnter(other: Collider)
{
if(other.gameObject.tag == "player_weapon")
{
print("hit");
SendMessageUpwards ("Assasination");

}
}

This code is on a collider behind the enemy and when you sneak up behind him and attack him he will die in one hit. A problem that I am having is that the sword object is always active. So even without hitting the attack button it will kill then enemy. One way to solve this problem is im am going to change the name of the collider for the sword and only change it when the attack button is pressed and then change it back in a couple of seconds.

No comments:

Post a Comment