Platform material & filter bundle
This commit is contained in:
parent
12e58b3fc0
commit
297811e882
6 changed files with 93 additions and 21 deletions
|
|
@ -1,23 +1,42 @@
|
|||
use crate::game::*;
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy::prelude::{shape::Quad, *};
|
||||
use bevy_rapier2d::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>>,
|
||||
) {
|
||||
commands
|
||||
.spawn_bundle(TransformBundle::from(Transform::from_xyz(0.0, -256.0, 0.0)))
|
||||
.insert(Collider::cuboid(400., 10.))
|
||||
.spawn_bundle(ColorMesh2dBundle {
|
||||
mesh: meshes
|
||||
.add(Mesh::from(Quad {
|
||||
size: Vec2 { x: 800.0, y: 16.0 },
|
||||
flip: false,
|
||||
}))
|
||||
.into(),
|
||||
material: materials.add(ColorMaterial::from(Color::GRAY)),
|
||||
transform: Transform::from_xyz(0.0, -256.0, 0.0),
|
||||
..default()
|
||||
})
|
||||
.insert(Collider::cuboid(400., 8.))
|
||||
.insert(Level);
|
||||
commands
|
||||
.spawn_bundle(TransformBundle::from(Transform::from_xyz(
|
||||
256.0, -128.0, 0.0,
|
||||
)))
|
||||
.insert(Collider::cuboid(200., 10.))
|
||||
.spawn_bundle(ColorMesh2dBundle {
|
||||
mesh: meshes
|
||||
.add(Mesh::from(Quad {
|
||||
size: Vec2 { x: 400.0, y: 16.0 },
|
||||
flip: false,
|
||||
}))
|
||||
.into(),
|
||||
material: materials.add(ColorMaterial::from(Color::GRAY)),
|
||||
transform: Transform::from_xyz(256.0, -128.0, 0.0),
|
||||
..default()
|
||||
})
|
||||
.insert(Collider::cuboid(200., 8.))
|
||||
.insert(Level);
|
||||
|
||||
spawn_character(
|
||||
|
|
@ -47,4 +66,24 @@ pub fn setup(
|
|||
Color::GREEN,
|
||||
false,
|
||||
);
|
||||
|
||||
commands
|
||||
.spawn_bundle(AbsorbingFilter {
|
||||
color: FilterColor(Color::RED),
|
||||
mesh: ColorMesh2dBundle {
|
||||
mesh: meshes
|
||||
.add(Mesh::from(Quad {
|
||||
size: Vec2 { x: 128.0, y: 16.0 },
|
||||
flip: false,
|
||||
}))
|
||||
.into(),
|
||||
material: materials.add(Color::rgba(1., 0., 0., 0.5).into()),
|
||||
transform: Transform::from_xyz(0., 0., 2.),
|
||||
..Default::default()
|
||||
},
|
||||
collider: Collider::cuboid(64., 8.),
|
||||
sensor: Sensor,
|
||||
filter_type: PassThroughFilter::Absorbing,
|
||||
})
|
||||
.insert(Level);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue