← Back to all addons

Falling Attacks & Many more Abilities (super fast implementation) ๐Ÿ’ซ๐Ÿ”ฅ๐Ÿงจ

Posted by Mr.Titan on Sep 13, 2025 at 1:22 AM

Feature3.0 Verified
๐Ÿš€ 2 ๐Ÿ‡ต๐Ÿ‡น 1 ๐Ÿ‡ง๐Ÿ‡ท 1 ๐Ÿ‘ 1 ๐Ÿ”ฅ 1

It just adds new options and a few lines of code, and allows you to do unlimited things! I’ll include some prints of configured abilities

Updates and troubleshooting (check the comments for solution):

  • Fire blast not hitting enemies -> change the “Projectile property from “meteor” to “fireball”
  • Fire black with too much radius of explosion -> Change the “Explosion radius” to “0.7” (standard fireball value)

This includes the following functionalities:

  • Instantiates the projectiles distante from the player
  • Instantiates the projectiles distante from the player multiplied by the index of the prefab (i.e. each projectile will get more distance then the one before)
  • Instantiation position ajustment - in case you want it to start a bit more to the top, left, etc. (used in the “falling” attacks)
  • Force direction… well forces the direction of the projectile (used in falling attacks)

Add in file ProjectileAbilitySheet.cs

Include the following after [Header(“Projectile Ability Settings”)]:

        [SerializeField] private float m_distanceFromSource = 0f;
        [SerializeField] private float m_distanceFromSourcePerStep = 0f;
        [SerializeField] private Vector3 m_positionAdjustment = Vector3.zero;
        [SerializeField] private Vector2 m_forceDirection = Vector2.zero;

And the follow in the getters bellow public int projectileCount => m_projectileCount;

        public float distanceFromSource => m_distanceFromSource;
        public float distanceFromSourcePerStep => m_distanceFromSourcePerStep;
        public Vector3 positionAdjustment => m_positionAdjustment;
        public Vector2 forceDirection => m_forceDirection;

continue in comments….

Add in file ProjectileAbility.cs

Replace the entire method ThrowProjectile with the following:

private void ThrowProjectile(int projectileIndex)
{
    Vector2 direction = m_character.GetTargetDirection();
    float totalSpread = activeAbilitySheet.spread;
    float spreadStep = totalSpread / Mathf.Max(1, activeAbilitySheet.projectileCount - 1);
    float spreadAngle = -totalSpread / 2 + spreadStep * projectileIndex;

    // calculate projectile direction
    Vector2 actualDirection = (Quaternion.Euler(0, 0, spreadAngle) * direction).normalized;

    // base spawn position
    Vector3 spawnPos = m_projectileSpawnPoint.position;

    // Adds an outwards distance from source when instantiting
    if (activeAbilitySheet.distanceFromSource>0f)
    {
        // projectiles spawn in a ring around the source
        // use spreadAngle to decide their offset
        Vector2 offset = actualDirection * activeAbilitySheet.distanceFromSource;
        spawnPos += (Vector3)offset;
    }

    // Adds distance from source in instantiating multiplied by the index
    if (activeAbilitySheet.distanceFromSourcePerStep > 0f)
    {
        Vector2 offset = actualDirection * ( activeAbilitySheet.distanceFromSourcePerStep * projectileIndex);
        spawnPos += (Vector3)offset;
    }

    // force direction instead of pre calculated (player faced direction)
    if (!Vector3.zero.Equals(activeAbilitySheet.forceDirection))
    {
        actualDirection = activeAbilitySheet.forceDirection;
    }

    // Apply additional adjustment (e.g., lift projectiles above source)
    spawnPos += activeAbilitySheet.positionAdjustment;

    // instantiate and fire
    Projectile projectile = InstantiateProjectile(spawnPos);
    projectile.Throw(m_character, actualDirection, activeAbilitySheet);
}

Here’s some prebuilded abilities for you!!

I’m sorry but i have them in the “src” folder in you case you should have it in “demo”… just pass drag and drop the folders inside of the src to demo folder.

@Zuko please delete the messages so that the tutorial it’s liniar. Thanks mate

It took me a but more to do this last part

๐Ÿ’ฌ Comments (17)

Zuko Sep 13, 2025 at 01:31 AM
Done!!
Zuko Sep 13, 2025 at 01:31 AM
Sorry about that
Mr.Titan Sep 13, 2025 at 01:31 AM
That’s fine… i liked the excitement tought! ๐Ÿ˜ ๐Ÿป
๐Ÿ‘ 1 ๐Ÿ‡ง๐Ÿ‡ท 1
Mr.Titan Sep 13, 2025 at 01:39 AM

The prefab of the meteor is a copy of the fireball but with the component “Collider2D” disabled.

The abilities in case you are curious heres the prints:

๐Ÿ‘ 1 ๐Ÿš€ 1 ๐Ÿ‘ 1
Zuko Sep 13, 2025 at 02:33 AM
Flame burst appears to be the only skill that is not working properly
Zuko Sep 13, 2025 at 02:33 AM
it passes trhough the enemies, hitting no one
Zuko Sep 13, 2025 at 02:36 AM
rainfall and meteor barrage works fine
Mr.Titan Sep 13, 2025 at 02:39 AM
Ah shit, it’s using the meteor prefab
Zuko Sep 13, 2025 at 02:40 AM
just change it to fireball?
Mr.Titan Sep 13, 2025 at 02:41 AM
Yes. And the radius its using the meteor too, it should be using the fireball:
Zuko Sep 13, 2025 at 02:42 AM
ok
Zuko Sep 13, 2025 at 03:37 AM
@Mr.Titan why let the capsule collider disabled?
Mr.Titan Sep 13, 2025 at 08:15 AM
Since its a “falling” attack, you dont want nothing to collide with it while falling, only when it fell and touched the ground
Zuko Sep 13, 2025 at 02:34 PM
but in this case, how can n we match the size of the projectile with the size ofm the particle?
Mr.Titan Sep 13, 2025 at 06:41 PM
Use “Explosion Radius”
Zuko Sep 13, 2025 at 06:43 PM
it worked
Zuko Sep 13, 2025 at 06:43 PM
ty

Want to continue the conversation?