Forum begins after the advertisement:


[Part 5] My SceneFader cannot function

Home Forums Video Game Tutorial Series Creating a Metroidvania in Unity [Part 5] My SceneFader cannot function

Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • #13690
    Elvin Sim
    Participant
    Helpful?
    Up
    0
    ::

    when the player is transitioned to another scene the mana UI is being filled

    #13691
    Elvin Sim
    Participant
    #13693
    Joseph Tang
    Moderator
    Helpful?
    Up
    0
    ::

    1. Your Player is stuck in healing.

    If this does not work, we may need to get more information to identify the issue.

    [Part 4] Player gets stuck in the heal state and does not heal

    In your PlayerController.cs, check if Heal() under Update() method is not called after, but before the If (pState.healing) return;code.

    2. Casting after healing

    In Part 6 a bugfix was discussed for this.

    Creating a Metroidvania (like Hollow Knight) — Part 6: Enemies, Spikes, and an Advanced Camera

    This fix should solve the issue.

    3. Mana UI is filled after scene transition

    What is possibly happening is there are multiple instances of your mana UI in the scene.
    Ensure that only your starting scene has a Player and a Canvas, all other scenes should not have their own Canvas or Player.

    If any of these do not work, feel free to update us.

    #13743
    Elvin Sim
    Participant
    Helpful?
    Up
    0
    ::

    Hello, sorry for disturbing, but in part 6 the casting after healing bug fix don’t include in the video

    #13746
    Joseph Tang
    Moderator
    Helpful?
    Up
    0
    ::

    Sorry for the confusion, but I believe this fix was only added in the Forum above:

    Creating a Metroidvania (like Hollow Knight) — Part 6: Enemies, Spikes, and an Advanced Camera

    I do think the video was made before the Forum, or the Forum was updated later to include the fix.
    If the fix shown above does not work, do inform us for further assistance.

    #13752
    Elvin Sim
    Participant
    Helpful?
    Up
    0
    ::

    Sorry, I don’t have money to open the paid forum, I am just learn from you guys, so if possible can you show the code that fix the bugs, thank you for your understanding

    #13753
    Joseph Tang
    Moderator
    Helpful?
    Up
    0
    ::

    Ah right, sorry about that, forgot the forum was locked. For the fix it’ll be;
    In the PlayerController.cs put the castOrHealTimer in the CastSpell() method instead of GetInputs(). This relocation ensures that the timer doesn’t reset when you release the Cast/Heal button before CastSpell() is called.

        void GetInputs()
        {
            xAxis = Input.GetAxisRaw("Horizontal");
            yAxis = Input.GetAxisRaw("Vertical");
            attack = Input.GetButtonDown("Attack");
    
            if (Input.GetButton("Cast/Heal"))
            {
                castOrHealTimer += Time.deltaTime;
            }
            else
            {
                castOrHealTimer = 0;
            }
        }
        void CastSpell()
        {
            if (Input.GetButtonUp("Cast/Heal") && castOrHealTimer <= 0.05f && timeSinceCast >= timeBetweenCast && Mana >= manaSpellCost)
            {
                pState.casting = true;
                timeSinceCast = 0;
                StartCoroutine(CastCoroutine());
            }
            else
            {
                timeSinceCast += Time.deltaTime;
            }
    
            if (!Input.GetButton("Cast/Heal"))
            {
                castOrHealTimer = 0;
            }
    
            if(Grounded())
            {
                //disable downspell if on the ground
                downSpellFireball.SetActive(false);
            }
            //if down spell is active, force player down until grounded
            if(downSpellFireball.activeInHierarchy)
            {
                rb.velocity += downSpellForce * Vector2.down;
            }
        }
    #13760
    Elvin Sim
    Participant
    Helpful?
    Up
    0
    ::

    Thank you!!!

Viewing 8 posts - 16 through 23 (of 23 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: