2d Space Shooter Movement Problems

I am currently making a 2d space shooter, similar to “Asteroids” and I’m having difficulty getting the ship to rotate when I press the A and D keys. I’m going off of an old tutorial that is likely outdated.

. The code by the end of the video was:
using System.Collections;
using UnityEngine;

public class PlayerController : MonoBehaviour {

float maxSpeed = 5f
float rotSpeed = 180f

void Start() {

}
// Update is called once per frame
void Update () {

Quaternion rot = transform.rotation;

float z = rot.eulerAngles.z;

z -= Input.GetAxis(“Horizontal”) * rotSpeed * Time.deltaTime;

rot = Quaternion.Euler( 0, 0, z );

transform.rotation = rot();

Vector3 pos = transform.position;

pos.y += Input.GetAxis(“Vertical”) * maxSpeed * Time.deltaTime;

transform.position = pos;

}
}

If somebody can explain how to change this, or at least why this code doesn’t work, that would be amazing. Thanks.

Please use Code Tags when pasting code.

In that code you pasted, your two Speed fields don’t have semicolons at the end.

In the Update function, you have “rot()” which should just be “rot”, because it’s a value not a method.

You can probably accomplish the same thing like this (untested):

private void Update() {
    float eulerDeltaZ = Input.GetAxis("Horizontal") * rotSpeed * Time.deltaTime;
    transform.Rotate(0, 0, eulerDeltaZ);

    float positionDeltaY = Input.GetAxis("Vertical") * maxSpeed * Time.deltaTime;
    transform.Translate(0f, positionDeltaY, 0f);
}