Clouds iteration and cleanup! rotation & scale (=

This commit is contained in:
Harmony Honey 2023-03-07 14:47:33 -05:00
parent f67bfb5f91
commit 6f75158372
2 changed files with 23 additions and 10 deletions

View file

@ -1,7 +1,7 @@
extends Node2D
onready var hide := $Hide
onready var circle := $Hide/Circle
onready var cloud := $Hide/Cloud
onready var color_rect := $Hide/ColorRect
onready var center := $Center
@ -60,16 +60,29 @@ func _physics_process(delta):
stars.rotate(deg2rad(star_speed * delta * -star_dir))
func create_clouds():
for i in clouds.get_children():
i.queue_free()
var i = 0
var gc = clouds.get_children()
var gcs = gc.size()
for x in 20:
for y in 3 + x:
var c = circle.duplicate()
clouds.add_child(c)
for x in (length / 50.0) + 5:
for y in max(3, x):
var c = null
if i < gcs:
c = gc[i]
else:
c = cloud.duplicate()
clouds.add_child(c)
c.owner = clouds
c.position = Vector2((x + 2) * 200, 0).rotated(rand_range(0.0, TAU))
c.position = Vector2(((x + 2) * 200) + rand_range(0.0, 100.0), 0).rotated(rand_range(0.0, TAU))
c.scale = Vector2.ONE * rand_range(0.25, 2.0)
c.rotation = randf() * TAU
c.visible = true
if c.position.length() > length + 500:
#c.color.a = lerp(c.color.a, 1.0, clamp((c.position.length() - (length + 700)) / 500.0, 0, 1))
c.color.a = 0.8
i += 1
if i < gcs:
for a in range(i, gcs):
gc[a].visible = false

View file

@ -28,7 +28,7 @@ script = ExtResource( 2 )
[node name="Hide" type="Node2D" parent="."]
visible = false
[node name="Circle" type="Polygon2D" parent="Hide"]
[node name="Cloud" type="Polygon2D" parent="Hide"]
material = SubResource( 1 )
color = Color( 1, 1, 1, 0.301961 )
polygon = PoolVector2Array( 156.458, -64.8071, 174.201, -54.2799, 188.104, -39.0379, 196.96, -20.4052, 200, 0, 196.96, 20.4052, 188.104, 39.0379, 174.201, 54.2799, 156.458, 64.8072, 161.56, 84.7968, 160.613, 105.405, 153.7, 124.843, 141.421, 141.421, 124.843, 153.7, 105.405, 160.613, 84.7968, 161.56, 64.8071, 156.458, 54.2799, 174.201, 39.0379, 188.104, 20.4052, 196.96, -8.74228e-06, 200, -20.4052, 196.96, -39.0379, 188.104, -54.2799, 174.201, -64.8072, 156.458, -84.7968, 161.56, -105.405, 160.613, -124.843, 153.7, -141.421, 141.421, -153.7, 124.843, -160.613, 105.405, -161.56, 84.7968, -156.458, 64.8071, -174.201, 54.2799, -188.104, 39.0379, -196.96, 20.4052, -200, -1.74846e-05, -196.96, -20.4052, -188.104, -39.038, -174.201, -54.2799, -156.458, -64.8072, -161.56, -84.7968, -160.613, -105.405, -153.7, -124.843, -141.421, -141.421, -124.843, -153.7, -105.405, -160.613, -84.7968, -161.56, -64.8071, -156.458, -54.2799, -174.201, -39.038, -188.104, -20.4052, -196.96, 2.38498e-06, -200, 20.4052, -196.96, 39.0379, -188.104, 54.2799, -174.201, 64.8071, -156.458, 84.7968, -161.56, 105.405, -160.613, 124.843, -153.7, 141.421, -141.421, 153.7, -124.843, 160.613, -105.405, 161.56, -84.7968 )