Ru_no4
Terrarian
In ExampleMod, I cannot learn how to change the location information of each minion according to the number of summons.
I have a question for those who are familiar with it.
The Minion placement in the ExampleMod example is just a straight line behind the player, but I wanted to place it in a circle around the player.
After thinking about it, I created the following code. By the way, this doesn't work, of course.
Looking at the various ExampleMod examples and tModLoader.cs,
I couldn't find any function or process to change the minion's location according to the number of summons.
I would like to know how to get Minion information one by one by array etc. and how to change the arrangement according to the number of summons.
Like the image below
Please help me, thanks
I have a question for those who are familiar with it.
The Minion placement in the ExampleMod example is just a straight line behind the player, but I wanted to place it in a circle around the player.
After thinking about it, I created the following code. By the way, this doesn't work, of course.
Looking at the various ExampleMod examples and tModLoader.cs,
I couldn't find any function or process to change the minion's location according to the number of summons.
Code:
public override void AI()
{
Player player = Main.player[projectile.owner];
#region General behavior
Vector2 idlePosition = player.Center;
float pi = 3.14159265f;
for (int i = 0; i < player.numMinions; i++)
{
float minionPositionOffsetX = (float)(40 * (1 + i * 0.5) * Math.Cos((double)(2 * pi / i))) * -player.direction;
float minionPositionOffsetY = (float)(40 * (1 + i * 0.5) * Math.Sin((double)(2 * pi / i)));
idlePosition.X += minionPositionOffsetX;
idlePosition.Y -= minionPositionOffsetY;
//X coordinate when Minion information is acquired as an array = idlePosition.X
//Y coordinate when Minion information is acquired as an array = idlePosition.Y
}
}
I would like to know how to get Minion information one by one by array etc. and how to change the arrangement according to the number of summons.
Like the image below
Please help me, thanks