From e860af1d7a9c86daa0a4ad3f64b13692124326a9 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 24 Dec 2020 13:45:07 -0500 Subject: [PATCH] Moving the snake --- src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.rs b/src/main.rs index 73f0e36..d30ee8e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,10 +22,17 @@ fn spawn_snake(commands: &mut Commands, materials: Res) { .with(SnakeHead); } +fn snake_movement(mut head_positions: Query<(&SnakeHead, &mut Transform)>) { + for (_head, mut transform) in head_positions.iter_mut() { + transform.translation.y += 2.; + } +} + fn main() { App::build() .add_startup_system(setup.system()) .add_startup_stage("game_setup", SystemStage::single(spawn_snake.system())) + .add_system(snake_movement.system()) .add_plugins(DefaultPlugins) .run(); }