How to make enemy randomly spawn within a specific area?
Hey so I’m very new to Godot and I’m currently trying to make an enemy randomly spawn within a specific area. My original idea on how to do this was to find the x and y of the collision shape and then to randomly generate a range between the origin point(of said collision shape) , and the origin point + x. (And i would do the same for y) Then to try set these coordinates as where the enemy would spawn.
I couldn’t get it to work and I don’t know if that is even the best way to accomplish this.
Well, the way you described it is a totally valid way to do it. Try to do it with code and if you have any issues - share your code here and we can debug it together.
Hint: you can use randi_range() to generate a random integer within a specified range for your X and Y coordinates.