fn display_score(
    mut commands: Commands,
    asset_server: Res<AssetServer>,
    game: Res<Game>,
    mut materials: ResMut<Assets<ColorMaterial>>,
) {
    commands
        .spawn_bundle(NodeBundle {
            style: Style {
                margin: Rect::all(Val::Auto),
                justify_content: JustifyContent::Center,
                align_items: AlignItems::Center,
                ..Default::default()
            },
            material: materials.add(Color::NONE.into()),
            ..Default::default()
        })
        .with_children(|parent| {
            parent.spawn_bundle(TextBundle {
                text: Text::with_section(
                    format!("Cake eaten: {}", game.cake_eaten),
                    TextStyle {
                        font: asset_server.load("fonts/FiraSans-Bold.ttf"),
                        font_size: 80.0,
                        color: Color::rgb(0.5, 0.5, 1.0),
                    },
                    Default::default(),
                ),
                ..Default::default()
            });
        });
}
// display the number of cake eaten before losing
display the number of cake eaten before losing
display the number of cake eaten before losing
fn display_score(
    mut commands: Commands,
    asset_server: Res<AssetServer>,
    game: Res<Game>,
    mut materials: ResMut<Assets<ColorMaterial>>,
) {
    commands
        .spawn_bundle(NodeBundle {
            style: Style {
                margin: Rect::all(Val::Auto),
                justify_content: JustifyContent::Center,
                align_items: AlignItems::Center,
                ..Default::default()
            },
            material: materials.add(Color::NONE.into()),
            ..Default::default()
        })
        .with_children(|parent| {
            parent.spawn_bundle(TextBundle {
                text: Text::with_section(
                    format!("Cake eaten: {}", game.cake_eaten),
                    TextStyle {
                        font: asset_server.load("fonts/FiraSans-Bold.ttf"),
                        font_size: 80.0,
                        color: Color::rgb(0.5, 0.5, 1.0),
                    },
                    Default::default(),
                ),
                ..Default::default()
            });
        });
}
fn display_score ( mut commands : Commands , asset_server : Res < AssetServer > , game : Res < Game > , mut materials : ResMut < Assets < ColorMaterial > > , ) { commands . spawn_bundle ( NodeBundle { style : Style { margin : Rect :: all ( Val :: Auto ) , justify_content : JustifyContent :: Center , align_items : AlignItems :: Center , .. Default :: default ( ) } , material : materials . add ( Color :: NONE . into ( ) ) , .. Default :: default ( ) } ) . with_children ( | parent | { parent . spawn_bundle ( TextBundle { text : Text :: with_section ( format ! ( " " game cake_eaten ) , TextStyle { font : asset_server . load ( " " ) , font_size : 80.0 , color : Color :: rgb ( 0.5 , 0.5 , 1.0 ) , } , Default :: default ( ) , ) , .. Default :: default ( ) } ) ; } ) ; }
display the number of cake eaten before losing
display the number of cake eaten before losing
commands
Commands
asset_server
Res<AssetServer>
game
Res<Game>
materials
ResMut<Assets<ColorMaterial>>
commands
Commands
asset_server
Res<AssetServer>
game
Res<Game>
materials
ResMut<Assets<ColorMaterial>>