bevyjam/src/levels/level0.rs

49 lines
1.1 KiB
Rust
Raw Normal View History

2022-08-23 10:02:58 +00:00
use crate::game::*;
2022-08-25 10:32:06 +00:00
use bevy::prelude::*;
2022-08-23 10:02:58 +00:00
pub fn setup(
commands: &mut Commands,
2022-08-24 10:21:08 +00:00
meshes: &mut ResMut<Assets<Mesh>>,
2022-08-23 10:02:58 +00:00
character_meshes: &Res<CharacterMeshes>,
materials: &mut ResMut<Assets<ColorMaterial>>,
2022-08-23 15:02:13 +00:00
audio: &Res<crossbeam_channel::Sender<AudioMsg>>,
2022-08-25 10:32:06 +00:00
asset_server: &Res<AssetServer>,
2022-08-23 10:02:58 +00:00
) {
2022-08-25 10:32:06 +00:00
let font = asset_server.get_handle("UacariLegacy-Thin.ttf");
2022-08-23 10:02:58 +00:00
commands
2022-08-25 10:32:06 +00:00
.spawn_bundle(Text2dBundle {
text: Text::from_section(
"Combine the colors to synthetize a white light.\nTab to switch; Arrows to move.",
TextStyle {
font,
font_size: 32.0,
color: Color::WHITE,
},
)
.with_alignment(TextAlignment::CENTER),
..Default::default()
2022-08-24 10:21:08 +00:00
})
2022-08-23 10:02:58 +00:00
.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 },
);
2022-08-24 16:51:18 +00:00
spawn_characters(
2022-08-23 10:02:58 +00:00
commands,
character_meshes,
materials,
2022-08-23 15:02:13 +00:00
audio,
2022-08-24 16:51:18 +00:00
[
(Transform::from_xyz(-128., -64., 0.), Color::RED),
(Transform::from_xyz(0., -64., 0.), Color::GREEN),
(Transform::from_xyz(128., -64., 0.), Color::BLUE),
],
2022-08-23 10:02:58 +00:00
);
}