Question by
asdfghjkla4fnhrnhjtfnfk · Nov 06, 2016 at 11:32 AM ·
errorerror messageerrormessage
Error CS1519 for public float, but public int works (I'm a beginner)
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<Rigidbody2D>();
}
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);
}
}
Comment
Answer by asdfghjkla4fnhrnhjtfnfk · Nov 06, 2016 at 11:34 AM
NEVER MIND I WAS MISSING A ";" AT THE END OF LINE 6
Your answer
Follow this Question
Related Questions
Build error Execution failed for task ':packageReleaseBundle'. 0 Answers
Help Troubleshooting: "Cannot generate 9 slice most likely because the size is too big." 2 Answers
Parsing error- Please help! 0 Answers
Error, host set to 1 Answer
D3DCOMPILER_47.dll is missing even tho i installed DirectX and the file is in System32 1 Answer