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)]
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<Res<SpriteSheet>>, 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()
});
}

Loading…
Cancel
Save