Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Zerrtor |
I have two scripts Bat and SwordhitBox. The bat script gives me this error:
'Area2D' does not contain a definition for 'KnockbackVector' and no accessible extension method 'KnockbackVector' accepting a first argument of type 'Area2D' could be found (are you missing a using directive or an assembly reference?)
I was following a tutorial, but I use C# and they don’t, and I’m not sure how to fix this even after searching though the Docs and google. Here’s the scripts below.
using Godot;
using System;
public class SwordHitbox : Area2D
{
public Vector2 KnockbackVector = Vector2.Zero;
}
using Godot;
using System;
public class Bat : KinematicBody2D
{
Vector2 knockback = Vector2.Zero;
SwordHitbox swordHitbox = null;
void _physics_process(float delta){
knockback = MoveAndSlide(knockback);
}
private void OnHurtboxAreaEntered(object area){
swordHitbox = (SwordHitbox)area;
Knockback = swordHitbox.KnockbackVector * 60;
}
}