I need help with this error i have been having error CS0131: The left-hand side of an assignment must be a variable, property or indexer(line: 59)i’ve searched on google couldn’t find an answer. What am i doing wrong?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float speed;
public float jumpForce;
private float moveInput;
private Rigidbody2D rb;
private bool facingRight = true;
private bool isGrounded;
public Transform groundCheck;
public float checkRadius;
public LayerMask whatIsGround;
private int extraJumps;
public int extraJumpsValue = 1;
// Start is called before the first frame update
void Start()
{
extraJumps = extraJumpsValue;
rb = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void FixedUpdate()
{
isGrounded = Physics2D.OverlapCircle(groundCheck.position, checkRadius, whatIsGround);
moveInput = Input.GetAxisRaw("Horizontal");
Debug.Log(moveInput);
rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);
if(facingRight == false && moveInput > 0 ){
Flip();
}else if(facingRight == true && moveInput < 0){
Flip();
}
}
void Update(){
if(isGrounded == true){
extraJumps = extraJumpsValue;
}
if(Input.GetKeyDown(KeyCode.Space) && extraJumps > 0){
extraJumps--;
rb.velocity = Vector2.up * jumpForce;
}
else if(Input.GetKeyDown(KeyCode.Space) && extraJumps == 0 && isGrounded = true){
rb.velocity = Vector2.up * jumpForce;
}
}
void Flip(){
facingRight = !facingRight;
Vector3 Scaler = transform.localScale;
Scaler.x *= -1;
transform.localScale = Scaler;
}
}