I asked before but the people that answered did not consider the fact that I might have been new to coding and simply disregarded my question and closed it. I understand that it tells me how to fix the code but I don't understand the language quite yet so a walk through would be much appreciated by anyone that can spare the time to help a newbie to the coding world.
So this is the error:
Assets/Project/Scripts/Game/Player.cs(72,47): error CS1501: No overload for method `AddForce' takes `1' arguments.
And this is the line it refers to:
// Perform the knockback effect.
Vector3 hurtDirection = (transform.position - enemy.transform.position).normalized;
Vector3 knockbackDirection = (hurtDirection + Vector3.up).normalized;
GetComponent ().AddForce (knockbackDirection * knockbackForce);
And this is the forcereciver file:
public class ForceReciver : MonoBehaviour {
public float deacceleration = 5;
public float mass = 3;
private Vector3 intensity;
private CharacterController character;
// Use this for initialization
void Start() {
intensity = Vector3.zero;
character = GetComponent ();
}
// Update is called once per frame
void Update() {
if (intensity.magnitude > 0.2f)
{
character.Move (intensity * Time.deltaTime);
}
intensity = Vector3.Lerp(intensity, Vector3.zero, deacceleration * Time.deltaTime);
}
public void AddForce (Vector3 direction, float force)
{
intensity += direction.normalized * force / mass;
}
}
Please let me know if you need anything else
Thank You!!
↧