experiments
This commit is contained in:
parent
4aba8bf0ae
commit
25664e36f5
23 changed files with 346 additions and 17 deletions
64
index.tscn
64
index.tscn
|
@ -1,18 +1,50 @@
|
|||
[gd_scene format=3 uid="uid://ccgnnif026wb4"]
|
||||
[gd_scene load_steps=2 format=3 uid="uid://ccgnnif026wb4"]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
[sub_resource type="GDScript" id="GDScript_oxyvh"]
|
||||
script/source = "extends Node
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "Hello world! I'm waiting for the gamejam to get started!"
|
||||
func makeAudioStreamPlayers(music_name: String) -> Array[AudioStreamPlayer]:
|
||||
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.stream = stream
|
||||
player.volume_db = -50
|
||||
players.push_back(player)
|
||||
|
||||
return players
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var players = makeAudioStreamPlayers(\"base\")
|
||||
for player in players:
|
||||
add_child(player)
|
||||
#player.volume_db = 0
|
||||
for player in players:
|
||||
player.play()
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
"
|
||||
|
||||
[node name="World" type="Node"]
|
||||
script = SubResource("GDScript_oxyvh")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue