This commit is contained in:
2026-09-18 17:46:29 +02:00
parent 5d422ecef0
commit 11ae27cefe
5 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ const COLS: i64 = (BOARD_WIDTH / CELL_SIZE).ceil() as i64;
pub fn spawn_background_chunk(commands: &mut Commands, id: i64) {
for row in (id * ROWS_PER_CHUNK)..(id * ROWS_PER_CHUNK + ROWS_PER_CHUNK) {
for col in 0..COLS {
let color = if (row + col as i64) % 2 == 0 {
let color = if (row + col) % 2 == 0 {
COLOR_A
} else {
COLOR_B
+1 -1
View File
@@ -16,7 +16,7 @@ pub struct HasCollided(pub bool);
// Check collision with Player
pub fn check_collision_with_player(
mut player: Single<(&Transform, &Collider, &mut Sprite), With<Player>>,
player: Single<(&Transform, &Collider, &mut Sprite), With<Player>>,
obstacle: Query<(&Transform, &Collider), With<Obstacle>>,
mut has_collided: ResMut<HasCollided>,
) {
+1 -1
View File
@@ -85,7 +85,7 @@ pub(crate) fn move_player(
// Reset player position
pub fn reset_player(
mut player: Single<(&mut Transform, &mut Velocity, &mut Sprite), With<Player>>,
player: Single<(&mut Transform, &mut Velocity, &mut Sprite), With<Player>>,
input: Res<ButtonInput<KeyCode>>,
mut has_collided: ResMut<HasCollided>,
mut fall_started: ResMut<FallStarted>,
+1 -1
View File
@@ -36,7 +36,7 @@ fn spawn_depth_text(mut commands: Commands) {
fn update_depth_text(
mut commands: Commands,
depth: Res<Depth>,
mut texts: Query<&mut Text, With<DepthText>>,
texts: Query<&mut Text, With<DepthText>>,
) {
for mut text in texts {
text.0 = format!("Score: {}", depth.0);
+3 -3
View File
@@ -2,9 +2,9 @@ use bevy::prelude::*;
use crate::{camera::MainCamera, player::Player};
pub const CHUNK_HEIGHT: f32 = 700.0; // Height of 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
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
#[derive(Component)]
pub struct Chunk {