#pragma strict
function Start () {
}
var Jumped = false;
var speedScroll = 10;
var JumpUP = 17;
public static var score=0;
function Update () {
transform.forward.x = 0;
transform.forward.y = 0;
transform.forward.z = 0;
if (Input.GetKey ("a")) {
rigidbody.AddForce (Vector3.left *speedScroll);
}
if (Input.GetKey ("d")) {
rigidbody.AddForce (Vector3.right * speedScroll);
}
if(Input.GetKey("space") && !Jumped)
{
rigidbody.velocity += Vector3(0,JumpUP,0);
Jumped = true;
}
}
function OnCollisionEnter(collision : Collision)
{
Jumped=false;
}
function OnGUI () {
GUI.Label ( Rect (10, 50, 100, 20), "Очки "+score);
}