fix terrain ordering

This commit is contained in:
2025-05-06 14:24:29 +01:00
parent 49095cc47f
commit 6f82b904fe
3 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -378,7 +378,7 @@ pub fn spawn_citizens(mut commands: Commands, asset_server: Res<AssetServer>) {
let mut rng = rand::rng();
// Spawn a handful of citizens
for _ in 0..50 {
for _ in 0..10 {
let x: f32 = rng.random_range(-8.0..8.0);
let y: f32 = rng.random_range(-8.0..8.0);
let mut position = Vec3::new(x.round(), y.round(), 30.0) * TILE_SIZE;
+2 -2
View File
@@ -9,9 +9,9 @@ use noise::{NoiseFn, Perlin};
pub const CHUNK_SIZE: i32 = 8;
pub const Z_BELOW: f32 = 30.0;
pub const Z_BELOW: f32 = 10.0;
pub const Z_ABOVE: f32 = 5.0;
pub const Z_TOTAL: f32 = Z_ABOVE + Z_BELOW;
pub const Z_TOTAL: f32 = Z_ABOVE + Z_BELOW; // MAX 255 DO NOT EXCEED
#[derive(Resource)]
pub struct ChunkMap {
+4 -2
View File
@@ -1,5 +1,6 @@
use crate::tile::{FixtureTile, FloorTile, NeedsOccluded, TileState};
use crate::{constants::*, game, tilemap};
use crate::tilemap::Z_BELOW;
use crate::{constants::*, tilemap};
use bevy::asset::RenderAssetUsages;
use bevy::prelude::*;
use bevy::render::render_resource;
@@ -250,7 +251,8 @@ pub fn build_quilted_terrain_sprites(
image: texture_handle,
..Default::default()
},
Transform::from_xyz(center_x, center_y, 0.0).with_scale(Vec3::splat(PIXEL_RATIO)),
Transform::from_xyz(center_x, center_y, (*z_index as f32 - Z_BELOW) * TILE_SIZE)
.with_scale(Vec3::splat(PIXEL_RATIO)),
Visibility::Hidden,
TerrainSprite { z_index: *z_index },
));