final changes to music
This commit is contained in:
parent
a8e364415c
commit
e62acd3ab1
@ -48,7 +48,7 @@ text = "REINICIAR"
|
||||
|
||||
[node name="GameOverMusic" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 4 )
|
||||
volume_db = -23.524
|
||||
volume_db = -25.0
|
||||
|
||||
[connection signal="visibility_changed" from="." to="." method="_play_music"]
|
||||
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
|
||||
[connection signal="pressed" from="Control/RestartButton" to="." method="_on_restart_button_pressed"]
|
||||
|
@ -16,7 +16,7 @@ void alai::GameOverScreen::_register_methods()
|
||||
godot::register_method("restart_game", &GameOverScreen::restart_game);
|
||||
godot::register_method("connect_signal", &GameOverScreen::connect_signal);
|
||||
godot::register_method("_on_player_died", &GameOverScreen::_on_player_died);
|
||||
godot::register_method("_play_music", &GameOverScreen::_play_music);
|
||||
godot::register_method("_on_visibility_changed", &GameOverScreen::_on_visibility_changed);
|
||||
}
|
||||
|
||||
alai::GameOverScreen::GameOverScreen()
|
||||
@ -96,6 +96,15 @@ void alai::GameOverScreen::connect_signal()
|
||||
event->connect("player_died", this, "_on_player_died");
|
||||
}
|
||||
|
||||
void alai::GameOverScreen::_play_music()
|
||||
void alai::GameOverScreen::_on_visibility_changed()
|
||||
{
|
||||
auto gameoversound = get_node<godot::AudioStreamPlayer>("GameOverMusic");
|
||||
if (is_visible())
|
||||
{
|
||||
gameoversound->play();
|
||||
}
|
||||
else
|
||||
{
|
||||
gameoversound->stop();
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ namespace alai
|
||||
void _on_restart_button_pressed();
|
||||
void restart_game();
|
||||
void connect_signal();
|
||||
void _play_music();
|
||||
void _on_visibility_changed();
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user