working path finding, non working targeting

This commit is contained in:
2025-01-24 17:20:45 +00:00
parent ca3fcc00ff
commit 7143a9dded
3 changed files with 100 additions and 103 deletions
+8 -8
View File
@@ -84,7 +84,7 @@ pub fn calculate_visibility(pos: IVec3, tilemap: &TileMap) -> [u32; 8] {
let mut is_occluded = false;
'vertical_check: for z_offset in 1..5 {
'vertical_check: for z_offset in 1..10 {
let above_pos = IVec3::new(pos.x, pos.y, pos.z + (z_offset * ITILE_SIZE));
if above_pos.z <= camera_z {
if let Some(&(_, opaque, _, _, _)) = tilemap.floor_tiles.get(&above_pos) {
@@ -93,10 +93,10 @@ pub fn calculate_visibility(pos: IVec3, tilemap: &TileMap) -> [u32; 8] {
break 'vertical_check;
}
}
if z_offset >= 4 {
is_occluded = true;
break 'vertical_check;
}
// if z_offset >= 4 {
// is_occluded = true;
// break 'vertical_check;
// }
// if let Some(&(_, solid, _)) = tilemap.fixtures.get(&above_pos) {
// if solid {
// is_occluded = true;
@@ -198,7 +198,7 @@ fn handle_chunk_loading(
);
// Spawn tiles and add them to tilemap
for z in -15..=5 {
for z in -10..=5 {
let position = Vec3::new(
(world_x as f32 * TILE_SIZE).round(),
(world_y as f32 * TILE_SIZE).round(),
@@ -287,8 +287,8 @@ fn handle_chunk_loading(
fn setup_initial_chunks(mut event_writer: EventWriter<LoadChunkEvent>) {
println!("setup_initial_chunks");
for x in -8..=8 {
for y in -8..=8 {
for x in -3..=3 {
for y in -2..=2 {
event_writer.send(LoadChunkEvent {
chunk_position: IVec2::new(x, y),
});