瀏覽代碼

:tada: Replace time trigger by space trigger

Need to be manually located though.
DricomDragon 2 年之前
父節點
當前提交
a0db51f00a

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

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

+ 4 - 4
godot/component/entity/star/Sound.gd

@@ -5,10 +5,6 @@ const PITCH_MIN = 0.8
 const PITCH_MAX = 2.6
 
 
-func _ready():
-	trigger()
-
-
 func _on_repeater_timeout():
 	trigger()
 
@@ -16,3 +12,7 @@ func _on_repeater_timeout():
 func trigger():
 	set_pitch_scale(randf_range(PITCH_MIN, PITCH_MAX))
 	play(0.0)
+
+
+func _on_trigger_area_entered(area):
+	trigger()

+ 7 - 7
godot/component/entity/star/Star.tscn

@@ -3,7 +3,8 @@
 [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"]
+
+[sub_resource type="CircleShape2D" id="CircleShape2D_6ypex"]
 
 [node name="Star" type="PathFollow2D"]
 script = ExtResource("1_bl1jp")
@@ -12,10 +13,9 @@ script = ExtResource("1_bl1jp")
 stream = ExtResource("2_io5nk")
 script = ExtResource("3_dccmh")
 
-[node name="Repeater" type="Timer" parent="."]
-wait_time = 2.431
-autostart = true
-script = ExtResource("4_33e8h")
+[node name="Trigger" type="Area2D" parent="."]
+
+[node name="Circle" type="CollisionShape2D" parent="Trigger"]
+shape = SubResource("CircleShape2D_6ypex")
 
-[connection signal="timeout" from="Repeater" to="Sound" method="_on_repeater_timeout"]
-[connection signal="timeout" from="Repeater" to="Repeater" method="_on_timeout"]
+[connection signal="area_entered" from="Trigger" to="Sound" method="_on_trigger_area_entered"]

+ 9 - 0
godot/component/entity/trigger/Trigger.tscn

@@ -0,0 +1,9 @@
+[gd_scene load_steps=2 format=3 uid="uid://dkltla4rn3vgv"]
+
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_0kdn5"]
+
+[node name="Trigger" type="Area2D"]
+position = Vector2(640, 448)
+
+[node name="Detector" type="CollisionShape2D" parent="."]
+shape = SubResource("RectangleShape2D_0kdn5")

+ 22 - 5
godot/world.tscn

@@ -1,6 +1,7 @@
-[gd_scene load_steps=5 format=3 uid="uid://bs8crkburdpjc"]
+[gd_scene load_steps=6 format=3 uid="uid://bs8crkburdpjc"]
 
 [ext_resource type="PackedScene" uid="uid://bs4hylgxwbr8y" path="res://component/entity/star/Star.tscn" id="1_wa4bn"]
+[ext_resource type="PackedScene" uid="uid://dkltla4rn3vgv" path="res://component/entity/trigger/Trigger.tscn" id="3_h3i8n"]
 [ext_resource type="PackedScene" uid="uid://bw4uy776cvn5o" path="res://component/entity/line/Line.tscn" id="3_l2vrj"]
 
 [sub_resource type="Curve2D" id="Curve2D_i8apf"]
@@ -24,11 +25,11 @@ modulate = Color(1, 0, 1, 1)
 curve = SubResource("Curve2D_i8apf")
 
 [node name="ProtoStar" parent="Lines/BassLine" instance=ExtResource("1_wa4bn")]
-position = Vector2(246, 1065)
+position = Vector2(64, 64)
 rotates = false
 
 [node name="SecondStar" parent="Lines/BassLine" instance=ExtResource("1_wa4bn")]
-position = Vector2(799.253, 427.169)
+position = Vector2(167.134, 729.784)
 progress = 4210.26
 rotates = false
 
@@ -37,10 +38,26 @@ modulate = Color(1, 0, 0, 1)
 curve = SubResource("Curve2D_yypd3")
 
 [node name="ElioStar" parent="Lines/NiceLine" instance=ExtResource("1_wa4bn")]
-position = Vector2(246, 1065)
+position = Vector2(1856, 320)
 rotates = false
 
 [node name="MiniStar" parent="Lines/NiceLine" instance=ExtResource("1_wa4bn")]
-position = Vector2(839.908, 746.409)
+position = Vector2(1354.87, 64)
 progress = 4210.26
 rotates = false
+
+[node name="Triggers" type="Node2D" parent="."]
+
+[node name="Trigger" parent="Triggers" instance=ExtResource("3_h3i8n")]
+
+[node name="Trigger2" parent="Triggers" instance=ExtResource("3_h3i8n")]
+position = Vector2(768, 448)
+
+[node name="Trigger3" parent="Triggers" instance=ExtResource("3_h3i8n")]
+position = Vector2(720, 640)
+
+[node name="Trigger4" parent="Triggers" instance=ExtResource("3_h3i8n")]
+position = Vector2(128, 720)
+
+[node name="Trigger5" parent="Triggers" instance=ExtResource("3_h3i8n")]
+position = Vector2(672, 856)