From 66c6019ea4f1b422c39843b9018c4984e8ba4f07 Mon Sep 17 00:00:00 2001 From: Elijah Voigt Date: Mon, 27 Oct 2025 22:06:48 -0700 Subject: [PATCH] Skip is still buggy but just... less so. --- src/bin/tetris/main.rs | 52 ++++++++++++++++++++++++++++++++---------- src/bin/tetris/test.rs | 7 ++++++ 2 files changed, 47 insertions(+), 12 deletions(-) diff --git a/src/bin/tetris/main.rs b/src/bin/tetris/main.rs index 4f84866..c0c23b0 100644 --- a/src/bin/tetris/main.rs +++ b/src/bin/tetris/main.rs @@ -487,8 +487,32 @@ impl Shape { output } + + fn height(&self) -> usize { + let mut x = 0; + + match self { + Self::M4(this) => { + for i in 0..4 { + if this.col(i).to_array().contains(&1.0) { + x += 1 + } + } + } + Self::M3(this) => { + for i in 0..3 { + if this.col(i).to_array().contains(&1.0) { + x += 1 + } + } + } + }; + + x + } } +// TODO: move to trigger fn update_position( mut changed: Query< (Entity, &GridPosition, &mut Transform), @@ -506,9 +530,9 @@ fn update_position( }); } -// TODO: Inline this to when movement occurs +// TODO: Move to trigger fn update_shape_blocks( - query: Query<(Entity, &Shape, &GridPosition), Or<(Added, Changed)>>, + query: Query<(Entity, &Shape, &GridPosition), Or<(Added, Changed, Added, Changed)>>, mut blocks: Query<&mut GridPosition, (With, Without)>, mut commands: Commands, visuals: Res, @@ -620,10 +644,11 @@ fn clock_cycle(n: f32) -> impl FnMut(Res