Here’s my script. Im not sure what exactly I would need to write for there to a be change to the movement speed when I hold down left shift. hoping someone could point me in the right direction. thanks!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WSv3 : MonoBehaviour
{
public Rigidbody rb;
public float jumpForce;
float speed = 5.0f;
// Start is called before the first frame update
void Start()
{
speed = 50f;
}
// Update is called once per frame
void Update()
{
if (Input.GetKey(KeyCode.W))
{
transform.Translate(Vector3.forward * Time.deltaTime * speed);
}
if (Input.GetKey(KeyCode.S))
{
transform.Translate(-1 * Vector3.forward * Time.deltaTime * speed);
}
if (Input.GetKeyDown("left shift"))
{
//need to speed up the 50f to 100f(?) to give the player a boost when
//the sprint animation starts, also from the left shift being held down.
}
}
}