The Adventures of Tokk Project Report Raphael Leon 31 may 2014 | Página 8

that if you collide with an object named baddie health will decrease and eventually cause you to die.*/ function OnCollisionEnter(collision : Collision) { if(collision.transform.name=="badie") { Application.LoadLevel ("001_george cave test_02");} } // this causes a half second delay for the death animation function timer() { var thing =false; yield WaitForSeconds(0.5); thing =true; } This is used so that when the character collides with an enemy, health will deteriorate until the character dies. This causes the game to restart and loads the first level. As the leader of the group and as head of game mechanics, I was in charge of assembling all the assets into Unity3D as well as coding the game. This has hopefully explained and broken down the more complicated script in the game. By organising regular meetings and implementing new assets as we went along, we were able to see the game grow and develop. The scripts were constantly edited throughout the game’s development. The script above was attached to a pill shape this and it this pill that controls movement. The character was parented to this pill the character itself has a script that corresponds to the movement but is in control of the animations. #pragma strict var speed: float; function Start () { animation.Play("idle"); } function Update () { if (Input.GetKey("d")) { //turns the character around transform.eulerAngles = Vector3(0, 290, 0); //this is the code start for an animation if (animation.isPlaying) animation.CrossFade("walk"); else animation.Play("walk"); } else if (Input.GetKeyUp("d")) { animation.CrossFade("idle", 1); } //this is the code start for an animation 8|Page