Snake collision with itself

This commit is contained in:
2022-08-18 21:26:52 +02:00
parent 10daae1cf6
commit d1db542b16
6 changed files with 489 additions and 89 deletions

View File

@@ -1,21 +1,23 @@
use crate::grid;
use bevy::prelude::*;
pub struct ModPlugin;
pub struct CanvasPlugin;
impl Plugin for ModPlugin {
impl Plugin for CanvasPlugin {
fn build(&self, app: &mut App) {
app.add_startup_system(spawn_background);
}
}
fn spawn_background(mut commands: Commands) {
commands.spawn_bundle(SpriteBundle {
sprite: Sprite {
color: Color::DARK_GRAY,
custom_size: Some(Vec2::splat(grid::SEGMENT_SIZE * grid::SIZE as f32)),
commands
.spawn_bundle(SpriteBundle {
sprite: Sprite {
color: Color::DARK_GRAY,
custom_size: Some(Vec2::splat(grid::SEGMENT_SIZE * grid::SIZE as f32)),
..Default::default()
},
..Default::default()
},
..Default::default()
});
})
.insert(Name::new("Canvas"));
}