I need help spawning objects randomly in my 3D game.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By fraserj

H, I am making an Aim Training game in Godot and I have finished everything except for spawning the enemies, I would appreciate if someone could send me some code for me to copy and paste into my game for spawning the enemies and making them spawn randomly.

Asking for help would be describing a situation in which you are stuck, and the community could chime in on how they would proceed.
What you are asking for is not help, it’s work.
If you rephrase the “question” and go into detail about how it should work, people would be content with giving you directions.

zhyrin | 2023-05-05 08:05

:bust_in_silhouette: Reply From: godot_dev_

Here is a related post that should be a good starting point for spawning nodes in random locations. The solutions in those posts used the randi function to generate a random integer and bounded it using the modulo operator % to generated random x and y coordinates to create a random position. The randi_range function could also acheive a desired effect.