Godot Version
4.3
Question
I am extremely new to GD code, and I really want to create a 2D AI movement that goes in all directions on the screen. The AI does not have the ability to jump as it’s flat down, but all the tutorials I searched have just led me to a side-view version of AI movement. Please help!
In my game, the base enemy scene has a Timer
child node. When the timeout
signal fires, a method rolls a new velocity.x
and velocity.y
using randf_range
. (Within range of -1
to 1
.)
There’s extra bits of code to ensure the enemy doesn’t do silly things like constantly grate its face against a wall, but in essence my random movement code is exactly like I described-- a Timer
node and three lines of code.
1 Like