mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
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 <dilyanks@amazon.com>
This commit is contained in:
parent
056f12236e
commit
4f5f04041f
1 changed files with 2 additions and 1 deletions
|
@ -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 },
|
||||
));
|
||||
|
|
Loading…
Reference in a new issue