This commit is contained in:
Rendo 2026-01-24 17:01:47 +05:00
commit dcca424406
5 changed files with 28 additions and 4 deletions

View file

@ -44,6 +44,13 @@ fn test_card_setup(
Card,
ChildOf(hand.entity()),
));
commands.spawn((
Sprite::from_image(card_image.0.clone()),
Transform::from_xyz(0., 0., 0.),
Card,
ChildOf(hand.entity()),
));
}
fn card_arrange(
@ -58,8 +65,8 @@ fn card_arrange(
continue;
}
let size = assets.get(&sprite.image).unwrap().size_f32();
let left_boundary = -size.x * (cards_amount as f32) / 2.0;
transform.translation.x = left_boundary + size.x * card_id + size.x / 2.0;
let left_boundary = -size.x * (cards_amount as f32) / 2.0 + size.x / 2.0;
transform.translation.x = left_boundary + size.x * card_id;
transform.translation.y = size.y / 2.0;
card_id += 1.0;