diff --git a/game/src/main.rs b/game/src/main.rs index 3cd4b76548ac3625c243fa0a9354971fbc2a4120..c64abaaba3aa7e3eb4c05f59c92d89e44d194a18 100644 --- a/game/src/main.rs +++ b/game/src/main.rs @@ -3,21 +3,30 @@ use bevy::prelude::*; #[derive(Component)] struct Person; +#[derive(Component)] +struct Name(String); fn hello_world() { println!("hello world!"); } fn add_people(mut commands: Commands) { - commands.spawn((Person, Name("Elaina Proctor".to_string()))); - commands.spawn((Person, Name("Renzo Hume".to_string()))); - commands.spawn((Person, Name("Zayna Nieves".to_string()))); + commands.spawn((Person, Name("Antoine A".to_string()))); + commands.spawn((Person, Name("Ricardo B".to_string()))); + commands.spawn((Person, Name("Theo B".to_string()))); +} + +fn greet_people(query: Query<&Name, With<Person>>) { + for name in &query { + println!("hello {}!", name.0); + } } fn main() { App::new() .add_systems(Startup, add_people) - .add_systems(Update, hello_world) + .add_systems(Update, (hello_world, greet_people)) .run(); } + diff --git a/game/target/debug/game b/game/target/debug/game index 6f517843f0e48c0ddce5f23e9ee75ffe51ed17d6..53d00530f7d50210832691e617a1f6a93ea2fe73 100755 Binary files a/game/target/debug/game and b/game/target/debug/game differ