Merge branch 'main' of github.com-personal:Back777space/among-me
This commit is contained in:
58
src/main.rs
58
src/main.rs
@@ -1,24 +1,46 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
fn main() -> AppExit {
|
||||
pub mod player;
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugins((DefaultPlugins))
|
||||
// We need to register components to make them visible to Blenvy
|
||||
.add_plugins((DefaultPlugins, BlenvyPlugin::default()))
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(Update, camera::move_camera)
|
||||
.run()
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_systems(Startup, (setup, player::init_player))
|
||||
.add_systems(Update, player::move_camera)
|
||||
.add_systems(FixedUpdate, player::advance_physics)
|
||||
.add_systems(
|
||||
RunFixedMainLoop,
|
||||
(
|
||||
player::handle_input.in_set(RunFixedMainLoopSystem::BeforeFixedMainLoop),
|
||||
player::interpolate_rendered_transform.in_set(RunFixedMainLoopSystem::AfterFixedMainLoop),
|
||||
),
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[derive(Component, Reflect)]
|
||||
struct Player {
|
||||
strength: f32,
|
||||
perception: f32,
|
||||
endurance: f32,
|
||||
charisma: f32,
|
||||
intelligence: f32,
|
||||
agility: f32,
|
||||
luck: f32,
|
||||
fn setup(
|
||||
mut commands: Commands,
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
) {
|
||||
// circular base
|
||||
commands.spawn((
|
||||
Mesh3d(meshes.add(Circle::new(4.0))),
|
||||
MeshMaterial3d(materials.add(Color::WHITE)),
|
||||
Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::FRAC_PI_2)),
|
||||
));
|
||||
// cube
|
||||
commands.spawn((
|
||||
Mesh3d(meshes.add(Cuboid::new(1.0, 1.0, 1.0))),
|
||||
MeshMaterial3d(materials.add(Color::srgb_u8(124, 144, 255))),
|
||||
Transform::from_xyz(3.0, 0.5, 0.0),
|
||||
));
|
||||
// light
|
||||
commands.spawn((
|
||||
PointLight {
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
Transform::from_xyz(4.0, 8.0, 4.0),
|
||||
));
|
||||
}
|
||||
|
||||
fn setup(mut commands: Commands) {}
|
||||
|
||||
Reference in New Issue
Block a user