Help getting player killed when enemy collides with him

I need help getting the player to automatically die when the enemy collides with him. How can I do this?

OnCollisionEnter.

Then, the dying part is up to you, but probably :

Application.LoadLevel();
Time.timeScale = 0;
Destroy( gameObject);

etc …

I am assuming that you have colliders set up on both your character and your enemy for this.

normally what you should do is check if a collision occured between your player and the enemy, after that, check the tag of the object that collided with your player. if it matches the tag ‘enemy’ for example, then you would proceed to go on with the logic that kills your player (I’m not sure what it is your looking for with the actual death sequence, so more info on that would better refine this answer).

in code it would look something like this (write this code somewhere in your main script, probably the player script or manager script or something):

//im using c# for this implementation, but there should be a javascript equivalent


//you will check for a collision that enters your player object, with a reference to the collision itself as the parameter

void OnCollisionEnter(Collision c)
	{
                //here we check for the collider involved in the collision, and check its tag  
                //if it matches enemy, proceed with the logic

		if(c.collider.tag == "enemy")
		{
                       //here you would proceed with the death sequence, since i dont know what it is, i made a template with a debug statement
			Debug.Log("the player has died");
		}
	}

hope that helps! let me know if you have any further questions at gamenovice@gmail.com!