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
- This topic has 22 replies, 3 voices, and was last updated 6 months, 1 week ago by Elvin Sim.
-
AuthorPosts
-
April 2, 2024 at 1:21 pm #13690Elvin SimParticipantApril 2, 2024 at 1:28 pm #13691Elvin SimParticipantApril 2, 2024 at 2:20 pm #13693Joseph TangModerator::
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()
underUpdate()
method is not called after, but before theIf (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.
April 5, 2024 at 12:50 am #13743Elvin SimParticipant::Hello, sorry for disturbing, but in part 6 the casting after healing bug fix don’t include in the video
April 5, 2024 at 2:22 am #13746Joseph TangModerator::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.April 5, 2024 at 1:14 pm #13752Elvin SimParticipant::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
April 5, 2024 at 1:36 pm #13753Joseph TangModerator::Ah right, sorry about that, forgot the forum was locked. For the fix it’ll be;
In the PlayerController.cs put thecastOrHealTimer
in theCastSpell()
method instead ofGetInputs()
. This relocation ensures that the timer doesn’t reset when you release the Cast/Heal button beforeCastSpell()
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; } }
April 7, 2024 at 1:33 pm #13760 -
AuthorPosts
- You must be logged in to reply to this topic.
Advertisement below: