Please help have been looking for a while and cant seem to find a fix
This is the error: Assets/Robotcontroller1.cs(44,9): error CS1501: No overload for method SetFloat' takes
1’ arguments
This is my script any help would be much appreciated
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Robotcontroller1 : MonoBehaviour
{
//how fast the robot can move
public float topspeed = 10f;
//tell the sprite which way its faceing
bool faceingRight = true;
//get reference to animator
Animator anim;
//not grounded
bool grounded = false;
//transform at robots foot to see if he is touching the ground
public Transform groundCheck;
//how big the circle is going to be when we check distance to the ground
float groundRadius = 0.2f;
//force of the jump
public float jumpForce = 700f;
//what layer is considered the ground
public LayerMask whatIsGround;
void Start()
{
anim = GetComponent<Animator>();
}
//physics in fixed update
void FixedUpdate()
{
//true or false did the ground transform hit the whatIsGround with the groundRadius
grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround);
// tell the animator that we are grounded
anim.SetBool("Ground", grounded);
//get how fast we are moving up or down from the Rigidbody2D
anim.SetFloat("vSpeed, GetComponent<Rigibody2D>().velocity.y");
//get move direction
float move = Input.GetAxis("Horizontal");
//add velocity to the rigibody in the move direction * our speed
GetComponent<Rigidbody2D>().velocity = new Vector2(move * topspeed, GetComponent<Rigidbody2D>().velocity.y);
anim.SetFloat("Speed", Mathf.Abs(move));
//if we're facing the negative direction and not faceing right, flip
if (move > 0 && !faceingRight)
Flip();
else if (move < 0 && faceingRight)
Flip();
}
void update()
{
if (grounded && Input.GetKeyDown(KeyCode.Space))
{
//not on the ground
anim.SetBool("Ground", false);
///add jump force to the y axsis of the rigibody
GetComponent<Rigidbody2D>().AddForce(new Vector2(0, jumpForce));
}
}
void Flip()
{
//saying we are facing the oppisite directions
faceingRight = !faceingRight;
//get the local scale
Vector3 thescale = transform.localScale;
//flip on x axis
thescale.x *= -1;
//apply that to the local scale
transform.localScale = thescale;
}
}