Проектная работа - WIP

This commit is contained in:
3 changed files with 61 additions and 27 deletions
+22 -2
View File
@@ -1,8 +1,8 @@
use std::time::Duration;
use bevy::{prelude::*, winit::WinitSettings};
use bevy::{ecs::spawn, prelude::*, winit::WinitSettings};
use crate::domain::{Direction, FRAMES_PER_SECOND, Inert, SNAKE_VELOCITY, Velocity};
use crate::domain::{Direction, FRAMES_PER_SECOND, GRID_SIZE, Inert, SNAKE_VELOCITY, Velocity};
/// Инициализация игрового мира
pub fn startup(mut commands: Commands, mut winit: ResMut<WinitSettings>) {
@@ -51,5 +51,25 @@ pub fn startup(mut commands: Commands, mut winit: ResMut<WinitSettings>) {
},
ChildOf(head),
));
for x in -20..=20 {
commands.spawn((
Sprite::from_color(Color::srgb(1.0, 1.0, 0.5), vec2(1.0, 2000.0)),
Transform {
translation: vec3(x as f32 * GRID_SIZE as f32, 0.0, -1.0),
..Default::default()
},
));
}
for y in -20..=20 {
commands.spawn((
Sprite::from_color(Color::srgb(1.0, 1.0, 0.5), vec2(2000.0, 1.0)),
Transform {
translation: vec3(0.0, y as f32 * GRID_SIZE as f32, -1.0),
..Default::default()
},
));
}
commands.spawn(Camera2d);
}