state modifs

This commit is contained in:
2026-09-18 22:39:29 +02:00
parent 26448cd0a0
commit 8d496eee73
8 changed files with 64 additions and 98 deletions
+6 -6
View File
@@ -1,10 +1,10 @@
use bevy::prelude::*;
use crate::{camera::MainCamera, player::Player};
use crate::{camera::MainCamera, game_state::GameState, player::Player};
pub const CHUNK_HEIGHT: f32 = 200.0; // Height a cunk
const MARGIN_BELLOW: f32 = 500.0; // Height bellow the camera view it'll be gen
const MARGIN_ABOVE: f32 = 500.0; // Height above the camera view it'll be gen
pub const CHUNK_HEIGHT: f32 = 600.0; // Height a cunk
const MARGIN_BELLOW: f32 = 400.0; // Height bellow the camera view it'll be gen
const MARGIN_ABOVE: f32 = 400.0; // Height above the camera view it'll be gen
#[derive(Component)]
pub struct Chunk {
@@ -55,13 +55,13 @@ fn visible_chunk_range(player_y: f32, camera_y: f32) -> (i64, i64) {
fn spawn_chunk(commands: &mut Commands, id: i64, run_seed: u64) {
crate::background::spawn_background_chunk(commands, id);
// TODO: obstacles
// crate::obstacle::spawn_obstacle_chunk(commands, id, run_seed);
}
pub struct WorldPlugin;
impl Plugin for WorldPlugin {
fn build(&self, app: &mut App) {
app.insert_resource(RunSeed(rand::random::<u64>()))
.add_systems(Update, stream_world);
.add_systems(Update, stream_world.run_if(in_state(GameState::InGame)));
}
}