var projectile :Transform;
var soketprojectile :Transform;
static var liveplayer :int =5;
var kecepatan : float = 10.0;
function Update () {
var kirikanan : float = Input.GetAxis ("Horizontal") * kecepatan;
var majumundur : float = Input.GetAxis ("Vertical") * kecepatan;
kirikanan *=Time.deltaTime;
majumundur *=Time.deltaTime;
transform.Translate ( kirikanan,0,0);
transform.Translate ( 0,majumundur,0);
transform.position.x=Mathf.Clamp(transform.position.x,-11,11);
transform.position.y=Mathf.Clamp(transform.position.y,-8,8);
if (Input.GetButtonDown("Jump"))
{
Instantiate(projectile,soketprojectile.position,soketprojectile.rotation);
}
if (liveplayer<=0)
{
Application.LoadLevel("Kalah");
}
}
function OnTriggerEnter (other :Collider)
{
if (other. gameObject.tag=="Enemy")
{
nyawaplayer();
}
}
function nyawaplayer()
{
liveplayer-=1;
}
function OnGUI()
{
GUI.Label(Rect(250,30,100,20),"NYAWA :" + liveplayer);
}
Tidak ada komentar:
Posting Komentar