tModLoader I want to create a minion that is arranged in a circle

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. <3


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

Minion.png


Please help me, thanks
 
sadly, i dont think i could help with this. but perhaps you could try asking divermansam? he's the thorium mod creator and there's a minion in thorium which does a very similar thing to what you are looking to do. the best advice i could give you is to maybe DM him on discord or something, and see if he could assist you with the code. again though, sorry i cant help.
 
Back
Top Bottom