Occlusion attempt 1
This commit is contained in:
+14
-16
@@ -1,12 +1,12 @@
|
||||
use crate::citizen::Citizen;
|
||||
use crate::constants::*;
|
||||
use crate::item::{Item, ItemBundle};
|
||||
use crate::tiles::TilePrefab;
|
||||
use crate::constants::*;
|
||||
use bevy::prelude::*;
|
||||
use rand::prelude::*;
|
||||
use noise::{NoiseFn, Perlin};
|
||||
use rand::prelude::*;
|
||||
|
||||
pub const Z_INDEX:f32 = 0.;
|
||||
pub const Z_INDEX: f32 = 0.;
|
||||
|
||||
pub fn setup_level(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
setup_tilemap(&mut commands, &asset_server);
|
||||
@@ -26,21 +26,13 @@ pub fn setup_level(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
fn setup_tilemap(commands: &mut Commands, asset_server: &Res<AssetServer>) {
|
||||
let perlin = Perlin::new(0);
|
||||
|
||||
for x in -20..20 {
|
||||
for y in -20..20 {
|
||||
for z in -2..10 {
|
||||
let position = Vec3::new(
|
||||
x as f32 * TILE_SIZE,
|
||||
y as f32 * TILE_SIZE,
|
||||
-z as f32,
|
||||
);
|
||||
for x in -15..15 {
|
||||
for y in -15..15 {
|
||||
for z in -2..15 {
|
||||
let position = Vec3::new(x as f32 * TILE_SIZE, y as f32 * TILE_SIZE, -z as f32);
|
||||
|
||||
// Generate Perlin noise value
|
||||
let noise_value = perlin.get([
|
||||
x as f64 * 0.1,
|
||||
y as f64 * 0.1,
|
||||
z as f64 * 0.1,
|
||||
]);
|
||||
let noise_value = perlin.get([x as f64 * 0.1, y as f64 * 0.1, z as f64 * 0.1]);
|
||||
|
||||
let mut items: Vec<ItemBundle> = vec![];
|
||||
if noise_value < -0.4 {
|
||||
@@ -73,4 +65,10 @@ fn setup_tilemap(commands: &mut Commands, asset_server: &Res<AssetServer>) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for x in -15..15 {
|
||||
for y in -15..15 {
|
||||
let position = Vec3::new(x as f32 * TILE_SIZE, y as f32 * TILE_SIZE, -14.);
|
||||
commands.spawn(TilePrefab::bedrock(position, asset_server));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user