Need Help with Code

It keeps saing Assets\Playermovement.cs(35,63): error CS1003: Syntax error, ‘,’ expected
this is my code sorry that it’s a lot

public class Playermovement : MonoBehaviour {
public float movementSpeed;
public Rigidbody2D rb;

public float JumpForce = 90f;
public Transform feet;
public LayerMask groundLayers;

float mx;

private void Update() {
mx = Input.GetAxisRaw(“Horizontal”);

if (Input.GetButtonDown(“Jump”) && IsGrounded()) {
Jump();
}
}
private void FixedUpdate() {
Vector2 movement = new Vector2(mx * movementSpeed, rb.velocity.y);

rb.velocity = movement;
}

void Jump() {
Vector2 movement = new Vector2(rb.velocity.x, JumpForce);

rb.velocity = movement;
}

public bool IsGrounded() {
Collider2D groundCheck = Physics2D.OverlapCircle(Our Boi.posision, 0.5f, groundLayers);

if (groundCheck != null) {
return true;
}

return false;
}
}

Can you edit your post and repaste your code with code tags? It is difficult to read as is.

1 Like
public class Playermovement : MonoBehaviour {
public float movementSpeed;
public Rigidbody2D rb;

public float JumpForce = 90f;
public Transform feet;
public LayerMask groundLayers;

float mx;

private void Update() {
mx = Input.GetAxisRaw("Horizontal");

if (Input.GetButtonDown("Jump") && IsGrounded()) {
Jump();
}
}
private void FixedUpdate() {
Vector2 movement = new Vector2(mx * movementSpeed, rb.velocity.y);

rb.velocity = movement;
}

void Jump() {
Vector2 movement = new Vector2(rb.velocity.x, JumpForce);

rb.velocity = movement;
}

public bool IsGrounded() {
Collider2D groundCheck = Physics2D.OverlapCircle(Our Boi.posision, 0.5f, groundLayers);

if (groundCheck != null) {
return true;
}

return false;
}
}

yes there you go

So its hard to tell exactly because sometimes that error can mean too many or too little parentheses AND you didnt include the entire script including namespaces so where the error says the line (35,63) i cant see exactly what line. But, my guess is this:

6808052--790028--upload_2021-2-5_17-2-23.png
the Our Boi is probably mistyped and that Space is confusing Unity. If it is a typo, just fix that and hopefully it should work. If that is actually your variable, try renaming it without the space or throw in an _ to fix it. If you change it and there is still the same error, copy and paste the entire code (with namespaces) so the error line # lines up with the code you post. Thank you for editting you post with code tags, it really does help.

Thank you for the help and I did copy and paste the entire thing I don’t have any higher than 39

There is a new error
Assets\Playermovement.cs(35,66): error CS1061: ‘Transform’ does not contain a definition for ‘posision’ and no accessible extension method ‘posision’ accepting a first argument of type ‘Transform’ could be found (are you missing a using directive or an assembly reference?)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Playermovement : MonoBehaviour {
    public float movementSpeed;
    public Rigidbody2D rb;

    public float JumpForce = 90f;
    public Transform Player;
    public LayerMask groundLayers;

    float mx;

    private void Update() {
      mx = Input.GetAxisRaw("Horizontal");

       if (Input.GetButtonDown("Jump") && IsGrounded()) {
           Jump();
       }
       }
      private void FixedUpdate() {
         Vector2 movement = new Vector2(mx * movementSpeed, rb.velocity.y);

         rb.velocity = movement;
      }
     
      void Jump() {
         Vector2 movement = new Vector2(rb.velocity.x, JumpForce);

         rb.velocity = movement;
      }

      public bool IsGrounded() {
         Collider2D groundCheck = Physics2D.OverlapCircle(Player.posision, 0.5f, groundLayers);

         if (groundCheck != null) {
             return true;
         }

         return false;
}
}

This is the full code

You need to spell things correctly. It should be position

oh my goodness I’m so dumb