Question by
joelluckett83 · Jun 02, 2020 at 09:56 AM ·
2d-platformer
Jump then crouch attack performing when you crouch then jump (Unity2D)
I am trying to make a Mario-style Ground Pound attack and have written the code for the attack. It is supposed to be triggered when i jump then crouch but it also triggers when i crouch then jump. Can anyone help?
Here's the code that performs the attack:
if (coolDownTimer == 0)
{
/*if (Input.GetButtonDown("Jump"))
{
firstDown = true;
}*/
///if not on the ground
if (!controller.m_Grounded /*&& !_crouch*/)
{
keySequence = 1;
Debug.Log("1");
///if crouching while in the air ///If not on the gorund -> crouch: not other way
if (keySequence == 1 && _crouch == true)
{
StartCoroutine(SlamAttackFunction());
Debug.Log("3");
keySequence = 3;
//slam = true;
//animator.SetBool("isCrouching", true);
//animator.SetBool("isCrouching", false);
//Instantiate(LandEffect, LandEffectPoint.position, LandEffectPoint.rotation);
}
//Debug.Log("Hello");
//rb.Static;
}
else if(controller.m_Grounded && _crouch != true)
{
keySequence = 0;
}
//fix slam jumping with crouching then jumping bug
}
Comment
Your answer
Follow this Question
Related Questions
Problems with tilemaps of Unity 2d-extras 1 Answer
hi i want to add a slid and wall jump to my script with animation, i am lost ^^ 0 Answers
Changing game from PC to HTML5 creates errors 0 Answers
Help with 2D platformer (score),For my 2D game sometimes coins get added twice to the score?! 0 Answers
2d game/ unexpected idle flicker when landing (to run) 1 Answer