Quantcast
Channel: Questions in topic: "left"
Viewing all articles
Browse latest Browse all 135

What are the errors I'm making and how do I fix them

$
0
0
public class Player : MonoBehaviour { private Rigidbody2D myRigidbody; [SerializeField] private float movementSpeed; private bool facingRight; // Start is called before the first frame update void Start() { facingRight = true; myRigidbody = GetComponent(); } // Update is called once per frame void FixedUpdate() { float horizontal = Input.GetAxis("Horizontal"); HandleMovement(horizontal); } private void HandleMovement(float horizontal) { myRigidbody.velocity = new Vector2(horizontal * movementSpeed, myRigidbody.velocity.y); } private void flip(float horizontal); } if (horizontal > 0 && !facingRight || horizontal < 0 && facingRight) facingRight = !facingRight; Vector3 theScale = transform.localScale; theScale.x *= -1; transform.localScale = *theScale*

Viewing all articles
Browse latest Browse all 135

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>