void MovePlayer() { if (Values.started) { if (Input.GetKey(KeyCode.LeftArrow)) { Vector3 pos = transform.position; transform.position = new Vector3(Mathf.Clamp(pos.x - Values.playerSpeed, -12.5f, 12.5f), pos.y, pos.z); } else if (Input.GetKey(KeyCode.RightArrow)) { Vector3 pos = transform.position; transform.position = new Vector3(Mathf.Clamp(pos.x + Values.playerSpeed, -12.5f, 12.5f), pos.y, pos.z); } } else { if (Input.GetKey(KeyCode.LeftArrow)) { ball.PlayerStart(false); } else if (Input.GetKey(KeyCode.RightArrow)) { ball.PlayerStart(true); } } }
void MovePlayer() { if (!Values.started && Input.GetKey(KeyCode.Return)) { ball.PlayerStart(Values.queue); Values.started = true; } if (player) { if (Input.GetKey(KeyCode.UpArrow)) { Vector3 pos = transform.position; transform.position = new Vector3(pos.x, Mathf.Clamp(pos.y + Values.playerSpeed, -8.5f, 8.5f), pos.z); } else if (Input.GetKey(KeyCode.DownArrow)) { Vector3 pos = transform.position; transform.position = new Vector3(pos.x, Mathf.Clamp(pos.y - Values.playerSpeed, -8.5f, 8.5f), pos.z); } } else { if (Input.GetKey(KeyCode.W)) { Vector3 pos = transform.position; transform.position = new Vector3(pos.x, Mathf.Clamp(pos.y + Values.playerSpeed, -8.5f, 8.5f), pos.z); } else if (Input.GetKey(KeyCode.S)) { Vector3 pos = transform.position; transform.position = new Vector3(pos.x, Mathf.Clamp(pos.y - Values.playerSpeed, -8.5f, 8.5f), pos.z); } } }