diff options
| author | Kai Stevenson <kai@kaistevenson.com> | 2026-09-04 21:49:03 -0700 |
|---|---|---|
| committer | Kai Stevenson <kai@kaistevenson.com> | 2026-09-04 21:49:03 -0700 |
| commit | 67aee9ec7f3282cab20f6439f755588135a32af5 (patch) | |
| tree | a02b958bcdaf131040f58316cf101e68dd4989fb /src/sim/entity/mod.rs | |
| parent | 8a49bc98a8be81d38cfd11b88e269797048256e4 (diff) | |
character flipping
Diffstat (limited to 'src/sim/entity/mod.rs')
| -rw-r--r-- | src/sim/entity/mod.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/sim/entity/mod.rs b/src/sim/entity/mod.rs index 59479a2..61f9d84 100644 --- a/src/sim/entity/mod.rs +++ b/src/sim/entity/mod.rs @@ -34,6 +34,18 @@ impl EntityCells { .fold(0.0, |acc, cur| acc + cur.material.def().density as f32) * MASS_SCALING } + + pub fn flip_x(&mut self) { + let mut new_cells = Vec::with_capacity(self.cells.len()); + for y in 0..self.size.y { + for rx in 0..self.size.x { + let x = self.size.x - rx - 1; + new_cells.push(self.get_cell_at_local_position(IVec2::new(x, y))); + } + } + + self.cells = new_cells; + } } impl Marchable for EntityCells { |
