mirror of
https://github.com/Escada-Games/diver-down.git
synced 2026-01-23 09:25:09 +00:00
49 lines
1.5 KiB
Text
49 lines
1.5 KiB
Text
[gd_scene load_steps=4 format=2]
|
|
|
|
[ext_resource path="res://Resources/Textures/white.png" type="Texture" id=1]
|
|
|
|
[sub_resource type="GDScript" id=1]
|
|
script/source = "extends RigidBody2D
|
|
var colors=[Color('3a5339'),Color('394071')]
|
|
var direction=Vector2(0,-1)
|
|
func _ready():
|
|
randomize()
|
|
self.modulate=colors[0] if randf()<0.6 else colors[1]
|
|
$timer.wait_time=rand_range(1,5)
|
|
$timer.start()
|
|
var variation = Vector2(
|
|
rand_range(-50.0,50.0) if direction.x == 0 else 0.0,\\
|
|
rand_range(-50.0,50.0) if direction.y==0 else 0.0
|
|
)
|
|
self.linear_velocity=direction*rand_range(-200,200)+variation
|
|
|
|
func _on_timer_timeout():
|
|
$twn_fade.interpolate_property(self, 'modulate:a', self.modulate.a, 0, 1, Tween.TRANS_QUART, Tween.EASE_IN, 0.2)
|
|
$twn_fade.start()
|
|
|
|
func _on_twn_fade_tween_completed(_object, _key) -> void:
|
|
self.queue_free()
|
|
"
|
|
|
|
[sub_resource type="RectangleShape2D" id=2]
|
|
extents = Vector2( 1, 1 )
|
|
|
|
[node name="drop" type="RigidBody2D"]
|
|
collision_layer = 0
|
|
collision_mask = 4
|
|
gravity_scale = 4.0
|
|
script = SubResource( 1 )
|
|
|
|
[node name="timer" type="Timer" parent="."]
|
|
|
|
[node name="twn_fade" type="Tween" parent="."]
|
|
|
|
[node name="sprite" type="Sprite" parent="."]
|
|
scale = Vector2( 2, 2 )
|
|
texture = ExtResource( 1 )
|
|
|
|
[node name="collision_shape_2d" type="CollisionShape2D" parent="."]
|
|
shape = SubResource( 2 )
|
|
|
|
[connection signal="timeout" from="timer" to="." method="_on_timer_timeout"]
|
|
[connection signal="tween_completed" from="twn_fade" to="." method="_on_twn_fade_tween_completed"]
|