Forum begins after the advertisement:
[part 10] boss runs while barrage attack and player has no I-frames
Home › Forums › Video Game Tutorial Series › Creating a Metroidvania in Unity › [part 10] boss runs while barrage attack and player has no I-frames
- This topic has 5 replies, 2 voices, and was last updated 8 months, 2 weeks ago by Joseph Tang.
-
AuthorPosts
-
May 3, 2024 at 9:26 pm #14491::
boss runs while doing barrage attack instead of standing still
also player has no invincibility frames and time slow effect for any of the bosses attacks.
View post on imgur.com
May 3, 2024 at 11:42 pm #14492::For the running issue: How the Boss attacks and movement work is that they are all dependent on it’s Animator.
Every time a new animation plays, the given script plays as it becomes that animation state.
So, what’s likely happening is that your “Boss_Cast” animation’s condition is being met to return back to “Boss_Idle” > “Boss_Run”. This should not be the case as it is being controlled by a Bool Parameter called “Cast”.
Thus, Check your THKEvents.cs & your TheHollowKnight.cs for instances of “Cast” being set to true and then false. Your TheHollowKnight.cs should have a code
anim.SetBool("Cast", false);
being set at the very end of it’sOutbreak()
method.As for the player’s invincibility issue, that’s because the Boss was coded to note take the following function from Enemy.cs that calls for the timestop. This was an intentional, unintentional outcome.
In TheHollowKnight.cs the script has a code “protected override void OnCollisionStay2D(Collision2D _other) { }”
Simply get rid of that code or call the
base.OnCollisionStay2d()
. Because of the “override” code, the proper function is being completely ignored. And the Reason why the Player is taking damage is because THKEvents.cs is calling theTakeDamage()
method in PlayerController.cs directly.May 5, 2024 at 3:47 pm #14505::what is my boss doing? this happens frequently when boss switches stages
View post on imgur.com
and cast bool has been set to false
May 5, 2024 at 4:17 pm #14507::Could you look at the Animator while this is happening? If the Boss is simply in it’s run state, it could just mean that it’s getting caught behind a small pixel of a box collider from the ground.
Furthermore, to check if it’s truly stuck, try jumping over and around it to see if it will flip and run towards you.
May 8, 2024 at 11:22 am #14559May 8, 2024 at 2:29 pm #14560::What’s likely happening is that your Dive attack is being called, causing your boss to jump, but cannot be completed as
ResetAllAttacks()
is being called by the boss that just completed it’s slash action. This causes thediveAttack
bool to be set to false, which needs to be true to allow the jump animation to carry out it’s state function of the dive attack.Thus, you will need to make a way to either stop the
ResetAllAttacks()
from affecting yourdiveAttack
bool, or something to a similar affect.I’d suggest trying to make the attacks abide by the
attackCountdown
given, which should be possibly done by shifting the code that resets the attackCountdown under Boss_Idle.cs:to under Reset all attacks. <pre> attackCountdown = Random.Range(attackTimer - 1, attackTimer + 1);
-
AuthorPosts
- You must be logged in to reply to this topic.
Advertisement below: