Taken from my post here - viewtopic.php?f=147&t=152366&p=962278#p962278
Hello Hello. - Would anyone be so kind as to educate me on how I would achieve this effect?
- - <---- Notice the way that the little units spawn out of the buildings neatly side by side? This is what I'm trying to achieve.
A straight up "This is how its done" would be appreciated it, but I wouldn't mind a hint in the right direction
At the moment my units kind of just cluster all over each other and it makes it difficult to see how many are coming.
I can't wrap my head around how I would get overlapping units to slowly spread away from each other until they are not overlapping anymore, and continue their trajectory.
how do I tell the sprite to move away to the side that its closest to? (So it doesn't go 100 pixels to the right, when 10 pixels to the left would have accomplished it)
I don't know the proper string to type in to do something so dynamic. The best I could come up with was
"-1x, -1y"
repeat until not overlapping.
But that would cause issues if the bullets were heading towards that direction anyway and it would just accelerate them awkwardly.
------
I think what I need is a way to spawn my bullets but in a spread pattern that they don't collide with each other.
If anyone could point me towards a tutorial that handles something like this, would greatly appreciate it.
Anything I found was relating to setting bullet angle to random to simulate shotgun spread, but that won't work so well for me I presume.
I think I might need to create another invisible sprite in a rectangular shape of sorts, pin it to the building spawning and have it rotate towards the building being attacked.
But I still have no idea how I would get the sprites to slowly shuffle away from each other.
If anyone has any ideas, I would really love to hear them. This has been the only thing on my mind all week and its slowed my development to a crawl, and I'm thinking I might just forget about it and attempt it in another game, but that won't solve the issue of "I have no idea how to do this" in the first place.