0 votes

Hello!
Can anyone please write here code that would randomise enemy's random walking (2D tiles set)
When i learned Gamemaker, there was a code that kinda choosed 1 from 4 numbers, and depending on the number it chose, it went diferent way, it also had a stall code that made it look like it walks, then stops to think about reason of life,lol, and then goes somewhere else again.
Thank you! :)

in Engine by (227 points)

1 Answer

+1 vote

randi() % 4 returns a random number between 0 and 3 (inclusive).
The rest of the code depends on how you have set up your scene.

by (711 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.