2023-10-15 23:41:11 -05:00
|
|
|
use bevy::prelude::*;
|
|
|
|
|
|
|
|
pub mod util;
|
|
|
|
pub mod components;
|
|
|
|
pub mod systems;
|
|
|
|
pub mod characters;
|
|
|
|
|
2023-10-16 13:51:24 -05:00
|
|
|
use components::*;
|
|
|
|
use characters::*;
|
|
|
|
|
|
|
|
fn setup(
|
|
|
|
query: Query<&Transform, With<PlayerCharacter>>,
|
|
|
|
mut commands: Commands,
|
|
|
|
mut meshes: ResMut<Assets<Mesh>>,
|
|
|
|
mut materials: ResMut<Assets<StandardMaterial>>,
|
|
|
|
) {
|
|
|
|
for transform in query.iter() {
|
|
|
|
commands.spawn(PbrBundle {
|
|
|
|
mesh: meshes.add(Mesh::from(shape::Capsule{
|
|
|
|
radius: 1.0,
|
|
|
|
rings: 32,
|
|
|
|
depth: 2.0,
|
|
|
|
..Default::default()
|
|
|
|
})),
|
|
|
|
material: materials.add(StandardMaterial {
|
|
|
|
unlit: true,
|
|
|
|
..Default::default()
|
|
|
|
}),
|
|
|
|
transform: Transform::clone(transform),
|
|
|
|
..Default::default()
|
|
|
|
});
|
|
|
|
commands.spawn(DirectionalLightBundle::default());
|
|
|
|
commands.spawn(Camera3dBundle{
|
|
|
|
transform: Transform::from_xyz(0.0, 10.0, 0.0).looking_at(Vec3::default(), Vec3::Y),
|
|
|
|
projection: OrthographicProjection::default().into(),
|
|
|
|
..Default::default()
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2023-10-15 23:41:11 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
App::new()
|
|
|
|
.add_plugins(DefaultPlugins)
|
|
|
|
// Add systems, whatnot
|
|
|
|
.add_systems(Startup, spawn_player_character)
|
2023-10-16 13:51:24 -05:00
|
|
|
.add_systems(Startup, spawn_player_character)
|
|
|
|
.add_systems(Startup, setup)
|
2023-10-15 23:41:11 -05:00
|
|
|
.run();
|
|
|
|
}
|