-
Notifications
You must be signed in to change notification settings - Fork 2
/
credits.rs
44 lines (35 loc) · 1.4 KB
/
credits.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! A credits screen that can be accessed from the title screen.
use bevy::prelude::*;
use super::Screen;
use crate::{
assets::BgmHandles,
audio::bgm::BgmCommands as _,
theme::prelude::*,
};
pub(super) fn plugin(app: &mut App) {
app.add_systems(OnEnter(Screen::Credits), show_credits_screen);
app.add_systems(OnExit(Screen::Credits), stop_bgm);
}
fn show_credits_screen(mut commands: Commands) {
commands
.ui_root()
.insert(StateScoped(Screen::Credits))
.with_children(|children| {
children.header("Made by");
children.label("Joe Shmoe - Implemented aligator wrestling AI");
children.label("Jane Doe - Made the music for the alien invasion");
children.header("Assets");
children.label("Bevy logo - All rights reserved by the Bevy Foundation. Permission granted for splash screen use when unmodified.");
children.label("Ducky sprite - CC0 by Caz Creates Games");
children.label("Button SFX - CC0 by Jaszunio15");
children.label("Music - CC BY 3.0 by Kevin MacLeod");
children.button("Back").observe(enter_title);
});
commands.play_bgm(BgmHandles::PATH_CREDITS);
}
fn stop_bgm(mut commands: Commands) {
commands.stop_bgm();
}
fn enter_title(_trigger: Trigger<OnPress>, mut next_screen: ResMut<NextState<Screen>>) {
next_screen.set(Screen::Title);
}