doubletap

doubletap

PostPosted by Steviebops » Tue Jul 30, 2013 6:33 pm

I've been trying to code a doubletap to dodge function using this.

Code: Select all
if (Input.GetKeyDown(KeyCode.W))
        {
            if ((Time.time - lastTapTime) < tapSpeed)
            {
                if (runMod == 0)
                {
                    runMod = 1;
                    Debug.Log("Running");
                }
            }
            else
            {
                if (!animation.IsPlaying("AnnaJumpForward"))
                {
                    runMod = 0;
                    Debug.Log("Walking");
                }
            }
            lastTapTime = Time.time;
        }
         if ((Input.GetKeyUp(KeyCode.W)
             || ((Time.time - lastTapTime) > lungeTime))
             && !animation.IsPlaying("AnnaJumpForward"))
         {
             runMod = 0;
             Debug.Log("Idle");
         }


My problem is, that once the animation begins, it requires the user to hold down the 'W' key to complete, if they release it, the animation ends. I want the jump to play to completion, once the button has been double tapped, with no interruption,is this possible with Sage?
I'm using a blend node to blend between walk and run blend graphs. The run graph contains the forward jump.
Steviebops
 
Posts: 9
Joined: Tue Jul 30, 2013 6:22 pm

Re: doubletap

PostPosted by AlteredReality » Tue Jul 30, 2013 9:08 pm

Yeah, you can do this with Sage. You'd definately want to handle the input external to sage though. When you want to trigger the dodge state, you could use a Trigger node in Sage to transition to your dodge state. You can reference the "StartFire" trigger in the included SoldierSL example. You'll also want to look at the documentation for the Trigger Node in the Sage documentation.

From there, the dodge state could handle when to transition out. Let me know if that answers your question.
Andy - Altered Reality
AlteredReality
Site Admin
 
Posts: 118
Joined: Fri Jan 06, 2012 8:31 pm

Re: doubletap

PostPosted by Steviebops » Wed Jul 31, 2013 7:06 am

Will do, thanks.
Steviebops
 
Posts: 9
Joined: Tue Jul 30, 2013 6:22 pm

Re: doubletap

PostPosted by AlteredReality » Wed Jul 31, 2013 9:43 am

Steviebops wrote:Will do, thanks.


Cool, let me know if you have any other questions.
Andy - Altered Reality
AlteredReality
Site Admin
 
Posts: 118
Joined: Fri Jan 06, 2012 8:31 pm


Return to Questions and Discussion

Who is online

Users browsing this forum: No registered users and 0 guests


Style by Gokinstudio | Free forum hosting by ProphpBB | Software by phpBB | Report Abuse | Privacy
cron