extends Node @export var star : PackedScene @export var stars_amount = 1000 @export var compress_space_amount = 0.5 func _ready(): var compress_multiplier = 1-compress_space_amount var map_width_halved = get_tree().current_scene.map_width * compress_multiplier var map_height_halved = get_tree().current_scene.map_height * compress_multiplier for i in range(stars_amount): var star_inst = star.instantiate() var x = randi_range(-map_width_halved, map_width_halved) var y = randi_range(-map_height_halved, map_height_halved) var distance = randi_range(0,get_child_count()-1) get_children()[distance].add_child(star_inst) star_inst.position = Vector2(x, y)