0 votes

How to make 10 second timer and when jetPack(kinematicbody2D) up stop?

Example image:

in Engine by (30 points)
edited by

Add a Timer component.

Go to Inspector set the wait_time to 10 and then click in Node.

Double click in timeout() and link to your script. This will create a function ontimer_timeout() in your script. Write the code to set the motion or velocity to 0.

Somewhere in your code, activate the timer:

if Input.is_action_just_pressed("ui_up") :

      if get_node("Timer").is_stopped():

Don't forget to stop the timer. You may use the option one shot for this or in your script inside ontimer_timeout() write get_node("Timer").stop()

P.s.: Depending of the nodes you may use getparent().getnode("Timer")

I'll edit

Alex Pires, thank
I got

Please log in or register to answer this question.

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 Frequently asked questions and 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 [email protected] with your username.