Bläddra i källkod

:wrench: Randomize waiting time

DricomDragon 2 år sedan
förälder
incheckning
d52254c693
2 ändrade filer med 10 tillägg och 1 borttagningar
  1. 6 0
      godot/component/entity/star/Repeater.gd
  2. 4 1
      godot/component/entity/star/Star.tscn

+ 6 - 0
godot/component/entity/star/Repeater.gd

@@ -0,0 +1,6 @@
+extends Timer
+
+
+func _on_timeout():
+	var waiting_time = randf_range(0.2, 4.0)
+	start(waiting_time)

+ 4 - 1
godot/component/entity/star/Star.tscn

@@ -1,8 +1,9 @@
-[gd_scene load_steps=4 format=3 uid="uid://bs4hylgxwbr8y"]
+[gd_scene load_steps=5 format=3 uid="uid://bs4hylgxwbr8y"]
 
 [ext_resource type="Script" path="res://component/entity/star/Star.gd" id="1_bl1jp"]
 [ext_resource type="AudioStream" uid="uid://j4mgj1tvivki" path="res://component/entity/star/hjm-tesla_sound_shot.wav" id="2_io5nk"]
 [ext_resource type="Script" path="res://component/entity/star/Sound.gd" id="3_dccmh"]
+[ext_resource type="Script" path="res://component/entity/star/Repeater.gd" id="4_33e8h"]
 
 [node name="Star" type="PathFollow2D"]
 script = ExtResource("1_bl1jp")
@@ -14,5 +15,7 @@ script = ExtResource("3_dccmh")
 [node name="Repeater" type="Timer" parent="."]
 wait_time = 2.431
 autostart = true
+script = ExtResource("4_33e8h")
 
 [connection signal="timeout" from="Repeater" to="Sound" method="_on_repeater_timeout"]
+[connection signal="timeout" from="Repeater" to="Repeater" method="_on_timeout"]