POCKETS
Terrarian
I've been able to create dust vortexes, dust rings, dust ovals, and many other effects with dust, but this one has me stumped.
I need to spawn dust between two projectiles at random points between them in a line. Projectile one spawns projectile two. I've passed in the parent projectile's
I'm only beginning to understand vectors, but I'm assuming to get the direction from the child projectile to the parent, I would need to do something like this -I'm a little fuzzy on that one, but to get the distance from a projectile to the player, you would do something like
EDIT: So this is apparently incorrect. I believe the proper distance between the two would be worked out like this -
Now, the only thing I need to work out is how to get random points in between the two. The above code does work, and I can get the dust to spawn on the parent projectile's position based on the distance from the child projectile, but I can't seem to understand how to get random points in between the two...
This is about as far as I've been able to go. I lack trig knowledge, and with my limited knowledge of Vectors, I'm just not sure how to tie all this in to the Vector2 position the dust requires. .
Any help in this regard would be very much appreciated
I need to spawn dust between two projectiles at random points between them in a line. Projectile one spawns projectile two. I've passed in the parent projectile's
whoAmI
through NewProjectile
's ai[1] (ai[0] is occupied). I then store that info using Projectile parentProj = Main.projectile[(int)projectile.ai[1]]
.I'm only beginning to understand vectors, but I'm assuming to get the direction from the child projectile to the parent, I would need to do something like this -
Vector2 direction = projectile.DirectionTo(parentProj.Center)
. Assuming this is correct, I now at least have this vector facing towards the other projectile. At this point, I would assume I would need to get the distance between the two. float distanceSQ = projectile.DistanceSQ(player)
. Replacing "player" with "parentProj.Center" (I'm assuming yet again) would give me the squared distance from one projectile to the other? EDIT: So this is apparently incorrect. I believe the proper distance between the two would be worked out like this -
Vector2 distance = direction + parentProj.Center
Now, the only thing I need to work out is how to get random points in between the two. The above code does work, and I can get the dust to spawn on the parent projectile's position based on the distance from the child projectile, but I can't seem to understand how to get random points in between the two...
This is about as far as I've been able to go. I lack trig knowledge, and with my limited knowledge of Vectors, I'm just not sure how to tie all this in to the Vector2 position the dust requires. .
Any help in this regard would be very much appreciated
Last edited: