Files
fps_project_1/scripts/cloudSpawner.gd
2025-03-31 22:31:59 -05:00

23 lines
596 B
GDScript

extends CSGBox3D
@export var number_of_clouds : int = 50
@export var cloud = preload("res://cloud1.tscn")
func _ready() -> void:
spawn_clouds()
func spawn_clouds():
print("SPAWNING CLOUDS")
while number_of_clouds >= 0:
number_of_clouds -= 1
var x : float = randf_range(size.x / 2, -size.x /2)
var y : float = randf_range(size.y/ 2, -size.y /2)
var z : float = randf_range(size.z / 2, -size.z /2)
var spawn_pos = Vector3(x,y,z)
var cloud = cloud.instantiate()
add_child(cloud)
cloud.global_position = self.global_position + spawn_pos
print("CLOUD POS : ",spawn_pos)