Implement basic player plugin

This commit is contained in:
Daniel Lynn 2021-07-12 22:56:00 -05:00
parent 6705870f81
commit bc5eb9b006
Signed by: daniel
GPG Key ID: 28496A140E180A9D
4 changed files with 24 additions and 6 deletions

View File

@ -1,2 +1,4 @@
use crate::prelude::*;
pub struct Name(pub String);
pub struct Player;

View File

@ -1,12 +1,19 @@
mod components;
mod plugins;
mod systems;
use bevy::prelude::*;
use systems::*;
mod prelude {
pub use crate::components::*;
pub use crate::plugins::*;
pub use crate::systems::*;
pub use bevy::prelude::*;
}
use prelude::*;
fn main() {
App::build()
.add_startup_system(add_player.system())
.add_system(greet_player.system())
.add_plugins(DefaultPlugins)
.add_plugin(PlayerPlugin)
.run();
}

10
src/plugins/mod.rs Normal file
View File

@ -0,0 +1,10 @@
use crate::prelude::*;
pub struct PlayerPlugin;
impl Plugin for PlayerPlugin {
fn build(&self, app: &mut AppBuilder) {
app.add_startup_system(add_player.system())
.add_system(greet_player.system());
}
}

View File

@ -1,5 +1,4 @@
use crate::components::{Name, Player};
use bevy::prelude::*;
use crate::prelude::*;
pub fn add_player(mut commands: Commands) {
commands