Search Unity

Help needed- dash once upon a space

Discussion in '2D' started by damniam0, Apr 5, 2021.

  1. damniam0

    damniam0

    Joined:
    Apr 5, 2021
    Posts:
    6
    Hi

    Ive been following YT tuts on dashing, but now I have a problem. I can dash and dash ininitely, and I want player to dash only once when he is in the air. Ive been trying to put
    if (Input.GetKeyDown(KeyCode.UpArrow))
    but it was not the solution I am looking for
    Thoughts?
     
  2. damniam0

    damniam0

    Joined:
    Apr 5, 2021
    Posts:
    6
    Here is the script- basicaly, cooldown needed
     

    Attached Files:

  3. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @damniam0

    Please paste the code here in code tags... not many will bother to open some random attached file.

    You'll have to keep track of grounded state of your character. When character is grounded, dash is not allowed. When character is not grounded, dashing is allowed.
     
    damniam0 likes this.