Board index I think is key for bridging game resource to display

selection-refactor
Elijah Voigt 2 years ago
parent 9cf884e54f
commit 21f5bded8a

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

Loading…
Cancel
Save