From b1c7bcab2dbb440131317559c408367b708ef620 Mon Sep 17 00:00:00 2001 From: Dilyan <44360328+dilyankostov@users.noreply.github.com> Date: Sun, 26 Jun 2022 13:58:56 +0000 Subject: [PATCH] Fix player number in example game in the ecs_guide (#5098) # Objective - Small bug in the example game given in examples/ecs/ecs_guide Currently, if there are 2 players in this example game, the function exclusive_player_system can add a player with the name "Player 2". However, the name should be "Player 3". This PR fixes this. I also add a message to inform that a new player has arrived in the mock game. Co-authored-by: Dilyan Kostov --- examples/ecs/ecs_guide.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/ecs/ecs_guide.rs b/examples/ecs/ecs_guide.rs index 4bc0d527263ee9..60bda9a8e7e73c 100644 --- a/examples/ecs/ecs_guide.rs +++ b/examples/ecs/ecs_guide.rs @@ -211,9 +211,10 @@ fn exclusive_player_system(world: &mut World) { }; // Randomly add a new player if should_add_player { + println!("Player {} has joined the game!", total_players + 1); world.spawn().insert_bundle(( Player { - name: format!("Player {}", total_players), + name: format!("Player {}", total_players + 1), }, Score { value: 0 }, ));