Hi,
I am making an isometric game and I have come a long way. I am actually now making my boss fights and Although I have had some success I find that I am still not fully understanding how to determine directionality of a vector2 and how to control it properly.
here is an example ability of a boss in my game which works fine:
void FourDirectionalShot(Vector3 initialDirection, int amountOfDirection)
{
for (int i = 1; i <= amountOfDirection; i++)
{
if (i != 1)
{
initialDirection = Vector2.Perpendicular(initialDirection);
}
GameObject projectile = PooledProjectilesController.instance.GetEnemyProjectile(gameObject.name, aoeProjectile);
projectile.GetComponent<enemy_Projectile>().MakeProjectileReady();
projectile.transform.position = projectileLaunchPoint.transform.position;
projectile.GetComponent<Rigidbody2D>().AddForce(initialDirection * projectileSpeed);
SoundManager.instance.PlayCombatSound(gameObject.name + "_shot");
}
}
This ability shoots projectiles in a maximum of 4 directions as every angle after the first one is simply perpendicular to the previous one.
My question is. What would be a smart way to about shooting in 8 different directions for example, or more. How could I for example get a direction that was in between two of the projectiles in previoiusly mentioned ability. I just want to understand how to better play with this and make some more interesting events.
Any help is greatly appreciated.