diff --git a/examples/sprites-2d.rs b/examples/sprites-2d.rs index da1a7da..0015b2c 100644 --- a/examples/sprites-2d.rs +++ b/examples/sprites-2d.rs @@ -35,6 +35,12 @@ struct SpriteSheet { #[derive(Debug, Component)] struct Board2d; +#[derive(Debug, Component)] +struct BoardIndex { + x: usize, + y: usize, +} + /// STARTUP: Initialize 2d gameplay Camera fn initialize_camera(mut commands: Commands) { commands.spawn(Camera2dBundle::default()); @@ -87,11 +93,14 @@ fn initialize_board(sprite_sheet: Option>, mut commands: Comman let texture_atlas = sprite_sheet.handle.clone(); + let index = BoardIndex { x, y }; + // Rectangle parent.spawn(SpriteSheetBundle { texture_atlas, sprite, transform, + index, ..default() }); }