Done refactoring
This commit is contained in:
parent
3a136ff215
commit
2176e9d798
88 changed files with 821 additions and 880 deletions
14
scripts/misc/StarsGeneration.gd
Normal file
14
scripts/misc/StarsGeneration.gd
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
extends Node2D
|
||||
|
||||
@export var star : PackedScene
|
||||
@export var stars_amount = 1000
|
||||
|
||||
func _ready():
|
||||
var map_width_halved = get_tree().current_scene.map_width / 2
|
||||
var map_height_halved = get_tree().current_scene.map_height / 2
|
||||
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)
|
||||
add_child(star_inst)
|
||||
star_inst.position = Vector2(x, y)
|
||||
Loading…
Add table
Add a link
Reference in a new issue