-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: speed up music with difficulty
- Loading branch information
1 parent
1afc405
commit bc301bc
Showing
9 changed files
with
33 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
extends AudioStreamPlayer | ||
|
||
const SPEED_UP_FACTOR = 0.04 | ||
|
||
func _ready(): | ||
GameEvents.difficulty_changed.connect(on_new_difficulty) | ||
|
||
|
||
func on_new_difficulty(difficulty: float): | ||
pitch_scale = min(1.0 + (difficulty * SPEED_UP_FACTOR), 3.0) | ||
var bus_pitch_effect = AudioServer.get_bus_effect(AudioServer.get_bus_index("Music"), 0) | ||
bus_pitch_effect.pitch_scale = 1.0 / pitch_scale | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://f18mif5mqetj"] | ||
[gd_scene load_steps=3 format=3 uid="uid://f18mif5mqetj"] | ||
|
||
[ext_resource type="AudioStream" uid="uid://b58s30aknuxhm" path="res://assets/audio/a-little-bird-shows-the-way.wav" id="1_lbsty"] | ||
[ext_resource type="Script" path="res://scenes/autoload/music_player.gd" id="2_35173"] | ||
|
||
[node name="MusicPlayer" type="AudioStreamPlayer"] | ||
process_mode = 3 | ||
stream = ExtResource("1_lbsty") | ||
volume_db = -15.0 | ||
autoplay = true | ||
bus = &"Music" | ||
script = ExtResource("2_35173") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters