void Movement() { float inputV = Input.GetAxis("Vertical"); // -1 == S || DownArrow // 0 == Not Pressed // 1 == W || UpArrow float inputH = Input.GetAxis("Horizontal"); // -1 == A || LeftArrow // 0 == Not Pressed // 1 == D || RightArrow if (inputV > 0) { movement.Accelerate(transform.up); } if (inputH < 0) { movement.RotateLeft(); } if (inputH > 0) { movement.RotateRight(); } if (Input.GetKey(KeyCode.S)) { movement.Stop(); } }
void Movement() { float inputV = Input.GetAxis("Vertical"); float inputH = Input.GetAxis("Horizontal"); // Check if up arrow is pressed if (inputV > 0) { // Accelerate player movement.Accelerate(transform.up); } // Rotate depending on what inputH direction is //movement.Rotate(inputH); // if right arrow is pressed if (Input.GetKey(KeyCode.RightArrow)) { movement.RotateRight(); } // rotate right // if left arrow is pressed if (Input.GetKey(KeyCode.LeftArrow)) { movement.RotateLeft(); } // rotate left }
// Handles Moving Functionality void Movement() { float inputV = Input.GetAxis("Vertical"); float inputH = Input.GetAxis("Horizontal"); // Check if up arrow is pressed if (inputV > 0) { // Accelerate player movement.Accelerate(transform.up); } // Check if horizontal axis (left or right arrow) is pressed // Rotate in correct direction movement.Rotate(inputH); // If right arrow is pressed if (Input.GetKey(KeyCode.RightArrow)) { movement.RotateRight(); } // Rotate right // If left arrow is pressed if (Input.GetKey(KeyCode.LeftArrow)) { movement.RotateLeft(); } //Rotate left #endregion }
// Update is called once per frame void Update() { float inputV = Input.GetAxisRaw("Vertical"); float inputH = Input.GetAxisRaw("Horizontal"); if (inputV > 0) { movement.Accelerate(transform.up); } if (inputH < 0) { movement.RotateLeft(); } if (inputH > 0) { movement.RotateRight(); } }
void Movement() { float inputV = Input.GetAxis("Vertical"); float inputH = Input.GetAxis("Horizontal"); // -1 == A || LeftArrow // 0 == Not being pressed // 1 == D || RightArrow if (inputV > 0) { movement.Accelerate(transform.up); } if (inputH < 0) { movement.RotateLeft(); } if (inputH > 0) { movement.RotateRight(); } #endregion }
void Movememnt() { float inputV = Input.GetAxis("Vertical"); float inputH = Input.GetAxis("Horizontal"); // Check if up arrow is pressed if (inputV > 0) { // Accelerate player movement.Accelerate(transform.up); } // Rotate in correct direction //movement.Rotate(inputH); if (inputH > 0) { movement.RotateLeft(); } if (inputH < 0) { movement.RotateRight(); } }
// Update is called once per frame void Movement() { float inputH = Input.GetAxis("Horizontal"); // linear interpolation; // -1 == A || LeftArrow // 0 == Not pressed // 1 == D || RightArrow float inputV = Input.GetAxis("Vertical"); // More linear interpolation; // -1 == S || DownArrow // 0 == Nothing pressed // 1 == W || UpArrow if (inputV > 0) { movement.Accelerate(transform.up); } if (inputV < 0) { movement.Accelerate(-transform.up); } if (Input.GetKey(KeyCode.A)) { movement.RotateRight(); } if (Input.GetKey(KeyCode.D)) { movement.RotateLeft(); } }