A little folders cleanup
This commit is contained in:
parent
997e3c0982
commit
545da7be1f
90 changed files with 68 additions and 1661 deletions
|
|
@ -1,25 +0,0 @@
|
|||
extends Node
|
||||
|
||||
## Star scene
|
||||
@export var star : PackedScene
|
||||
## Affects how many stars will be generated and places on whole system
|
||||
@export var stars_amount = 1000
|
||||
## Affects how much space on borders of the star system will be empty
|
||||
@export_range(0, 1) var compress_space_amount = 0.1
|
||||
## Shortcut to get_parent()
|
||||
@onready var star_system: = get_parent()
|
||||
|
||||
func _ready():
|
||||
var compress_multiplier = 1.0 - compress_space_amount
|
||||
var parallax_layers = get_children()
|
||||
var width_halved = star_system.width / 2
|
||||
var height_halved = star_system.height / 2
|
||||
for i in range(stars_amount):
|
||||
var star_inst = star.instantiate()
|
||||
var x = randi_range(-width_halved, width_halved) * compress_multiplier
|
||||
var y = randi_range(-height_halved, height_halved) * compress_multiplier
|
||||
# Decides parallax layer which star belongs to
|
||||
var distance = randi_range(0, get_child_count() - 1)
|
||||
parallax_layers[distance].add_child(star_inst)
|
||||
var position = Vector2(x, y)
|
||||
star_inst.position = position
|
||||
Loading…
Add table
Add a link
Reference in a new issue