0 votes

Here is my code so far and it is randomly moving at every tick of the game, but I want it to move preferably every 1 to 2 seconds:

extends StaticBody
var rng = 0

var speed = 0.5

func process(delta):
randomize()
rng = rand
range(-30.0, 30.0)
translate(Vector3(rng,0,rng)*delta)

in Engine by (12 points)

1 Answer

0 votes

add a timer to the scene with one_shot set to false and autostart to true, connect timeoutto some method, and resolve all this movement code in this method

by (8,101 points)
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.