CS0201 with Movement script

I’m pretty new to Unity, and I wanted to make a platformer. I used blackthornprods’s movement script, I get

Blockquote CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement

Can somebody help me? Here’s my code.

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

public class ClickMoveScript : MonoBehaviour{

	public float speed;
	public float jumpForce;
	private float moveInput;

	private Rigidbody2D rb;

	private bool isGrounded;
	public Transform groundCheck;
	public float checkRadius;
	public LayerMask whatIsGround;

	private int extraJumps;
	public int extraJumpsValue;

	void Start(){
		extraJumps = extraJumpsValue;
		rb = GetComponent<Rigidbody2D>();
	}

	void FixedUpdate(){

		isGrounded = Physics2D.OverlapCircle(groundCheck.position, checkRadius,whatIsGround);

		moveInput = Input.GetAxis("Horizontal");
		rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);
	}

	void Update(){

		if (isGrounded == true){
			extraJumps - extraJumpsValue;
		}

		if (Input.GetKeyDown(KeyCode.UpArrow) && extraJumps > 0){
			rb.velocity = Vector2.up * jumpForce;
			extraJumps--;
		} else if (Input.GetKeyDown(KeyCode.UpArrow) && extraJumps == 0 && isGrounded == true){
			rb.velocity = Vector2.up * jumpForce;
		}
	}
}

Hi,

Welcome to our community! :slight_smile:

Please double click on the error message. To which line does it refer? Please share that line here.

This topic was automatically closed after 2 hours. New replies are no longer allowed.

Privacy & Terms