Hello again! I’ve a problem. I’ve a 2 square tall enemy idk if I can post a pic of it (It’s Mussolini upside down walking on his hands ). He is a mini boss that if defeated it gives you 1 upgrade coin (you could use it to upgrade the defenders). He doesn’t spawn randomly but I’ve set it far from the field so you have 10-15 seconds to prepare your troops. My problem is that he occupies 2 squares but he should be a children of the Spawner of his lane but the problem is that only 1 lane shoots at him and the other one doesn’t do anything. I know the problem it’s in the Projectiles.cs script (it’s a script from the course)
bool IsAttackerAheadInLane()
{
if (myLaneSpawner.transform.childCount <= 0)
{
return false;
}
foreach(Transform attackers in myLaneSpawner.transform)
{
if (attackers.transform.position.x > transform.position.x)
{
return true;
}
}
return false;
}
maybe I should use a new condition that says If (enemy.transform.position.y==transform.position.y)
or something like that. Maybe it’s better use that than all the code
bool IsAttackerAheadInLane()
{
// ...
}
but it doesn’t work. How should I change that?