September 2010
Beginner
384 pages
8h 49m
English
Just as we did when our falling object hit the ground, we'll use the Instantiate command to make a copy of a Prefab appear in the game world. This time around, when we determine that the player has been hit in the face by a bomb, we'll instantiate the Explosion Prefab on top of his head.
var lastX:float; var isMoving:boolean = false; var explosion:GameObject;
Instantiate command:if(col.gameObject.tag == "bomb")
{
// I got hit by a bomb!
Instantiate(explosion, col.gameObject.transform.position, Quaternion.identity);
}
else if (col.gameObject.tag == "stein") {
Read now
Unlock full access