From 21f5bded8affb5729ca9a94f868e88a44328d623 Mon Sep 17 00:00:00 2001 From: Elijah Voigt Date: Sun, 1 Oct 2023 20:43:31 -0700 Subject: [PATCH] Board index I think is key for bridging game resource to display --- examples/sprites-2d.rs | 9 +++++++++ 1 file changed, 9 insertions(+) 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() }); }