0 votes

i was trying to make my player to dash in a short amount of time. But it dashed once and didnt dash again at all. And there was no issue with my scripting. And i think timer nodes might doesnt work well inside signals. or there is a problem with my scriipting?

And i was trying to troubleshoot, then what i found is that cool_down node doesnt start.

Here is my script:

dash_av = 1

if Input.isactionjustpressed("player1dash") and Input.isactionpressed("uiright"):
if Input.is
actionjustpressed("player1dash") and Input.isactionpressed("uileft"):

func dash():
maxspeed = 1500
motion.y += gravity * 2
acc = 2000
av = 0

func ondashtimetimeout():
maxspeed = 500
acc = 100

func ondashcooldowntimeout():
dash_av = 1

in Engine by (14 points)

1 Answer

0 votes

Here is the code I test, it work.

var dash_av = 1

func _ready():
    $dash_time.one_shot = true
    $dash_cooldown.one_shot = true

func _input(event):
    if event is InputEventKey:
        if Input.is_action_pressed("ui_right") and dash_av == 1:
        if Input.is_action_pressed("ui_left") and dash_av == 1:

func dash():
    dash_av = 0

func dash_time_timeout():

func dash_cooldown_timeout():
    dash_av = 1
by (603 points)

TY so much, it worked

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.