Hello,
I just worked on the axe weapon from part 16 and I’m having difficulties with the weapon being thrown up. At the moment the weapon spawns in and falls in whichever way the player is facing. I did some searching and using ChatGPT, I got some logic that will throw the axe upward(not very smooth) but I currently have that commented out because I wanted to see if I missed something or I’m misunderstanding the physics.
Thank you
public class AxeWeapon : ProjectileWeapon
{
//gives the spawn angle when instantiated
protected override float GetSpawnAngle()
{
//calculates offset that is used to modify the angle of axes
int offset = currentAttackCount > 0 ? currentStats.number - currentAttackCount : 0;
//instantiates the first projectile at 90 degrees and modifies future axes during attack
return 90f - Mathf.Sign(movement.lastMovedVector.x) * (5 * offset);
}
protected override Vector2 GetSpawnOffset(float spawnAngle = 0)
{
return new Vector2(
Random.Range(currentStats.spawnVariance.xMin, currentStats.spawnVariance.xMax),
Random.Range(currentStats.spawnVariance.yMin, currentStats.spawnVariance.yMax));
}
}