fix terrain ordering
This commit is contained in:
+1
-1
@@ -378,7 +378,7 @@ pub fn spawn_citizens(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||||||
let mut rng = rand::rng();
|
let mut rng = rand::rng();
|
||||||
|
|
||||||
// Spawn a handful of citizens
|
// Spawn a handful of citizens
|
||||||
for _ in 0..50 {
|
for _ in 0..10 {
|
||||||
let x: f32 = rng.random_range(-8.0..8.0);
|
let x: f32 = rng.random_range(-8.0..8.0);
|
||||||
let y: 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;
|
let mut position = Vec3::new(x.round(), y.round(), 30.0) * TILE_SIZE;
|
||||||
|
|||||||
+2
-2
@@ -9,9 +9,9 @@ use noise::{NoiseFn, Perlin};
|
|||||||
|
|
||||||
pub const CHUNK_SIZE: i32 = 8;
|
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_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)]
|
#[derive(Resource)]
|
||||||
pub struct ChunkMap {
|
pub struct ChunkMap {
|
||||||
|
|||||||
+4
-2
@@ -1,5 +1,6 @@
|
|||||||
use crate::tile::{FixtureTile, FloorTile, NeedsOccluded, TileState};
|
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::asset::RenderAssetUsages;
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy::render::render_resource;
|
use bevy::render::render_resource;
|
||||||
@@ -250,7 +251,8 @@ pub fn build_quilted_terrain_sprites(
|
|||||||
image: texture_handle,
|
image: texture_handle,
|
||||||
..Default::default()
|
..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,
|
Visibility::Hidden,
|
||||||
TerrainSprite { z_index: *z_index },
|
TerrainSprite { z_index: *z_index },
|
||||||
));
|
));
|
||||||
|
|||||||
Reference in New Issue
Block a user