Snake collision with itself
This commit is contained in:
@@ -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"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user