So basically I’m just trying to do a basic command to move the player WASD in a top down arcade setting
Here’s my code. Basically whenever I change from moving x to y or y to x it resets my position to the starting position. Do I need to make it update the players position and how would I do so?
void Update () {
if(Input.GetKey(KeyCode.D)){
transform.position = new Vector3(transform.position.x + (MovementSpeed), transform.position.y, 0);
}
if(Input.GetKey(KeyCode.A)){
transform.position = new Vector3(transform.position.x - (MovementSpeed), transform.position.y + 0, 0);
}
if(Input.GetKey(KeyCode.W)){
transform.position = new Vector3(transform.position.x, transform.position.y + (MovementSpeed), 0);
}
if(Input.GetKey(KeyCode.S)){
transform.position = new Vector3(transform.position.x, transform.position.y - (MovementSpeed), 0);
}
}
}
Thanks for the help
Cheers!