- Home /
Question by
clayton1314 · Aug 05, 2019 at 09:58 AM ·
scripting problem
Double Tap to DASH not resting, how do I fix it?
So I went through a couple of tutorials online and made a DoubleTap Dash but there is a problem the dash doesn't reset once the double-tap is done running. how do i reset it?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DoubleTap : Dashing
{
public float tapSpeed = 0.5f; //in seconds
private float lastTapTime = 0;
// Use this for initialization
void Start()
{
lastTapTime = 0;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.A))
{
if ((Time.time - lastTapTime) < tapSpeed)
{
Debug.Log("Double tap");
}
lastTapTime = Time.time;
}
}
}
Comment
What does "reset" mean in this context? Please describe what this is supposed to do from start to finish
The script allows me to dash left when I press the A $$anonymous$$ey twice but this happens only once then afterward whenever I $$anonymous$$eyup A the dash happens.