|
|
|
|
@ -162,14 +162,16 @@ fn init_obstacles(
|
|
|
|
|
mut commands: Commands,
|
|
|
|
|
mut meshes: ResMut<Assets<Mesh>>,
|
|
|
|
|
mut materials: ResMut<Assets<ColorMaterial>>,
|
|
|
|
|
server: Res<AssetServer>,
|
|
|
|
|
) {
|
|
|
|
|
let ground = {
|
|
|
|
|
let material = MeshMaterial2d(materials.add(ColorMaterial {
|
|
|
|
|
color: LIGHT_GREEN.into(),
|
|
|
|
|
texture: Some(server.load("kenny.nl/1-bit-platformer-pack/tile_0088.png")),
|
|
|
|
|
color: BLACK.into(),
|
|
|
|
|
..default()
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
let mesh = Mesh2d(meshes.add(Rectangle::new(10.0, 1.0)));
|
|
|
|
|
let mesh = Mesh2d(meshes.add(Rectangle::new(1.0, 1.0)));
|
|
|
|
|
|
|
|
|
|
let name = Name::new("ground");
|
|
|
|
|
|
|
|
|
|
@ -179,12 +181,13 @@ fn init_obstacles(
|
|
|
|
|
};
|
|
|
|
|
let pipe = {
|
|
|
|
|
let material = MeshMaterial2d(materials.add(ColorMaterial {
|
|
|
|
|
color: GREEN.into(),
|
|
|
|
|
texture: Some(server.load("kenny.nl/1-bit-platformer-pack/tile_0247.png")),
|
|
|
|
|
color: BLACK.into(),
|
|
|
|
|
..default()
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
let mesh = Mesh2d(meshes.add(Rectangle::new(1.0, 2.0)));
|
|
|
|
|
let physics = (RigidBody::Static, Collider::rectangle(1.0, 2.0));
|
|
|
|
|
let mesh = Mesh2d(meshes.add(Rectangle::new(1.0, 1.0)));
|
|
|
|
|
let physics = (RigidBody::Static, Collider::rectangle(1.0, 1.0));
|
|
|
|
|
let name = Name::new("pipe");
|
|
|
|
|
|
|
|
|
|
(
|
|
|
|
|
@ -225,9 +228,17 @@ fn init_obstacles(
|
|
|
|
|
Transform::from_xyz(300.0 * i as f32, 0.0, 10.0).with_scale(Vec3::splat(100.0));
|
|
|
|
|
commands.spawn((hitbox_pos, hitbox.clone()));
|
|
|
|
|
|
|
|
|
|
let floor =
|
|
|
|
|
let floor1 =
|
|
|
|
|
Transform::from_xyz(300.0 * i as f32 - 100.0, -300.0, 1.0).with_scale(Vec3::splat(100.0));
|
|
|
|
|
commands.spawn((ground.clone(), floor1));
|
|
|
|
|
|
|
|
|
|
let floor2 =
|
|
|
|
|
Transform::from_xyz(300.0 * i as f32, -300.0, 1.0).with_scale(Vec3::splat(100.0));
|
|
|
|
|
commands.spawn((ground.clone(), floor));
|
|
|
|
|
commands.spawn((ground.clone(), floor2));
|
|
|
|
|
|
|
|
|
|
let floor3 =
|
|
|
|
|
Transform::from_xyz(300.0 * i as f32 + 100.0, -300.0, 1.0).with_scale(Vec3::splat(100.0));
|
|
|
|
|
commands.spawn((ground.clone(), floor3));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|