Trouble getting my speeds to match and Axis to Work

I am on #14 in: Learn Unity in C# & Code Your First Five 2D Video Games for Web, Mac & PC. The Tutorials Cover Tilemap

Initially I was able to get the Axis to work with the A/D as well as the right and left arrow keys.
I then also tried to speed it up under my driving speed and something went way wrong.
The driving speed in Unity does not match the driving spped code I entered off unity and when I try to change it in Unity it will not change.

I erases the Axis steps and started over again thinking I did something wrong on the line of code and now I am getting a ton of error messages and I have no idea what happened or how to brainstorm this.

Any help would be appresiated.

Thank you,
Kate




using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class Control : MonoBehaviour

{

[SerializeField] float steerSpeed = 1f;

[SerializeField] float moveSpeed = 0.01f;



// Start is called before the first frame update

void Start()

{

   

}

// Update is called once per frame

void Update()

{

   

    float steerAmount = Input.GetAxis("Horizontal") * steerSpeed;

    float moveAmount = Input.GetAxis("Vertical") * moveSpeed;

    transform.Rotate(0, 0, -steerAmount);

    transform.Translate(0, moveAmount, 0);

}

}

=====
try looking at the code that I have followed in this course. and try to check again in the code that you have created. because there is something wrong in your code. Don’t forget to move it, you can use WASD or arrow direction.

Privacy & Terms