camera zooming
This commit is contained in:
+8
-7
@@ -11,8 +11,8 @@ use noise::{NoiseFn, Perlin};
|
||||
|
||||
pub const CHUNK_SIZE: i32 = 8;
|
||||
|
||||
pub const Z_BELOW: f32 = 3.0;
|
||||
pub const Z_ABOVE: f32 = 5.0;
|
||||
pub const Z_BELOW: f32 = 20.0;
|
||||
pub const Z_ABOVE: f32 = 10.0;
|
||||
pub const Z_TOTAL: f32 = Z_ABOVE + Z_BELOW; // MAX 255 DO NOT EXCEED
|
||||
|
||||
#[derive(Resource)]
|
||||
@@ -164,6 +164,7 @@ fn generate_chunks_from_algo(
|
||||
) {
|
||||
let is_empty = events.is_empty();
|
||||
let start = Instant::now();
|
||||
let count = events.len();
|
||||
|
||||
let cave_noise = Perlin::new(0);
|
||||
for event in events.read() {
|
||||
@@ -204,9 +205,9 @@ fn generate_chunks_from_algo(
|
||||
let noise_value = cave_noise.get([
|
||||
world_x as f64 * 0.05,
|
||||
world_y as f64 * 0.05,
|
||||
z as f64 * (0.15 * -z as f64),
|
||||
z as f64 * 0.05,
|
||||
]);
|
||||
if noise_value < -0.65 {
|
||||
if noise_value < -0.85 {
|
||||
FloorTilePrefab::air(position).spawn(&mut commands);
|
||||
tilemap
|
||||
.floor_tiles
|
||||
@@ -278,13 +279,13 @@ fn generate_chunks_from_algo(
|
||||
}
|
||||
}
|
||||
if !is_empty {
|
||||
println!("Chunks loaded in {:.2?}", start.elapsed());
|
||||
println!("{} chunks loaded in {:.2?}", count, start.elapsed());
|
||||
}
|
||||
}
|
||||
|
||||
fn setup_initial_chunks(mut event_writer: EventWriter<LoadChunkEvent>) {
|
||||
for x in -10..=10 {
|
||||
for y in -10..=10 {
|
||||
for x in -16..=16 {
|
||||
for y in -9..=9 {
|
||||
event_writer.write(LoadChunkEvent {
|
||||
chunk_position: IVec2::new(x, y),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user