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

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #14491
    Anuk Thotawatta
    Participant

    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

    #14492
    Joseph Tang
    Moderator

    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’s Outbreak() 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 the TakeDamage() method in PlayerController.cs directly.

    #14505
    Anuk Thotawatta
    Participant

    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

    #14507
    Joseph Tang
    Moderator

    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.

    #14559
    Anuk Thotawatta
    Participant

    i checked and the boss is stuck in the jump animation

    #14560
    Joseph Tang
    Moderator

    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 the diveAttack 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 your diveAttack 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:

    attackCountdown = Random.Range(attackTimer - 1, attackTimer + 1);
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: