bevyjam/src/levels/level1.rs

57 lines
1 KiB
Rust

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>,
) {
spawn_platforms(
commands,
meshes,
materials,
[
(
Transform::from_xyz(0.0, -256.0, 0.0),
Vec2 { x: 800.0, y: 16.0 },
),
(
Transform::from_xyz(256.0, -128.0, 0.0),
Vec2 { x: 400.0, y: 16.0 },
),
],
);
spawn_characters(
commands,
character_meshes,
materials,
audio,
[
(Transform::from_xyz(128., 64., 0.), Color::BLUE),
(Transform::from_xyz(-128., -128., 0.), Color::RED),
(Transform::from_xyz(0., -128., 0.), Color::GREEN),
],
);
spawn_absorbing_filter(
commands,
meshes,
materials,
Transform::from_xyz(0., 0., 2.),
Vec2 { x: 128.0, y: 16.0 },
Color::RED,
);
spawn_rotating_filter(
commands,
asset_server,
Transform::from_xyz(256., -224., 2.),
45.,
);
}