You need to translate the enemy using a Vector of random numbers. In Godot you generate pseudo-random numbers in a few ways:
First you generate 2 random numbers (or 3 if you have a 3D game and want the enemy to move in all three directions). Then you set the velocity of the enemy to be equal to the randomly generated numbers like this:
This moves the object by a random vector every tick of the game. You can make it more sophisticated.
Does this answer you question? Please Mark the answer as best if it does.
you cannot make a movement to the right and when you touch with the limit fence to the left, and from the left when you touch the limit to the right, and so