spawn ship
This commit is contained in:
@@ -6,7 +6,6 @@ pub struct GamePlugin {}
|
|||||||
|
|
||||||
impl Plugin for GamePlugin {
|
impl Plugin for GamePlugin {
|
||||||
fn build(&self, app: &mut bevy::app::App) {
|
fn build(&self, app: &mut bevy::app::App) {
|
||||||
// Todo: Pending update to bevy 0.16.0
|
|
||||||
// app.add_plugins(RapierPhysicsPlugin::<NoUserData>::default());
|
// app.add_plugins(RapierPhysicsPlugin::<NoUserData>::default());
|
||||||
|
|
||||||
app.add_systems(Startup, (setup_scene, spawn_ship));
|
app.add_systems(Startup, (setup_scene, spawn_ship));
|
||||||
@@ -41,7 +40,10 @@ fn spawn_ship(
|
|||||||
mut meshes: ResMut<Assets<Mesh>>,
|
mut meshes: ResMut<Assets<Mesh>>,
|
||||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||||
) {
|
) {
|
||||||
|
let window_material = materials.add(Color::lcha(1.0, 0.0, 1.0, 0.5));
|
||||||
|
|
||||||
let material = materials.add(Color::BLACK);
|
let material = materials.add(Color::BLACK);
|
||||||
|
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
Mesh3d(meshes.add(Cuboid::new(3.0, 0.1, 6.0))),
|
Mesh3d(meshes.add(Cuboid::new(3.0, 0.1, 6.0))),
|
||||||
MeshMaterial3d(material.clone()),
|
MeshMaterial3d(material.clone()),
|
||||||
@@ -52,13 +54,25 @@ fn spawn_ship(
|
|||||||
Name::new("Back Wall"),
|
Name::new("Back Wall"),
|
||||||
Mesh3d(meshes.add(Cuboid::new(3.0, 2.0, 0.1))),
|
Mesh3d(meshes.add(Cuboid::new(3.0, 2.0, 0.1))),
|
||||||
MeshMaterial3d(material.clone()),
|
MeshMaterial3d(material.clone()),
|
||||||
Transform::from_xyz(0.0, 0.0, 6.0 / 2.0),
|
Transform::from_xyz(0.0, 1.0, 6.0 / 2.0),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
Name::new("Front Wall"),
|
Name::new("Front Window"),
|
||||||
|
Mesh3d(meshes.add(Cuboid::new(3.0, 2.0, 0.1))),
|
||||||
|
MeshMaterial3d(window_material),
|
||||||
|
Transform::from_xyz(0.0, 1.0, -6.0 / 2.0),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
Name::new("Right Wall"),
|
||||||
Mesh3d(meshes.add(Cuboid::new(0.1, 2.0, 6.0))),
|
Mesh3d(meshes.add(Cuboid::new(0.1, 2.0, 6.0))),
|
||||||
MeshMaterial3d(material.clone()),
|
MeshMaterial3d(material.clone()),
|
||||||
Transform::from_xyz(3.0 / 2.0, 0.0, 0.0),
|
Transform::from_xyz(3.0 / 2.0, 1.0, 0.0),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
Name::new("Left Wall"),
|
||||||
|
Mesh3d(meshes.add(Cuboid::new(0.1, 2.0, 6.0))),
|
||||||
|
MeshMaterial3d(material.clone()),
|
||||||
|
Transform::from_xyz(-3.0 / 2.0, 1.0, 0.0),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
Name::new("Roof"),
|
Name::new("Roof"),
|
||||||
|
|||||||
Reference in New Issue
Block a user