bevyjam/src/levels/game_over.rs

62 lines
1.2 KiB
Rust
Raw Normal View History

2022-08-23 10:02:58 +00:00
use crate::game::*;
use bevy::prelude::*;
2022-08-25 10:32:06 +00:00
pub fn setup(
commands: &mut Commands,
meshes: &mut ResMut<Assets<Mesh>>,
character_meshes: &Res<CharacterMeshes>,
materials: &mut ResMut<Assets<ColorMaterial>>,
audio: &Res<crossbeam_channel::Sender<AudioMsg>>,
asset_server: &Res<AssetServer>,
) {
2022-08-23 10:42:56 +00:00
let font = asset_server.get_handle("UacariLegacy-Thin.ttf");
2022-08-23 10:02:58 +00:00
commands
.spawn_bundle(Text2dBundle {
text: Text::from_section(
2022-08-25 10:32:06 +00:00
"Thank you for playing!",
2022-08-23 10:02:58 +00:00
TextStyle {
font: font.clone(),
font_size: 48.0,
color: Color::WHITE,
},
)
.with_alignment(TextAlignment::CENTER),
2022-08-23 10:42:56 +00:00
transform: Transform::from_xyz(0., 128.0, 0.),
2022-08-23 10:02:58 +00:00
..Default::default()
})
.insert(Level);
commands
.spawn_bundle(Text2dBundle {
text: Text::from_section(
"There is no more light to combine.",
TextStyle {
font,
font_size: 32.0,
color: Color::WHITE,
},
)
.with_alignment(TextAlignment::CENTER),
..Default::default()
})
.insert(Level);
2022-08-25 10:32:06 +00:00
spawn_platform(
commands,
meshes,
materials,
Transform::from_xyz(0.0, -256.0, 0.0),
Vec2 { x: 800.0, y: 16.0 },
);
spawn_character(
commands,
character_meshes,
materials,
audio,
Transform::from_xyz(-128., -64., 0.),
Color::RED,
true,
);
2022-08-23 10:02:58 +00:00
}