73 lines
1.3 KiB
Rust
73 lines
1.3 KiB
Rust
// Absorbing filter tutorial
|
|
|
|
use crate::game::*;
|
|
|
|
use bevy::prelude::*;
|
|
|
|
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>,
|
|
) {
|
|
let font = asset_server.get_handle("UacariLegacy-Thin.ttf");
|
|
commands
|
|
.spawn_bundle(Text2dBundle {
|
|
text: Text::from_section(
|
|
"Press R to reset.",
|
|
TextStyle {
|
|
font,
|
|
font_size: 32.0,
|
|
color: Color::WHITE,
|
|
},
|
|
)
|
|
.with_alignment(TextAlignment::CENTER),
|
|
..Default::default()
|
|
})
|
|
.insert(Level);
|
|
|
|
spawn_platforms(
|
|
commands,
|
|
meshes,
|
|
materials,
|
|
[
|
|
(
|
|
Transform::from_xyz(0.0, -256.0, 0.0),
|
|
Vec2 { x: 800.0, y: 16.0 },
|
|
),
|
|
(
|
|
Transform::from_xyz(0.0, -128.0, 0.0),
|
|
Vec2 { x: 800.0, y: 16.0 },
|
|
),
|
|
],
|
|
);
|
|
|
|
spawn_characters(
|
|
commands,
|
|
character_meshes,
|
|
materials,
|
|
audio,
|
|
[
|
|
(
|
|
Transform::from_xyz(-128., -192., 0.),
|
|
Color::rgba(1., 0.64, 0., 1.),
|
|
),
|
|
(
|
|
Transform::from_xyz(128., -192., 0.),
|
|
Color::rgba(0., 0.37, 1., 1.),
|
|
),
|
|
],
|
|
);
|
|
|
|
spawn_absorbing_filter(
|
|
commands,
|
|
meshes,
|
|
materials,
|
|
Transform::from_xyz(0., -192., 2.),
|
|
Vec2 { x: 16.0, y: 112.0 },
|
|
Color::RED,
|
|
);
|
|
}
|