Merge branch 'master' of https://git.sjkillen.ca/sjkillen/ABGJ-23
This commit is contained in:
		
						commit
						8f5abaee24
					
				
					 3 changed files with 65 additions and 5 deletions
				
			
		|  | @ -1,4 +1,4 @@ | |||
| [gd_scene load_steps=23 format=3 uid="uid://3d51hjh2st8a"] | ||||
| [gd_scene load_steps=24 format=3 uid="uid://3d51hjh2st8a"] | ||||
| 
 | ||||
| [ext_resource type="PackedScene" uid="uid://d2d4uv7o5gx5p" path="res://Level/World/screen_shader.tscn" id="1_huyen"] | ||||
| [ext_resource type="PackedScene" uid="uid://b35w4hlh4n1jt" path="res://Level/World/world_environment.tscn" id="2_lerrn"] | ||||
|  | @ -17,7 +17,8 @@ | |||
| [ext_resource type="PackedScene" uid="uid://bj8le45u845v3" path="res://Models/beach_decor/floatie.tscn" id="15_2v7p7"] | ||||
| [ext_resource type="PackedScene" uid="uid://dhrnbubumgi5h" path="res://Models/buildings/buildingruined.tscn" id="15_6cbuu"] | ||||
| [ext_resource type="PackedScene" uid="uid://dvpank15vkvtv" path="res://Models/beach_decor/parsol.tscn" id="21_dlhqg"] | ||||
| [ext_resource type="PackedScene" uid="uid://c4s6y758n77lw" path="res://villager_shared.tscn" id="21_hxwg1"] | ||||
| [ext_resource type="Script" path="res://Level/Music.gd" id="22_2pcqg"] | ||||
| [ext_resource type="AudioStream" uid="uid://mvyk5xpf0f55" path="res://Sounds/beachquiet.ogg" id="22_4tylf"] | ||||
| [ext_resource type="PackedScene" uid="uid://7utef1nnena8" path="res://player.tscn" id="22_cuxj6"] | ||||
| [ext_resource type="PackedScene" uid="uid://b3aus2kigf8xt" path="res://Models/beach_decor/cooler.tscn" id="24_sl7ne"] | ||||
| [ext_resource type="PackedScene" uid="uid://bw3k2c75qavce" path="res://Models/beach_decor/bucket.tscn" id="27_f3p1i"] | ||||
|  | @ -250,3 +251,21 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.192051, 2.60275, 0) | |||
| 
 | ||||
| [node name="villager" parent="." instance=ExtResource("21_hxwg1")] | ||||
| transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.948, 0) | ||||
| [node name="Ambiance" type="AudioStreamPlayer" parent="."] | ||||
| stream = ExtResource("22_4tylf") | ||||
| volume_db = 5.0 | ||||
| autoplay = true | ||||
| 
 | ||||
| [node name="Music" type="AudioStreamPlayer" parent="."] | ||||
| volume_db = -5.0 | ||||
| script = ExtResource("22_2pcqg") | ||||
| 
 | ||||
| [node name="Transition" type="Timer" parent="Music"] | ||||
| one_shot = true | ||||
| 
 | ||||
| [node name="Tween" type="Timer" parent="Music"] | ||||
| one_shot = true | ||||
| 
 | ||||
| [connection signal="finished" from="Music" to="Music" method="_on_finished"] | ||||
| [connection signal="timeout" from="Music/Transition" to="Music" method="_on_transition_timer_timeout"] | ||||
| [connection signal="timeout" from="Music/Tween" to="Music" method="_on_tween_timer_timeout"] | ||||
|  |  | |||
							
								
								
									
										41
									
								
								godot/Level/Music.gd
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								godot/Level/Music.gd
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,41 @@ | |||
| extends AudioStreamPlayer | ||||
| 
 | ||||
| var music_list = (["res://Sounds/GiantsLullaby.ogg", | ||||
| "res://Sounds/IslandBoogie.ogg", | ||||
| "res://Sounds/OrangeSky.ogg", | ||||
| "res://Sounds/SlimeParty.ogg", | ||||
| "res://Sounds/WelcomeToOceanCity.ogg"]) | ||||
| 
 | ||||
| var song = music_list[randi() % music_list.size()] | ||||
| var time_left | ||||
| 
 | ||||
| const TRANSITIONTIME = 2.0 | ||||
| 
 | ||||
| @onready var transition_timer = $Transition | ||||
| @onready var tween_timer = $Tween | ||||
| 
 | ||||
| # Called when the node enters the scene tree for the first time. | ||||
| func _ready(): | ||||
| 	self.stream = load(song)  | ||||
| 	time_left = self.stream.get_length() - TRANSITIONTIME | ||||
| 	tween_timer.start(time_left) | ||||
| 	self.play() | ||||
| 	 | ||||
| func _on_finished(): | ||||
| 	transition_timer.start(TRANSITIONTIME/2) | ||||
| 
 | ||||
| func _on_transition_timer_timeout(): | ||||
| 	var last_played = song | ||||
| 	var new_song = music_list[randi()% music_list.size()] | ||||
| 	 | ||||
| 	while new_song == last_played: | ||||
| 		new_song = music_list[randi()% music_list.size()] | ||||
| 		 | ||||
| 	self.stream = load(new_song) | ||||
| 	time_left = self.stream.get_length()- TRANSITIONTIME | ||||
| 	tween_timer.start(time_left) | ||||
| 	self.play() | ||||
| 
 | ||||
| func _on_tween_timer_timeout(): | ||||
| 	var tween = create_tween() | ||||
| 	tween.tween_property(self, "volume_db", -20, TRANSITIONTIME) | ||||
|  | @ -12,8 +12,8 @@ dest_files=["res://.godot/imported/beachquiet.ogg-4df273610db2807fc589980f114fa3 | |||
| 
 | ||||
| [params] | ||||
| 
 | ||||
| loop=false | ||||
| loop_offset=0 | ||||
| bpm=0 | ||||
| loop=true | ||||
| loop_offset=0.0 | ||||
| bpm=0.0 | ||||
| beat_count=0 | ||||
| bar_beats=4 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue