Replace spawn_ui implementation

This commit is contained in:
2025-07-26 18:30:38 -05:00
parent 7f5a166f10
commit 2f9afaeac1

View File

@@ -229,36 +229,10 @@ fn wrap_entities(mut query: Query<&mut Position>, world_size: Res<WorldSize>) {
} }
fn spawn_ui(mut commands: Commands, score: Res<Score>, lives: Res<Lives>) { fn spawn_ui(mut commands: Commands, score: Res<Score>, lives: Res<Lives>) {
commands.spawn(TextBundle::from_sections([ commands.spawn((
TextSection::new( Text::new(format!("Score: {score:?} | Lives: {lives:?}")),
"Score: ", TextFont::from_font_size(25.0),
TextStyle { ));
font_size: 25.0,
..default()
},
),
TextSection::new(
*score,
TextStyle {
font_size: 25.0,
..default()
},
),
TextSection::new(
" | Lives: ",
TextStyle {
font_size: 25.0,
..default()
},
),
TextSection::new(
*lives,
TextStyle {
font_size: 25.0,
..default()
},
),
]));
} }
fn start_screen(mut commands: Commands) { fn start_screen(mut commands: Commands) {