Huyino2
Skeletron
So im working on a boss for my mod and I got 39 errors and cut it down to 4 but I cant seem to figure out how to fix these 4. Anybody know a fix?
Here are the errors
Error 1:TURTLE.cs(82,20) : error CS7036: There is no argument given that corresponds to the required formal parameter 'turnResistance' of 'TURTLE.MoveTowards(NPC, Vector2, float, float)'
Error 2:TURTLE.cs(95,38) : error CS0131: The left-hand side of an assignment must be a variable, property or indexer
Error 3(similar to error 2):TURTLE.cs(96,38) : error CS0131: The left-hand side of an assignment must be a variable, property or indexer
Code: (error 2 & 3)
Code: (error 1)
(Edit: I fixed error 4 I just needed to add some using tags)
Here are the errors
Error 1:TURTLE.cs(82,20) : error CS7036: There is no argument given that corresponds to the required formal parameter 'turnResistance' of 'TURTLE.MoveTowards(NPC, Vector2, float, float)'
Error 2:TURTLE.cs(95,38) : error CS0131: The left-hand side of an assignment must be a variable, property or indexer
Error 3(similar to error 2):TURTLE.cs(96,38) : error CS0131: The left-hand side of an assignment must be a variable, property or indexer
Code: (error 2 & 3)
Code:
if((double)npc.ai[0] % 50 == 0)
{
float speed = 12f;
Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
float x = player.position.X + (float)(player.width / 2) = vector.X;
float y = player.position.Y + (float)(player.height / 2) = vector.Y;
float distance2 = (float)Math.Sqrt(x * x + y * y);
float factor = speed / distance;
npc.velocity.X = x * factor;
npc.velocity.Y = y * factor;
Code:
private void MoveTowards(NPC npc, Vector2 playerTarget, float speed, float turnResistance)
{
var move = playerTarget - npc.Center;
float length = move.Length();
if(length > speed)
{
move *= speed / length;
}
move = (npc.velocity * turnResistance + move) / (turnResistance + 1f);
length = move.Length();
if(length > speed)
{
move *= speed / length;
}
npc.velocity = move;
}
(Edit: I fixed error 4 I just needed to add some using tags)
Last edited: