Implement basic player plugin
This commit is contained in:
parent
6705870f81
commit
bc5eb9b006
@ -1,2 +1,4 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
pub struct Name(pub String);
|
||||
pub struct Player;
|
||||
|
15
src/main.rs
15
src/main.rs
@ -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
10
src/plugins/mod.rs
Normal 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());
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
use crate::components::{Name, Player};
|
||||
use bevy::prelude::*;
|
||||
use crate::prelude::*;
|
||||
|
||||
pub fn add_player(mut commands: Commands) {
|
||||
commands
|
||||
|
Loading…
Reference in New Issue
Block a user