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

Error CS1519 for public float, but public int works (I'm a beginner)

$
0
0
For some reason, public int, public Transform and public LayerMask work, but when I type public float, I get Error CS1519, I am new to this though, so there may be an easy way around this. Here is the script- public class PlayerController : MonoBehaviour { public int moveSpeed; public int jumpHeight; public Transform groundPoint public float radius; public LayerMask groundMask; bool isGrounded; Rigidbody2D rb2D; void Start () { rb2D = GetComponent(); } void Update () { Vector2 moveDir = new Vector2 (Input.GetAxisRaw ("Horizontal") * moveSpeed, rb2D.velocity.y); rb2D.velocity = moveDir; isGrounded = Physics2D.OverlapBox (groundPoint.Position, radius, groundMask); if (Input.GetAxisRaw ("Horizontal") == 1) { transform.localScale = new Vector2 (3, 4); } else if (Input.GetAxisRaw ("Horizontal") == -1) { transform.localScale = new Vector2 (-3, 4); } if(Input.GetKeyDown(KeyCode.Space) && isGrounded){ rb2D.AddForce (new Vector2 (0, jumpHeight)); } } void OnDrawGizmos() { Gizmos.color = Color.green; Gizmos.DrawWireSphere (groundPoint.position, radius); } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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