fix music not playing in exported builds
This commit is contained in:
parent
6a59b54c11
commit
203696e022
45 changed files with 357 additions and 321 deletions
|
@ -1,79 +1,8 @@
|
|||
[gd_scene load_steps=10 format=3 uid="uid://df5m716pd6mej"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://df5m716pd6mej"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_vumbr"]
|
||||
bounce = 0.2
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_rvq6k"]
|
||||
script/source = "extends RigidBody3D
|
||||
|
||||
var stream_players: Array[AudioStreamPlayer] = []
|
||||
|
||||
func makeAudioStreamPlayers(music_name: String):
|
||||
var path: String = \"res://music/\" + music_name
|
||||
var dir: DirAccess = DirAccess.open(path)
|
||||
var file_paths: Array[String] = []
|
||||
|
||||
assert(dir, path + \" is not a valid path!\")
|
||||
if dir:
|
||||
dir.list_dir_begin()
|
||||
var file_name = dir.get_next()
|
||||
while file_name != \"\":
|
||||
if !dir.current_is_dir():
|
||||
if file_name.ends_with(\".ogg\"):
|
||||
file_paths.push_back(path + \"/\" + file_name)
|
||||
file_name = dir.get_next()
|
||||
assert(len(file_paths), path + \" had no .ogg files!\")
|
||||
|
||||
var players: Array[AudioStreamPlayer] = []
|
||||
for file_path in file_paths:
|
||||
var stream: AudioStreamOggVorbis = AudioStreamOggVorbis.load_from_file(file_path)
|
||||
stream.loop = true
|
||||
stream.bpm = 124
|
||||
|
||||
var player: AudioStreamPlayer = AudioStreamPlayer.new()
|
||||
player.name = file_path.substr(10)
|
||||
player.stream = stream
|
||||
player.volume_db = -50
|
||||
players.push_back(player)
|
||||
add_child(player)
|
||||
|
||||
stream_players = players
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var level = get_parent().get_parent()
|
||||
if is_instance_valid(level) and level is Node3D:
|
||||
makeAudioStreamPlayers(level.name.to_lower())
|
||||
for player in stream_players:
|
||||
player.play()
|
||||
|
||||
func handleMusicWithVelocity(velocity: float, delta: float) -> void:
|
||||
var instruments_needed = floor(velocity / 7)
|
||||
var instruments_playing = stream_players.filter(func(p: AudioStreamPlayer): return p.volume_db > -50)
|
||||
|
||||
for index_p in len(instruments_playing):
|
||||
var playing = instruments_playing[index_p]
|
||||
if index_p + 1 > instruments_needed:
|
||||
playing.volume_db -= delta * 32
|
||||
elif playing.volume_db <= 0:
|
||||
playing.volume_db += delta * 8
|
||||
|
||||
if instruments_needed > len(instruments_playing):
|
||||
var instruments_not_playing = stream_players.filter(func(p: AudioStreamPlayer): return p.volume_db <= -50)
|
||||
if len(instruments_not_playing):
|
||||
var to_play = instruments_not_playing.pick_random()
|
||||
if is_instance_valid(to_play):
|
||||
to_play.volume_db += delta * 16
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
for player in stream_players:
|
||||
if player.volume_db > 0:
|
||||
player.volume_db = 0
|
||||
var velocity: float = abs(self.linear_velocity.x) + abs(self.linear_velocity.y)
|
||||
handleMusicWithVelocity(velocity, delta)
|
||||
"
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_xfgrm"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_bgp4x"]
|
||||
|
@ -105,7 +34,6 @@ collision_priority = 100.0
|
|||
axis_lock_linear_z = true
|
||||
physics_material_override = SubResource("PhysicsMaterial_vumbr")
|
||||
contact_monitor = true
|
||||
script = SubResource("GDScript_rvq6k")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("SphereShape3D_xfgrm")
|
||||
|
|
30
index.tscn
30
index.tscn
|
@ -82,6 +82,21 @@ shadow_size = 2
|
|||
shadow_color = Color(0, 0, 0, 1)
|
||||
shadow_offset = Vector2(0, 0)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_glb01"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_75r06"]
|
||||
resource_name = "fadeout"
|
||||
step = 0.5
|
||||
|
@ -98,21 +113,6 @@ tracks/0/keys = {
|
|||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_glb01"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_5cb2g"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_glb01"),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://b0mhosbyt1fit"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://b0mhosbyt1fit"]
|
||||
|
||||
[ext_resource type="Material" uid="uid://brwwlwb1rpro7" path="res://graphics/unhappy_material.tres" id="1_dwsqy"]
|
||||
[ext_resource type="PackedScene" uid="uid://ygvokp5f78i5" path="res://levels/base/environment.tscn" id="1_n7fd8"]
|
||||
|
@ -6,6 +6,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://cnnvwotv33u1b" path="res://elements/player.tscn" id="2_b00jj"]
|
||||
[ext_resource type="PackedScene" uid="uid://cpm3laywhlbq5" path="res://elements/ring.tscn" id="3_hel5x"]
|
||||
[ext_resource type="PackedScene" uid="uid://c77bli40240nk" path="res://elements/sign.tscn" id="4_atq6y"]
|
||||
[ext_resource type="PackedScene" uid="uid://cgt5st4qacruw" path="res://levels/base/music.tscn" id="4_uq42r"]
|
||||
|
||||
[node name="Base" type="Node3D"]
|
||||
script = ExtResource("1_rj40i")
|
||||
|
@ -13,6 +14,8 @@ metadata/material = ExtResource("1_dwsqy")
|
|||
|
||||
[node name="Environment" parent="." instance=ExtResource("1_n7fd8")]
|
||||
|
||||
[node name="Music" parent="." instance=ExtResource("4_uq42r")]
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("2_b00jj")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 13.2075, 0)
|
||||
|
||||
|
|
30
levels/base/music.tscn
Normal file
30
levels/base/music.tscn
Normal file
|
@ -0,0 +1,30 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://cgt5st4qacruw"]
|
||||
|
||||
[ext_resource type="AudioStream" uid="uid://b46a7y6vdqd4n" path="res://levels/base/music/hihat-closed.ogg" id="1_shxcq"]
|
||||
[ext_resource type="Script" path="res://levels/music.gd" id="1_y1f1r"]
|
||||
[ext_resource type="AudioStream" uid="uid://buag3j2s22jpo" path="res://levels/base/music/hihat-open.ogg" id="3_xb717"]
|
||||
[ext_resource type="AudioStream" uid="uid://djmbrvp7k263k" path="res://levels/base/music/kick2.ogg" id="4_1da6f"]
|
||||
[ext_resource type="AudioStream" uid="uid://dma7btls87mg4" path="res://levels/base/music/kick.ogg" id="5_7thjx"]
|
||||
[ext_resource type="AudioStream" uid="uid://dqeupvkvaoypg" path="res://levels/base/music/sequencer.ogg" id="6_km1j8"]
|
||||
[ext_resource type="AudioStream" uid="uid://dq88q86etj27v" path="res://levels/base/music/synth.ogg" id="7_qjsvw"]
|
||||
|
||||
[node name="Music" type="Node"]
|
||||
script = ExtResource("1_y1f1r")
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("1_shxcq")
|
||||
|
||||
[node name="AudioStreamPlayer2" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("3_xb717")
|
||||
|
||||
[node name="AudioStreamPlayer3" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("4_1da6f")
|
||||
|
||||
[node name="AudioStreamPlayer4" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("5_7thjx")
|
||||
|
||||
[node name="AudioStreamPlayer5" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("6_km1j8")
|
||||
|
||||
[node name="AudioStreamPlayer6" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("7_qjsvw")
|
19
levels/base/music/hihat-closed.ogg.import
Normal file
19
levels/base/music/hihat-closed.ogg.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://b46a7y6vdqd4n"
|
||||
path="res://.godot/imported/hihat-closed.ogg-a4fd4ac57f9bcbf8863b75bd01bfa84c.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://levels/base/music/hihat-closed.ogg"
|
||||
dest_files=["res://.godot/imported/hihat-closed.ogg-a4fd4ac57f9bcbf8863b75bd01bfa84c.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
19
levels/base/music/hihat-open.ogg.import
Normal file
19
levels/base/music/hihat-open.ogg.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://buag3j2s22jpo"
|
||||
path="res://.godot/imported/hihat-open.ogg-1ff17e1f7eb655a882114a76a47bf45d.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://levels/base/music/hihat-open.ogg"
|
||||
dest_files=["res://.godot/imported/hihat-open.ogg-1ff17e1f7eb655a882114a76a47bf45d.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
19
levels/base/music/kick.ogg.import
Normal file
19
levels/base/music/kick.ogg.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://dma7btls87mg4"
|
||||
path="res://.godot/imported/kick.ogg-e994457ca45e35e03f573f3e5d305b6d.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://levels/base/music/kick.ogg"
|
||||
dest_files=["res://.godot/imported/kick.ogg-e994457ca45e35e03f573f3e5d305b6d.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
19
levels/base/music/kick2.ogg.import
Normal file
19
levels/base/music/kick2.ogg.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://djmbrvp7k263k"
|
||||
path="res://.godot/imported/kick2.ogg-21697d8d81705122a16bf20ab5ca580f.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://levels/base/music/kick2.ogg"
|
||||
dest_files=["res://.godot/imported/kick2.ogg-21697d8d81705122a16bf20ab5ca580f.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
19
levels/base/music/sequencer.ogg.import
Normal file
19
levels/base/music/sequencer.ogg.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://dqeupvkvaoypg"
|
||||
path="res://.godot/imported/sequencer.ogg-65c6b6dc33eb8e40d40f72a512bea430.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://levels/base/music/sequencer.ogg"
|
||||
dest_files=["res://.godot/imported/sequencer.ogg-65c6b6dc33eb8e40d40f72a512bea430.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
19
levels/base/music/synth.ogg.import
Normal file
19
levels/base/music/synth.ogg.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://dq88q86etj27v"
|
||||
path="res://.godot/imported/synth.ogg-7c8d21e195e06939f83b74f7e0b8db8c.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://levels/base/music/synth.ogg"
|
||||
dest_files=["res://.godot/imported/synth.ogg-7c8d21e195e06939f83b74f7e0b8db8c.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://dfvuxfxc6ooya"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://dfvuxfxc6ooya"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://w4h8ip754qnb" path="res://levels/forest/environment.tscn" id="1_7clrg"]
|
||||
[ext_resource type="Script" path="res://levels/level.gd" id="1_fdxcj"]
|
||||
[ext_resource type="PackedScene" uid="uid://cnnvwotv33u1b" path="res://elements/player.tscn" id="2_mjogx"]
|
||||
[ext_resource type="PackedScene" uid="uid://dp8nvfm55te85" path="res://levels/forest/music.tscn" id="3_n1xsx"]
|
||||
[ext_resource type="PackedScene" uid="uid://cpm3laywhlbq5" path="res://elements/ring.tscn" id="4_p8yhq"]
|
||||
|
||||
[node name="Forest" type="Node3D"]
|
||||
|
@ -10,6 +11,8 @@ script = ExtResource("1_fdxcj")
|
|||
|
||||
[node name="Environment" parent="." instance=ExtResource("1_7clrg")]
|
||||
|
||||
[node name="Music" parent="." instance=ExtResource("3_n1xsx")]
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("2_mjogx")]
|
||||
|
||||
[node name="Rings" type="Node3D" parent="."]
|
||||
|
|
30
levels/forest/music.tscn
Normal file
30
levels/forest/music.tscn
Normal file
|
@ -0,0 +1,30 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://dp8nvfm55te85"]
|
||||
|
||||
[ext_resource type="Script" path="res://levels/music.gd" id="1_whsrg"]
|
||||
[ext_resource type="AudioStream" uid="uid://pn2b2f3egpck" path="res://levels/forest/music/dong2.ogg" id="2_pm2p2"]
|
||||
[ext_resource type="AudioStream" uid="uid://dghw6a7i3adcu" path="res://levels/forest/music/dong.ogg" id="3_1eawt"]
|
||||
[ext_resource type="AudioStream" uid="uid://bu4kmowmputnr" path="res://levels/forest/music/hihat-closed.ogg" id="4_kv4yx"]
|
||||
[ext_resource type="AudioStream" uid="uid://cbgimkc8fi4q3" path="res://levels/forest/music/hihat-open.ogg" id="5_lqsu1"]
|
||||
[ext_resource type="AudioStream" uid="uid://b5rl0nf2bawbr" path="res://levels/forest/music/kick.ogg" id="6_hqf73"]
|
||||
[ext_resource type="AudioStream" uid="uid://76mr4g8vfex2" path="res://levels/forest/music/synth.ogg" id="7_ix2vi"]
|
||||
|
||||
[node name="Music" type="Node"]
|
||||
script = ExtResource("1_whsrg")
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("2_pm2p2")
|
||||
|
||||
[node name="AudioStreamPlayer2" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("3_1eawt")
|
||||
|
||||
[node name="AudioStreamPlayer3" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("4_kv4yx")
|
||||
|
||||
[node name="AudioStreamPlayer4" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("5_lqsu1")
|
||||
|
||||
[node name="AudioStreamPlayer5" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("6_hqf73")
|
||||
|
||||
[node name="AudioStreamPlayer6" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("7_ix2vi")
|
19
levels/forest/music/dong.ogg.import
Normal file
19
levels/forest/music/dong.ogg.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://dghw6a7i3adcu"
|
||||
path="res://.godot/imported/dong.ogg-115b60b551ec8e344fc7b99c431af8ba.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://levels/forest/music/dong.ogg"
|
||||
dest_files=["res://.godot/imported/dong.ogg-115b60b551ec8e344fc7b99c431af8ba.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
19
levels/forest/music/dong2.ogg.import
Normal file
19
levels/forest/music/dong2.ogg.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://pn2b2f3egpck"
|
||||
path="res://.godot/imported/dong2.ogg-585cbd4ce8c067321831fa9a8385d768.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://levels/forest/music/dong2.ogg"
|
||||
dest_files=["res://.godot/imported/dong2.ogg-585cbd4ce8c067321831fa9a8385d768.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
19
levels/forest/music/hihat-closed.ogg.import
Normal file
19
levels/forest/music/hihat-closed.ogg.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://bu4kmowmputnr"
|
||||
path="res://.godot/imported/hihat-closed.ogg-b5faf2a89cd0678ed48976cb1037a27a.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://levels/forest/music/hihat-closed.ogg"
|
||||
dest_files=["res://.godot/imported/hihat-closed.ogg-b5faf2a89cd0678ed48976cb1037a27a.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
19
levels/forest/music/hihat-open.ogg.import
Normal file
19
levels/forest/music/hihat-open.ogg.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://cbgimkc8fi4q3"
|
||||
path="res://.godot/imported/hihat-open.ogg-9d01bf65188a2c57b01d882fe3aa4d2d.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://levels/forest/music/hihat-open.ogg"
|
||||
dest_files=["res://.godot/imported/hihat-open.ogg-9d01bf65188a2c57b01d882fe3aa4d2d.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
19
levels/forest/music/kick.ogg.import
Normal file
19
levels/forest/music/kick.ogg.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://b5rl0nf2bawbr"
|
||||
path="res://.godot/imported/kick.ogg-6ee78d8b6c4eec3b73cc3fa21c04068f.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://levels/forest/music/kick.ogg"
|
||||
dest_files=["res://.godot/imported/kick.ogg-6ee78d8b6c4eec3b73cc3fa21c04068f.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
19
levels/forest/music/synth.ogg.import
Normal file
19
levels/forest/music/synth.ogg.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://76mr4g8vfex2"
|
||||
path="res://.godot/imported/synth.ogg-916c165d0a1ca07d9bef74a3789385e5.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://levels/forest/music/synth.ogg"
|
||||
dest_files=["res://.godot/imported/synth.ogg-916c165d0a1ca07d9bef74a3789385e5.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -4,13 +4,20 @@ var rings_count = 72727
|
|||
var finished_rings_count = 0
|
||||
var rings: Array[Node] = []
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
var stream_players: Array[AudioStreamPlayer] = []
|
||||
|
||||
func _ready() -> void:
|
||||
var music_node = get_node("Music")
|
||||
assert(is_instance_valid(music_node), self.name + " has no music!")
|
||||
var music = music_node.get_children()
|
||||
for music_player in music:
|
||||
if music_player is AudioStreamPlayer:
|
||||
stream_players.push_back(music_player)
|
||||
|
||||
var rings_node = get_node("Rings")
|
||||
assert(is_instance_valid(rings_node), self.name + " has no rings!")
|
||||
rings = rings_node.get_children()
|
||||
rings_count = len(rings)
|
||||
|
||||
for ring in rings:
|
||||
ring.connect("collect_signal", do_we_end_yet)
|
||||
|
||||
|
@ -20,3 +27,23 @@ func do_we_end_yet():
|
|||
var game = get_parent().get_parent()
|
||||
if is_instance_valid(game) and game.has_method("stop_level"):
|
||||
game.stop_level()
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
var sphere = $Player/Sphere
|
||||
var velocity: float = abs(sphere.linear_velocity.x) + abs(sphere.linear_velocity.y)
|
||||
var instruments_needed = floor(velocity / 8)
|
||||
var instruments_playing = stream_players.filter(func(p: AudioStreamPlayer): return p.volume_db > -50)
|
||||
|
||||
for index_p in len(instruments_playing):
|
||||
var playing = instruments_playing[index_p]
|
||||
if index_p + 1 > instruments_needed:
|
||||
playing.volume_db = max(playing.volume_db - (delta * 32), -50)
|
||||
elif playing.volume_db <= 0:
|
||||
playing.volume_db = min(playing.volume_db + (delta * 8), 0)
|
||||
|
||||
if instruments_needed > len(instruments_playing):
|
||||
var instruments_not_playing = stream_players.filter(func(p: AudioStreamPlayer): return p.volume_db <= -50)
|
||||
if len(instruments_not_playing):
|
||||
var to_play = instruments_not_playing.pick_random()
|
||||
if is_instance_valid(to_play):
|
||||
to_play.volume_db = min(to_play.volume_db + (delta * 16), 0)
|
||||
|
|
15
levels/music.gd
Normal file
15
levels/music.gd
Normal file
|
@ -0,0 +1,15 @@
|
|||
extends Node
|
||||
|
||||
func _ready() -> void:
|
||||
var players = get_children()
|
||||
for player in players:
|
||||
if player is AudioStreamPlayer:
|
||||
player.volume_db = -50
|
||||
var stream: AudioStreamOggVorbis = player.stream
|
||||
if stream is AudioStreamOggVorbis:
|
||||
stream.loop = true
|
||||
stream.bpm = 124
|
||||
|
||||
for player in players:
|
||||
if player is AudioStreamPlayer:
|
||||
player.play()
|
|
@ -1,19 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://b46a7y6vdqd4n"
|
||||
path="res://.godot/imported/hihat-closed.ogg-634dc0c568a8092078932f08dc65fc8f.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://music/base/hihat-closed.ogg"
|
||||
dest_files=["res://.godot/imported/hihat-closed.ogg-634dc0c568a8092078932f08dc65fc8f.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,19 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://buag3j2s22jpo"
|
||||
path="res://.godot/imported/hihat-open.ogg-1aa0c33db5be0d76efd9dd318d5705d8.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://music/base/hihat-open.ogg"
|
||||
dest_files=["res://.godot/imported/hihat-open.ogg-1aa0c33db5be0d76efd9dd318d5705d8.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,19 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://dma7btls87mg4"
|
||||
path="res://.godot/imported/kick.ogg-8bc4c6e0b9f2124e3c3e6f52c093e841.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://music/base/kick.ogg"
|
||||
dest_files=["res://.godot/imported/kick.ogg-8bc4c6e0b9f2124e3c3e6f52c093e841.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,19 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://djmbrvp7k263k"
|
||||
path="res://.godot/imported/kick2.ogg-5477221d7a46d2bcc9595d2f229c37a8.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://music/base/kick2.ogg"
|
||||
dest_files=["res://.godot/imported/kick2.ogg-5477221d7a46d2bcc9595d2f229c37a8.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,19 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://dqeupvkvaoypg"
|
||||
path="res://.godot/imported/sequencer.ogg-aa983a1c0920b312ad60781850c5dbf7.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://music/base/sequencer.ogg"
|
||||
dest_files=["res://.godot/imported/sequencer.ogg-aa983a1c0920b312ad60781850c5dbf7.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,19 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://dq88q86etj27v"
|
||||
path="res://.godot/imported/synth.ogg-bb57dd708920d475d52e82c18cfac921.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://music/base/synth.ogg"
|
||||
dest_files=["res://.godot/imported/synth.ogg-bb57dd708920d475d52e82c18cfac921.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,19 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://dghw6a7i3adcu"
|
||||
path="res://.godot/imported/dong.ogg-ffb15076d2b8a5ffc947d53d6a3fc115.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://music/forest/dong.ogg"
|
||||
dest_files=["res://.godot/imported/dong.ogg-ffb15076d2b8a5ffc947d53d6a3fc115.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,19 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://pn2b2f3egpck"
|
||||
path="res://.godot/imported/dong2.ogg-58e0e1bd9d339e6c5a96259a33a583cf.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://music/forest/dong2.ogg"
|
||||
dest_files=["res://.godot/imported/dong2.ogg-58e0e1bd9d339e6c5a96259a33a583cf.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,19 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://bu4kmowmputnr"
|
||||
path="res://.godot/imported/hihat-closed.ogg-2d3ac57a208e8a0283aa44d553fd6fd2.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://music/forest/hihat-closed.ogg"
|
||||
dest_files=["res://.godot/imported/hihat-closed.ogg-2d3ac57a208e8a0283aa44d553fd6fd2.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,19 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://cbgimkc8fi4q3"
|
||||
path="res://.godot/imported/hihat-open.ogg-f90ba031f5e4f4f762a1d8e5e441132a.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://music/forest/hihat-open.ogg"
|
||||
dest_files=["res://.godot/imported/hihat-open.ogg-f90ba031f5e4f4f762a1d8e5e441132a.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,19 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://b5rl0nf2bawbr"
|
||||
path="res://.godot/imported/kick.ogg-f4dc38db14482b78ded821894f1a2034.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://music/forest/kick.ogg"
|
||||
dest_files=["res://.godot/imported/kick.ogg-f4dc38db14482b78ded821894f1a2034.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,19 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://76mr4g8vfex2"
|
||||
path="res://.godot/imported/synth.ogg-b5f3958a400c45e698e4b6e9bb35ef0c.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://music/forest/synth.ogg"
|
||||
dest_files=["res://.godot/imported/synth.ogg-b5f3958a400c45e698e4b6e9bb35ef0c.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -13,7 +13,7 @@ config_version=5
|
|||
config/name="DreamBall"
|
||||
config/description="I'm Taevas, and this is \"DreamBall\", my entry for the 21st edition of \"Alakajam!\", a gamejam that lasts for 48 hours and starts on 2025-02-21 19:00UTC
|
||||
https://alakajam.com/21st-alakajam"
|
||||
config/version="20250222.0"
|
||||
config/version="20250223.0"
|
||||
run/main_scene="res://index.tscn"
|
||||
config/features=PackedStringArray("4.3", "GL Compatibility")
|
||||
boot_splash/show_image=false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue