fix: music switching
This commit is contained in:
@@ -8,10 +8,26 @@
|
||||
clip_count = 2
|
||||
clip_0/name = &"Base"
|
||||
clip_0/stream = ExtResource("1_5vxup")
|
||||
clip_0/auto_advance = 0
|
||||
clip_0/auto_advance = 1
|
||||
clip_0/next_clip = 0
|
||||
clip_1/name = &"Boss"
|
||||
clip_1/stream = ExtResource("2_w5q55")
|
||||
clip_1/auto_advance = 0
|
||||
clip_1/auto_advance = 1
|
||||
clip_1/next_clip = 1
|
||||
_transitions = {
|
||||
Vector2i(-1, -1): {
|
||||
"fade_beats": 2.0,
|
||||
"fade_mode": 3,
|
||||
"from_time": 2,
|
||||
"to_time": 2
|
||||
},
|
||||
Vector2i(1, 1): {
|
||||
"fade_beats": 2.0,
|
||||
"fade_mode": 3,
|
||||
"from_time": 2,
|
||||
"to_time": 2
|
||||
}
|
||||
}
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_khlsn"]
|
||||
|
||||
@@ -22,12 +38,18 @@ script = ExtResource("1_w5q55")
|
||||
stream = SubResource("AudioStreamInteractive_lr66j")
|
||||
|
||||
[node name="BossArea" type="Area2D" parent="."]
|
||||
collision_layer = 16
|
||||
collision_mask = 16
|
||||
collision_layer = 31
|
||||
collision_mask = 31
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="BossArea"]
|
||||
scale = Vector2(50, 50)
|
||||
shape = SubResource("CircleShape2D_khlsn")
|
||||
|
||||
[connection signal="area_entered" from="BossArea" to="." method="_on_boss_area_entered"]
|
||||
[connection signal="area_exited" from="BossArea" to="." method="_on_boss_area_exited"]
|
||||
[node name="ColorRect" type="ColorRect" parent="BossArea/CollisionShape2D"]
|
||||
offset_left = -10.0
|
||||
offset_top = -10.0
|
||||
offset_right = 10.0
|
||||
offset_bottom = 10.0
|
||||
|
||||
[connection signal="body_entered" from="BossArea" to="." method="_on_boss_area_body_entered"]
|
||||
[connection signal="body_exited" from="BossArea" to="." method="_on_boss_area_body_exited"]
|
||||
|
||||
@@ -4,19 +4,11 @@ func _ready() -> void:
|
||||
$AudioStreamPlayer.play()
|
||||
|
||||
|
||||
func _on_boss_area_entered(_body: Node2D) -> void:
|
||||
func _on_boss_area_body_entered(_body: Node2D) -> void:
|
||||
print_debug("Boss area entered")
|
||||
if $AudioStreamPlayer["parameters/switch_to_clip"] == "Boss":
|
||||
print_debug("Already in boss music")
|
||||
return
|
||||
|
||||
$AudioStreamPlayer["parameters/switch_to_clip"] = "-> Boss"
|
||||
$AudioStreamPlayer.get_stream_playback().switch_to_clip_by_name("Boss")
|
||||
|
||||
|
||||
func _on_boss_area_exited(_body: Node2D) -> void:
|
||||
func _on_boss_area_body_exited(_body: Node2D) -> void:
|
||||
print_debug("Boss area exited")
|
||||
if $AudioStreamPlayer["parameters/switch_to_clip"] == "Base":
|
||||
print_debug("Already in base music")
|
||||
return
|
||||
|
||||
$AudioStreamPlayer["parameters/switch_to_clip"] = "-> Base"
|
||||
$AudioStreamPlayer.get_stream_playback().switch_to_clip_by_name("Base")
|
||||
|
||||
Reference in New Issue
Block a user