Forum begins after the advertisement:


[General] Creating Unholy Vespers (King Bible Evolution)

Home Forums Video Game Tutorial Series Creating a Rogue-like Shoot-em Up in Unity [General] Creating Unholy Vespers (King Bible Evolution)

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #16102
    kyle
    Level 9
    Moderator
    Helpful?
    Up
    1
    ::

    Hi all! We’ve recently recreated the King Bible in this forum post so we’ve decided to create its evolution, the Unholy Vespers! The main bulk of work in this article is just creating new VFX for the weapon, as the Unholy Vespers is basically just a King Bible  that never ends.

    What the completed Unholy Vespers in our project looks like. What the completed Unholy Vespers in our project looks like.

    Before we start, please ensure you’ve completed the King Bible forum post, as we will be inheriting from a script (KingBibleWeapon.cs) that we’ve implemented there.

    Here’s what we will be covering:

    1. Creating the Spellbinder Passive 2. Creating the Unholy Vesper Projectile Prefab 3. Creating the UnholyVespersWeapon.cs script 4. Creating the Unholy Vespers Weapon Data 5. Configuring the evolution to take place

    1. Creating the Spellbinder Passive

    To start off, let’s create the passive that is required to evolve the King Bible. If you already have one you can skip this step.
    1. Navigate to your Scriptable Objects>Passive Items folder and right-click and go to Create>2D Top-down Rogue-like>Passive Data. Rename the newly created Scriptable Object to “Spellbinder”
    2. Configure the Spellbinder accordingly. Here’s its wiki page if you’d like to refer to its actual stats. For now you do not need to put anything in the Evolution Data as we have not created the Unholy Vespers weapon yet.
    Here’s how I configured my Spellbinder:
    View post on imgur.com
    How my Spellbinder was set up

    2. Creating the Unholy Vesper Projectile Prefab.

    The prefab for the Unholy Vesper Projectile is almost the same as its original weapon, so we can just duplicate the King Bible Projectile’s prefab and make a few changes.

    We will also be reusing the King Bible Projectile script on our new Prefab as well, since they both spin around the Player and deal damage on contact, though we will change a few values.

    1. Drag the King Bible prefab into your scene, right-click it and select Prefab>Unpack.
    2. Next, rename it to “Unholy Vesper Projectile” and drag it back into your Weapon Prefabs folder. You can delete the prefab that’s left in your scene as we will be working on the prefab in Prefab Mode.
    3. Double-click the newly-created prefab in the Project window to enter Prefab Mode.

    Rearranging the Particle System

    Since the King Bible and Unholy Vespers share the ‘Pages Falling Out’ effect (just with a different rate of falling out), we’ll just modify a few properties of the Particle System we created for the King Bible to get the effect we need.

    However, since we’ll also be using Texture Sheet Animation to animate the ‘Changing Symbols’ effect of the Vespers, we’ll put the Page Falling Out effect onto a child Game Object and the Symbols effect on the parent Game Object so we can modify the projectile’s collider easier to fit the symbols.

    1. Firstly, let’s create a new empty Game Object as a child of the Unholy Vesper Projectile by right-clicking it in the Hierarchy and selecting “Create Empty”. Rename this new Game Object to “Falling Pages VFX”.
    2. Click the 3 dots on the newly created empty object’s Transform and click “Reset”.
    3.  Go back to the Unholy Vesper Projectile and copy the Particle System on it by clicking the 3 dots on the Particle System‘s component and clicking “Copy Component”.
    4. Then, go to the Falling Pages VFX object and paste the script by clicking on the dots next to the Transform and clicking “Paste Component As New”. You can then remove the original Particle System on the parent object.

    Creating the Pages Falling Out VFX

    Now, the ‘Pages Falling Out’ Particle System should be transferred onto the child Game Object. We can start modifying the Particle System to increase the rate of pages falling out since that happens in the original Game.
    1. We’ll change the following values:
      • Start Lifetime – 0.35
      • Start Size – 0.7
      • Start Color – A dark shade of Purple with the Alpha (A) value of 0.8
    2. Then, we’ll go over to “Emission” and set the Rate over Time to 9.
    3. Next, we’ll go over to “Shape” and increase the Radius of our Edge to 0.1.
    4. After that, we’ll go over to “Size over Lifetime” and turn it on. Click on the Size graph, and a graph should pop up at the bottom of the Inspector. Make sure that the Key Value at the start is 0.5 and the Key Value at the end is 1. You can move the keys on the graph by dragging them, and holding Ctrl to snap.
    5. Finally, go over to “Noise” and turn it on. You can experiment with the values, but I feel that the default Noise is subtle enough for our effect.
    Here’s how my new Falling Pages VFX Game Object looks like:
    View post on imgur.com
    How my “Falling Pages VFX” Game Object was set up

    Creating the Changing Symbols VFX

    Now, we can move onto creating the Changing Symbols VFX.
      1. Create a new Particle System on the Unholy Vesper Projectile.
      2. We’ll change the following values:
        • Duration – 1
        • Looping – on
        • Prewarm – on
        • Start Lifetime – 1
        • Start Speed – 0
        • Start Size – 1
        • Start Rotation – 0
        • Start Color – Red with an Alpha (A) value of 1
        • Gravity Modifier – 0
        • Scaling Mode – Hierarchy (Scales the particles with the scale of the Game Object)
      3. Next we’ll go over to “Emission” and set the Rate over Time to 1.
      4. After that turn “Shape” off.
      5. Now, let’s go over to “Texture Sheet Animation” and turn it on. Set the Mode to Sprites, and click the “plus” button to add in slots depending on how many symbol sprites you’ll add, then add the symbols into the slots.
        • I just used the red weapons in the Weapon Sprite Sheet for easy use.
        • I’d recommend using sprites that are of the same dimensions so that the colliders can be set up easily.
        • Also, do take note that if you’re planning to use your own Symbol sprites, they all need to be in the same sprite sheet for the Texture Sheet to animate properly.
      6. Then, set the Time Mode to Lifetime and click on the graph next to Frame over Time. Adjust the graph so that the graph curves towards the ends.
    How to select and curve the graph keys. How to select and curve the graph keys.
    1. After that, you’ll want to click on the arrow next to the Start Frame field and click “Random Between Two Constants”. Set the first constant to 0 and the second constant to the amount of symbol sprites you’re using.
    2. To end off the VFX, go to “Renderer” and configure these following settings. Remember to also configure the Order in Layer properly so the particles do not get blocked!
      • Material – AdditiveParticle (or any additive material, I only changed the material to remove the outline on the symbols, but if you need the outlines, you can just use the “Default-ParticleSystem” material.
      • Min Particle Size – 0
      • Max Particle Size – 99
      • Render Alignment – Local
    3. Once the VFX is done, check if the Box Collider 2D attached to the projectile fits the symbols. Configure it accordingly to fit if it doesn’t.
    4. Finally, let’s change the “Speed Multiplier” and “Radius Multiplier” of the King Bible Projectile (script) attached to the Game Object. I’ve set my “Speed Multiplier” to 4 and “Radius Multiplier” to 1.75. This ensures the rings are of a suitable distance away from the player and makes them feel like the original game.
    Here’s how my Unholy Vesper Projectile Game Object looks like after adding the VFX. You’re always free to configure your own prefab however you want it!
    View post on imgur.com
    How my “Unholy Vesper Projectile” Game Object looks like after adding the VFX.

    Now, you should have an Unholy Vesper projectile that both changes its sprite to a random symbol, and has pages that fall out at an increased rate.

    3. Creating the UnholyVespersWeapon.cs script

    Here, we’ll set up the controller that will fire the projectiles. We’re going to create a new C# script called UnholyVespersWeapon.cs. Here’s the script with an explanation further below.
    using UnityEngine;
    
    public class UnholyVespersWeapon : KingBibleWeapon
    {
        public override bool ActivateCooldown(bool strict = false)
        {
            // When 'strict' is enabled and the cooldown is not yet finished,
            // do not refresh the cooldown.
            if (strict && currentCooldown > 0) return false;
    
            // Calculate what the cooldown is going to be, factoring in the cooldown
            // reduction stat in the player character.
            // Cooldown no longer depends on duration, so we take it out
            float actualCooldown = (currentStats.lifespan) * Owner.Stats.cooldown;
    
            // Limit the maximum cooldown to the actual cooldown, so we cannot increase
            // the cooldown above the cooldown stat if we accidentally call this function
            // multiple times.
            currentCooldown = Mathf.Min(actualCooldown, currentCooldown + actualCooldown);
            return true;
        }
    }
    
    • We’re going to make it inherit from the KingBibleWeapon class, since it functions the same way as the King Bible controller (i.e. spawns rings every time the cooldown ends).

    The Overriden ActivateCooldown() function

    • This is the only function we’re overriding, because according to the wiki, the cooldown of the weapon no longer depends on its duration so we take it out of the actualCooldown calculation.
    • This makes it so there’s always at least 1 spawned ring active on the screen at any time, giving the illusion that it never ends.

    4. Creating the Unholy Vespers Weapon Data

    Here we’ll set up the Weapon Data Scriptable Object that will give our Unholy Vespers its stats.
    1. Navigate to your Scriptable Objects>Weapons folder, right-click and go to Create>2D Top-Down Rogue-Like>Weapon Data. Rename the newly created Scriptable Object to “Unholy Vespers”.
    2. Set the Behaviour to “UnholyVespersWeapon” and you should be able to configure your Unholy Vespers accordingly. Here’s the wiki page for it if you’d like to have the exact stats.
    Here’s how I configured my Unholy Vespers Weapon Data: The Unholy Vesper's Weapon Data The Unholy Vesper’s Weapon Data

    5. Configuring the weapon evolution to take place

    Finally, we’ll get the weapon to evolve if the user picks up a treasure chest when their King Bible is at the max Level and they have the Spellbinder in their inventory.
    1. Search for your King Bible’s Weapon Data Scriptable Object and configure the Evolution Data like so:The Evolution Data of the King Bible. The Evolution Data of the King Bible.
    2. We’ll also need to go to the Spellbinder’s Passive Data Scriptable Object and configure the Evolution Data as well:The Evolution Data of the Spellbinder. The Evolution Data of the Spellbinder.
    If you need a quick refresher on what the Evolution Data is,
      • Name – The name of the evolution.
      • Condition – What triggers the weapon evolution. We set it to “Treasure Chest” so if the Player steps on the chest, it will do the necessary Evolution checks.
      • Consumes – The item to remove after evolving. We select “Weapons”, since it will remove the King Bible weapon and replace it with the Unholy Vespers.
      • Evolution Level – The level at which the item can evolve. We set it to 8 since the King Bible has 8 levels.
      • Catalysts – The items needed, as well as the level the item must be, in order for the evolution to take place.
        • For the King Bible, we set the Catalyst to the Spellbinder and set the level to 1 since as long as it’s in the player’s inventory, the King Bible can evolve.
        • For the Spellbinder, we set the Catalyst to the King Bible and set the level to 8 since the King Bible needs to be at level 8 to evolve.
      • Outcome –  The weapon or passive that gets added to our inventory, and its starting level. We set this to the Unholy Vespers Scriptable Object, and set its starting level to 1.
    Now, if you level up the King Bible to level 8 and have the Spellbinder passive in your inventory, when you walk over the treasure chest, they will evolve into the Unholy Vespers (as seen in the opening gif)!

    And we’re done!

    Now, you should be able to have a working Unholy Vespers weapon that will always have at least 1 ring of projectiles surrounding you, plus a Spellbinder passive if you don’t have one already!

    As always, if you encounter any problems in creating the Unholy Vespers, you can submit a forum post about in detail for further assistance. If you have your own implementation of the Unholy Vespers, or have any improvements you’d want to see, feel free to make a post as well!

    has upvoted this post.
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: