Skip to content

Commit

Permalink
Moving our "snake"
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusbuffett committed Nov 5, 2020
1 parent baaefcc commit fde99c9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main.rs
Expand Up @@ -23,11 +23,18 @@ fn game_setup(mut commands: Commands, materials: Res<Materials>) {
.with(SnakeHead);
}

fn snake_movement(mut head_positions: Query<(&SnakeHead, &mut Transform)>) {
for (_head, mut transform) in head_positions.iter_mut() {
*transform.translation.y_mut() += 2.;
}
}

fn main() {
App::build()
.add_startup_system(setup.system())
.add_startup_stage("game_setup")
.add_startup_system_to_stage("game_setup", game_setup.system())
.add_system(snake_movement.system())
.add_plugins(DefaultPlugins)
.run();
}

0 comments on commit fde99c9

Please sign in to comment.