This is my code:
public class PlayerMovement : MonoBehaviour {
public Rigidbody2D rb;
public float SidewaysForce = 500f;
public float UpwardsForce = 500f;
void FixedUpdate()
{
if (Input.GetKey(“d”))
{
rb.AddForce(SidewaysForce * Time.deltaTime, 0f);
}
if (Input.GetKey(“a”) )
{
rb.AddForce(-SidewaysForce * Time.deltaTime, 0f);
}
if (Input.GetKey(“w”) )
{
rb.AddForce(0f, UpwardsForce * Time.deltaTime);
}
}
}
And I get these errors:
Error CS1503 Argument 1: cannot convert from ‘float’ to ‘UnityEngine.Vector2’ New Unity
Error CS1503 Argument 1: cannot convert from ‘float’ to ‘UnityEngine.Vector2’ New Unity
Error CS1503 Argument 1: cannot convert from ‘float’ to ‘UnityEngine.Vector2’ New Unity
Error CS1503 Argument 2: cannot convert from ‘float’ to ‘UnityEngine.ForceMode2D’ New Unity
Had to translate the errors into english, I’m sorry if they aren’t translated correctly!
Hope you can tell me what is wrong…