He. I’ve been trying to learn how to script. Anyway, I need some help. I wrote a script to make my character move left and right for a side scroller. It works, but when I hit the buttons I set up to make the player move, he won’t keep moving if I hold the button down. It only moves once per press. Can someone help me with this?
Here is the script that I’m using:
var moveSpeed = 10;
function Update () {
if(Input.GetButtonDown(“a”)){
transform.position.x += moveSpeed * Time.deltaTime;
}
if(Input.GetButtonDown(“d”)){
transform.position.x -= moveSpeed * Time.deltaTime;
}
}