working on showing all cards for debug mode

main
Elijah Voigt 2 years ago
parent 673417aefc
commit 1bea9e0a91

@ -14,13 +14,20 @@ impl Plugin for SetupPlugin {
/// Setup drawing our cards on the screen
pub(crate) fn setup_cards(mut commands: Commands, deck: Res<Deck>) {
Deck::iter_cards().for_each(|this_card| {
Deck::iter_cards().enumerate().for_each(|(i, this_card)| {
let this = deck
.cards
.get(&this_card)
.expect(format!("fech card sprite {:?}", this_card).as_str())
.clone();
commands.spawn((this, this_card));
// for a 9x9 grid we want x to wrap every 9 and y to increment every 9
let x = i % 9;
let y = i / 9;
let l = 100.0;
let x_off = -50.0 * 7.0;
let y_off = -50.0 * 5.0;
let t = Transform::from_xyz(l * (x as f32) + x_off, l * (y as f32) + y_off, 0.0);
commands.spawn((this, this_card, t));
});
}

Loading…
Cancel
Save