cleaning
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@ const COLS: i64 = (BOARD_WIDTH / CELL_SIZE).ceil() as i64;
|
|||||||
pub fn spawn_background_chunk(commands: &mut Commands, id: 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 row in (id * ROWS_PER_CHUNK)..(id * ROWS_PER_CHUNK + ROWS_PER_CHUNK) {
|
||||||
for col in 0..COLS {
|
for col in 0..COLS {
|
||||||
let color = if (row + col as i64) % 2 == 0 {
|
let color = if (row + col) % 2 == 0 {
|
||||||
COLOR_A
|
COLOR_A
|
||||||
} else {
|
} else {
|
||||||
COLOR_B
|
COLOR_B
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ pub struct HasCollided(pub bool);
|
|||||||
|
|
||||||
// Check collision with Player
|
// Check collision with Player
|
||||||
pub fn 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>>,
|
obstacle: Query<(&Transform, &Collider), With<Obstacle>>,
|
||||||
mut has_collided: ResMut<HasCollided>,
|
mut has_collided: ResMut<HasCollided>,
|
||||||
) {
|
) {
|
||||||
|
|||||||
+1
-1
@@ -85,7 +85,7 @@ pub(crate) fn move_player(
|
|||||||
|
|
||||||
// Reset player position
|
// Reset player position
|
||||||
pub fn reset_player(
|
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>>,
|
input: Res<ButtonInput<KeyCode>>,
|
||||||
mut has_collided: ResMut<HasCollided>,
|
mut has_collided: ResMut<HasCollided>,
|
||||||
mut fall_started: ResMut<FallStarted>,
|
mut fall_started: ResMut<FallStarted>,
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ fn spawn_depth_text(mut commands: Commands) {
|
|||||||
fn update_depth_text(
|
fn update_depth_text(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
depth: Res<Depth>,
|
depth: Res<Depth>,
|
||||||
mut texts: Query<&mut Text, With<DepthText>>,
|
texts: Query<&mut Text, With<DepthText>>,
|
||||||
) {
|
) {
|
||||||
for mut text in texts {
|
for mut text in texts {
|
||||||
text.0 = format!("Score: {}", depth.0);
|
text.0 = format!("Score: {}", depth.0);
|
||||||
|
|||||||
+3
-3
@@ -2,9 +2,9 @@ use bevy::prelude::*;
|
|||||||
|
|
||||||
use crate::{camera::MainCamera, player::Player};
|
use crate::{camera::MainCamera, player::Player};
|
||||||
|
|
||||||
pub const CHUNK_HEIGHT: f32 = 700.0; // Height of a cunk
|
pub const CHUNK_HEIGHT: f32 = 200.0; // Height a cunk
|
||||||
const MARGIN_BELLOW: f32 = 400.0; // Height bellow the camera view it'll be gen
|
const MARGIN_BELLOW: f32 = 500.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
|
const MARGIN_ABOVE: f32 = 500.0; // Height above the camera view it'll be gen
|
||||||
|
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
pub struct Chunk {
|
pub struct Chunk {
|
||||||
|
|||||||
Reference in New Issue
Block a user