forked from team-sg/hero-mark-2
pause music
This commit is contained in:
parent
cf8bfa6210
commit
394f53585e
6 changed files with 50 additions and 6 deletions
BIN
audio/music/pause.ogg
Normal file
BIN
audio/music/pause.ogg
Normal file
Binary file not shown.
15
audio/music/pause.ogg.import
Normal file
15
audio/music/pause.ogg.import
Normal file
|
@ -0,0 +1,15 @@
|
|||
[remap]
|
||||
|
||||
importer="ogg_vorbis"
|
||||
type="AudioStreamOGGVorbis"
|
||||
path="res://.import/pause.ogg-e880bf592ac2065d4f2c443ae1e801bb.oggstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://audio/music/pause.ogg"
|
||||
dest_files=[ "res://.import/pause.ogg-e880bf592ac2065d4f2c443ae1e801bb.oggstr" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
|
@ -9,6 +9,7 @@ onready var ac_music = $Music
|
|||
onready var ac_cheat = $CodeEntrySound
|
||||
onready var ac_boss = $BossSound
|
||||
onready var ac_shard = $ShardSound
|
||||
onready var ac_pause_music = $PauseMusic
|
||||
#Sounds
|
||||
const a_gold = preload("res://audio/sounds/key.wav")
|
||||
const a_arrow = preload("res://audio/sounds/arrow_collect.ogg")
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://autoloads/audio.gd" type="Script" id=1]
|
||||
[ext_resource path="res://audio/sounds/shard.wav" type="AudioStream" id=2]
|
||||
[ext_resource path="res://audio/music/pause.ogg" type="AudioStream" id=3]
|
||||
|
||||
[node name="Audio" type="Node"]
|
||||
pause_mode = 2
|
||||
|
@ -39,4 +40,8 @@ bus = "sound"
|
|||
volume_db = -12.0
|
||||
bus = "sound"
|
||||
|
||||
[node name="PauseMusic" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 3 )
|
||||
volume_db = -12.0
|
||||
|
||||
[connection signal="finished" from="ShardSound" to="." method="_on_ShardSound_finished"]
|
||||
|
|
|
@ -13,21 +13,24 @@ func _ready():
|
|||
if lore_entry != null:
|
||||
var lore = lore_entry.instance()
|
||||
lore_container.add_child(lore)
|
||||
#Pause music
|
||||
Audio.ac_music.set_stream_paused(true)
|
||||
Audio.ac_pause_music.play()
|
||||
|
||||
func _physics_process(delta):
|
||||
#Resume with pause button
|
||||
if Input.is_action_just_pressed("pause"):
|
||||
queue_free()
|
||||
get_tree().paused = false
|
||||
unpause()
|
||||
|
||||
Console.print(get_tree().paused)
|
||||
|
||||
func _on_Resume_pressed():
|
||||
get_tree().paused = false
|
||||
queue_free()
|
||||
unpause()
|
||||
|
||||
|
||||
func _on_Restart_pressed():
|
||||
Audio.ac_music.set_stream_paused(false)
|
||||
Audio.ac_pause_music.stop()
|
||||
Game.call_deferred("restart_level")
|
||||
get_tree().paused = false
|
||||
queue_free()
|
||||
|
@ -39,6 +42,8 @@ func _on_Settings_pressed():
|
|||
|
||||
|
||||
func _on_ExitLevel_pressed():
|
||||
Audio.ac_music.set_stream_paused(false)
|
||||
Audio.ac_pause_music.stop()
|
||||
get_tree().paused = false
|
||||
Game.change_map(load("res://menus/level_select_scholar.tscn"))
|
||||
yield(Fade, "fade_finished")
|
||||
|
@ -49,3 +54,10 @@ func _on_OptionsScreen_exit():
|
|||
options_screen.visible = false
|
||||
$LoreContainer.visible = true
|
||||
$Body/Settings.grab_focus()
|
||||
|
||||
func unpause():
|
||||
get_tree().paused = false
|
||||
#Stop pause music
|
||||
Audio.ac_music.set_stream_paused(false)
|
||||
Audio.ac_pause_music.stop()
|
||||
queue_free()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=9 format=2]
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://ui/arrow_figure_8.tres" type="Material" id=1]
|
||||
[ext_resource path="res://ui/theme.tres" type="Theme" id=2]
|
||||
|
@ -8,6 +8,7 @@
|
|||
[ext_resource path="res://ui/2ndpuberty_outline.tres" type="Material" id=6]
|
||||
[ext_resource path="res://objects/hud/options_screen.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://ui/border.png" type="Texture" id=8]
|
||||
[ext_resource path="res://objects/hud/menu_sounds.tscn" type="PackedScene" id=9]
|
||||
|
||||
[node name="PauseScreen" type="CanvasLayer"]
|
||||
pause_mode = 2
|
||||
|
@ -110,8 +111,18 @@ margin_bottom = -14.0
|
|||
[node name="OptionsScreen" parent="." instance=ExtResource( 7 )]
|
||||
visible = false
|
||||
|
||||
[node name="MenuSounds" parent="." instance=ExtResource( 9 )]
|
||||
|
||||
[connection signal="focus_entered" from="Body/Resume" to="MenuSounds" method="play_select_sound"]
|
||||
[connection signal="pressed" from="Body/Resume" to="." method="_on_Resume_pressed"]
|
||||
[connection signal="pressed" from="Body/Resume" to="MenuSounds" method="play_confirm_sound"]
|
||||
[connection signal="focus_entered" from="Body/Restart" to="MenuSounds" method="play_select_sound"]
|
||||
[connection signal="pressed" from="Body/Restart" to="." method="_on_Restart_pressed"]
|
||||
[connection signal="pressed" from="Body/Restart" to="MenuSounds" method="play_confirm_sound"]
|
||||
[connection signal="focus_entered" from="Body/Settings" to="MenuSounds" method="play_select_sound"]
|
||||
[connection signal="pressed" from="Body/Settings" to="." method="_on_Settings_pressed"]
|
||||
[connection signal="pressed" from="Body/Settings" to="MenuSounds" method="play_confirm_sound"]
|
||||
[connection signal="focus_entered" from="Body/ExitLevel" to="MenuSounds" method="play_select_sound"]
|
||||
[connection signal="pressed" from="Body/ExitLevel" to="." method="_on_ExitLevel_pressed"]
|
||||
[connection signal="pressed" from="Body/ExitLevel" to="MenuSounds" method="play_confirm_sound"]
|
||||
[connection signal="exit" from="OptionsScreen" to="." method="_on_OptionsScreen_exit" flags=3]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue