Skip to content

Commit

Permalink
Fix player number in example game in the ecs_guide (bevyengine#5098)
Browse files Browse the repository at this point in the history
# 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>
  • Loading branch information
2 people authored and ItsDoot committed Feb 1, 2023
1 parent 023477d commit b1c7bca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/ecs/ecs_guide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
));
Expand Down

0 comments on commit b1c7bca

Please sign in to comment.