diff --git a/src/main.rs b/src/main.rs index 491723d..f1801f3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,10 +43,11 @@ impl Direction { } } } +struct SegmentMaterial(Handle); #[derive(Default)] struct SnakeSegment { - next_segment: Option + next_segment: Option, } struct SnakeHead { @@ -56,6 +57,17 @@ struct SnakeHead { struct SnakeMoveTimer(Timer); struct HeadMaterial(Handle); +fn spawn_segment(commands: &mut Commands, material: Handle, position: Position) { + commands + .spawn(SpriteComponents { + material, + ..Default::default() + }) + .with(SnakeSegment { next_segment: None }) + .with(position) + .with(Size::square(0.65)); +} + fn snake_movement( time: Res