Movement of player

So i got a problem with player movement
below is the javascript to moveplayer but it wont’t move i only set the left for test …
**

[quote]**
#pragma strict

var left : int = -10;
var right : int = 10;
var Player : GameObject;
Player = GameObject.Find(“purplebus”);

function Start () {

if (Input.GetKeyDown(KeyCode.LeftArrow))
{

Player.transform.position = Vector3(1,0,0);
};

};
**[/quote]
**

The “Start” method is only called once, when the object is about to be shown the first time. If you want to check for keyboard input, you want to have the check inside an “Update” method instead.

wait wait it can only be from 0 to … i want it less then 0 i mean 0.1,0.2 etc

i forgot it uses float instead of int

Also what you did would only put you at a exact position, you would need to use += so it adds your vector to the current position. It will also be a good idea to multiply that by Time. deltaTime as well so the movment is smooth and not effected by the frame rate.

my code is this and working correctly

#pragma strict

    var Player : GameObject;
    Player = GameObject.Find("Car");
   
function Start () {

}

function Update () {
   
    if (Input.GetKey(KeyCode.RightArrow))
        {
            Player.transform.Translate(0.5,0,0);
     };
     if (Input.GetKey(KeyCode.LeftArrow))
        {
            Player.transform.Translate(-0.5,0,0);
     };
     if (Input.GetKey(KeyCode.UpArrow))
        {
            Player.transform.Translate(0,0,0.5);
     };
     if (Input.GetKey(KeyCode.DownArrow))
        {
            Player.transform.Translate(0,0,-0.5);
     };
}