Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Error cs1525 Unexpected symbol `private'

$
0
0
I'm new to programming please help. Error between 1 - 42 using UnityEngine; public class Controls : MonoBehaviour { public float horizontalSpeed; float speedX; public float verticalImpulse; Rigidbody2D rb; bool isGrounded; void Start () { rb = GetComponent(); } void FixedUpdate () { if (Input.GetKey(KeyCode.A)) { speedX = -horizontalSpeed; } else if (Input.GetKey(KeyCode.D)) { speedX = horizontalSpeed; } if (Input.GetKeyDown(KeyCode.Space) && isGrounded) { rb.AddForce(new Vector2(0, verticalImpulse), ForceMode2D.Impulse); } transform.Translate(speedX, 0, 0); speedX = 0; } private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Ground") isGrounded = true; } private void OnCollisionExit2D(Collision2D collision) { if (collision.gameObject.tag == "Ground") isGrounded = false; private bool faceRight = true; if (moveX > 0 && !faceRight) flip (); else if (moveX < 0 && faceRight) flip (); } void flip () { faceRight = !faceRight; transform.localScale = new Vector3 (transform.localScale.x * -1, transform.localScale.y, transform.localScale.z); } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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