Skip to content

Commit 0bfc94e

Browse files
committed
Moving our "snake"
1 parent b487fac commit 0bfc94e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,17 @@ fn spawn_snake(mut commands: Commands) {
2525
.insert(SnakeHead);
2626
}
2727

28+
fn snake_movement(mut head_positions: Query<(&SnakeHead, &mut Transform)>) {
29+
for (_head, mut transform) in head_positions.iter_mut() {
30+
transform.translation.y += 2.;
31+
}
32+
}
33+
2834
fn main() {
2935
App::new()
3036
.add_startup_system(setup_camera)
3137
.add_startup_system(spawn_snake)
38+
.add_system(snake_movement)
3239
.add_plugins(DefaultPlugins)
3340
.run();
3441
}

0 commit comments

Comments
 (0)