improve comments in example (#8127)

# Objective

Added additional comments to describe what is going on in an example.
This commit is contained in:
Carl B. Smiley 2023-03-20 11:42:10 -07:00 committed by GitHub
parent 7b7294b8a7
commit e27f38a3e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,6 +35,7 @@ struct RpgSpriteHandles {
}
fn load_textures(mut rpg_sprite_handles: ResMut<RpgSpriteHandles>, asset_server: Res<AssetServer>) {
// load multiple, individual sprites from a folder
rpg_sprite_handles.handles = asset_server.load_folder("textures/rpg").unwrap();
}
@ -43,6 +44,7 @@ fn check_textures(
rpg_sprite_handles: ResMut<RpgSpriteHandles>,
asset_server: Res<AssetServer>,
) {
// Advance the `AppState` once all sprite handles have been loaded by the `AssetServer`
if let LoadState::Loaded = asset_server
.get_group_load_state(rpg_sprite_handles.handles.iter().map(|handle| handle.id()))
{
@ -57,6 +59,7 @@ fn setup(
mut texture_atlases: ResMut<Assets<TextureAtlas>>,
mut textures: ResMut<Assets<Image>>,
) {
// Build a `TextureAtlas` using the individual sprites
let mut texture_atlas_builder = TextureAtlasBuilder::default();
for handle in &rpg_sprite_handles.handles {
let handle = handle.typed_weak();