Cant move left or right. Only forward?

This is really strange, I am very very new to programming so be patient and bear with me please.

As the title says I can only move my character forward or back and not sideways, the funny thing about this is that I don’t want him to move forward or back I want only side ways.

It is the basic 2d space shooter you would expect.

I have tried two sets of code, first is below:

`var speed : float = 3; var projectile_prefab: GameObject;

function Update () { var translationX : float = Input.GetAxis (“Horizontal”) * speed;

var translationZ : float = Input.GetAxis (“Horizontal”) * speed;

translationX = Time.deltaTime; translationZ = Time.deltaTime; transform.Translate (translationX, 0, translationZ);

if(Input.GetKeyDown(“space”)) Instantiate(projectile_prefab); }`

The other set of code I tried was:

`var moveSpeed = 1.0; var turnSpeed = 1.0;

function Update() { /* if(Input.GetButtonDown(“Jump”)) { transform.position.z += 1.0; } */

if(Input.GetButton(“Forward”))
{
transform.position += transform.forward * moveSpeed * Time.deltaTime;
}
if(Input.GetButton(“Backward”))
{
transform.position += -transform.forward * moveSpeed * Time.deltaTime;
}
if(Input.GetButton(“Left”))
{
transform.eulerAngles.y += -turnSpeed * Time.deltaTime;
}
if(Input.GetButton(“Right”))
{
transform.eulerAngles.y += turnSpeed * Time.deltaTime;
}
}

if(Input.GetKeyDown(“space”)) Instantiate(projectile_prefab);

}`

I cant understand why either of these don’t work. Any help is greatly appreciated.

Hi

I haven’t got much time :
have you try rotate → Unity - Scripting API: Transform.Rotate

it’s not recommended to increment it :From the doc → Transform.eulerAngles " Only use this variable to read and set the angles to absolute values. Don’t increment them, as it will fail when the angle exceeds 360 degrees. Use Transform.Rotate instead. "