Add basic systems
This commit is contained in:
parent
c8384883ad
commit
e863f5af88
15
src/systems/mod.rs
Normal file
15
src/systems/mod.rs
Normal file
@ -0,0 +1,15 @@
|
||||
use crate::components::{Name, Player};
|
||||
use bevy::prelude::*;
|
||||
|
||||
pub fn add_player(mut commands: Commands) {
|
||||
commands
|
||||
.spawn()
|
||||
.insert(Player)
|
||||
.insert(Name("Player 1".to_string()));
|
||||
}
|
||||
|
||||
pub fn greet_player(query: Query<&Name, With<Player>>) {
|
||||
for name in query.iter() {
|
||||
println!("Hello, {}!", name.0);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user